Anonymous committed 5d2aa93

calc67: #i117661# filterByPageDimension: don't overwrite source filter with page field selection

Comments (0)

Files changed (3)


 	List					aColLevelList;
 	List					aRowLevelList;
 	sal_Bool					bResultOverflow;
+    bool                    bPageFiltered;      // set if page field filters have been applied to cache table
     ::std::auto_ptr<rtl::OUString> mpGrandTotalName;


+    // #i117661# If maRowsVisible is already false from source filtering, don't set to true again.
+    // filterByPageDimension is called only once after initializing with fillTable
+    // (this is enforced in ScDPSource::FilterCacheTableByPageDimensions).
     for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow)
-        maRowsVisible[nRow] = isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims);
+        maRowsVisible[nRow] = maRowsVisible[nRow] && isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims);
 const ScDPItemData* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const


 	pColResults( NULL ),
 	pRowResults( NULL ),
 	bResultOverflow( sal_False ),
+    bPageFiltered( false ),
 	pData->SetEmptyFlags( bIgnoreEmptyRows, bRepeatIfEmpty );
 	nColDimCount = nRowDimCount = nDataDimCount = nPageDimCount = 0;
 	pData->DisposeData();	// cached entries etc.
+    bPageFiltered = false;
 	bResultOverflow = sal_False;
 void ScDPSource::FilterCacheTableByPageDimensions()
+    // #i117661# Repeated calls to ScDPCacheTable::filterByPageDimension are invalid because
+    // rows are only hidden, never shown again. If FilterCacheTableByPageDimensions is called
+    // again, the cache table must be re-initialized. Currently, CreateRes_Impl always uses
+    // a fresh cache because ScDBDocFunc::DataPilotUpdate calls InvalidateData.
+    if (bPageFiltered)
+    {
+        DBG_ERRORFILE("tried to apply page field filters several times");
+        pData->DisposeData();
+        pData->CreateCacheTable();  // re-initialize the cache table
+        bPageFiltered = false;
+    }
     // filter table by page dimensions.
     vector<ScDPCacheTable::Criterion> aCriteria;
         hash_set<sal_Int32> aCatDims;
         pData->FilterCacheTable(aCriteria, aCatDims);
+        bPageFiltered = true;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.