limit rows to ones having data when computing ScSortedRangeCache
Change-Id: I2de9ea4887b6101f10eb3b8da6f3596de0ea09eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134128 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include <rowheightcontext.hxx>
|
||||
#include <queryevaluator.hxx>
|
||||
#include <rangecache.hxx>
|
||||
#include <refdata.hxx>
|
||||
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <tools/fract.hxx>
|
||||
|
||||
@@ -68,6 +68,14 @@ ScSortedRangeCache::ScSortedRangeCache(ScDocument* pDoc, const ScRange& rRange,
|
||||
&& param.GetEntry(0).GetQueryItems().size() == 1);
|
||||
const ScQueryEntry& entry = param.GetEntry(0);
|
||||
const ScQueryEntry::Item& item = entry.GetQueryItem();
|
||||
|
||||
SCROW startRow = maRange.aStart.Row();
|
||||
SCROW endRow = maRange.aEnd.Row();
|
||||
SCCOL startCol = maRange.aStart.Col();
|
||||
SCCOL endCol = maRange.aEnd.Col();
|
||||
if (!pDoc->ShrinkToDataArea(nTab, startCol, startRow, endCol, endRow))
|
||||
return;
|
||||
|
||||
if (mValues == ValueType::Values)
|
||||
{
|
||||
struct RowData
|
||||
@@ -76,7 +84,7 @@ ScSortedRangeCache::ScSortedRangeCache(ScDocument* pDoc, const ScRange& rRange,
|
||||
double value;
|
||||
};
|
||||
std::vector<RowData> rowData;
|
||||
for (SCROW nRow = maRange.aStart.Row(); nRow <= maRange.aEnd.Row(); ++nRow)
|
||||
for (SCROW nRow = startRow; nRow <= endRow; ++nRow)
|
||||
{
|
||||
ScRefCellValue cell(pDoc->GetRefCellValue(ScAddress(nCol, nRow, nTab)));
|
||||
if (ScQueryEvaluator::isQueryByValue(entry, item, cell))
|
||||
@@ -102,7 +110,7 @@ ScSortedRangeCache::ScSortedRangeCache(ScDocument* pDoc, const ScRange& rRange,
|
||||
// Try to reuse as much ScQueryEvaluator code as possible, this should
|
||||
// basically do the same comparisons.
|
||||
ScQueryEvaluator evaluator(*pDoc, *pDoc->FetchTable(nTab), param, context);
|
||||
for (SCROW nRow = maRange.aStart.Row(); nRow <= maRange.aEnd.Row(); ++nRow)
|
||||
for (SCROW nRow = startRow; nRow <= endRow; ++nRow)
|
||||
{
|
||||
ScRefCellValue cell(pDoc->GetRefCellValue(ScAddress(nCol, nRow, nTab)));
|
||||
if (ScQueryEvaluator::isQueryByString(entry, item, cell))
|
||||
|
||||
Reference in New Issue
Block a user