incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1167326 - in /incubator/ooo/trunk/main/sc: inc/dptabsrc.hxx source/core/data/dpcachetable.cxx source/core/data/dptabsrc.cxx
Date Fri, 09 Sep 2011 18:51:35 GMT
Author: erack
Date: Fri Sep  9 18:51:34 2011
New Revision: 1167326

URL: http://svn.apache.org/viewvc?rev=1167326&view=rev
Log:
calc67: #i117661# filterByPageDimension: don't overwrite source filter with page field selection

# User Niklas Nebel <nn@openoffice.org>

Modified:
    incubator/ooo/trunk/main/sc/inc/dptabsrc.hxx
    incubator/ooo/trunk/main/sc/source/core/data/dpcachetable.cxx
    incubator/ooo/trunk/main/sc/source/core/data/dptabsrc.cxx

Modified: incubator/ooo/trunk/main/sc/inc/dptabsrc.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/dptabsrc.hxx?rev=1167326&r1=1167325&r2=1167326&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/dptabsrc.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/dptabsrc.hxx Fri Sep  9 18:51:34 2011
@@ -143,6 +143,7 @@ private:
 	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;
 

Modified: incubator/ooo/trunk/main/sc/source/core/data/dpcachetable.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/dpcachetable.cxx?rev=1167326&r1=1167325&r2=1167326&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/dpcachetable.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/dpcachetable.cxx Fri Sep  9 18:51:34 2011
@@ -305,8 +305,12 @@ void ScDPCacheTable::filterByPageDimensi
         return;
     }
 
+    // #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

Modified: incubator/ooo/trunk/main/sc/source/core/data/dptabsrc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/dptabsrc.cxx?rev=1167326&r1=1167325&r2=1167326&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/dptabsrc.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/dptabsrc.cxx Fri Sep  9 18:51:34 2011
@@ -140,6 +140,7 @@ ScDPSource::ScDPSource( ScDPTableData* p
 	pColResults( NULL ),
 	pRowResults( NULL ),
 	bResultOverflow( sal_False ),
+    bPageFiltered( false ),
     mpGrandTotalName(NULL)
 {
 	pData->SetEmptyFlags( bIgnoreEmptyRows, bRepeatIfEmpty );
@@ -589,6 +590,7 @@ void ScDPSource::disposeData()
 	nColDimCount = nRowDimCount = nDataDimCount = nPageDimCount = 0;
 
 	pData->DisposeData();	// cached entries etc.
+    bPageFiltered = false;
 	bResultOverflow = sal_False;
 }
 
@@ -741,6 +743,19 @@ void ScDPSource::GetCategoryDimensionInd
 
 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;
@@ -787,6 +802,7 @@ void ScDPSource::FilterCacheTableByPageD
         hash_set<sal_Int32> aCatDims;
         GetCategoryDimensionIndices(aCatDims);
         pData->FilterCacheTable(aCriteria, aCatDims);
+        bPageFiltered = true;
     }
 }
 



Mime
View raw message