summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2017-04-03 16:36:11 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2017-05-17 14:53:45 +0200
commit0f420e946b48cb5fea0302f6fbfbded3f6d50560 (patch)
tree05680df223f3cb76543cc74e1ada60bf346e645e
parent6b18ef78db8ba4cb816dcbb51a2e7e7a7bbc7195 (diff)
tdf#35636: Apply algorithm also to ranges spanning multiple columns
Change-Id: I6e574f2237dd6d4dcf4438a9fdafadb66aa049c5
-rw-r--r--sc/source/core/data/dociter.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index d31f17038b26..16c6d1fee94f 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -57,8 +57,16 @@ namespace
rStr = ScGlobal::pCharClass->uppercase(rStr.trim());
}
- void lcl_FillBlankCells( std::vector<ColEntry> &rSrcCols, std::vector<ColEntry> &rDestCols, SCROW nLastRow )
+ void lcl_FillBlankCells( std::vector<ColEntry> &rSrcCols, std::vector<ColEntry> &rDestCols, SCROW nLastRow, bool bMatchEmpty )
{
+ rDestCols.clear();
+
+ if (!bMatchEmpty)
+ {
+ rDestCols = rSrcCols;
+ return;
+ }
+
for( SCROW i = 0, n = 0; i <= nLastRow; ++i )
{
rDestCols.push_back(ColEntry());
@@ -1214,13 +1222,8 @@ bool ScQueryCellIterator::GetThis()
bool bMatchEmpty = ( rItem.mbMatchEmpty && rEntry.GetQueryItems().size() == 1 );
std::vector<ColEntry> rColItems;
- if ( !bMatchEmpty )
- rColItems = pCol->maItems;
- else
- {
- SCROW nLastRow = pCol->maItems.back().nRow;
- lcl_FillBlankCells( pCol->maItems, rColItems, std::max(nLastRow, mpParam->nRow2) );
- }
+ SCROW nLastRow = pCol->GetLastDataPos();
+ lcl_FillBlankCells( pCol->maItems, rColItems, std::max(nLastRow, mpParam->nRow2), bMatchEmpty );
for ( ;; )
{
@@ -1238,7 +1241,10 @@ bool ScQueryCellIterator::GetThis()
AdvanceQueryParamEntryField();
nFirstQueryField = rEntry.nField;
}
+
pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+ nLastRow = pCol->GetLastDataPos();
+ lcl_FillBlankCells( pCol->maItems, rColItems, std::max(nLastRow, mpParam->nRow2), bMatchEmpty );
} while ( pCol->maItems.empty() );
pCol->Search( nRow, nColRow );
bFirstStringIgnore = bIgnoreMismatchOnLeadingStrings &&