From ab121cf8540dc26b4877022b11e2ea50a4fd9b5e Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 25 Jan 2013 21:19:20 +0100 Subject: don't use a pointer here Change-Id: If7e7785e032d7d95764e8325870655e276cfda8f --- sc/source/filter/xml/XMLStylesExportHelper.cxx | 20 ++++++-------------- sc/source/filter/xml/XMLStylesExportHelper.hxx | 10 ++++------ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index 6e80aa8ea951..5e5c2161ac1b 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -477,12 +477,12 @@ void ScMyDefaultStyles::FillDefaultStyles(const sal_Int32 nTable, ScMyDefaultStyleList* pDefaults; if (bRow) { - pDefaults = pRowDefaults; + pDefaults = &maRowDefaults; nLast = nLastRow; } else { - pDefaults = pColDefaults; + pDefaults = &maColDefaults; nLast = nLastCol; } bool bPrevAutoStyle(false); @@ -561,22 +561,14 @@ void ScMyDefaultStyles::FillDefaultStyles(const sal_Int32 nTable, const sal_Int32 nLastRow, const sal_Int32 nLastCol, const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc) { - delete pRowDefaults; - pRowDefaults = new ScMyDefaultStyleList(nLastRow + 1); + maRowDefaults.clear(); + maRowDefaults.resize(nLastRow + 1); FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, true); - delete pColDefaults; - pColDefaults = new ScMyDefaultStyleList(nLastCol + 1); + maColDefaults.clear(); + maColDefaults.resize(nLastCol + 1); FillDefaultStyles(nTable, nLastRow, nLastCol, pCellStyles, pDoc, false); } -ScMyDefaultStyles::~ScMyDefaultStyles() -{ - if (pRowDefaults) - delete pRowDefaults; - if (pColDefaults) - delete pColDefaults; -} - ScMyRowFormatRange::ScMyRowFormatRange() : nStartColumn(0), nRepeatColumns(0), diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx b/sc/source/filter/xml/XMLStylesExportHelper.hxx index d9a2fd5e315c..2159c846d966 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.hxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx @@ -115,8 +115,8 @@ class ScFormatRangeStyles; class ScMyDefaultStyles { - ScMyDefaultStyleList* pRowDefaults; - ScMyDefaultStyleList* pColDefaults; + ScMyDefaultStyleList maRowDefaults; + ScMyDefaultStyleList maColDefaults; sal_Int32 GetStyleNameIndex(const ScFormatRangeStyles* pCellStyles, const sal_Int32 nTable, const sal_Int32 nPos, @@ -126,15 +126,13 @@ class ScMyDefaultStyles const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc, const bool bRow); public: - ScMyDefaultStyles() : pRowDefaults(NULL), pColDefaults(NULL) {} - ~ScMyDefaultStyles(); void FillDefaultStyles(const sal_Int32 nTable, const sal_Int32 nLastRow, const sal_Int32 nLastCol, const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc); - const ScMyDefaultStyleList* GetRowDefaults() const { return pRowDefaults; } - const ScMyDefaultStyleList* GetColDefaults() const { return pColDefaults; } + const ScMyDefaultStyleList* GetRowDefaults() const { return &maRowDefaults; } + const ScMyDefaultStyleList* GetColDefaults() const { return &maColDefaults; } }; struct ScMyRowFormatRange -- cgit