Kaydet (Commit) 1a4e0b30 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in ScMySharedData

Change-Id: I1cc01cfdbc2c9accbaf17d7b9c04b0ec006f9e01
Reviewed-on: https://gerrit.libreoffice.org/52615Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 91bb474c
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment