summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2024-01-22 16:43:11 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-08 17:11:39 +0100
commitbdd0579b58f7a3b8c1886ea8513618c647c0ad30 (patch)
tree69d14074132f8523e055538d24dfeaaae1c9bf08 /sc
parentf840a0d54d873d3003f8b624a50557f8c9872477 (diff)
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 <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162558 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx7
-rw-r--r--sc/source/ui/view/tabview.cxx10
-rw-r--r--sc/source/ui/view/tabview3.cxx13
4 files changed, 26 insertions, 7 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 14b80dde4ca7..85f9c235f450 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3603,6 +3603,9 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLongFirstColumnMouseClick)
// very long (longer than ~800px default size of GridWindow) triggers a code-path where the cell
// selected is the neighbouring cell even when we clicked on the area of the first cell.
+ comphelper::LibreOfficeKit::setCompatFlag(
+ comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
+
ScModelObj* pModelObj = createDoc("DocumentWithLongFirstColumn.ods");
CPPUNIT_ASSERT(pModelObj);
pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 96c4d18f69d7..f92864e76ece 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1171,13 +1171,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 a865acb71505..5d0699f26e6b 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2734,6 +2734,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
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 7de940ce24a9..fb91cc886ef3 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -423,9 +423,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());