Kaydet (Commit) 8c558755 authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Kohei Yoshida

Use std::unique_ptr for the SdrPageProperties member of SdrPage.

Change-Id: I37d95bd91c5bee1028eceda24e84b17162d0d2b1
Reviewed-on: https://gerrit.libreoffice.org/20844Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKohei Yoshida <libreoffice@kohei.us>
üst c6b11cf6
...@@ -414,12 +414,12 @@ public: ...@@ -414,12 +414,12 @@ public:
private: private:
std::unique_ptr<SdrLayerAdmin> mpLayerAdmin; std::unique_ptr<SdrLayerAdmin> mpLayerAdmin;
SdrPageProperties* mpSdrPageProperties; std::unique_ptr<SdrPageProperties> mpSdrPageProperties;
css::uno::Reference< css::uno::XInterface > mxUnoPage; css::uno::Reference< css::uno::XInterface > mxUnoPage;
public: public:
SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; } SdrPageProperties& getSdrPageProperties();
const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; } const SdrPageProperties& getSdrPageProperties() const;
const SdrPageProperties* getCorrectSdrPageProperties() const; const SdrPageProperties* getCorrectSdrPageProperties() const;
protected: protected:
......
...@@ -1219,7 +1219,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) ...@@ -1219,7 +1219,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
aPrefVisiLayers.SetAll(); aPrefVisiLayers.SetAll();
eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
mpSdrPageProperties = new SdrPageProperties(*this); mpSdrPageProperties.reset(new SdrPageProperties(*this));
} }
SdrPage::SdrPage(const SdrPage& rSrcPage) SdrPage::SdrPage(const SdrPage& rSrcPage)
...@@ -1278,12 +1278,7 @@ SdrPage::~SdrPage() ...@@ -1278,12 +1278,7 @@ SdrPage::~SdrPage()
TRG_ClearMasterPage(); TRG_ClearMasterPage();
mpViewContact.reset(); mpViewContact.reset();
mpSdrPageProperties.reset();
{
delete mpSdrPageProperties;
mpSdrPageProperties = nullptr;
}
} }
void SdrPage::lateInit(const SdrPage& rSrcPage, SdrModel* const pNewModel) void SdrPage::lateInit(const SdrPage& rSrcPage, SdrModel* const pNewModel)
...@@ -1325,7 +1320,7 @@ void SdrPage::lateInit(const SdrPage& rSrcPage, SdrModel* const pNewModel) ...@@ -1325,7 +1320,7 @@ void SdrPage::lateInit(const SdrPage& rSrcPage, SdrModel* const pNewModel)
mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent;
{ {
mpSdrPageProperties = new SdrPageProperties(*this); mpSdrPageProperties.reset(new SdrPageProperties(*this));
if(!IsMasterPage()) if(!IsMasterPage())
{ {
...@@ -1524,7 +1519,7 @@ void SdrPage::SetModel(SdrModel* pNewModel) ...@@ -1524,7 +1519,7 @@ void SdrPage::SetModel(SdrModel* pNewModel)
// create new SdrPageProperties with new model (due to SfxItemSet there) // create new SdrPageProperties with new model (due to SfxItemSet there)
// and copy ItemSet and StyleSheet // and copy ItemSet and StyleSheet
SdrPageProperties *pNew = new SdrPageProperties(*this); std::unique_ptr<SdrPageProperties> pNew(new SdrPageProperties(*this));
if(!IsMasterPage()) if(!IsMasterPage())
{ {
...@@ -1533,8 +1528,7 @@ void SdrPage::SetModel(SdrModel* pNewModel) ...@@ -1533,8 +1528,7 @@ void SdrPage::SetModel(SdrModel* pNewModel)
pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet()); pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet());
delete mpSdrPageProperties; mpSdrPageProperties = std::move(pNew);
mpSdrPageProperties = pNew;
} }
// update listeners at possible API wrapper object // update listeners at possible API wrapper object
...@@ -1792,7 +1786,15 @@ void SdrPage::ActionChanged() ...@@ -1792,7 +1786,15 @@ void SdrPage::ActionChanged()
} }
} }
// sdr::Comment interface SdrPageProperties& SdrPage::getSdrPageProperties()
{
return *mpSdrPageProperties;
}
const SdrPageProperties& SdrPage::getSdrPageProperties() const
{
return *mpSdrPageProperties;
}
const SdrPageProperties* SdrPage::getCorrectSdrPageProperties() const const SdrPageProperties* SdrPage::getCorrectSdrPageProperties() const
{ {
......
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