summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-10-31 21:46:46 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-10-31 22:12:46 -0400
commit6a06befd20b01290a61e8157bd72c20eddcd15a0 (patch)
tree5990b982238d83f70239b39c714dc43e41386982
parent8617c5a251ce725aa7c6743be28abd3db116255f (diff)
Since the cache there is never NULL, let's take a reference instead.
Change-Id: Idd3ca250ea51c9e17b4566febf13d9c8ca9c6a8f
-rw-r--r--sc/inc/dpcachetable.hxx4
-rw-r--r--sc/inc/dpsdbtab.hxx2
-rw-r--r--sc/inc/dpshttab.hxx2
-rw-r--r--sc/source/core/data/dpcachetable.cxx26
-rw-r--r--sc/source/core/data/dpobject.cxx4
-rw-r--r--sc/source/core/data/dpsdbtab.cxx4
-rw-r--r--sc/source/core/data/dpshttab.cxx4
-rw-r--r--sc/source/filter/excel/xepivot.cxx2
8 files changed, 21 insertions, 27 deletions
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 0358e58db428..7fb6c649be6d 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -109,7 +109,7 @@ public:
Criterion();
};
- ScDPCacheTable(const ScDPCache* pCache);
+ ScDPCacheTable(const ScDPCache& rCache);
~ScDPCacheTable();
sal_Int32 getRowSize() const;
@@ -180,7 +180,7 @@ private:
/** Rows visible by page dimension filtering. */
RowFlagType maShowByPage;
- const ScDPCache* mpCache;
+ const ScDPCache& mrCache;
};
#endif
diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx
index 943bf8d94179..87e6df61c3b3 100644
--- a/sc/inc/dpsdbtab.hxx
+++ b/sc/inc/dpsdbtab.hxx
@@ -70,7 +70,7 @@ class ScDatabaseDPData : public ScDPTableData
private:
ScDPCacheTable aCacheTable;
public:
- ScDatabaseDPData(ScDocument* pDoc, const ScDPCache* pCache);
+ ScDatabaseDPData(ScDocument* pDoc, const ScDPCache& rCache);
virtual ~ScDatabaseDPData();
virtual long GetColumnCount();
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index 0374123f2c68..633207ab5e97 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -107,7 +107,7 @@ private:
ScDPCacheTable aCacheTable;
public:
- ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache* pCache);
+ ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache& rCache);
virtual ~ScSheetDPData();
virtual long GetColumnCount();
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 9d7e3cbd8c23..6a648a9cd9b8 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -113,8 +113,8 @@ ScDPCacheTable::Criterion::Criterion() :
// ----------------------------------------------------------------------------
-ScDPCacheTable::ScDPCacheTable(const ScDPCache* pCache) :
- maShowByFilter(0, MAXROW+1, false), maShowByPage(0, MAXROW+1, true), mpCache(pCache)
+ScDPCacheTable::ScDPCacheTable(const ScDPCache& rCache) :
+ maShowByFilter(0, MAXROW+1, false), maShowByPage(0, MAXROW+1, true), mrCache(rCache)
{
}
@@ -124,19 +124,19 @@ ScDPCacheTable::~ScDPCacheTable()
sal_Int32 ScDPCacheTable::getRowSize() const
{
- return mpCache ? getCache()->GetRowCount() : 0;
+ return mrCache.GetRowCount();
}
sal_Int32 ScDPCacheTable::getColSize() const
{
- return mpCache ? getCache()->GetColumnCount() : 0;
+ return mrCache.GetColumnCount();
}
void ScDPCacheTable::fillTable(
const ScQueryParam& rQuery, bool bIgnoreEmptyRows, bool bRepeatIfEmpty)
{
SCROW nRowCount = getRowSize();
- SCROW nDataSize = mpCache->GetDataSize();
+ SCROW nDataSize = mrCache.GetDataSize();
SCCOL nColCount = getColSize();
if (nRowCount <= 0 || nColCount <= 0)
return;
@@ -282,11 +282,8 @@ void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, c
const ScDPItemData* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const
{
- if (!mpCache)
- return NULL;
-
- SCROW nId= getCache()->GetItemDataId(nCol, nRow, bRepeatIfEmpty);
- return getCache()->GetItemDataById( nCol, nId );
+ SCROW nId= mrCache.GetItemDataId(nCol, nRow, bRepeatIfEmpty);
+ return mrCache.GetItemDataById( nCol, nId );
}
void ScDPCacheTable::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const
@@ -304,10 +301,7 @@ void ScDPCacheTable::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, boo
rtl::OUString ScDPCacheTable::getFieldName(SCCOL nIndex) const
{
- if (!mpCache)
- return rtl::OUString();
-
- return getCache()->GetDimensionName( nIndex );
+ return mrCache.GetDimensionName(nIndex);
}
const ::std::vector<SCROW>& ScDPCacheTable::getFieldEntries( sal_Int32 nColumn ) const
@@ -389,7 +383,7 @@ void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< S
SCROW ScDPCacheTable::getOrder(long nDim, SCROW nIndex) const
{
- return mpCache->GetOrder(nDim, nIndex);
+ return mrCache.GetOrder(nDim, nIndex);
}
void ScDPCacheTable::clear()
@@ -427,7 +421,7 @@ bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCr
const ScDPCache* ScDPCacheTable::getCache() const
{
- return mpCache;
+ return &mrCache;
}
#if DEBUG_PIVOT_TABLE
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 81888fdfe6dc..cfd89aa31efe 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -595,7 +595,7 @@ ScDPTableData* ScDPObject::GetTableData()
if (pCache)
{
pCache->AddReference(this);
- pData.reset(new ScDatabaseDPData(pDoc, pCache));
+ pData.reset(new ScDatabaseDPData(pDoc, *pCache));
}
}
else
@@ -616,7 +616,7 @@ ScDPTableData* ScDPObject::GetTableData()
if (pCache)
{
pCache->AddReference(this);
- pData.reset(new ScSheetDPData(pDoc, *pSheetDesc, pCache));
+ pData.reset(new ScSheetDPData(pDoc, *pSheetDesc, *pCache));
}
}
}
diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx
index da9da054fd9c..696f74d7b920 100644
--- a/sc/source/core/data/dpsdbtab.cxx
+++ b/sc/source/core/data/dpsdbtab.cxx
@@ -72,9 +72,9 @@ const ScDPCache* ScImportSourceDesc::CreateCache(const ScDPDimensionSaveData* pD
}
ScDatabaseDPData::ScDatabaseDPData(
- ScDocument* pDoc, const ScDPCache* pCache) :
+ ScDocument* pDoc, const ScDPCache& rCache) :
ScDPTableData(pDoc),
- aCacheTable(pCache)
+ aCacheTable(rCache)
{
}
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index 78f702501d6d..15ea27c1af28 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -51,12 +51,12 @@ using ::std::vector;
// -----------------------------------------------------------------------
-ScSheetDPData::ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache* pCache) :
+ScSheetDPData::ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache& rCache) :
ScDPTableData(pD),
aQuery ( rDesc.GetQueryParam() ),
bIgnoreEmptyRows( false ),
bRepeatIfEmpty(false),
- aCacheTable(pCache)
+ aCacheTable(rCache)
{
SCSIZE nEntryCount( aQuery.GetEntryCount());
for (SCSIZE j = 0; j < nEntryCount; ++j)
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index ac0bef940619..85e36e53dfad 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -547,7 +547,7 @@ void XclExpPCField::InsertNumDateGroupItems( const ScDPObject& rDPObj, const ScD
if (!pCache)
return;
- ScSheetDPData aDPData(GetDocPtr(), *pSrcDesc, pCache);
+ ScSheetDPData aDPData(GetDocPtr(), *pSrcDesc, *pCache);
long nDim = GetFieldIndex();
const std::vector< SCROW > aOrignial = aDPData.GetColumnEntries(nDim);
// get the string collection with generated grouping elements