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 /include/svx | |
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 'include/svx')
-rw-r--r-- | include/svx/cube3d.hxx | 6 | ||||
-rw-r--r-- | include/svx/extrud3d.hxx | 6 | ||||
-rw-r--r-- | include/svx/fmpage.hxx | 2 | ||||
-rw-r--r-- | include/svx/lathe3d.hxx | 6 | ||||
-rw-r--r-- | include/svx/obj3d.hxx | 14 | ||||
-rw-r--r-- | include/svx/polygn3d.hxx | 7 | ||||
-rw-r--r-- | include/svx/scene3d.hxx | 7 | ||||
-rw-r--r-- | include/svx/sphere3d.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdoashp.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdobj.hxx | 24 | ||||
-rw-r--r-- | include/svx/svdocapt.hxx | 9 | ||||
-rw-r--r-- | include/svx/svdocirc.hxx | 8 | ||||
-rw-r--r-- | include/svx/svdoedge.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdograf.hxx | 12 | ||||
-rw-r--r-- | include/svx/svdogrp.hxx | 7 | ||||
-rw-r--r-- | include/svx/svdomeas.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdomedia.hxx | 13 | ||||
-rw-r--r-- | include/svx/svdoole2.hxx | 7 | ||||
-rw-r--r-- | include/svx/svdopage.hxx | 7 | ||||
-rw-r--r-- | include/svx/svdopath.hxx | 8 | ||||
-rw-r--r-- | include/svx/svdorect.hxx | 7 | ||||
-rw-r--r-- | include/svx/svdotable.hxx | 8 | ||||
-rw-r--r-- | include/svx/svdotext.hxx | 3 | ||||
-rw-r--r-- | include/svx/svdouno.hxx | 8 | ||||
-rw-r--r-- | include/svx/svdovirt.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdpage.hxx | 8 |
26 files changed, 128 insertions, 79 deletions
diff --git a/include/svx/cube3d.hxx b/include/svx/cube3d.hxx index 95acaab386cd..570805f8a908 100644 --- a/include/svx/cube3d.hxx +++ b/include/svx/cube3d.hxx @@ -57,6 +57,10 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC E3dCubeObj final : public E3dCompoundObject void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; +private: + // protected destructor - due to final, make private + virtual ~E3dCubeObj() override; + public: E3dCubeObj(SdrModel& rSdrModel, const E3dDefaultAttributes& rDefault, @@ -67,7 +71,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual E3dCubeObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dCubeObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() E3dCubeObj& operator=(const E3dCubeObj& rObj); diff --git a/include/svx/extrud3d.hxx b/include/svx/extrud3d.hxx index 5c121343af4d..656a1114a3ee 100644 --- a/include/svx/extrud3d.hxx +++ b/include/svx/extrud3d.hxx @@ -42,6 +42,10 @@ private: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); +private: + // protected destructor - due to final, make private + virtual ~E3dExtrudeObj() override; + public: E3dExtrudeObj( SdrModel& rSdrModel, @@ -84,7 +88,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; - virtual E3dExtrudeObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dExtrudeObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() E3dExtrudeObj& operator=(const E3dExtrudeObj& rObj); diff --git a/include/svx/fmpage.hxx b/include/svx/fmpage.hxx index f91893aa3bd0..478c2a2ce1a3 100644 --- a/include/svx/fmpage.hxx +++ b/include/svx/fmpage.hxx @@ -52,7 +52,7 @@ public: explicit FmFormPage(FmFormModel& rModel, bool bMasterPage=false); virtual ~FmFormPage() override; - virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override; + virtual SdrPage* CloneSdrPage(SdrModel& rTargetModel) const override; virtual void InsertObject(SdrObject* pObj, size_t nPos = SAL_MAX_SIZE) override; diff --git a/include/svx/lathe3d.hxx b/include/svx/lathe3d.hxx index 89df10369045..073bf5787e3c 100644 --- a/include/svx/lathe3d.hxx +++ b/include/svx/lathe3d.hxx @@ -41,6 +41,10 @@ class SVX_DLLPUBLIC E3dLatheObj final : public E3dCompoundObject virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); +private: + // protected destructor - due to final, make private + virtual ~E3dLatheObj() override; + public: E3dLatheObj( SdrModel& rSdrModel, @@ -90,7 +94,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; - virtual E3dLatheObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dLatheObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() E3dLatheObj& operator=(const E3dLatheObj& rObj); diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx index 099c4b3aad63..a14279523de1 100644 --- a/include/svx/obj3d.hxx +++ b/include/svx/obj3d.hxx @@ -103,12 +103,13 @@ protected: // to protected area E3dObject(SdrModel& rSdrModel); + // protected destructor + virtual ~E3dObject() override; + public: virtual void SetTransformChanged(); virtual void RecalcSnapRect() override; - virtual ~E3dObject() override; - virtual SdrInventor GetObjInventor() const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; @@ -139,7 +140,7 @@ public: // TakeObjName...() is for the display in the UI, for example "3 frames selected". virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual E3dObject* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dObject* CloneSdrObject(SdrModel& rTargetModel) const override; E3dObject& operator=( const E3dObject& rObj ); virtual SdrObjGeoData *NewGeoData() const override; @@ -186,10 +187,11 @@ protected: // convert given basegfx::B3DPolyPolygon to screen coor basegfx::B2DPolyPolygon TransformToScreenCoor(const basegfx::B3DPolyPolygon& rCandidate); -public: + // protected destructor + virtual ~E3dCompoundObject() override; +public: E3dCompoundObject(SdrModel& rSdrModel); - virtual ~E3dCompoundObject() override; virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; virtual sal_uInt32 GetHdlCount() const override; @@ -198,7 +200,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual void RecalcSnapRect() override; - virtual E3dCompoundObject* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dCompoundObject* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() E3dCompoundObject& operator=(const E3dCompoundObject& rObj); diff --git a/include/svx/polygn3d.hxx b/include/svx/polygn3d.hxx index 9f5acca38ce2..da2225c74360 100644 --- a/include/svx/polygn3d.hxx +++ b/include/svx/polygn3d.hxx @@ -38,6 +38,9 @@ private: protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; + // protected destructor + virtual ~E3dPolygonObj() override; + public: void SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); @@ -48,8 +51,6 @@ public: const basegfx::B3DPolyPolygon& rPolyPoly3D); E3dPolygonObj(SdrModel& rSdrModel); - virtual ~E3dPolygonObj() override; - const basegfx::B3DPolyPolygon& GetPolyPolygon3D() const { return aPolyPoly3D; } const basegfx::B3DPolyPolygon& GetPolyNormals3D() const { return aPolyNormals3D; } const basegfx::B2DPolyPolygon& GetPolyTexture2D() const { return aPolyTexture2D; } @@ -57,7 +58,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual E3dPolygonObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dPolygonObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() E3dPolygonObj& operator=(const E3dPolygonObj& rObj); diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index 57c79e7e1bec..044b27d5368f 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -87,12 +87,13 @@ protected: protected: void SetDefaultAttributes(); - void ImpCleanup3DDepthMapper(); + // protected destructor + virtual ~E3dScene() override; + public: E3dScene(SdrModel& rSdrModel); - virtual ~E3dScene() override; virtual void SetBoundRectDirty() override; @@ -131,7 +132,7 @@ public: const Camera3D& GetCamera() const { return aCamera; } void removeAllNonSelectedObjects(); - virtual E3dScene* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dScene* CloneSdrObject(SdrModel& rTargetModel) const override; E3dScene& operator=(const E3dScene&); virtual SdrObjGeoData *NewGeoData() const override; diff --git a/include/svx/sphere3d.hxx b/include/svx/sphere3d.hxx index e5534e528fa9..ca1d9ec644ef 100644 --- a/include/svx/sphere3d.hxx +++ b/include/svx/sphere3d.hxx @@ -37,6 +37,10 @@ private: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); +private: + // protected destructor - due to final, make private + virtual ~E3dSphereObj() override; + public: E3dSphereObj( SdrModel& rSdrModel, @@ -60,7 +64,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual E3dSphereObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dSphereObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() E3dSphereObj& operator=(const E3dSphereObj& rObj); diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index 3ce7833ca8c8..364b8ce7795a 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -129,6 +129,9 @@ protected: Size m_aSuggestedTextFrameSize; + // protected destructor + virtual ~SdrObjCustomShape() override; + public: bool UseNoFillStyle() const; @@ -141,7 +144,6 @@ public: double GetExtraTextRotation( const bool bPreRotation = false ) const; SdrObjCustomShape(SdrModel& rSdrModel); - virtual ~SdrObjCustomShape() override; /* is merging default attributes from type-shape into the SdrCustomShapeGeometryItem. If pType is NULL then the type is being taken from the "Type" property of the SdrCustomShapeGeometryItem. @@ -207,7 +209,7 @@ public: virtual void TakeTextAnchorRect( tools::Rectangle& rAnchorRect ) const override; virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText, tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override; - virtual SdrObjCustomShape* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrObjCustomShape* CloneSdrObject(SdrModel& rTargetModel) const override; SdrObjCustomShape& operator=(const SdrObjCustomShape& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index c901dfa1416d..0972849dd74a 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -306,7 +306,7 @@ public: // SwFlyDrawObj /// Abstract DrawObject -class SVX_DLLPUBLIC SdrObject: public SfxListener, public virtual tools::WeakBase +class SVX_DLLPUBLIC SdrObject : public SfxListener, public virtual tools::WeakBase { private: friend class SdrObjListIter; @@ -479,11 +479,11 @@ public: virtual bool HasLimitedRotation() const; // Returns a copy of the object. Every inherited class must reimplement this (in class Foo - // it should be sufficient to do "virtual Foo* Clone() const { return CloneHelper< Foo >(); }". + // it should be sufficient to do "virtual Foo* CloneSdrObject(...) const { return CloneHelper< Foo >(); }". // Note that this function uses operator= internally. - virtual SdrObject* Clone(SdrModel* pTargetModel = nullptr) const; + virtual SdrObject* CloneSdrObject(SdrModel& rTargetModel) const; - // implemented mainly for the purposes of Clone() + // implemented mainly for the purposes of CloneSdrObject() SdrObject& operator=(const SdrObject& rObj); // TakeObjName...() is for the display in the UI, e.g. "3 frames selected" @@ -982,7 +982,7 @@ protected: virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& _rxUnoShape ); // helper function for reimplementing Clone(). - template< typename T > T* CloneHelper(SdrModel* pTargetModel) const; + template< typename T > T* CloneHelper(SdrModel& rTargetModel) const; private: struct Impl; @@ -1025,6 +1025,16 @@ private: SdrObject( const SdrObject& ) = delete; }; +// helper for constructing std::unique_ptr for SdrObjects where a +// deleter is needed - here, SdrObject::Free needs to be used. +struct SVX_DLLPUBLIC SdrObjectFreeOp +{ + void operator()(SdrObject* obj) + { + SdrObject::Free(obj); + } +}; + /** Suppress BroadcastObjectChange() until destruction of the (last) instance. Prevents multiple broadcasts for a sequence of calls that would trigger a broadcast each. Instances may be nested in levels, the outer instance will @@ -1076,12 +1086,12 @@ private: SdrObjFactory() = delete; }; -template< typename T > T* SdrObject::CloneHelper(SdrModel* pTargetModel) const +template< typename T > T* SdrObject::CloneHelper(SdrModel& rTargetModel) const { OSL_ASSERT( typeid( T ) == typeid( *this )); T* pObj = dynamic_cast< T* >( SdrObjFactory::MakeNewObject( - nullptr == pTargetModel ? getSdrModelFromSdrObject() : *pTargetModel, + rTargetModel, GetObjInventor(), GetObjIdentifier())); diff --git a/include/svx/svdocapt.hxx b/include/svx/svdocapt.hxx index baa0e0390bd6..0539861eb969 100644 --- a/include/svx/svdocapt.hxx +++ b/include/svx/svdocapt.hxx @@ -56,7 +56,6 @@ private: bool mbFixedTail; // for calc note box fixed tail, default FALSE Point maFixedTailPos; // for calc note box fixed tail position. -private: SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams& rPara) const; SVX_DLLPRIVATE static void ImpCalcTail1(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect); SVX_DLLPRIVATE static void ImpCalcTail2(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect); @@ -64,6 +63,10 @@ private: SVX_DLLPRIVATE static void ImpCalcTail (const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect); SVX_DLLPRIVATE void ImpRecalcTail(); +protected: + // protected destructor + virtual ~SdrCaptionObj() override; + public: SdrCaptionObj(SdrModel& rSdrModel); SdrCaptionObj( @@ -71,11 +74,9 @@ public: const tools::Rectangle& rRect, const Point& rTail); - virtual ~SdrCaptionObj() override; - virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; - virtual SdrCaptionObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrCaptionObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() SdrCaptionObj& operator=(const SdrCaptionObj& rObj); diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx index fc3045585aa6..0ec5ff01afae 100644 --- a/include/svx/svdocirc.hxx +++ b/include/svx/svdocirc.hxx @@ -65,6 +65,10 @@ private: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; +private: + // protected destructor - due to final, make private + virtual ~SdrCircObj() override; + public: SdrCircObj( SdrModel& rSdrModel, @@ -85,8 +89,6 @@ public: long nNewStartAngle, long nNewEndWink); - virtual ~SdrCircObj() override; - virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; @@ -94,7 +96,7 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrCircObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrCircObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() SdrCircObj& operator=(const SdrCircObj& rObj); diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx index ae28ad7103be..e142a4a809e5 100644 --- a/include/svx/svdoedge.hxx +++ b/include/svx/svdoedge.hxx @@ -186,9 +186,11 @@ protected: void ImpSetAttrToEdgeInfo(); // copying values from the pool to aEdgeInfo void ImpSetEdgeInfoToAttr(); // copying values from the aEdgeInfo to the pool + // protected destructor + virtual ~SdrEdgeObj() override; + public: SdrEdgeObj(SdrModel& rSdrModel); - virtual ~SdrEdgeObj() override; SdrObjConnection& GetConnection(bool bTail1) { return *(bTail1 ? &aCon1 : &aCon2); } virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; @@ -213,7 +215,7 @@ public: virtual void RecalcSnapRect() override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual SdrEdgeObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrEdgeObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrEdgeObj& operator=(const SdrEdgeObj& rObj); virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index 9b1a4631b376..e07864d3423b 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -84,7 +84,6 @@ private: friend class SdrExchangeView; // Only for a ForceSwapIn() call. friend class SdrGraphicLink; -private: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; @@ -115,8 +114,6 @@ private: bool mbIsSignatureLineCanAddComment; css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic; -private: - void ImpRegisterLink(); void ImpDeregisterLink(); bool ImpUpdateGraphicLink( bool bAsynchron = true ) const; @@ -126,8 +123,11 @@ private: void onGraphicChanged(); GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const; -public: +protected: + // protected destructor + virtual ~SdrGrafObj() override; +public: SdrGrafObj(SdrModel& rSdrModel); SdrGrafObj( SdrModel& rSdrModel, @@ -137,8 +137,6 @@ public: const Graphic& rGrf, const tools::Rectangle& rRect); - virtual ~SdrGrafObj() override; - void SetGraphicObject( const GraphicObject& rGrfObj ); const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const; const GraphicObject* GetReplacementGraphicObject() const; @@ -185,7 +183,7 @@ public: // #i25616# virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; - virtual SdrGrafObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrGrafObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrGrafObj& operator=(const SdrGrafObj& rObj); virtual sal_uInt32 GetHdlCount() const override; diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index 118f91a0a9eb..2901ee82f7d5 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -38,9 +38,12 @@ private: SdrObjList maSdrObjList; // sub list (children) Point aRefPoint; // Reference point inside the object group +private: + // protected destructor - due to final, make private + virtual ~SdrObjGroup() override; + public: SdrObjGroup(SdrModel& rSdrModel); - virtual ~SdrObjGroup() override; virtual void SetBoundRectDirty() override; virtual sal_uInt16 GetObjIdentifier() const override; @@ -54,7 +57,7 @@ public: virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetSnapRect() const override; - virtual SdrObjGroup* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrObjGroup* CloneSdrObject(SdrModel& rTargetModel) const override; SdrObjGroup& operator=(const SdrObjGroup& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index ffde6d09468c..8b1a79797b30 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -72,18 +72,20 @@ protected: virtual void SaveGeoData(SdrObjGeoData& rGeo) const override; virtual void RestGeoData(const SdrObjGeoData& rGeo) override; + // protected destructor + virtual ~SdrMeasureObj() override; + public: SdrMeasureObj(SdrModel& rSdrModel); SdrMeasureObj( SdrModel& rSdrModel, const Point& rPt1, const Point& rPt2); - virtual ~SdrMeasureObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual SdrMeasureObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrMeasureObj* CloneSdrObject(SdrModel& rTargetModel) const override; // implemented mainly for the purposes of Clone() SdrMeasureObj& operator=(const SdrMeasureObj& rObj); diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx index a45410f76bdf..f99fd2570133 100644 --- a/include/svx/svdomedia.hxx +++ b/include/svx/svdomedia.hxx @@ -34,16 +34,16 @@ class SVX_DLLPUBLIC SdrMediaObj final : public SdrRectObj { friend class sdr::contact::ViewContactOfSdrMediaObj; -public: - +private: + // protected destructor - due to final, make private + virtual ~SdrMediaObj() override; +public: SdrMediaObj(SdrModel& rSdrModel); SdrMediaObj( SdrModel& rSdrModel, const tools::Rectangle& rRect); - virtual ~SdrMediaObj() override; - virtual bool HasTextEdit() const override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; @@ -52,13 +52,11 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrMediaObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrMediaObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrMediaObj& operator=(const SdrMediaObj& rObj); virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override; -public: - void setURL( const OUString& rURL, const OUString& rReferer, const OUString& rMimeType = OUString() ); const OUString& getURL() const; @@ -74,7 +72,6 @@ public: virtual bool shouldKeepAspectRatio() const override { return true; } private: - void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState ); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx index 6122eef9c5dc..7dc190b33b67 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -65,6 +65,9 @@ protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; + // protected destructor + virtual ~SdrOle2Obj() override; + public: OUString GetStyleString(); @@ -77,8 +80,6 @@ public: const OUString& rNewObjName, const tools::Rectangle& rNewRect); - virtual ~SdrOle2Obj() override; - const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const; sal_Int64 GetAspect() const; @@ -136,7 +137,7 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrOle2Obj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrOle2Obj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrOle2Obj& assignFrom(const SdrOle2Obj& rObj); SdrOle2Obj& operator=(const SdrOle2Obj& rObj); diff --git a/include/svx/svdopage.hxx b/include/svx/svdopage.hxx index 1f349a9a38ad..a23727e62b72 100644 --- a/include/svx/svdopage.hxx +++ b/include/svx/svdopage.hxx @@ -40,6 +40,9 @@ protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; + // protected destructor + virtual ~SdrPageObj() override; + public: SdrPageObj( SdrModel& rSdrModel, @@ -49,8 +52,6 @@ public: const tools::Rectangle& rRect, SdrPage* pNewPage = nullptr); - virtual ~SdrPageObj() override; - SdrPage* GetReferencedPage() const { return mpShownPage;} void SetReferencedPage(SdrPage* pNewPage); @@ -59,7 +60,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; - virtual SdrPageObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrPageObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrPageObj& operator=(const SdrPageObj& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx index 6c21fd06571a..d626747f31b6 100644 --- a/include/svx/svdopath.hxx +++ b/include/svx/svdopath.hxx @@ -61,6 +61,10 @@ private: void ImpForceLineAngle(); ImpPathForDragAndCreate& impGetDAC() const; +private: + // protected destructor - due to final, make private + virtual ~SdrPathObj() override; + public: SdrPathObj( SdrModel& rSdrModel, @@ -70,12 +74,10 @@ public: SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly); - virtual ~SdrPathObj() override; - virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual SdrPathObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrPathObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrPathObj& operator=(const SdrPathObj& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx index f9c1c34fd145..125d1d7fb5b3 100644 --- a/include/svx/svdorect.hxx +++ b/include/svx/svdorect.hxx @@ -59,6 +59,9 @@ protected: const XPolygon& GetXPoly() const; virtual void RestGeoData(const SdrObjGeoData& rGeo) override; + // protected destructor + virtual ~SdrRectObj() override; + public: /** * The corner radius parameter is dropped at some point. @@ -82,8 +85,6 @@ public: SdrObjKind eNewTextKind, const tools::Rectangle& rRect); - virtual ~SdrRectObj() override; - virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; @@ -91,7 +92,7 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrRectObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrRectObj* CloneSdrObject(SdrModel& rTargetModel) const override; virtual void RecalcSnapRect() override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override; diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 7c5e30ec4e8d..12e27379f5ff 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -97,6 +97,10 @@ class SVX_DLLPUBLIC SdrTableObj : public ::SdrTextObj friend class Cell; friend class SdrTableObjImpl; +protected: + // protected destructor + virtual ~SdrTableObj() override; + public: SdrTableObj(SdrModel& rSdrModel); SdrTableObj( @@ -105,8 +109,6 @@ public: sal_Int32 nColumns, sal_Int32 nRows); - virtual ~SdrTableObj() override; - // Table stuff SdrTableObj* CloneRange( const CellPos& rStartPos, @@ -199,7 +201,7 @@ public: virtual bool AdjustTextFrameWidthAndHeight() override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrTableObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrTableObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrTableObj& operator=(const SdrTableObj& rObj); virtual void RecalcSnapRect() override; virtual const tools::Rectangle& GetSnapRect() const override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 8cae87d87af2..e0b9bbe434ba 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -315,6 +315,7 @@ protected: SdrObjKind eNewTextKind, const tools::Rectangle& rNewRect); + // protected destructor virtual ~SdrTextObj() override; public: @@ -443,7 +444,7 @@ public: virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrTextObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrTextObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrTextObj& operator=(const SdrTextObj& rObj); virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; virtual basegfx::B2DPolyPolygon TakeContour() const override; diff --git a/include/svx/svdouno.hxx b/include/svx/svdouno.hxx index d9dfb5d6acd2..245069635910 100644 --- a/include/svx/svdouno.hxx +++ b/include/svx/svdouno.hxx @@ -59,8 +59,11 @@ private: SVX_DLLPRIVATE void CreateUnoControlModel(const OUString& rModelName, const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac ); -public: +protected: + // protected destructor + virtual ~SdrUnoObj() override; +public: explicit SdrUnoObj( SdrModel& rSdrModel, const OUString& rModelName); @@ -68,12 +71,11 @@ public: SdrModel& rSdrModel, const OUString& rModelName, const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac); - virtual ~SdrUnoObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; - virtual SdrUnoObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrUnoObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrUnoObj& operator= (const SdrUnoObj& rObj); virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; virtual void NbcSetLayer(SdrLayerID nLayer) override; diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx index 9e4e6d9ed179..7376b0506b76 100644 --- a/include/svx/svdovirt.hxx +++ b/include/svx/svdovirt.hxx @@ -46,11 +46,13 @@ protected: virtual void SaveGeoData(SdrObjGeoData& rGeo) const override; virtual void RestGeoData(const SdrObjGeoData& rGeo) override; + // protected destructor + virtual ~SdrVirtObj() override; + public: SdrVirtObj( SdrModel& rSdrModel, SdrObject& rNewObj); - virtual ~SdrVirtObj() override; SdrObject& ReferencedObj(); const SdrObject& GetReferencedObj() const; @@ -64,7 +66,7 @@ public: virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetLastBoundRect() const override; virtual void RecalcBoundRect() override; - virtual SdrVirtObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrVirtObj* CloneSdrObject(SdrModel& rTargetModel) const override; SdrVirtObj& operator=(const SdrVirtObj& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index fa5364bae022..5d978c09cba1 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -83,7 +83,7 @@ friend class SdrEditView; protected: void RecalcRects(); - void copyDataFromSdrObjList(const SdrObjList& rSrcList, SdrModel* pNewModel); + void copyDataFromSdrObjList(const SdrObjList& rSrcList); private: /// simple ActionChildInserted forwarder to have it on a central place @@ -99,7 +99,7 @@ public: SdrObjList(SdrPage* pNewPage = nullptr); virtual ~SdrObjList(); - void CopyObjects(const SdrObjList& rSrcList, SdrModel* pNewModel = nullptr); + void CopyObjects(const SdrObjList& rSrcList); // tdf#116879 clean up everything (without Undo), plus broadcasting // changes. Split to this call and a private one (impClearSdrObjList) @@ -449,7 +449,7 @@ protected: virtual css::uno::Reference< css::uno::XInterface > createUnoPage(); // Copying of pages is split into two parts: construction and copying of page objects, - // because the copying might need access to fully initialized page. Clone() is responsible + // because the copying might need access to fully initialized page. CloneSdrPage() is responsible // to call lateInit() after copy-construction of a new object. Any initialization in derived // classes that needs access to the page objects must be deferred to lateInit. And it must // call lateInit() of its parent class. @@ -459,7 +459,7 @@ public: explicit SdrPage(SdrModel& rModel, bool bMasterPage=false); virtual ~SdrPage() override; - virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const; + virtual SdrPage* CloneSdrPage(SdrModel& rTargetModel) const; bool IsMasterPage() const { return mbMaster; } void SetInserted(bool bNew = true); bool IsInserted() const { return mbInserted; } |