diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-05-07 11:44:26 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-05-08 01:53:46 +0200 |
commit | 91b0d2122bdee361bf5412a42d48ff051159cbf2 (patch) | |
tree | 003ef60b93668847803a812486534ebc805e6546 /reportdesign/inc | |
parent | bdccb7e9991d83029eb2f2f11327b54534a00db8 (diff) |
tdf#116977 secured ::Clone methods
Renamed SdrPage::Clone -> SdrPage::CloneSdrPage
Renamed SdrObject::Clone -> SdrObject::CloneSdrObject
Giving SdrModel is no longer an option, but a must (as
reference). This makes future changes more safe by force
usage to think about it. Also equals the constructors
which already require a target SdrModel.
Done the same for ::CloneSdrPage.
Change-Id: I06f0129e15140bd8693db27a445037d7e2f7f652
Reviewed-on: https://gerrit.libreoffice.org/53933
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'reportdesign/inc')
-rw-r--r-- | reportdesign/inc/RptObject.hxx | 19 | ||||
-rw-r--r-- | reportdesign/inc/RptPage.hxx | 2 |
2 files changed, 14 insertions, 7 deletions
diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index 17f433629c56..b078e1f7d143 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -124,6 +124,11 @@ class REPORTDESIGN_DLLPUBLIC OCustomShape final : public SdrObjCustomShape , pub { friend class OReportPage; friend class DlgEdFactory; + +private: + // protected destructor - due to final, make private + virtual ~OCustomShape() override; + public: static OCustomShape* Create( SdrModel& rSdrModel, @@ -132,8 +137,6 @@ public: return new OCustomShape(rSdrModel, _xComponent ); } - virtual ~OCustomShape() override; - virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override; virtual css::uno::Reference< css::uno::XInterface > getUnoShape() override; @@ -165,6 +168,11 @@ class REPORTDESIGN_DLLPUBLIC OOle2Obj final : public SdrOle2Obj , public OObject { friend class OReportPage; friend class DlgEdFactory; + +private: + // protected destructor - due to final, make private + virtual ~OOle2Obj() override; + public: static OOle2Obj* Create( SdrModel& rSdrModel, @@ -174,15 +182,13 @@ public: return new OOle2Obj(rSdrModel, _xComponent, _nType); } - virtual ~OOle2Obj() override; - virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override; virtual css::uno::Reference< css::uno::XInterface > getUnoShape() override; virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrInventor GetObjInventor() const override; // Clone() should make a complete copy of the object. - virtual OOle2Obj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual OOle2Obj* CloneSdrObject(SdrModel& rTargetModel) const override; virtual void initializeOle() override; OOle2Obj& operator=(const OOle2Obj& rObj); @@ -234,6 +240,7 @@ protected: const OUString& rModelName, sal_uInt16 _nObjectType); + // protected destructor virtual ~OUnoObject() override; virtual void NbcMove( const Size& rSize ) override; @@ -259,7 +266,7 @@ public: virtual css::uno::Reference< css::uno::XInterface > getUnoShape() override; virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrInventor GetObjInventor() const override; - virtual OUnoObject* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual OUnoObject* CloneSdrObject(SdrModel& rTargetModel) const override; OUnoObject& operator=(const OUnoObject& rObj); diff --git a/reportdesign/inc/RptPage.hxx b/reportdesign/inc/RptPage.hxx index 96fb26a84a67..80d65c6777f6 100644 --- a/reportdesign/inc/RptPage.hxx +++ b/reportdesign/inc/RptPage.hxx @@ -55,7 +55,7 @@ public: OReportPage( OReportModel& rModel ,const css::uno::Reference< css::report::XSection >& _xSection ); - virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override; + virtual SdrPage* CloneSdrPage(SdrModel& rTargetModel) const override; virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override; virtual SdrObject* RemoveObject(size_t nObjNum) override; |