sc/source/ui/dbgui/csvgrid.cxx |    3 ++
 sc/source/ui/view/tabview3.cxx |   44 +++++++++++++++++++++++++++++------------
 vcl/source/window/layout.cxx   |   16 +-------------
 3 files changed, 37 insertions(+), 26 deletions(-)

New commits:
commit 496475c66665209dcb56f0bd1528b14dd8b689ca
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Jul 1 11:29:28 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Jul 26 16:55:17 2022 +0200

    lok: allow shrinking too big widgets
    
    This is followup for:
    
https://cgit.freedesktop.org/libreoffice/core/commit/?id=2b58a0979f9206cfca6d78cb2f3d5e65cd735f8b
    Add sanity check to avoid potential crash in the Collabora Online server
    
    nExtraSpace can be negative for shrinking the widget - this is correct.
    For example listbox can have many entries, in GetOptimalSize it returns
    size required to show all of them, then here we calculate how much of
    that size we can allow to be used. When we have too many entries we use
    negative nExtraSpace.
    
    The original problem is not that we get negative number but case when we
    get value that is much bigger than size of a widget and it becomes
    invisible.
    
    So this reverts hack which makes impossible to shrink widget what causes
    problems with listboxes in tunneled dialogs. Also it setups better
    size request for csv import dialog grid widget - so we don't paint it
    as 10px rectangle - what was workarounded by the previous patches.
    
    Change-Id: I478660b12cf0b6a783c704201800018e9849cc23
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136728
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mert Tumer <mert.tu...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137451
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index 6752fcb78a3d..82e2909cc195 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <comphelper/lok.hxx>
 #include <csvgrid.hxx>
 #include <csvtablebox.hxx>
 
@@ -108,6 +109,8 @@ void ScCsvGrid::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
     // the left edge will be lost. If this widget is smaller than the scrolling
     // window it is stretched to fit the parent and the problem doesn't arise.
     Size aInitialSize(10, 10);
+    if (comphelper::LibreOfficeKit::isActive())
+        aInitialSize = Size(-1, 150);
     ScCsvControl::SetDrawingArea(pDrawingArea);
     pDrawingArea->set_size_request(aInitialSize.Width(), 
aInitialSize.Height());
     SetOutputSizePixel(aInitialSize);
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index facfeb8c71f0..ffdfce012f75 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -297,20 +297,8 @@ void VclBox::setAllocation(const Size &rAllocation)
     else if (nExpandChildren)
     {
         Size aRequisition = calculateRequisition();
-        nExtraSpace = (getPrimaryDimension(rAllocation) - 
getPrimaryDimension(aRequisition)) / nExpandChildren;
-// In mobile, the screen size is small and extraSpace can become negative
-// Though the dialogs are rendered in javascript for LOK Android some widgets 
like weld::DrawingArea
-// is sent as bitmap but it is rendered from only the visible part
-// when it gets negative, it shrinks instead of expands and it becomes 
invisible
-
-        if (nExtraSpace < 0)
-        {
-            SAL_WARN("vcl.layout", "nExtraSpace went negative for VclBox: " << 
GetHelpId());
-            if (comphelper::LibreOfficeKit::isActive())
-            {
-                nExtraSpace = 0;
-            }
-        }
+        tools::Long nPrimaryDimension = getPrimaryDimension(rAllocation);
+        nExtraSpace = (nPrimaryDimension - getPrimaryDimension(aRequisition)) 
/ nExpandChildren;
     }
 
     //Split into those we pack from the start onwards, and those we pack from 
the end backwards
commit 8b5a6af435952398bfc6328c10e8f3cdae475312
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Jul 19 12:08:58 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Jul 26 16:55:05 2022 +0200

    MarkColumns should modify formula if editing is active
    
    Change-Id: I2ad4df0e6ad87bdad689112683bd29babf127502
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137227
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mert Tumer <mert.tu...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137462
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 1e0255788977..feab66cbd411 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1632,12 +1632,22 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 
nModifier)
     if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
         bMoveIsShift = true;
 
-    DoneBlockMode( nModifier != 0 );
-    InitBlockMode( nStartCol, 0, nTab, true, true);
-    MarkCursor( nCol, rDoc.MaxRow(), nTab );
-    bMoveIsShift = false;
-    SetCursor( nCol, 0 );
-    SelectionChanged();
+    if ( SC_MOD()->IsFormulaMode() )
+    {
+        DoneRefMode( nModifier != 0 );
+        InitRefMode( nCol, 0, nTab, SC_REFTYPE_REF );
+        UpdateRef( nCol, rDoc.MaxRow(), nTab );
+        bMoveIsShift = false;
+    }
+    else
+    {
+        DoneBlockMode( nModifier != 0 );
+        InitBlockMode( nStartCol, 0, nTab, true, true);
+        MarkCursor( nCol, rDoc.MaxRow(), nTab );
+        bMoveIsShift = false;
+        SetCursor( nCol, 0 );
+        SelectionChanged();
+    }
 }
 
 void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
@@ -1649,12 +1659,22 @@ void ScTabView::MarkRows(SCROW nRow, sal_Int16 
nModifier)
     if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
         bMoveIsShift = true;
 
-    DoneBlockMode( nModifier != 0 );
-    InitBlockMode( 0, nStartRow, nTab, true, false, true );
-    MarkCursor( rDoc.MaxCol(), nRow, nTab );
-    bMoveIsShift = false;
-    SetCursor( 0, nRow );
-    SelectionChanged();
+    if ( SC_MOD()->IsFormulaMode() )
+    {
+        DoneRefMode( nModifier != 0 );
+        InitRefMode( 0, nRow, nTab, SC_REFTYPE_REF );
+        UpdateRef( rDoc.MaxCol(), nRow, nTab );
+        bMoveIsShift = false;
+    }
+    else
+    {
+        DoneBlockMode( nModifier != 0 );
+        InitBlockMode( 0, nStartRow, nTab, true, false, true );
+        MarkCursor( rDoc.MaxCol(), nRow, nTab );
+        bMoveIsShift = false;
+        SetCursor( 0, nRow );
+        SelectionChanged();
+    }
 }
 
 void ScTabView::MarkDataArea( bool bIncludeCursor )

Reply via email to