[Libreoffice-commits] core.git: include/svx sc/source sd/source svx/source

Kohei Yoshida kohei.yoshida at gmail.com
Fri Dec 18 15:43:21 PST 2015


 include/svx/svdpage.hxx          |    8 +++-----
 sc/source/core/data/drwlayer.cxx |    1 +
 sd/source/core/drawdoc4.cxx      |    1 +
 sd/source/core/sdpage.cxx        |    1 +
 svx/source/svdraw/svdpage.cxx    |   22 ++++++++++++++++------
 5 files changed, 22 insertions(+), 11 deletions(-)

New commits:
commit a103c3456a2bd12c5c94124abeda06978caea609
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Dec 17 23:08:08 2015 -0500

    Use std::unique_ptr for SdrLayerAdmin data member.
    
    Change-Id: Ib49f52c94ae96b8bddec6718585d5d7d6e3d148d
    Reviewed-on: https://gerrit.libreoffice.org/20806
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index c8d5370..347beb3 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -28,7 +28,6 @@
 #include <tools/contnr.hxx>
 #include <cppuhelper/weakref.hxx>
 #include <svx/svdtypes.hxx>
-#include <svx/svdlayer.hxx>
 #include <svx/sdrpageuser.hxx>
 #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
 #include <svx/sdrmasterpagedescriptor.hxx>
@@ -417,9 +416,8 @@ friend class reportdesign::OSection;
     sal_Int32 nBordRgt; // Seitenrand rechts
     sal_Int32 nBordLwr; // Seitenrand unten
 
-protected:
-    SdrLayerAdmin*      pLayerAdmin;
 private:
+    std::unique_ptr<SdrLayerAdmin> mpLayerAdmin;
     SdrPageProperties*  mpSdrPageProperties;
     css::uno::Reference< css::uno::XInterface > mxUnoPage;
 
@@ -506,8 +504,8 @@ protected:
 public:
 
     /// changing the layers does not set the modified-flag!
-    const         SdrLayerAdmin& GetLayerAdmin() const                  { return *pLayerAdmin; }
-                  SdrLayerAdmin& GetLayerAdmin()                        { return *pLayerAdmin; }
+    const SdrLayerAdmin& GetLayerAdmin() const;
+    SdrLayerAdmin& GetLayerAdmin();
 
     virtual OUString GetLayoutName() const;
 
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 1fa2e6c..d6b26b8 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -37,6 +37,7 @@
 #include <svx/xtable.hxx>
 #include <svx/svdoutl.hxx>
 #include <svx/svditer.hxx>
+#include <svx/svdlayer.hxx>
 #include <svx/svdocapt.hxx>
 #include <svx/svdocirc.hxx>
 #include <svx/svdoedge.hxx>
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 56ca923..fc50caf 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -84,6 +84,7 @@
 #include <svx/xlnclit.hxx>
 #include <svx/svditer.hxx>
 #include <svx/svdogrp.hxx>
+#include <svx/svdlayer.hxx>
 #include <tools/shl.hxx>
 #include <editeng/numitem.hxx>
 #include <editeng/editeng.hxx>
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index f140cca..a4a6c65 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -47,6 +47,7 @@
 #include <editeng/flditem.hxx>
 #include <svx/sdr/contact/displayinfo.hxx>
 #include <svx/svditer.hxx>
+#include <svx/svdlayer.hxx>
 #include <com/sun/star/xml/dom/XNode.hpp>
 #include <com/sun/star/xml/dom/XNodeList.hpp>
 #include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index a5828e2..583c489 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1203,7 +1203,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
     nBordUpp(0L),
     nBordRgt(0L),
     nBordLwr(0L),
-    pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())),
+    mpLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())),
     mpSdrPageProperties(nullptr),
     mpMasterPageDescriptor(nullptr),
     nPageNum(0L),
@@ -1228,7 +1228,7 @@ SdrPage::SdrPage(const SdrPage& rSrcPage)
     nBordUpp(rSrcPage.nBordUpp),
     nBordRgt(rSrcPage.nBordRgt),
     nBordLwr(rSrcPage.nBordLwr),
-    pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())),
+    mpLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())),
     mpSdrPageProperties(nullptr),
     mpMasterPageDescriptor(nullptr),
     nPageNum(rSrcPage.nPageNum),
@@ -1269,7 +1269,7 @@ SdrPage::~SdrPage()
     // when they get called from PageInDestruction().
     maPageUsers.clear();
 
-    delete pLayerAdmin;
+    mpLayerAdmin.reset();
 
     TRG_ClearMasterPage();
 
@@ -1506,11 +1506,11 @@ sal_Int32 SdrPage::GetLwrBorder() const
 void SdrPage::impl_setModelForLayerAdmin(SdrModel* const pNewModel)
 {
     if (pNewModel!=nullptr) {
-        pLayerAdmin->SetParent(&pNewModel->GetLayerAdmin());
+        mpLayerAdmin->SetParent(&pNewModel->GetLayerAdmin());
     } else {
-        pLayerAdmin->SetParent(nullptr);
+        mpLayerAdmin->SetParent(nullptr);
     }
-    pLayerAdmin->SetModel(pNewModel);
+    mpLayerAdmin->SetModel(pNewModel);
 }
 
 void SdrPage::SetModel(SdrModel* pNewModel)
@@ -1661,6 +1661,16 @@ const SdrPageGridFrameList* SdrPage::GetGridFrameList(const SdrPageView* /*pPV*/
     return nullptr;
 }
 
+const SdrLayerAdmin& SdrPage::GetLayerAdmin() const
+{
+    return *mpLayerAdmin;
+}
+
+SdrLayerAdmin& SdrPage::GetLayerAdmin()
+{
+    return *mpLayerAdmin;
+}
+
 OUString SdrPage::GetLayoutName() const
 {
     return OUString();


More information about the Libreoffice-commits mailing list