sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods |binary
 sc/source/ui/view/tabview.cxx                                  |    9 +++--
 sc/source/ui/view/tabview3.cxx                                 |   16 
++++++----
 3 files changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 73957dd866b6d5b7144a37ce1477b0c781d5fef6
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Mar 25 14:31:11 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Mar 26 18:25:44 2024 +0100

    lok: The GridWindow can get reset to a smaller than wanted size
    
    This is the same problem as described in:
    
    commit 22a185a977f90d706c3e9d182adeaac310b6f348
    Date:   Thu Jan 11 15:08:21 2024 +0900
    
        sc lok: set the GridWindow size to the client area size + test
    
    except that the size of the GridWindow gets reset by UpdateFormulas
    via UpdateHeaderWidth to the width of the "frame" which is remains
    at the nominal 800x600 initial size throughout.
    
    That only happens if there are enough rows in the document to trigger
    a check against this, so add some extra content into the test document
    to trigger the problem, and then guard against this reset for the kit
    case.
    
    Change-Id: Ibf80849929a4c987fd0fe977518336e5115ebdce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165240
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods 
b/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods
index 27fc3f45c543..9c03b5ae2f43 100644
Binary files a/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods 
and b/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods differ
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 79bd6d1e67ff..d82a8a1c7962 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2760,9 +2760,6 @@ void lcl_ExtendTiledDimension(bool bColumn, const 
SCCOLROW nEnd, const SCCOLROW
     if (pModelObj)
         aNewSize = pModelObj->getDocumentSize();
 
-    if (aOldSize == aNewSize)
-        return;
-
     if (!pDocSh)
         return;
 
@@ -2772,10 +2769,14 @@ void lcl_ExtendTiledDimension(bool bColumn, const 
SCCOLROW nEnd, const SCCOLROW
         if (pGridWindow)
         {
             Size aNewSizePx(aNewSize.Width() * rViewData.GetPPTX(), 
aNewSize.Height() * rViewData.GetPPTY());
-            pGridWindow->SetOutputSizePixel(aNewSizePx);
+            if (aNewSizePx != pGridWindow->GetOutputSizePixel())
+                pGridWindow->SetOutputSizePixel(aNewSizePx);
         }
     }
 
+    if (aOldSize == aNewSize)
+        return;
+
     // New area extended to the right/bottom of the sheet after last col/row
     tools::Rectangle aNewArea(Point(0, 0), aNewSize);
     // excluding overlapping area with aNewArea
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 7a69d5d82af9..0b8dcb4b8f61 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -424,9 +424,6 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool 
bNew )
     if (pModelObj)
         aNewSize = pModelObj->getDocumentSize();
 
-    if (aOldSize == aNewSize)
-        return;
-
     if (!pDocSh)
         return;
 
@@ -436,10 +433,14 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool 
bNew )
         if (pGridWindow)
         {
             Size aNewSizePx(aNewSize.Width() * aViewData.GetPPTX(), 
aNewSize.Height() * aViewData.GetPPTY());
-            pGridWindow->SetOutputSizePixel(aNewSizePx);
+            if (aNewSizePx != pGridWindow->GetOutputSizePixel())
+                pGridWindow->SetOutputSizePixel(aNewSizePx);
         }
     }
 
+    if (aOldSize == aNewSize)
+        return;
+
     // New area extended to the right of the sheet after last column
     // including overlapping area with aNewRowArea
     tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), 
aNewSize.getHeight());
@@ -2380,7 +2381,12 @@ void ScTabView::UpdateFormulas(SCCOL nStartCol, SCROW 
nStartRow, SCCOL nEndCol,
     if ( aViewData.IsPagebreakMode() )
         UpdatePageBreakData();              //! asynchronous
 
-    UpdateHeaderWidth();
+    bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
+    // UpdateHeaderWidth can fit the GridWindow widths to the frame, something
+    // we don't want in kit-mode where we try and match the GridWindow width
+    // to the tiled area separately
+    if (!bIsTiledRendering)
+        UpdateHeaderWidth();
 
     //  if in edit mode, adjust edit view area because widths/heights may have 
changed
     if ( aViewData.HasEditView( aViewData.GetActivePart() ) )

Reply via email to