summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table1.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-05-15 11:04:03 +0200
committerDennis Francis <dennis.francis@collabora.com>2019-05-15 13:36:46 +0200
commit3e664b8f194392eb27aae953c0d33a8bdfd32982 (patch)
treeeb09dc53a9287524d98b157cda8b1f5ca9bac58f /sc/source/core/data/table1.cxx
parent5fbd5c9ba97a7ecacebc6bcc582a36dd1631a5b3 (diff)
cache cell positions when opening standard filter in calc (tdf#80853)
Part of the performance problem in the bugreport. Mdds otherwise always starts a search from the beginning of the contaier. Change-Id: Ic5c542220b7a8dc3aec0cfa93a0888997435fbfe Reviewed-on: https://gerrit.libreoffice.org/72347 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/source/core/data/table1.cxx')
-rw-r--r--sc/source/core/data/table1.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 24d0439935ea..c18c039c46db 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -801,6 +801,11 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
bool bBottom = false;
bool bChanged = false;
+ // We need to cache sc::ColumnBlockConstPosition per each column.
+ std::vector< sc::ColumnBlockConstPosition > blockPos( rEndCol + 1 );
+ for( SCCOL i = 0; i <= rEndCol; ++i )
+ aCol[ i ].InitBlockPosition( blockPos[ i ] );
+
do
{
bChanged = false;
@@ -815,7 +820,10 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
if (rEndCol < (aCol.size()-1))
if (!aCol[rEndCol+1].IsEmptyBlock(nStart,nEnd))
{
+ assert( int( blockPos.size()) == rEndCol + 1 );
++rEndCol;
+ blockPos.resize( blockPos.size() + 1 );
+ aCol[ rEndCol ].InitBlockPosition( blockPos[ rEndCol ] );
bChanged = true;
bRight = true;
}
@@ -833,7 +841,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
SCROW nTest = rStartRow-1;
bool needExtend = false;
for ( SCCOL i = rStartCol; i<=rEndCol && !needExtend; i++)
- if (aCol[i].HasDataAt(nTest))
+ if (aCol[i].HasDataAt(blockPos[i], nTest))
needExtend = true;
if (needExtend)
{
@@ -849,7 +857,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
SCROW nTest = rEndRow+1;
bool needExtend = false;
for ( SCCOL i = rStartCol; i<=rEndCol && !needExtend; i++)
- if (aCol[i].HasDataAt(nTest))
+ if (aCol[i].HasDataAt(blockPos[ i ], nTest))
needExtend = true;
if (needExtend)
{