summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-27 19:49:55 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-28 03:33:38 +0200
commit2939a0f4805c7f708a803d624c5ac42f78bcf791 (patch)
tree1fbdd028a685c001eba5e4406b2a15d536e873ac
parent39372e828d846fa2a6befe19b388595f159bc2fa (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> Reviewed-on: https://gerrit.libreoffice.org/79769 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.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 685b36659845..07c54e6f671f 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -450,6 +450,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;
@@ -525,6 +526,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;
}
}
@@ -1732,12 +1735,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()
@@ -1766,7 +1773,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);
}
}
}