summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-21 15:48:44 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-25 12:32:53 +0200
commite740aaf876edd58c1f5c5e17af2495cad36cfc27 (patch)
tree52fa6abfd4060361fc3636835a88e16812a5b99e /sc
parent9c975823b82e6b64c3dff0b4347162e8d426b852 (diff)
sc lok: Optimize invalidation triggered by getRowColumnHeaders() method
Don't call a full invalidation, rather use invalidation only on the new area. Make sure that the invalidation is called first. Change-Id: I89d1c6342ed8e95fe738a876a76ca6feda031962 Reviewed-on: https://gerrit.libreoffice.org/79494 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx15
-rw-r--r--sc/source/ui/view/tabview.cxx38
2 files changed, 25 insertions, 28 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index a22cca344966..35e61c791db6 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1761,9 +1761,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
pModelObj->getRowColumnHeaders(tools::Rectangle(0, 15, 19650, 5400));
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
- CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[1]);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[0]);
// Extend area top-to-bottom
aView1.m_bInvalidateTiles = false;
@@ -1771,9 +1770,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
pModelObj->getRowColumnHeaders(tools::Rectangle(0, 5400, 19650, 9800));
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
- CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[1]);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[0]);
// Extend area left-to-right
aView1.m_bInvalidateTiles = false;
@@ -1781,9 +1779,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
pModelObj->getRowColumnHeaders(tools::Rectangle(5400, 5400, 25050, 9800));
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
- CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
- CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[1]);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]);
}
}
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 5116fd17e6fc..8e83b17ed267 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2555,14 +2555,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
SAL_INFO("sc.lok.header", "Row Header: a new height: " << aNewSize.Height());
if (pDocSh)
{
- // Provide size in the payload, so clients don't have to
- // call lok::Document::getDocumentSize().
- std::stringstream ss;
- ss << aNewSize.Width() << ", " << aNewSize.Height();
- OString sSize = ss.str().c_str();
- ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel);
-
// New area extended to the bottom of the sheet after last row
// excluding overlapping area with aNewColArea
tools::Rectangle aNewRowArea(0, aOldSize.getHeight(), aOldSize.getWidth(), aNewSize.getHeight());
@@ -2573,6 +2565,14 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
UpdateSelectionOverlay();
SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString());
}
+
+ // Provide size in the payload, so clients don't have to
+ // call lok::Document::getDocumentSize().
+ std::stringstream ss;
+ ss << aNewSize.Width() << ", " << aNewSize.Height();
+ OString sSize = ss.str().c_str();
+ ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
+ SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
}
}
@@ -2697,17 +2697,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
if (pDocSh)
{
- if (aOldSize != aNewSize)
- {
- // Provide size in the payload, so clients don't have to
- // call lok::Document::getDocumentSize().
- std::stringstream ss;
- ss << aNewSize.Width() << ", " << aNewSize.Height();
- OString sSize = ss.str().c_str();
- ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel);
- }
-
// 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());
@@ -2718,6 +2707,17 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
UpdateSelectionOverlay();
SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewColArea.toString());
}
+
+ if (aOldSize != aNewSize)
+ {
+ // Provide size in the payload, so clients don't have to
+ // call lok::Document::getDocumentSize().
+ std::stringstream ss;
+ ss << aNewSize.Width() << ", " << aNewSize.Height();
+ OString sSize = ss.str().c_str();
+ ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
+ SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
+ }
}
}