diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-09-24 16:10:16 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-09-25 12:35:17 +0200 |
commit | 96bd7504165f89ec5485d00a487e54634af347ce (patch) | |
tree | 6a6ac32b510130327241a2d4cdd92aa91a0c73c0 /sc | |
parent | 2984856798d8ad98b96e6a57bfcc701bc52876e8 (diff) |
sc lok: Optimize invalidation triggered by ScTabView::TabChanged() method
We don't need to invalidate all parts of the document. It's enough to
invalidate only that sheet which we changed to.
Change-Id: I2c3aeb226c83bef473b0b33444b625e93d111b01
Reviewed-on: https://gerrit.libreoffice.org/79500
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 8 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 59700cfccc9c..2dd5dcfbb2cd 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -453,6 +453,7 @@ public: bool m_bFullInvalidateTiles; bool m_bInvalidateTiles; std::vector<tools::Rectangle> m_aInvalidations; + std::vector<int> m_aInvalidationsParts; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -542,6 +543,8 @@ public: aInvalidationRect.setWidth(aSeq[2].toInt32()); aInvalidationRect.setHeight(aSeq[3].toInt32()); m_aInvalidations.push_back(aInvalidationRect); + if (aSeq.getLength() == 5) + m_aInvalidationsParts.push_back(aSeq[4].toInt32()); m_bInvalidateTiles = true; } } @@ -1696,12 +1699,16 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() SfxLokHelper::setView(nView1); aView1.m_bInvalidateTiles = false; aView1.m_aInvalidations.clear(); + aView1.m_aInvalidationsParts.clear(); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(3), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidationsParts.size()); + CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[0]); } void ScTiledRenderingTest::testInsertDeletePageInvalidation() @@ -1729,7 +1736,7 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation() comphelper::dispatchCommand(".uno:Insert", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(size_t(6), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts()); diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 3ece4d760efb..9d611736f1bb 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -327,8 +327,14 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) ss << aDocSize.Width() << ", " << aDocSize.Height(); OString sRect = ss.str().c_str(); ScTabViewShell* pViewShell = aViewData.GetViewShell(); + + // Invalidate first + tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000); + OString sPayload = aRectangle.toString() + OString(", ") + OString::number(aViewData.GetTabNo()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr()); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false); } } } |