diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2015-12-18 19:42:09 -0500 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2015-12-19 02:26:36 +0000 |
commit | 6b57529888f384307b88cf5ead5e3e477c6c03b1 (patch) | |
tree | b4dd4c50339797a9128e37315daabc6825fd2a22 /svx/source/svdraw/svdpage.cxx | |
parent | c1aca008603d18dcd84a751df70fb8eefd9f0111 (diff) |
Use std::unique_ptr for mpViewContact member instance of SdrPage.
And fix some const-incorrect-ness while at it.
Change-Id: I0314c8e5b73f1a7edce040b2a57fbc5d1081d70c
Reviewed-on: https://gerrit.libreoffice.org/20815
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'svx/source/svdraw/svdpage.cxx')
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 583c4892823e..d6679ff36e57 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1061,18 +1061,22 @@ sdr::contact::ViewContact* SdrPage::CreateObjectSpecificViewContact() return new sdr::contact::ViewContactOfSdrPage(*this); } -sdr::contact::ViewContact& SdrPage::GetViewContact() const +const sdr::contact::ViewContact& SdrPage::GetViewContact() const { - if(!mpViewContact) - { - const_cast< SdrPage* >(this)->mpViewContact = - const_cast< SdrPage* >(this)->CreateObjectSpecificViewContact(); - } + if (!mpViewContact) + const_cast<SdrPage*>(this)->mpViewContact.reset( + const_cast<SdrPage*>(this)->CreateObjectSpecificViewContact()); return *mpViewContact; } +sdr::contact::ViewContact& SdrPage::GetViewContact() +{ + if (!mpViewContact) + mpViewContact.reset(CreateObjectSpecificViewContact()); + return *mpViewContact; +} void SdrPageProperties::ImpRemoveStyleSheet() { @@ -1273,11 +1277,7 @@ SdrPage::~SdrPage() TRG_ClearMasterPage(); - if(mpViewContact) - { - delete mpViewContact; - mpViewContact = nullptr; - } + mpViewContact.reset(); { delete mpSdrPageProperties; @@ -1780,7 +1780,7 @@ bool SdrPage::checkVisibility( } // DrawContact support: Methods for handling Page changes -void SdrPage::ActionChanged() const +void SdrPage::ActionChanged() { // Do necessary ViewContact actions GetViewContact().ActionChanged(); |