summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2015-12-18 19:42:09 -0500
committerKohei Yoshida <libreoffice@kohei.us>2015-12-19 02:26:36 +0000
commit6b57529888f384307b88cf5ead5e3e477c6c03b1 (patch)
treeb4dd4c50339797a9128e37315daabc6825fd2a22 /svx
parentc1aca008603d18dcd84a751df70fb8eefd9f0111 (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')
-rw-r--r--svx/source/sdr/contact/objectcontactofobjlistpainter.cxx4
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx2
-rw-r--r--svx/source/svdraw/svdpage.cxx24
3 files changed, 15 insertions, 15 deletions
diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
index 5c9fb17a6e27..a55607e65f56 100644
--- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
+++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
@@ -45,7 +45,7 @@ sal_uInt32 ObjectContactOfObjListPainter::GetPaintObjectCount() const
return maStartObjects.size();
}
-ViewContact& ObjectContactOfObjListPainter::GetPaintObjectViewContact(sal_uInt32 nIndex) const
+ViewContact& ObjectContactOfObjListPainter::GetPaintObjectViewContact(sal_uInt32 nIndex)
{
const SdrObject* pObj = maStartObjects[nIndex];
DBG_ASSERT(pObj, "ObjectContactOfObjListPainter: Corrupt SdrObjectVector (!)");
@@ -157,7 +157,7 @@ sal_uInt32 ObjectContactOfPagePainter::GetPaintObjectCount() const
return (GetStartPage() ? 1L : 0L);
}
-ViewContact& ObjectContactOfPagePainter::GetPaintObjectViewContact(sal_uInt32 /*nIndex*/) const
+ViewContact& ObjectContactOfPagePainter::GetPaintObjectViewContact(sal_uInt32 /*nIndex*/)
{
DBG_ASSERT(GetStartPage(), "ObjectContactOfPagePainter::GetPaintObjectViewContact: no StartPage set (!)");
return GetStartPage()->GetViewContact();
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 1376c37929cf..03516df99ec6 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -120,7 +120,7 @@ void PagePrimitiveExtractor::Invoke()
drawinglayer::primitive2d::Primitive2DContainer PagePrimitiveExtractor::createPrimitive2DSequenceForPage(const DisplayInfo& /*rDisplayInfo*/)
{
drawinglayer::primitive2d::Primitive2DContainer xRetval;
- const SdrPage* pStartPage = GetStartPage();
+ SdrPage* pStartPage = GetStartPage();
if(pStartPage)
{
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();