summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2012-01-12 14:09:32 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-01-12 21:51:52 -0500
commit29cfe42f6473fa2e7351f98d5f3480ffbd9904fe (patch)
tree3dfd20f6d6527aa9463a8d6da1fef4ef94fbf811 /sc/inc
parent659d0ebda52cb7252590d9b11ebe0ef461df89a9 (diff)
fdo#43077: Have cache instance keep track of who is referencing it.
With this change, ScDPCacheTable should never clear pointer to the data cache instance; it should keep the same data cache instance that it is instantiated with.
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/dpcachetable.hxx1
-rw-r--r--sc/inc/dpsdbtab.hxx5
-rw-r--r--sc/inc/dptablecache.hxx9
3 files changed, 12 insertions, 3 deletions
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 62efc84b7e41..695586f42874 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -175,7 +175,6 @@ public:
SCROW getOrder(long nDim, SCROW nIndex) const;
void clear();
bool empty() const;
- void setCache(const ScDPCache* p);
bool hasCache() const;
private:
diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx
index 87c3ccd1ec5c..8be0cb9904fc 100644
--- a/sc/inc/dpsdbtab.hxx
+++ b/sc/inc/dpsdbtab.hxx
@@ -38,6 +38,7 @@
class ScDPCacheTable;
class ScDocument;
+class ScDPCache;
struct ScImportSourceDesc
{
@@ -69,8 +70,8 @@ private:
const ScImportSourceDesc& mrImport;
ScDPCacheTable aCacheTable;
public:
- ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport);
- virtual ~ScDatabaseDPData();
+ ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport, const ScDPCache* pCache);
+ virtual ~ScDatabaseDPData();
virtual long GetColumnCount();
virtual String getDimensionName(long nColumn);
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx
index 950cc5459bef..a67103d0f788 100644
--- a/sc/inc/dptablecache.hxx
+++ b/sc/inc/dptablecache.hxx
@@ -53,11 +53,17 @@ public:
private:
typedef ::boost::ptr_vector<DataListType> DataGridType;
typedef ::boost::ptr_vector< ::std::vector<SCROW> > RowGridType;
+ typedef std::set<ScDPObject*> ObjectSetType;
ScDocument* mpDoc;
long mnColumnCount;
/**
+ * All pivot table objects that references this cache.
+ */
+ mutable ObjectSetType maRefObjects;
+
+ /**
* This container stores only the unique instances of item data in each
* column. Duplicates are not allowed.
*/
@@ -88,6 +94,9 @@ private:
mutable ScDPItemDataPool maAdditionalData;
public:
+ void AddReference(ScDPObject* pObj) const;
+ void RemoveReference(ScDPObject* pObj) const;
+
SCROW GetIdByItemData( long nDim, const String& sItemData ) const;
SCROW GetIdByItemData( long nDim, const ScDPItemData& rData ) const;