diff options
-rw-r--r-- | sc/inc/dpobject.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 49 |
2 files changed, 46 insertions, 6 deletions
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 1683480d7d2b..9bdb12346b13 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -118,11 +118,14 @@ public: ScDPObject(const ScDPObject& r); ~ScDPObject(); + ScDPObject& operator= (const ScDPObject& r); + void EnableGetPivotData(bool b); void SetAllowMove(bool bSet); void InvalidateData(); + void Clear(); void ClearTableData(); void ReloadGroupTableData(); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index cb107ba1490d..e8b384c4184f 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -354,12 +354,34 @@ ScDPObject::ScDPObject(const ScDPObject& r) : ScDPObject::~ScDPObject() { - delete pOutput; - delete pSaveData; - delete pSheetDesc; - delete pImpDesc; - delete pServDesc; - ClearTableData(); + Clear(); +} + +ScDPObject& ScDPObject::operator= (const ScDPObject& r) +{ + Clear(); + + pDoc = r.pDoc; + aTableName = r.aTableName; + aTableTag = r.aTableTag; + aOutRange = r.aOutRange; + mnAutoFormatIndex = r.mnAutoFormatIndex; + nHeaderRows = r.nHeaderRows; + mbHeaderLayout = r.mbHeaderLayout; + bAllowMove = false; + bSettingsChanged = false; + mbEnableGetPivotData = r.mbEnableGetPivotData; + + if (r.pSaveData) + pSaveData = new ScDPSaveData(*r.pSaveData); + if (r.pSheetDesc) + pSheetDesc = new ScSheetSourceDesc(*r.pSheetDesc); + if (r.pImpDesc) + pImpDesc = new ScImportSourceDesc(*r.pImpDesc); + if (r.pServDesc) + pServDesc = new ScDPServiceDesc(*r.pServDesc); + + return *this; } void ScDPObject::EnableGetPivotData(bool b) @@ -780,6 +802,21 @@ void ScDPObject::InvalidateData() bSettingsChanged = true; } +void ScDPObject::Clear() +{ + delete pOutput; + delete pSaveData; + delete pSheetDesc; + delete pImpDesc; + delete pServDesc; + pOutput = NULL; + pSaveData = NULL; + pSheetDesc = NULL; + pImpDesc = NULL; + pServDesc = NULL; + ClearTableData(); +} + void ScDPObject::ClearTableData() { ClearSource(); |