summaryrefslogtreecommitdiff
path: root/sc/qa/unit/ucalc_sort.cxx
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-01-23 14:22:59 +0100
committerEike Rathke <erack@redhat.com>2018-01-31 14:34:08 +0100
commitea607135ce6bb607508ac6ce6fcc4dae99f297a9 (patch)
tree2501ffe09d4917832b6ae8d8b506a25b011261bf /sc/qa/unit/ucalc_sort.cxx
parent3341c752024687e96b7aad2d19e04d65ee7e232e (diff)
Improve performance when looking for draw objects anchored to cells
Look for a whole column at once so we don't have to iterate all draw objects for every cell, but only once per column. Follow-up for 3a2a430ae8e2c1647c18d8904477949f6e2e7941 Change-Id: Ic8740fca7d595528785b432c1cedf4fad4f13ba1 Reviewed-on: https://gerrit.libreoffice.org/48416 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/qa/unit/ucalc_sort.cxx')
-rw-r--r--sc/qa/unit/ucalc_sort.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index eb7d1b79039e..e700c5e4ffe2 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -1921,8 +1921,9 @@ void Test::testSortImages()
ScAddress aCellPos(1, 1, 0);
pDrawLayer->MoveObject(pObj, aCellPos);
- std::vector<SdrObject*> pObjects = pDrawLayer->GetObjectsAnchoredToCell(aCellPos);
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pObjects.size());
+ std::map<SCROW, std::vector<SdrObject*>> pRowObjects
+ = pDrawLayer->GetObjectsAnchoredToRange(aCellPos.Tab(), aCellPos.Col(), aCellPos.Row(), aCellPos.Row());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pRowObjects[aCellPos.Row()].size());
ScSortParam aSortData;
aSortData.nCol1 = 0;
@@ -1940,8 +1941,9 @@ void Test::testSortImages()
// check that note is also moved after sorting
aCellPos = ScAddress(1, 0, 0);
- pObjects = pDrawLayer->GetObjectsAnchoredToCell(aCellPos);
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pObjects.size());
+ pRowObjects
+ = pDrawLayer->GetObjectsAnchoredToRange(aCellPos.Tab(), aCellPos.Col(), aCellPos.Row(), aCellPos.Row());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pRowObjects[aCellPos.Row()].size());
m_pDoc->DeleteTab(0);
}