summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-07 19:28:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-09 11:28:47 +0200
commit1a4e0b3003b88f8541a8e0e3264346ced10f4796 (patch)
tree222c5757b64a1ab23e4ee7be4e5f8447a4b3a2f7
parent91bb474cc5342b32dab6c701a1bea6c49b87f498 (diff)
loplugin:useuniqueptr in ScMySharedData
Change-Id: I1cc01cfdbc2c9accbaf17d7b9c04b0ec006f9e01 Reviewed-on: https://gerrit.libreoffice.org/52615 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/filter/xml/XMLExportSharedData.cxx18
-rw-r--r--sc/source/filter/xml/XMLExportSharedData.hxx18
2 files changed, 18 insertions, 18 deletions
diff --git a/sc/source/filter/xml/XMLExportSharedData.cxx b/sc/source/filter/xml/XMLExportSharedData.cxx
index 59e3bef03fca..b5fa9cbb1e3c 100644
--- a/sc/source/filter/xml/XMLExportSharedData.cxx
+++ b/sc/source/filter/xml/XMLExportSharedData.cxx
@@ -37,11 +37,11 @@ ScMySharedData::ScMySharedData(const sal_Int32 nTempTableCount) :
ScMySharedData::~ScMySharedData()
{
- delete pShapesContainer;
- delete pTableShapes;
- delete pDrawPages;
- delete pDetectiveObjContainer;
- delete pNoteShapes;
+ pShapesContainer.reset();
+ pTableShapes.reset();
+ pDrawPages.reset();
+ pDetectiveObjContainer.reset();
+ pNoteShapes.reset();
}
void ScMySharedData::SetLastColumn(const sal_Int32 nTable, const sal_Int32 nCol)
@@ -67,7 +67,7 @@ sal_Int32 ScMySharedData::GetLastRow(const sal_Int32 nTable) const
void ScMySharedData::AddDrawPage(const ScMyDrawPage& aDrawPage, const sal_Int32 nTable)
{
if (!pDrawPages)
- pDrawPages = new ScMyDrawPages(nTableCount, ScMyDrawPage());
+ pDrawPages.reset(new ScMyDrawPages(nTableCount, ScMyDrawPage()));
(*pDrawPages)[nTable] = aDrawPage;
}
@@ -104,7 +104,7 @@ bool ScMySharedData::HasForm(const sal_Int32 nTable, uno::Reference<drawing::XDr
void ScMySharedData::AddNewShape(const ScMyShape& aMyShape)
{
if (!pShapesContainer)
- pShapesContainer = new ScMyShapesContainer();
+ pShapesContainer.reset(new ScMyShapesContainer());
pShapesContainer->AddNewShape(aMyShape);
}
@@ -123,14 +123,14 @@ bool ScMySharedData::HasShapes()
void ScMySharedData::AddTableShape(const sal_Int32 nTable, const uno::Reference<drawing::XShape>& xShape)
{
if (!pTableShapes)
- pTableShapes = new ScMyTableShapes(nTableCount);
+ pTableShapes.reset(new ScMyTableShapes(nTableCount));
(*pTableShapes)[nTable].push_back(xShape);
}
void ScMySharedData::AddNoteObj(const uno::Reference<drawing::XShape>& xShape, const ScAddress& rPos)
{
if (!pNoteShapes)
- pNoteShapes = new ScMyNoteShapesContainer();
+ pNoteShapes.reset( new ScMyNoteShapesContainer() );
ScMyNoteShape aNote;
aNote.xShape = xShape;
aNote.aPos = rPos;
diff --git a/sc/source/filter/xml/XMLExportSharedData.hxx b/sc/source/filter/xml/XMLExportSharedData.hxx
index 3998f268c0a9..3db698c3182c 100644
--- a/sc/source/filter/xml/XMLExportSharedData.hxx
+++ b/sc/source/filter/xml/XMLExportSharedData.hxx
@@ -47,11 +47,11 @@ class ScMySharedData
{
std::vector<sal_Int32> nLastColumns;
std::vector<sal_Int32> nLastRows;
- ScMyTableShapes* pTableShapes;
- ScMyDrawPages* pDrawPages;
- ScMyShapesContainer* pShapesContainer;
- ScMyDetectiveObjContainer* pDetectiveObjContainer;
- ScMyNoteShapesContainer* pNoteShapes;
+ std::unique_ptr<ScMyTableShapes> pTableShapes;
+ std::unique_ptr<ScMyDrawPages> pDrawPages;
+ std::unique_ptr<ScMyShapesContainer> pShapesContainer;
+ std::unique_ptr<ScMyDetectiveObjContainer> pDetectiveObjContainer;
+ std::unique_ptr<ScMyNoteShapesContainer> pNoteShapes;
sal_Int32 nTableCount;
public:
explicit ScMySharedData(const sal_Int32 nTableCount);
@@ -68,14 +68,14 @@ public:
bool HasForm(const sal_Int32 nTable, css::uno::Reference<css::drawing::XDrawPage>& xDrawPage);
void AddNewShape(const ScMyShape& aMyShape);
void SortShapesContainer();
- ScMyShapesContainer* GetShapesContainer() { return pShapesContainer; }
+ ScMyShapesContainer* GetShapesContainer() { return pShapesContainer.get(); }
bool HasShapes();
void AddTableShape(const sal_Int32 nTable, const css::uno::Reference<css::drawing::XShape>& xShape);
- ScMyTableShapes* GetTableShapes() { return pTableShapes; }
- ScMyDetectiveObjContainer* GetDetectiveObjContainer() { return pDetectiveObjContainer; }
+ ScMyTableShapes* GetTableShapes() { return pTableShapes.get(); }
+ ScMyDetectiveObjContainer* GetDetectiveObjContainer() { return pDetectiveObjContainer.get(); }
void AddNoteObj(const css::uno::Reference<css::drawing::XShape>& xShape, const ScAddress& rPos);
void SortNoteShapes();
- ScMyNoteShapesContainer* GetNoteShapes() { return pNoteShapes; }
+ ScMyNoteShapesContainer* GetNoteShapes() { return pNoteShapes.get(); }
};
#endif