sc/qa/unit/tiledrendering/data/split.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 45 +++++++++++++++++++++++++++ sc/source/ui/view/gridwin.cxx | 17 ++++++++++ 3 files changed, 62 insertions(+)
New commits: commit 2bea4e32abea4084804ba7d5b38da5d0201aef6b Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Dec 19 21:03:11 2023 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Dec 22 15:33:36 2023 +0100 kit: update formulas in frozen area when the main pane has scrolled sufficiently that those areas are off screen from the main pane perspective. In kit mode while there can be (up to) 4 panes, each pane is considered to be at cell 0, 0 and of the same size as the window. Unlike desktop mode the information as to what ranges are shown when there are frozen rows/cols is instead available via LOKSheetFreezeIndex commit daaf101ffe683eb691418ec2df4adc260d7e6a15 Date: Mon May 7 12:49:22 2018 +0200 lok: sc: formulas were not updated correctly this patch fixes several issues: commit 0ef7bc8a1d2f00715d6849f1bbceb26e32382d41 Date: Fri Mar 29 09:01:05 2019 -0400 sc lok: avoid save incorrect data, whether the pane has ... horizontal / vertical splits commit 7b4802070ac6fb930255536bf3ed2c52428b4181 Date: Wed Jul 15 15:55:45 2020 +0530 lok-freezepanes: Generalize FreezePanes* uno-commands... commit 818b7e508bcabae48cb1c96c987a9f83d83ff6e0 Date: Wed Apr 21 18:28:13 2021 +0200 lok: calc: formula breaking to multiple lines partly shown in edit mode Change-Id: I1e55f7bbc0df5c6fd09a10e261d25c1ce00a243a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160995 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sc/qa/unit/tiledrendering/data/split.ods b/sc/qa/unit/tiledrendering/data/split.ods new file mode 100644 index 000000000000..efe2c225a410 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/split.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 0f962c5fabdb..4933adc299c5 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -157,6 +157,7 @@ public: void testGetViewRenderState(); void testInvalidateOnTextEditWithDifferentZoomLevels(const ColRowZoom& rData); void testOpenURL(); + void testInvalidateForSplitPanes(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnHeaders); @@ -227,6 +228,7 @@ public: {0, 999, -5}, {99, 0, -5} }); CPPUNIT_TEST(testOpenURL); + CPPUNIT_TEST(testInvalidateForSplitPanes); CPPUNIT_TEST_SUITE_END(); private: @@ -3431,6 +3433,49 @@ void ScTiledRenderingTest::testOpenURL() CPPUNIT_ASSERT(!aView2.m_aHyperlinkClicked.isEmpty()); } +void ScTiledRenderingTest::testInvalidateForSplitPanes() +{ + comphelper::LibreOfficeKit::setCompatFlag( + comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); + + ScModelObj* pModelObj = createDoc("split.ods"); + CPPUNIT_ASSERT(pModelObj); + ScTabViewShell* pView = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current()); + CPPUNIT_ASSERT(pView); + + // view + ViewCallback aView; + + // move way over to the right where BP:20 exists, enough so that rows A and B + // would scroll off the page and not be visible, if they were not frozen + pModelObj->setClientVisibleArea(tools::Rectangle(73050, 0, 94019, 7034)); + Scheduler::ProcessEventsToIdle(); + + ScAddress aBP20(67, 19, 0); // BP:20 + + pView->SetCursor(aBP20.Col(), aBP20.Row()); + Scheduler::ProcessEventsToIdle(); + + aView.m_bInvalidateTiles = false; + aView.m_aInvalidations.clear(); + + lcl_typeCharsInCell("X", aBP20.Col(), aBP20.Row(), pView, pModelObj); // Type 'X' in A1 + + CPPUNIT_ASSERT(aView.m_bInvalidateTiles); + + // missing before fix + tools::Rectangle aTopLeftPane(0, 500, 3817, 742); + bool bFoundTopLeftPane = + std::find(aView.m_aInvalidations.begin(), aView.m_aInvalidations.end(), aTopLeftPane) != aView.m_aInvalidations.end(); + CPPUNIT_ASSERT_MESSAGE("The cell visible in the top left pane should be redrawn", bFoundTopLeftPane); + + // missing before fix + tools::Rectangle aBottomLeftPane(0, 500, 3817, 3242); + bool bFoundBottomLeftPane = + std::find(aView.m_aInvalidations.begin(), aView.m_aInvalidations.end(), aBottomLeftPane) != aView.m_aInvalidations.end(); + CPPUNIT_ASSERT_MESSAGE("The cell visible in the bottom left pane should be redrawn", bFoundBottomLeftPane); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 4594e458815e..f4a1d6e6f5dd 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5032,6 +5032,23 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2) nY2 = pViewShell->GetLOKEndHeaderRow(); if (nX1 < 0 || nY1 < 0) return; + + // Consider frozen ranges not in main pane range as candidates + // for update + SCCOLROW nFreezeCol = mrViewData.GetLOKSheetFreezeIndex(true); + SCCOLROW nFreezeRow = mrViewData.GetLOKSheetFreezeIndex(false); + if ((nFreezeCol || nFreezeRow) && (nX1 || nY1)) + { + // top left + if (nFreezeCol && nFreezeRow) + UpdateFormulaRange(0, 0, nFreezeCol, nFreezeRow); + // bottom left + if (nFreezeCol && nX1) + UpdateFormulaRange(0, nY1, nFreezeCol, nY2); + // top right + if (nFreezeRow && nY1) + UpdateFormulaRange(nX1, 0, nX2, nFreezeRow); + } } else {