sc/source/ui/unoobj/docuno.cxx |    7 -------
 sc/source/ui/view/tabview.cxx  |   10 ++++++++++
 sc/source/ui/view/tabview3.cxx |   13 +++++++++++++
 3 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit c146f376dec93a4e83a8b434af4f3d39f82b8e44
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Mon Jan 22 16:43:11 2024 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Jan 23 09:41:02 2024 +0100

    lok: calc: GridWindow size not updated for some view
    
    The grid window size was updated for the view used for painting and
    not for other views with the same zoom level. In fact the grid window
    size was updated in ScModelObj::paintTile only. Now the required
    updating is performed in lcl_ExtendTiledDimension and
    ScTabView::SetCursor, too.
    In order to get this working it has been neede to revert changes in
    `ScModelObj::setClientVisibleArea` introduced by
    https://gerrit.libreoffice.org/c/core/+/161907
    
    Change-Id: Ie8f585b861b0c916624d8e2f9d828cf23b799672
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162406
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 6b4b8b9734f0..cb13801b7b1e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1169,13 +1169,6 @@ void ScModelObj::setClientVisibleArea(const 
tools::Rectangle& rRectangle)
         if (pTabView)
             pTabView->extendTiledAreaIfNeeded();
     }
-
-    // Set the GridWindow size to the client area size, so that the logic in 
GridWindow works correctly
-    // for the current view and doesn't cause any unexpected behaviour related 
to window size and checks if we are
-    // outside of the window.
-
-    ScGridWindow* pGridWindow = pViewData->GetActiveWin();
-    pGridWindow->SetOutputSizePixel(Size(rRectangle.GetWidth() * 
pViewData->GetPPTX(), rRectangle.GetHeight() * pViewData->GetPPTY()));
 }
 
 void ScModelObj::setOutlineState(bool bColumn, int nLevel, int nIndex, bool 
bHidden)
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 2dcc360a8bef..05e08345075a 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2678,6 +2678,16 @@ void lcl_ExtendTiledDimension(bool bColumn, const 
SCCOLROW nEnd, const SCCOLROW
     if (!pDocSh)
         return;
 
+    if (pModelObj)
+    {
+        ScGridWindow* pGridWindow = rViewData.GetActiveWin();
+        if (pGridWindow)
+        {
+            Size aNewSizePx(aNewSize.Width() * rViewData.GetPPTX(), 
aNewSize.Height() * rViewData.GetPPTY());
+            pGridWindow->SetOutputSizePixel(aNewSizePx);
+        }
+    }
+
     // New area extended to the right/bottom of the sheet after last col/row
     // excluding overlapping area with aNewArea
     tools::Rectangle aNewArea = bColumn ?
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index db171a96e3b1..f30de4e3d121 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -418,9 +418,22 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool 
bNew )
     if (pModelObj)
         aNewSize = pModelObj->getDocumentSize();
 
+    if (aOldSize == aNewSize)
+        return;
+
     if (!pDocSh)
         return;
 
+    if (pModelObj)
+    {
+        ScGridWindow* pGridWindow = aViewData.GetActiveWin();
+        if (pGridWindow)
+        {
+            Size aNewSizePx(aNewSize.Width() * aViewData.GetPPTX(), 
aNewSize.Height() * aViewData.GetPPTY());
+            pGridWindow->SetOutputSizePixel(aNewSizePx);
+        }
+    }
+
     // 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());

Reply via email to