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 /sw/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 'sw/inc')
-rw-r--r-- | sw/inc/dcontact.hxx | 15 | ||||
-rw-r--r-- | sw/inc/dpage.hxx | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 7898c68154ab..544e55973526 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -186,7 +186,9 @@ public: class SW_DLLPUBLIC SwFlyDrawContact final : public SwContact { private: - std::unique_ptr<SwFlyDrawObj> mpMasterObj; + typedef std::unique_ptr< SwFlyDrawObj, SdrObjectFreeOp > SwFlyDrawObjPtr; + + SwFlyDrawObjPtr mpMasterObj; void SwClientNotify(const SwModify&, const SfxHint& rHint) override; sal_uInt32 GetOrdNumForNewRef(const SwFlyFrame* pFly); @@ -236,18 +238,19 @@ class SwDrawVirtObj : public SdrVirtObj of original SnapRect) */ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; + // protected destructor + virtual ~SwDrawVirtObj() override; + public: SwDrawVirtObj( SdrModel& rSdrModel, SdrObject& _rNewObj, SwDrawContact& _rDrawContact); - virtual ~SwDrawVirtObj() override; - /// access to offset virtual const Point GetOffset() const override; - virtual SwDrawVirtObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SwDrawVirtObj* CloneSdrObject(SdrModel& rTargetModel) const override; SwDrawVirtObj& operator= (const SwDrawVirtObj& rObj); /// connection to writer layout @@ -309,6 +312,8 @@ bool CheckControlLayer( const SdrObject *pObj ); /** ContactObject for connection of formats as representatives of draw objects in SwClient and the objects themselves in Drawing (SDrObjUserCall). */ +typedef std::unique_ptr< SwDrawVirtObj, SdrObjectFreeOp > SwDrawVirtObjPtr; + class SwDrawContact final : public SwContact { private: @@ -317,7 +322,7 @@ class SwDrawContact final : public SwContact SwAnchoredDrawObject maAnchoredDrawObj; /** container for 'virtual' drawing object supporting drawing objects in headers/footers. */ - std::vector<std::unique_ptr<SwDrawVirtObj>> maDrawVirtObjs; + std::vector< SwDrawVirtObjPtr > maDrawVirtObjs; /** boolean indicating set 'master' drawing object has been cleared. */ diff --git a/sw/inc/dpage.hxx b/sw/inc/dpage.hxx index 7b3b50e4295d..a599a462d2bb 100644 --- a/sw/inc/dpage.hxx +++ b/sw/inc/dpage.hxx @@ -39,7 +39,7 @@ public: explicit SwDPage(SwDrawModel& rNewModel, bool bMasterPage); virtual ~SwDPage() override; - virtual SwDPage* Clone(SdrModel* pNewModel = nullptr) const override; + virtual SwDPage* CloneSdrPage(SdrModel& rTargetModel) const override; // #i3694# // This GetOffset() method is not needed anymore, it even leads to errors. |