summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-26 11:37:11 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-27 13:39:57 +0200
commitc564c40d8ccc2ed0e4022caa138dcd0433e6d768 (patch)
tree82c56f9a8240e07c96989a70beaf42895317abca
parentf56bd3b77e27dff3981ce6b81a2a053e7e209613 (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. Reviewed-on: https://gerrit.libreoffice.org/79500 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 96bd7504165f89ec5485d00a487e54634af347ce) Change-Id: I2c3aeb226c83bef473b0b33444b625e93d111b01 Reviewed-on: https://gerrit.libreoffice.org/79626 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx11
-rw-r--r--sc/source/ui/view/tabview5.cxx8
2 files changed, 16 insertions, 3 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 06f576ccf38a..be2ba2f5ec51 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -446,6 +446,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;
@@ -521,6 +522,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;
}
}
@@ -1745,12 +1748,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]);
mxComponent->dispose();
mxComponent.clear();
@@ -1783,7 +1790,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 88d35b111ed3..396b1c63a72c 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -329,8 +329,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 = ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel);
+ SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false);
}
}
}