From 878a5dabff4669fb606a461e11eaf286d0c8b07f Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 29 Apr 2014 15:32:18 -0400 Subject: fdo#74650: Speed up GetFilteredFilterEntries(). Change-Id: I1b3ae601726401a0e70fb1a05b9a90c43773794c --- sc/inc/column.hxx | 5 ++++- sc/source/core/data/column3.cxx | 7 +++++-- sc/source/core/data/table3.cxx | 9 +++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 7f6f81c310bf..0e13ec940d49 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -460,7 +460,10 @@ public: /// Including current, may return -1 SCsROW GetNextUnprotected( SCROW nRow, bool bUp ) const; - void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector& rStrings, bool& rHasDates); + void GetFilterEntries( + sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow, + std::vector& rStrings, bool& rHasDates ); + bool GetDataEntries( SCROW nRow, std::set& rStrings, bool bLimit ) const; void UpdateInsertTabAbs(SCTAB nNewPos); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 3008fec88a30..e3a81a57d32b 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2047,10 +2047,13 @@ public: } -void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector& rStrings, bool& rHasDates) +void ScColumn::GetFilterEntries( + sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow, + std::vector& rStrings, bool& rHasDates ) { FilterEntriesHandler aFunc(*this, rStrings); - sc::ParseAllNonEmpty(maCells.begin(), maCells, nStartRow, nEndRow, aFunc); + rBlockPos.miCellPos = + sc::ParseAllNonEmpty(rBlockPos.miCellPos, maCells, nStartRow, nEndRow, aFunc); rHasDates = aFunc.hasDates(); } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index acd8f5ef364b..2cf6c1b26401 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2556,12 +2556,17 @@ bool ScTable::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL /* nEndCol * void ScTable::GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector& rStrings, bool& rHasDates) { - aCol[nCol].GetFilterEntries( nRow1, nRow2, rStrings, rHasDates ); + sc::ColumnBlockConstPosition aBlockPos; + aCol[nCol].InitBlockPosition(aBlockPos); + aCol[nCol].GetFilterEntries(aBlockPos, nRow1, nRow2, rStrings, rHasDates); } void ScTable::GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector& rStrings, bool& rHasDates) { + sc::ColumnBlockConstPosition aBlockPos; + aCol[nCol].InitBlockPosition(aBlockPos); + // remove the entry for this column from the query parameter ScQueryParam aParam( rParam ); aParam.RemoveEntryByField(nCol); @@ -2573,7 +2578,7 @@ void ScTable::GetFilteredFilterEntries( if (ValidQuery(j, aParam)) { bool bThisHasDates = false; - aCol[nCol].GetFilterEntries( j, j, rStrings, bThisHasDates ); + aCol[nCol].GetFilterEntries(aBlockPos, j, j, rStrings, bThisHasDates); bHasDates |= bThisHasDates; } } -- cgit v1.2.3