summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-03-25 17:33:24 +0100
committerLuboš Luňák <l.lunak@suse.cz>2011-03-25 17:33:24 +0100
commit0527adbab1eca41ae6aeefa6e63c2e02a796c111 (patch)
tree7e010b157c25b63f38a1999047d3891e6c3b77fc
parente71901089adf1ec3d62fef0c6c07559381e5a551 (diff)
more sensible SdrObject::Clone() and SdrObject::operator=()
Virtual operator=() is IMO pointless, and especially in a class hierarchy like SdrObject it's pretty unlikely one could reasonably assign any SdrObject-based object to any other one. Moreover, it was actually only used in Clone(), which was almost never reimplemented, so the more sensible choice is to have non-virtual operator= and virtual Clone() always being reimplemented and using that. This commit also fixes various smaller or bigger, er, interesting details in the various operator= implementations.
-rwxr-xr-xsvx/inc/svx/cube3d.hxx2
-rwxr-xr-xsvx/inc/svx/extrud3d.hxx2
-rwxr-xr-xsvx/inc/svx/lathe3d.hxx2
-rwxr-xr-xsvx/inc/svx/obj3d.hxx6
-rwxr-xr-xsvx/inc/svx/polygn3d.hxx2
-rwxr-xr-xsvx/inc/svx/polysc3d.hxx1
-rwxr-xr-xsvx/inc/svx/scene3d.hxx3
-rwxr-xr-xsvx/inc/svx/sphere3d.hxx2
-rwxr-xr-xsvx/inc/svx/svdoashp.hxx3
-rwxr-xr-xsvx/inc/svx/svdobj.hxx26
-rwxr-xr-xsvx/inc/svx/svdocapt.hxx2
-rwxr-xr-xsvx/inc/svx/svdocirc.hxx2
-rwxr-xr-xsvx/inc/svx/svdoedge.hxx3
-rwxr-xr-xsvx/inc/svx/svdograf.hxx3
-rwxr-xr-xsvx/inc/svx/svdogrp.hxx3
-rwxr-xr-xsvx/inc/svx/svdomeas.hxx2
-rwxr-xr-xsvx/inc/svx/svdomedia.hxx3
-rwxr-xr-xsvx/inc/svx/svdoole2.hxx3
-rwxr-xr-xsvx/inc/svx/svdopage.hxx3
-rwxr-xr-xsvx/inc/svx/svdopath.hxx3
-rwxr-xr-xsvx/inc/svx/svdorect.hxx2
-rwxr-xr-xsvx/inc/svx/svdotable.hxx3
-rwxr-xr-xsvx/inc/svx/svdotext.hxx3
-rwxr-xr-xsvx/inc/svx/svdouno.hxx3
-rwxr-xr-xsvx/inc/svx/svdovirt.hxx4
-rwxr-xr-xsvx/inc/svx/svdpage.hxx2
-rwxr-xr-xsvx/source/engine3d/cube3d.cxx19
-rwxr-xr-xsvx/source/engine3d/extrud3d.cxx16
-rwxr-xr-xsvx/source/engine3d/lathe3d.cxx16
-rwxr-xr-xsvx/source/engine3d/obj3d.cxx28
-rwxr-xr-xsvx/source/engine3d/polygn3d.cxx19
-rwxr-xr-xsvx/source/engine3d/polysc3d.cxx5
-rwxr-xr-xsvx/source/engine3d/scene3d.cxx10
-rwxr-xr-xsvx/source/engine3d/sphere3d.cxx17
-rwxr-xr-xsvx/source/form/fmobj.cxx41
-rwxr-xr-xsvx/source/inc/fmobj.hxx4
-rwxr-xr-xsvx/source/svdraw/svdoashp.cxx14
-rwxr-xr-xsvx/source/svdraw/svdobj.cxx18
-rwxr-xr-xsvx/source/svdraw/svdocapt.cxx5
-rwxr-xr-xsvx/source/svdraw/svdocirc.cxx7
-rwxr-xr-xsvx/source/svdraw/svdoedge.cxx20
-rwxr-xr-xsvx/source/svdraw/svdograf.cxx24
-rwxr-xr-xsvx/source/svdraw/svdogrp.cxx43
-rwxr-xr-xsvx/source/svdraw/svdomeas.cxx7
-rwxr-xr-xsvx/source/svdraw/svdomedia.cxx19
-rwxr-xr-xsvx/source/svdraw/svdoole2.cxx8
-rwxr-xr-xsvx/source/svdraw/svdopage.cxx12
-rwxr-xr-xsvx/source/svdraw/svdopath.cxx13
-rwxr-xr-xsvx/source/svdraw/svdorect.cxx4
-rwxr-xr-xsvx/source/svdraw/svdotext.cxx64
-rwxr-xr-xsvx/source/svdraw/svdouno.cxx18
-rwxr-xr-xsvx/source/svdraw/svdovirt.cxx10
-rwxr-xr-xsvx/source/svdraw/svdpage.cxx5
-rwxr-xr-xsvx/source/table/svdotable.cxx46
54 files changed, 320 insertions, 285 deletions
diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx
index 5538aec90ec9..a5f1ce6c807c 100755
--- a/svx/inc/svx/cube3d.hxx
+++ b/svx/inc/svx/cube3d.hxx
@@ -73,7 +73,7 @@ public:
virtual sal_uInt16 GetObjIdentifier() const;
virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
- virtual void operator=(const SdrObject&);
+ virtual E3dCubeObj* Clone() const;
// Set local parameters with geometry recreation
void SetCubePos(const basegfx::B3DPoint& rNew);
diff --git a/svx/inc/svx/extrud3d.hxx b/svx/inc/svx/extrud3d.hxx
index 3ff2b0a5ab20..ac1b630ece46 100755
--- a/svx/inc/svx/extrud3d.hxx
+++ b/svx/inc/svx/extrud3d.hxx
@@ -92,7 +92,7 @@ public:
virtual sal_uInt16 GetObjIdentifier() const;
- virtual void operator=(const SdrObject&);
+ virtual E3dExtrudeObj* Clone() const;
// TakeObjName...() is for the display in the UI (for example "3 frames selected")
virtual void TakeObjNameSingul(String& rName) const;
diff --git a/svx/inc/svx/lathe3d.hxx b/svx/inc/svx/lathe3d.hxx
index 3a6ed2561127..7755c385e42e 100755
--- a/svx/inc/svx/lathe3d.hxx
+++ b/svx/inc/svx/lathe3d.hxx
@@ -102,7 +102,7 @@ private:
virtual sal_uInt16 GetObjIdentifier() const;
void ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs);
- virtual void operator=(const SdrObject&);
+ virtual E3dLatheObj* Clone() const;
virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx
index 9aca65c5da52..188839e4e1af 100755
--- a/svx/inc/svx/obj3d.hxx
+++ b/svx/inc/svx/obj3d.hxx
@@ -196,7 +196,8 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
sal_uInt16 GetLogicalGroup() { return 0; }
- virtual void operator=(const SdrObject&);
+ virtual E3dObject* Clone() const;
+ E3dObject& operator=( const E3dObject& rObj );
virtual SdrObjGeoData *NewGeoData() const;
virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
@@ -316,8 +317,7 @@ public :
sal_Bool GetCreateTexture() const { return bCreateTexture; }
void SetCreateTexture(sal_Bool bNew);
- // copy operator
- virtual void operator=(const SdrObject&);
+ virtual E3dCompoundObject* Clone() const;
// material of the object
const Color& GetMaterialAmbientColor() const { return aMaterialAmbientColor; }
diff --git a/svx/inc/svx/polygn3d.hxx b/svx/inc/svx/polygn3d.hxx
index d3943c4c046b..4e1c7c001118 100755
--- a/svx/inc/svx/polygn3d.hxx
+++ b/svx/inc/svx/polygn3d.hxx
@@ -80,7 +80,7 @@ public:
virtual sal_uInt16 GetObjIdentifier() const;
virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
- virtual void operator=(const SdrObject&);
+ virtual E3dPolygonObj* Clone() const;
// LineOnly?
sal_Bool GetLineOnly() { return bLineOnly; }
diff --git a/svx/inc/svx/polysc3d.hxx b/svx/inc/svx/polysc3d.hxx
index 6560237d906b..d1ada0084301 100755
--- a/svx/inc/svx/polysc3d.hxx
+++ b/svx/inc/svx/polysc3d.hxx
@@ -46,6 +46,7 @@ public:
E3dPolyScene(E3dDefaultAttributes& rDefault);
virtual sal_uInt16 GetObjIdentifier() const;
+ virtual E3dPolyScene* Clone() const;
};
#endif // _E3D_POLYSC3D_HXX
diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx
index 6557d9a12990..c29b4676da53 100755
--- a/svx/inc/svx/scene3d.hxx
+++ b/svx/inc/svx/scene3d.hxx
@@ -210,7 +210,8 @@ public:
const Camera3D& GetCamera() const { return aCamera; }
void removeAllNonSelectedObjects();
- virtual void operator=(const SdrObject&);
+ virtual E3dScene* Clone() const;
+ E3dScene& operator=(const E3dScene&);
virtual SdrObjGeoData *NewGeoData() const;
virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
diff --git a/svx/inc/svx/sphere3d.hxx b/svx/inc/svx/sphere3d.hxx
index d2a51d288186..7b416d7465c5 100755
--- a/svx/inc/svx/sphere3d.hxx
+++ b/svx/inc/svx/sphere3d.hxx
@@ -71,7 +71,7 @@ public:
virtual sal_uInt16 GetObjIdentifier() const;
virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
- virtual void operator=(const SdrObject&);
+ virtual E3dSphereObj* Clone() const;
void ReSegment(sal_uInt32 nHorzSegments, sal_uInt32 nVertSegments);
const basegfx::B3DPoint& Center() const { return aCenter; }
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index ea0ec663d9f1..3d91549fa44d 100755
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -225,7 +225,8 @@ public:
virtual void TakeTextAnchorRect( Rectangle& rAnchorRect ) const;
virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText = false,
Rectangle* pAnchorRect=NULL, bool bLineWidth = true ) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrObjCustomShape* Clone() const;
+ SdrObjCustomShape& operator=(const SdrObjCustomShape& rObj);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index 42309c65b61b..72964cf30e30 100755
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -30,6 +30,7 @@
#define _SVDOBJ_HXX
#include <memory>
+#include <typeinfo>
#include <cppuhelper/weakref.hxx>
#include <vcl/mapmod.hxx>
#include <tools/weakbase.hxx>
@@ -686,9 +687,16 @@ public:
sal_Bool SingleObjectPainter(OutputDevice& rOut) const;
sal_Bool LineGeometryUsageIsNecessary() const;
- // Clone() soll eine komplette Kopie des Objektes erzeugen.
+ /**
+ 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 >(); }".
+ Note that this function uses operator= internally.
+ */
virtual SdrObject* Clone() const;
- virtual void operator=(const SdrObject& rObj);
+ /**
+ Implemented mainly for the purposes of Clone().
+ */
+ SdrObject& operator=(const SdrObject& rObj);
// TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
virtual void TakeObjNameSingul(String& rName) const;
@@ -1129,6 +1137,11 @@ public:
protected:
void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape );
+ /**
+ Helper function for reimplementing Clone().
+ */
+ template< typename T > T* CloneHelper() const;
+
private:
/** only for internal use!
*/
@@ -1183,6 +1196,15 @@ public:
typedef tools::WeakReference< SdrObject > SdrObjectWeakRef;
+template< typename T > T* SdrObject::CloneHelper() const
+{
+ OSL_ASSERT( typeid( T ) == typeid( *this ));
+ T* pObj = dynamic_cast< T* >( SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL));
+ if (pObj!=NULL)
+ *pObj=*static_cast< const T* >( this );
+ return pObj;
+}
+
#endif //_SVDOBJ_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx
index fdfd71c844ec..7397a29e781a 100755
--- a/svx/inc/svx/svdocapt.hxx
+++ b/svx/inc/svx/svdocapt.hxx
@@ -94,7 +94,7 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual sal_uInt16 GetObjIdentifier() const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrCaptionObj* Clone() const;
// for calc: special shadow only for text box
void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = sal_True; }
diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx
index d325e3203942..2c3b23a283db 100755
--- a/svx/inc/svx/svdocirc.hxx
+++ b/svx/inc/svx/svdocirc.hxx
@@ -110,7 +110,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrCircObj* Clone() const;
virtual void RecalcSnapRect();
virtual void NbcSetSnapRect(const Rectangle& rRect);
virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx
index 99aca957b1e3..70268e342330 100755
--- a/svx/inc/svx/svdoedge.hxx
+++ b/svx/inc/svx/svdoedge.hxx
@@ -247,7 +247,8 @@ public:
virtual void RecalcSnapRect();
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrEdgeObj* Clone() const;
+ SdrEdgeObj& operator=(const SdrEdgeObj& rObj);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index 57d76fdedee5..df317d9c4f91 100755
--- a/svx/inc/svx/svdograf.hxx
+++ b/svx/inc/svx/svdograf.hxx
@@ -181,7 +181,8 @@ public:
// #i25616#
virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrGrafObj* Clone() const;
+ SdrGrafObj& operator=(const SdrGrafObj& rObj);
virtual sal_uInt32 GetHdlCount() const;
virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx
index caa9af3f902b..7e48ec372ae7 100755
--- a/svx/inc/svx/svdogrp.hxx
+++ b/svx/inc/svx/svdogrp.hxx
@@ -80,7 +80,8 @@ public:
virtual const Rectangle& GetCurrentBoundRect() const;
virtual const Rectangle& GetSnapRect() const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrObjGroup* Clone() const;
+ SdrObjGroup& operator=(const SdrObjGroup& rObj);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx
index fe1a89fbc068..df9b7fbd5b94 100755
--- a/svx/inc/svx/svdomeas.hxx
+++ b/svx/inc/svx/svdomeas.hxx
@@ -102,7 +102,7 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual sal_uInt16 GetObjIdentifier() const;
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrMeasureObj* Clone() const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx
index e6cf8a4114b8..fa2de35e6a0d 100755
--- a/svx/inc/svx/svdomedia.hxx
+++ b/svx/inc/svx/svdomedia.hxx
@@ -62,7 +62,8 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrMediaObj* Clone() const;
+ SdrMediaObj& operator=(const SdrMediaObj& rObj);
virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx
index 8a70fd7cf7cd..d43fd5d52283 100755
--- a/svx/inc/svx/svdoole2.hxx
+++ b/svx/inc/svx/svdoole2.hxx
@@ -145,7 +145,8 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual void operator=(const SdrObject& rObj);
+ SdrOle2Obj* Clone() const;
+ SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
virtual void NbcMove(const Size& rSize);
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
diff --git a/svx/inc/svx/svdopage.hxx b/svx/inc/svx/svdopage.hxx
index 9f597eba2290..edc264e502b5 100755
--- a/svx/inc/svx/svdopage.hxx
+++ b/svx/inc/svx/svdopage.hxx
@@ -65,7 +65,8 @@ public:
virtual sal_uInt16 GetObjIdentifier() const;
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrPageObj* Clone() const;
+ SdrPageObj& operator=(const SdrPageObj& rObj);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx
index 6981281a9b1c..2b1eeb7408bf 100755
--- a/svx/inc/svx/svdopath.hxx
+++ b/svx/inc/svx/svdopath.hxx
@@ -96,7 +96,8 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual sal_uInt16 GetObjIdentifier() const;
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrPathObj* Clone() const;
+ SdrPathObj& operator=(const SdrPathObj& rObj);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx
index 16c1198e5fc9..fd98d69213f8 100755
--- a/svx/inc/svx/svdorect.hxx
+++ b/svx/inc/svx/svdorect.hxx
@@ -99,7 +99,7 @@ public:
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrRectObj* Clone() const;
virtual void RecalcSnapRect();
virtual void NbcSetSnapRect(const Rectangle& rRect);
virtual void NbcSetLogicRect(const Rectangle& rRect);
diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx
index 24ee35224b76..1493e8883e6f 100755
--- a/svx/inc/svx/svdotable.hxx
+++ b/svx/inc/svx/svdotable.hxx
@@ -226,7 +226,8 @@ public:
virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrTableObj* Clone() const;
+ SdrTableObj& operator=(const SdrTableObj& rObj);
virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual basegfx::B2DPolyPolygon TakeContour() const;
virtual void RecalcSnapRect();
diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
index f473eaf24cbc..2dd5774d6c0e 100755
--- a/svx/inc/svx/svdotext.hxx
+++ b/svx/inc/svx/svdotext.hxx
@@ -438,7 +438,8 @@ public:
virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrTextObj* Clone() const;
+ SdrTextObj& operator=(const SdrTextObj& rObj);
virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
virtual basegfx::B2DPolyPolygon TakeContour() const;
virtual void RecalcSnapRect();
diff --git a/svx/inc/svx/svdouno.hxx b/svx/inc/svx/svdouno.hxx
index ea68340b8441..fe2e8f232caa 100755
--- a/svx/inc/svx/svdouno.hxx
+++ b/svx/inc/svx/svdouno.hxx
@@ -87,7 +87,8 @@ public:
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
virtual sal_uInt16 GetObjIdentifier() const;
- virtual void operator = (const SdrObject& rObj);
+ virtual SdrUnoObj* Clone() const;
+ SdrUnoObj& operator= (const SdrUnoObj& rObj);
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
virtual void NbcSetLayer(SdrLayerID nLayer);
diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx
index 4543cdcfbe38..5842d009b4e4 100755
--- a/svx/inc/svx/svdovirt.hxx
+++ b/svx/inc/svx/svdovirt.hxx
@@ -79,8 +79,8 @@ public:
virtual const Rectangle& GetLastBoundRect() const;
virtual void RecalcBoundRect();
virtual void SetChanged();
- virtual SdrObject* Clone() const;
- virtual void operator=(const SdrObject& rObj);
+ virtual SdrVirtObj* Clone() const;
+ SdrVirtObj& operator=(const SdrVirtObj& rObj);
virtual void TakeObjNameSingul(String& rName) const;
virtual void TakeObjNamePlural(String& rName) const;
diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx
index 891a98750cd1..55ff262a330a 100755
--- a/svx/inc/svx/svdpage.hxx
+++ b/svx/inc/svx/svdpage.hxx
@@ -476,7 +476,7 @@ public:
SdrPage(const SdrPage& rSrcPage);
virtual ~SdrPage();
// pModel, pPage, pUpList, pOwnerObj und mbInserted werden Zuweisungeoperator nicht veraendert!
- virtual void operator=(const SdrPage& rSrcPage);
+ SdrPage& operator=(const SdrPage& rSrcPage);
virtual SdrPage* Clone() const;
virtual SdrPage* Clone(SdrModel* pNewModel) const;
bool IsMasterPage() const { return mbMaster; }
diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx
index f072a73e2528..ee35d1e221b1 100755
--- a/svx/source/engine3d/cube3d.cxx
+++ b/svx/source/engine3d/cube3d.cxx
@@ -104,24 +104,9 @@ SdrObject *E3dCubeObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
return NULL;
}
-/*************************************************************************
-|*
-|* Zuweisungsoperator
-|*
-\************************************************************************/
-
-void E3dCubeObj::operator=(const SdrObject& rObj)
+E3dCubeObj* E3dCubeObj::Clone() const
{
- // erstmal alle Childs kopieren
- E3dCompoundObject::operator=(rObj);
-
- // weitere Parameter kopieren
- const E3dCubeObj& r3DObj = (const E3dCubeObj&)rObj;
-
- aCubePos = r3DObj.aCubePos;
- aCubeSize = r3DObj.aCubeSize;
- bPosIsCenter = r3DObj.bPosIsCenter;
- nSideFlags = r3DObj.nSideFlags;
+ return CloneHelper< E3dCubeObj >();
}
/*************************************************************************
diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx
index ae96716a8099..6098b1506da1 100755
--- a/svx/source/engine3d/extrud3d.cxx
+++ b/svx/source/engine3d/extrud3d.cxx
@@ -122,21 +122,9 @@ sal_uInt16 E3dExtrudeObj::GetObjIdentifier() const
return E3D_EXTRUDEOBJ_ID;
}
-/*************************************************************************
-|*
-|* Zuweisungsoperator
-|*
-\************************************************************************/
-
-void E3dExtrudeObj::operator=(const SdrObject& rObj)
+E3dExtrudeObj* E3dExtrudeObj::Clone() const
{
- // erstmal alle Childs kopieren
- E3dCompoundObject::operator=(rObj);
-
- // weitere Parameter kopieren
- const E3dExtrudeObj& r3DObj = (const E3dExtrudeObj&)rObj;
-
- maExtrudePolygon = r3DObj.maExtrudePolygon;
+ return CloneHelper< E3dExtrudeObj >();
}
/*************************************************************************
diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx
index 8297510e0c83..323aeff0b58b 100755
--- a/svx/source/engine3d/lathe3d.cxx
+++ b/svx/source/engine3d/lathe3d.cxx
@@ -136,21 +136,9 @@ sal_uInt16 E3dLatheObj::GetObjIdentifier() const
return E3D_LATHEOBJ_ID;
}
-/*************************************************************************
-|*
-|* Zuweisungsoperator
-|*
-\************************************************************************/
-
-void E3dLatheObj::operator=(const SdrObject& rObj)
+E3dLatheObj* E3dLatheObj::Clone() const
{
- // erstmal alle Childs kopieren
- E3dCompoundObject::operator=(rObj);
-
- // weitere Parameter kopieren
- const E3dLatheObj& r3DObj = (const E3dLatheObj&)rObj;
-
- maPolyPoly2D = r3DObj.maPolyPoly2D;
+ return CloneHelper< E3dLatheObj >();
}
/*************************************************************************
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 314745f1f0e6..8e2aa78acb39 100755
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -868,14 +868,21 @@ void E3dObject::TakeObjNamePlural(XubString& rName) const
rName=ImpGetResStr(STR_ObjNamePluralObj3d);
}
+E3dObject* E3dObject::Clone() const
+{
+ return CloneHelper< E3dObject >();
+}
+
/*************************************************************************
|*
|* Zuweisungsoperator
|*
\************************************************************************/
-void E3dObject::operator=(const SdrObject& rObj)
+E3dObject& E3dObject::operator=(const E3dObject& rObj)
{
+ if( this == &rObj )
+ return *this;
SdrObject::operator=(rObj);
const E3dObject& r3DObj = (const E3dObject&) rObj;
@@ -894,6 +901,7 @@ void E3dObject::operator=(const SdrObject& rObj)
// Selektionsstatus kopieren
mbIsSelected = r3DObj.mbIsSelected;
+ return *this;
}
/*************************************************************************
@@ -1183,23 +1191,9 @@ void E3dCompoundObject::RecalcSnapRect()
}
}
-/*************************************************************************
-|*
-|* Copy-Operator
-|*
-\************************************************************************/
-
-void E3dCompoundObject::operator=(const SdrObject& rObj)
+E3dCompoundObject* E3dCompoundObject::Clone() const
{
- // erstmal alle Childs kopieren
- E3dObject::operator=(rObj);
-
- // weitere Parameter kopieren
- const E3dCompoundObject& r3DObj = (const E3dCompoundObject&) rObj;
-
- bCreateNormals = r3DObj.bCreateNormals;
- bCreateTexture = r3DObj.bCreateTexture;
- aMaterialAmbientColor = r3DObj.aMaterialAmbientColor;
+ return CloneHelper< E3dCompoundObject >();
}
/*************************************************************************
diff --git a/svx/source/engine3d/polygn3d.cxx b/svx/source/engine3d/polygn3d.cxx
index 30bc7111f7bc..00f3c4432c85 100755
--- a/svx/source/engine3d/polygn3d.cxx
+++ b/svx/source/engine3d/polygn3d.cxx
@@ -324,24 +324,9 @@ SdrObject *E3dPolygonObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
return NULL;
}
-/*************************************************************************
-|*
-|* Zuweisungsoperator
-|*
-\************************************************************************/
-
-void E3dPolygonObj::operator=(const SdrObject& rObj)
+E3dPolygonObj* E3dPolygonObj::Clone() const
{
- // erstmal alle Childs kopieren
- E3dCompoundObject::operator=(rObj);
-
- // weitere Parameter kopieren
- const E3dPolygonObj& r3DObj = (const E3dPolygonObj&)rObj;
-
- aPolyPoly3D = r3DObj.aPolyPoly3D;
- aPolyNormals3D = r3DObj.aPolyNormals3D;
- aPolyTexture2D = r3DObj.aPolyTexture2D;
- bLineOnly = r3DObj.bLineOnly;
+ return CloneHelper< E3dPolygonObj >();
}
/*************************************************************************
diff --git a/svx/source/engine3d/polysc3d.cxx b/svx/source/engine3d/polysc3d.cxx
index c3139d955c64..ab6f2686ae32 100755
--- a/svx/source/engine3d/polysc3d.cxx
+++ b/svx/source/engine3d/polysc3d.cxx
@@ -72,6 +72,11 @@ sal_uInt16 E3dPolyScene::GetObjIdentifier() const
return E3D_POLYSCENE_ID;
}
+E3dPolyScene* E3dPolyScene::Clone() const
+{
+ return CloneHelper< E3dPolyScene >();
+}
+
// eof
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index d6458afb0c8a..159daf97badc 100755
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -529,14 +529,21 @@ void E3dScene::removeAllNonSelectedObjects()
}
}
+E3dScene* E3dScene::Clone() const
+{
+ return CloneHelper< E3dScene >();
+}
+
/*************************************************************************
|*
|* Zuweisungsoperator
|*
\************************************************************************/
-void E3dScene::operator=(const SdrObject& rObj)
+E3dScene& E3dScene::operator=(const E3dScene& rObj)
{
+ if( this == &rObj )
+ return *this;
E3dObject::operator=(rObj);
const E3dScene& r3DObj = (const E3dScene&) rObj;
@@ -566,6 +573,7 @@ void E3dScene::operator=(const SdrObject& rObj)
// ActionChanged at the VC which will for this class
// flush that cached data and initalize it's valid reconstruction
GetViewContact().ActionChanged();
+ return *this;
}
/*************************************************************************
diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx
index cd5a3df551dd..b847fa96c2ab 100755
--- a/svx/source/engine3d/sphere3d.cxx
+++ b/svx/source/engine3d/sphere3d.cxx
@@ -151,22 +151,9 @@ void E3dSphereObj::ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs)
}
}
-/*************************************************************************
-|*
-|* Zuweisungsoperator
-|*
-\************************************************************************/
-
-void E3dSphereObj::operator=(const SdrObject& rObj)
+E3dSphereObj* E3dSphereObj::Clone() const
{
- // erstmal alle Childs kopieren
- E3dCompoundObject::operator=(rObj);
-
- // weitere Parameter kopieren
- const E3dSphereObj& r3DObj = (const E3dSphereObj&) rObj;
-
- aCenter = r3DObj.aCenter;
- aSize = r3DObj.aSize;
+ return CloneHelper< E3dSphereObj >();
}
/*************************************************************************
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 87458cc0ef38..c86e492251f1 100755
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -388,16 +388,14 @@ void FmFormObj::clonedFrom(const FmFormObj* _pSource)
}
//------------------------------------------------------------------
-SdrObject* FmFormObj::Clone() const
+FmFormObj* FmFormObj::Clone() const
{
- SdrObject* pReturn = SdrUnoObj::Clone();
-
- FmFormObj* pFormObject = PTR_CAST(FmFormObj, pReturn);
+ FmFormObj* pFormObject = CloneHelper< FmFormObj >();
DBG_ASSERT(pFormObject != NULL, "FmFormObj::Clone : invalid clone !");
if (pFormObject)
pFormObject->clonedFrom(this);
- return pReturn;
+ return pFormObject;
}
//------------------------------------------------------------------
@@ -408,30 +406,29 @@ void FmFormObj::NbcReformatText()
}
//------------------------------------------------------------------
-void FmFormObj::operator= (const SdrObject& rObj)
+FmFormObj& FmFormObj::operator= (const FmFormObj& rObj)
{
+ if( this == &rObj )
+ return *this;
SdrUnoObj::operator= (rObj);
- FmFormObj* pFormObj = PTR_CAST(FmFormObj, &rObj);
- if (pFormObj)
+ // liegt das UnoControlModel in einer Eventumgebung,
+ // dann koennen noch Events zugeordnet sein
+ Reference< XFormComponent > xContent(rObj.xUnoControlModel, UNO_QUERY);
+ if (xContent.is())
{
- // liegt das UnoControlModel in einer Eventumgebung,
- // dann koennen noch Events zugeordnet sein
- Reference< XFormComponent > xContent(pFormObj->xUnoControlModel, UNO_QUERY);
- if (xContent.is())
+ Reference< XEventAttacherManager > xManager(xContent->getParent(), UNO_QUERY);
+ Reference< XIndexAccess > xManagerAsIndex(xManager, UNO_QUERY);
+ if (xManagerAsIndex.is())
{
- Reference< XEventAttacherManager > xManager(xContent->getParent(), UNO_QUERY);
- Reference< XIndexAccess > xManagerAsIndex(xManager, UNO_QUERY);
- if (xManagerAsIndex.is())
- {
- sal_Int32 nPos = getElementPos( xManagerAsIndex, xContent );
- if ( nPos >= 0 )
- aEvts = xManager->getScriptEvents( nPos );
- }
+ sal_Int32 nPos = getElementPos( xManagerAsIndex, xContent );
+ if ( nPos >= 0 )
+ aEvts = xManager->getScriptEvents( nPos );
}
- else
- aEvts = pFormObj->aEvts;
}
+ else
+ aEvts = rObj.aEvts;
+ return *this;
}
//------------------------------------------------------------------
diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx
index 711f566edcf7..35297c2ad013 100755
--- a/svx/source/inc/fmobj.hxx
+++ b/svx/source/inc/fmobj.hxx
@@ -86,9 +86,9 @@ public:
virtual sal_uInt16 GetObjIdentifier() const;
virtual void NbcReformatText();
- virtual SdrObject* Clone() const;
+ virtual FmFormObj* Clone() const;
// #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const;
- virtual void operator= (const SdrObject& rObj);
+ FmFormObj& operator= (const FmFormObj& rObj);
virtual void SetModel(SdrModel* pNewModel);
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index a1ff85beb9b4..57304b85f1fe 100755
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -3107,12 +3107,20 @@ void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject
InvalidateRenderGeometry();
}
-void SdrObjCustomShape::operator=(const SdrObject& rObj)
+SdrObjCustomShape* SdrObjCustomShape::Clone() const
{
+ return CloneHelper< SdrObjCustomShape >();
+}
+
+SdrObjCustomShape& SdrObjCustomShape::operator=(const SdrObjCustomShape& rObj)
+{
+ if( this == &rObj )
+ return *this;
SdrTextObj::operator=( rObj );
- aName =((SdrObjCustomShape&)rObj).aName;
- fObjectRotation = ((SdrObjCustomShape&)rObj).fObjectRotation;
+ aName = rObj.aName;
+ fObjectRotation = rObj.fObjectRotation;
InvalidateRenderGeometry();
+ return *this;
}
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 52a2cf0d5a0d..f164e2f74871 100755
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -992,17 +992,14 @@ sal_Bool SdrObject::LineGeometryUsageIsNecessary() const
SdrObject* SdrObject::Clone() const
{
- SdrObject* pObj=SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL);
- if (pObj!=NULL) {
- pObj->pModel=pModel;
- pObj->pPage=pPage;
- *pObj=*this;
- }
- return pObj;
+ return CloneHelper< SdrObject >();
}
-void SdrObject::operator=(const SdrObject& rObj)
+SdrObject& SdrObject::operator=(const SdrObject& rObj)
{
+ if( this == &rObj )
+ return *this;
+
if(mpProperties)
{
delete mpProperties;
@@ -1022,6 +1019,7 @@ void SdrObject::operator=(const SdrObject& rObj)
mpProperties = &rObj.GetProperties().Clone(*this);
pModel =rObj.pModel;
+ pPage = rObj.pPage;
aOutRect=rObj.aOutRect;
mnLayerID = rObj.mnLayerID;
aAnchor =rObj.aAnchor;
@@ -1037,7 +1035,8 @@ void SdrObject::operator=(const SdrObject& rObj)
bNotVisibleAsMaster=rObj.bNotVisibleAsMaster;
bSnapRectDirty=sal_True; //rObj.bSnapRectDirty;
bNotMasterCachable=rObj.bNotMasterCachable;
- if (pPlusData!=NULL) { delete pPlusData; pPlusData=NULL; }
+ delete pPlusData;
+ pPlusData=NULL;
if (rObj.pPlusData!=NULL) {
pPlusData=rObj.pPlusData->Clone(this);
}
@@ -1045,6 +1044,7 @@ void SdrObject::operator=(const SdrObject& rObj)
delete pPlusData->pBroadcast; // der Broadcaster wird nicht mitkopiert
pPlusData->pBroadcast=NULL;
}
+ return *this;
}
void SdrObject::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 0bad6f44213b..bbba009800e8 100755
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -251,10 +251,9 @@ sal_uInt16 SdrCaptionObj::GetObjIdentifier() const
return sal_uInt16(OBJ_CAPTION);
}
-void SdrCaptionObj::operator=(const SdrObject& rObj)
+SdrCaptionObj* SdrCaptionObj::Clone() const
{
- SdrRectObj::operator=(rObj);
- aTailPoly=((SdrCaptionObj&)rObj).aTailPoly;
+ return CloneHelper< SdrCaptionObj >();
}
void SdrCaptionObj::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 273908513697..c951cb11c7e4 100755
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -349,12 +349,9 @@ void SdrCircObj::TakeObjNamePlural(XubString& rName) const
rName=ImpGetResStr(nID);
}
-void SdrCircObj::operator=(const SdrObject& rObj)
+SdrCircObj* SdrCircObj::Clone() const
{
- SdrRectObj::operator=(rObj);
-
- nStartWink = ((SdrCircObj&)rObj).nStartWink;
- nEndWink = ((SdrCircObj&)rObj).nEndWink;
+ return CloneHelper< SdrCircObj >();
}
basegfx::B2DPolyPolygon SdrCircObj::TakeXorPoly() const
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index d61bab8dafdc..f29b8806d928 100755
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -1592,16 +1592,24 @@ void SdrEdgeObj::Reformat()
}
}
-void SdrEdgeObj::operator=(const SdrObject& rObj)
+SdrEdgeObj* SdrEdgeObj::Clone() const
{
+ return CloneHelper< SdrEdgeObj >();
+}
+
+SdrEdgeObj& SdrEdgeObj::operator=(const SdrEdgeObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
SdrTextObj::operator=(rObj);
- *pEdgeTrack =*((SdrEdgeObj&)rObj).pEdgeTrack;
- bEdgeTrackDirty=((SdrEdgeObj&)rObj).bEdgeTrackDirty;
- aCon1 =((SdrEdgeObj&)rObj).aCon1;
- aCon2 =((SdrEdgeObj&)rObj).aCon2;
+ *pEdgeTrack =*rObj.pEdgeTrack;
+ bEdgeTrackDirty=rObj.bEdgeTrackDirty;
+ aCon1 =rObj.aCon1;
+ aCon2 =rObj.aCon2;
aCon1.pObj=NULL;
aCon2.pObj=NULL;
- aEdgeInfo=((SdrEdgeObj&)rObj).aEdgeInfo;
+ aEdgeInfo=rObj.aEdgeInfo;
+ return *this;
}
void SdrEdgeObj::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 1d8e36c9abfc..5d22b4dd3a09 100755
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -815,24 +815,30 @@ SdrObject* SdrGrafObj::getFullDragClone() const
return pRetval;
}
-void SdrGrafObj::operator=( const SdrObject& rObj )
+SdrGrafObj* SdrGrafObj::Clone() const
{
- SdrRectObj::operator=( rObj );
+ return CloneHelper< SdrGrafObj >();
+}
- const SdrGrafObj& rGraf = (SdrGrafObj&) rObj;
+SdrGrafObj& SdrGrafObj::operator=( const SdrGrafObj& rObj )
+{
+ if( this == &rObj )
+ return *this;
+ SdrRectObj::operator=( rObj );
- pGraphic->SetGraphic( rGraf.GetGraphic(), &rGraf.GetGraphicObject() );
- aCropRect = rGraf.aCropRect;
- aFileName = rGraf.aFileName;
- aFilterName = rGraf.aFilterName;
- bMirrored = rGraf.bMirrored;
+ pGraphic->SetGraphic( rObj.GetGraphic(), &rObj.GetGraphicObject() );
+ aCropRect = rObj.aCropRect;
+ aFileName = rObj.aFileName;
+ aFilterName = rObj.aFilterName;
+ bMirrored = rObj.bMirrored;
- if( rGraf.pGraphicLink != NULL)
+ if( rObj.pGraphicLink != NULL)
{
SetGraphicLink( aFileName, aFilterName );
}
ImpSetAttrToGrafInfo();
+ return *this;
}
// -----------------------------------------------------------------------------
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 7c49d50784e9..0a1ec4c47fcb 100755
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -295,26 +295,31 @@ const Rectangle& SdrObjGroup::GetSnapRect() const
}
}
-void SdrObjGroup::operator=(const SdrObject& rObj)
+SdrObjGroup* SdrObjGroup::Clone() const
{
- if(rObj.IsGroupObject())
- {
- // copy SdrObject stuff
- SdrObject::operator=(rObj);
-
- // #i36404#
- // copy SubList, init model and page first
- SdrObjList& rSourceSubList = *rObj.GetSubList();
- pSub->SetPage(rSourceSubList.GetPage());
- pSub->SetModel(rSourceSubList.GetModel());
- pSub->CopyObjects(*rObj.GetSubList());
-
- // copy local paremeters
- nDrehWink =((SdrObjGroup&)rObj).nDrehWink;
- nShearWink =((SdrObjGroup&)rObj).nShearWink;
- aRefPoint =((SdrObjGroup&)rObj).aRefPoint;
- bRefPoint =((SdrObjGroup&)rObj).bRefPoint;
- }
+ return CloneHelper< SdrObjGroup >();
+}
+
+SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj)
+{
+ if( this == &rObj )
+ return *this;
+ // copy SdrObject stuff
+ SdrObject::operator=(rObj);
+
+ // #i36404#
+ // copy SubList, init model and page first
+ SdrObjList& rSourceSubList = *rObj.GetSubList();
+ pSub->SetPage(rSourceSubList.GetPage());
+ pSub->SetModel(rSourceSubList.GetModel());
+ pSub->CopyObjects(*rObj.GetSubList());
+
+ // copy local paremeters
+ nDrehWink = rObj.nDrehWink;
+ nShearWink = rObj.nShearWink;
+ aRefPoint = rObj.aRefPoint;
+ bRefPoint = rObj.bRefPoint;
+ return *this;
}
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index a92f4fe2b9e8..7f960c9a0c2f 100755
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -734,12 +734,9 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
}
}
-void SdrMeasureObj::operator=(const SdrObject& rObj)
+SdrMeasureObj* SdrMeasureObj::Clone() const
{
- SdrTextObj::operator=(rObj);
- aPt1=((SdrMeasureObj&)rObj).aPt1;
- aPt2=((SdrMeasureObj&)rObj).aPt2;
- bTextDirty=((SdrMeasureObj&)rObj).bTextDirty;
+ return CloneHelper< SdrMeasureObj >();
}
void SdrMeasureObj::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index f7da515d7dbf..0001cd518534 100755
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -135,17 +135,20 @@ void SdrMediaObj::TakeObjNamePlural(XubString& rName) const
// ------------------------------------------------------------------------------
-void SdrMediaObj::operator=(const SdrObject& rObj)
+SdrMediaObj* SdrMediaObj::Clone() const
{
- SdrRectObj::operator=( rObj );
+ return CloneHelper< SdrMediaObj >();
+}
- if( rObj.ISA( SdrMediaObj ) )
- {
- const SdrMediaObj& rMediaObj = static_cast< const SdrMediaObj& >( rObj );
+SdrMediaObj& SdrMediaObj::operator=(const SdrMediaObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
+ SdrRectObj::operator=( rObj );
- setMediaProperties( rMediaObj.getMediaProperties() );
- setGraphic( rMediaObj.mapGraphic.get() );
- }
+ setMediaProperties( rObj.getMediaProperties() );
+ setGraphic( rObj.mapGraphic.get() );
+ return *this;
}
// ------------------------------------------------------------------------------
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 62dcb8486c4f..648907f72201 100755
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1599,7 +1599,12 @@ void SdrOle2Obj::TakeObjNamePlural(XubString& rName) const
// -----------------------------------------------------------------------------
-void SdrOle2Obj::operator=(const SdrObject& rObj)
+SdrOle2Obj* SdrOle2Obj::Clone() const
+{
+ return CloneHelper< SdrOle2Obj >();
+}
+
+SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
{
//TODO/LATER: who takes over control of my old object?!
if( &rObj != this )
@@ -1680,6 +1685,7 @@ void SdrOle2Obj::operator=(const SdrObject& rObj)
}
}
}
+ return *this;
}
// -----------------------------------------------------------------------------
diff --git a/svx/source/svdraw/svdopage.cxx b/svx/source/svdraw/svdopage.cxx
index 0da2aebfa408..5aa2e7bb34d4 100755
--- a/svx/source/svdraw/svdopage.cxx
+++ b/svx/source/svdraw/svdopage.cxx
@@ -168,10 +168,18 @@ void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
rInfo.bCanConvToPolyLineToArea=sal_False;
}
-void SdrPageObj::operator=(const SdrObject& rObj)
+SdrPageObj* SdrPageObj::Clone() const
{
+ return CloneHelper< SdrPageObj >();
+}
+
+SdrPageObj& SdrPageObj::operator=(const SdrPageObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
SdrObject::operator=(rObj);
- SetReferencedPage(((const SdrPageObj&)rObj).GetReferencedPage());
+ SetReferencedPage( rObj.GetReferencedPage());
+ return *this;
}
void SdrPageObj::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 0361f9b98bd5..b7fa9ce32248 100755
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -1879,11 +1879,18 @@ sal_uInt16 SdrPathObj::GetObjIdentifier() const
return sal_uInt16(meKind);
}
-void SdrPathObj::operator=(const SdrObject& rObj)
+SdrPathObj* SdrPathObj::Clone() const
{
+ return CloneHelper< SdrPathObj >();
+}
+
+SdrPathObj& SdrPathObj::operator=(const SdrPathObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
SdrTextObj::operator=(rObj);
- SdrPathObj& rPath=(SdrPathObj&)rObj;
- maPathPolygon=rPath.GetPathPoly();
+ maPathPolygon=rObj.GetPathPoly();
+ return *this;
}
void SdrPathObj::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 7766e45df772..e63518ad0e93 100755
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -281,9 +281,9 @@ void SdrRectObj::TakeObjNamePlural(XubString& rName) const
}
}
-void SdrRectObj::operator=(const SdrObject& rObj)
+SdrRectObj* SdrRectObj::Clone() const
{
- SdrTextObj::operator=(rObj);
+ return CloneHelper< SdrRectObj >();
}
basegfx::B2DPolyPolygon SdrRectObj::TakeXorPoly() const
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 39f1cfa51656..84da2a35173f 100755
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1208,47 +1208,51 @@ void SdrTextObj::TakeObjNamePlural(XubString& rName) const
} // switch
}
-void SdrTextObj::operator=(const SdrObject& rObj)
+SdrTextObj* SdrTextObj::Clone() const
{
+ return CloneHelper< SdrTextObj >();
+}
+
+SdrTextObj& SdrTextObj::operator=(const SdrTextObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
// call parent
SdrObject::operator=(rObj);
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >( &rObj );
- if (pTextObj!=NULL)
- {
- aRect =pTextObj->aRect;
- aGeo =pTextObj->aGeo;
- eTextKind =pTextObj->eTextKind;
- bTextFrame=pTextObj->bTextFrame;
- aTextSize=pTextObj->aTextSize;
- bTextSizeDirty=pTextObj->bTextSizeDirty;
+ aRect =rObj.aRect;
+ aGeo =rObj.aGeo;
+ eTextKind =rObj.eTextKind;
+ bTextFrame=rObj.bTextFrame;
+ aTextSize=rObj.aTextSize;
+ bTextSizeDirty=rObj.bTextSizeDirty;
- // #101776# Not all of the necessary parameters were copied yet.
- bNoShear = pTextObj->bNoShear;
- bNoRotate = pTextObj->bNoRotate;
- bNoMirror = pTextObj->bNoMirror;
- bDisableAutoWidthOnDragging = pTextObj->bDisableAutoWidthOnDragging;
+ // #101776# Not all of the necessary parameters were copied yet.
+ bNoShear = rObj.bNoShear;
+ bNoRotate = rObj.bNoRotate;
+ bNoMirror = rObj.bNoMirror;
+ bDisableAutoWidthOnDragging = rObj.bDisableAutoWidthOnDragging;
- OutlinerParaObject* pNewOutlinerParaObject = 0;
+ OutlinerParaObject* pNewOutlinerParaObject = 0;
- SdrText* pText = getActiveText();
+ SdrText* pText = getActiveText();
- if( pText && pTextObj->HasText() )
+ if( pText && rObj.HasText() )
+ {
+ const Outliner* pEO=rObj.pEdtOutl;
+ if (pEO!=NULL)
{
- const Outliner* pEO=pTextObj->pEdtOutl;
- if (pEO!=NULL)
- {
- pNewOutlinerParaObject = pEO->CreateParaObject();
- }
- else
- {
- pNewOutlinerParaObject = new OutlinerParaObject(*pTextObj->getActiveText()->GetOutlinerParaObject());
- }
+ pNewOutlinerParaObject = pEO->CreateParaObject();
+ }
+ else
+ {
+ pNewOutlinerParaObject = new OutlinerParaObject(*rObj.getActiveText()->GetOutlinerParaObject());
}
-
- mpText->SetOutlinerParaObject( pNewOutlinerParaObject );
- ImpSetTextStyleSheetListeners();
}
+
+ mpText->SetOutlinerParaObject( pNewOutlinerParaObject );
+ ImpSetTextStyleSheetListeners();
+ return *this;
}
basegfx::B2DPolyPolygon SdrTextObj::TakeXorPoly() const
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index 13b3a138d993..d13d30e342ce 100755
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -314,18 +314,25 @@ void SdrUnoObj::TakeObjNamePlural(XubString& rName) const
rName = ImpGetResStr(STR_ObjNamePluralUno);
}
-void SdrUnoObj::operator = (const SdrObject& rObj)
+SdrUnoObj* SdrUnoObj::Clone() const
{
- SdrRectObj::operator = (rObj);
+ return CloneHelper< SdrUnoObj >();
+}
+
+SdrUnoObj& SdrUnoObj::operator= (const SdrUnoObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
+ SdrRectObj::operator= (rObj);
// release the reference to the current control model
SetUnoControlModel(uno::Reference< awt::XControlModel >());
- aUnoControlModelTypeName = ((SdrUnoObj&) rObj).aUnoControlModelTypeName;
- aUnoControlTypeName = ((SdrUnoObj&) rObj).aUnoControlTypeName;
+ aUnoControlModelTypeName = rObj.aUnoControlModelTypeName;
+ aUnoControlTypeName = rObj.aUnoControlTypeName;
// copy the uno control model
- uno::Reference< awt::XControlModel > xCtrl( ((SdrUnoObj&) rObj).GetUnoControlModel(), uno::UNO_QUERY );
+ uno::Reference< awt::XControlModel > xCtrl( rObj.GetUnoControlModel(), uno::UNO_QUERY );
uno::Reference< util::XCloneable > xClone( xCtrl, uno::UNO_QUERY );
if ( xClone.is() )
@@ -398,6 +405,7 @@ void SdrUnoObj::operator = (const SdrObject& rObj)
uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
if (xComp.is())
m_pImpl->pEventListener->StartListening(xComp);
+ return *this;
}
void SdrUnoObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index 844316e08245..bfe7199001de 100755
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -160,16 +160,16 @@ void SdrVirtObj::SetChanged()
SdrObject::SetChanged();
}
-SdrObject* SdrVirtObj::Clone() const
+SdrVirtObj* SdrVirtObj::Clone() const
{
- SdrObject* pObj=new SdrVirtObj(((SdrVirtObj*)this)->rRefObj); // Nur eine weitere Referenz
- return pObj;
+ return new SdrVirtObj(this->rRefObj); // Nur eine weitere Referenz
}
-void SdrVirtObj::operator=(const SdrObject& rObj)
+SdrVirtObj& SdrVirtObj::operator=(const SdrVirtObj& rObj)
{ // ???anderes Objekt referenzieren???
SdrObject::operator=(rObj);
- aAnchor=((SdrVirtObj&)rObj).aAnchor;
+ aAnchor=rObj.aAnchor;
+ return *this;
}
void SdrVirtObj::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 3b13fb9981f8..776d5f8589ca 100755
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1422,8 +1422,10 @@ SdrPage::~SdrPage()
DBG_DTOR(SdrPage,NULL);
}
-void SdrPage::operator=(const SdrPage& rSrcPage)
+SdrPage& SdrPage::operator=(const SdrPage& rSrcPage)
{
+ if( this == &rSrcPage )
+ return *this;
if(mpViewContact)
{
delete mpViewContact;
@@ -1490,6 +1492,7 @@ void SdrPage::operator=(const SdrPage& rSrcPage)
// Now copy the contained obejcts (by cloning them)
SdrObjList::operator=(rSrcPage);
+ return *this;
}
SdrPage* SdrPage::Clone() const
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 1962af97eb9b..2731ed462326 100755
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1874,31 +1874,35 @@ void SdrTableObj::TakeObjNamePlural(XubString& rName) const
// --------------------------------------------------------------------
-void SdrTableObj::operator=(const SdrObject& rObj)
+SdrTableObj* SdrTableObj::Clone() const
{
+ return CloneHelper< SdrTableObj >();
+}
+
+SdrTableObj& SdrTableObj::operator=(const SdrTableObj& rObj)
+{
+ if( this == &rObj )
+ return *this;
// call parent
SdrObject::operator=(rObj);
- const SdrTableObj* pTableObj = dynamic_cast< const SdrTableObj* >( &rObj );
- if (pTableObj!=NULL)
- {
- TableModelNotifyGuard aGuard( mpImpl ? mpImpl->mxTable.get() : 0 );
-
- maLogicRect = pTableObj->maLogicRect;
- aRect = pTableObj->aRect;
- aGeo = pTableObj->aGeo;
- eTextKind = pTableObj->eTextKind;
- bTextFrame = pTableObj->bTextFrame;
- aTextSize = pTableObj->aTextSize;
- bTextSizeDirty = pTableObj->bTextSizeDirty;
- bNoShear = pTableObj->bNoShear;
- bNoRotate = pTableObj->bNoRotate;
- bNoMirror = pTableObj->bNoMirror;
- bDisableAutoWidthOnDragging = pTableObj->bDisableAutoWidthOnDragging;
-
- if( pTableObj->mpImpl )
- *mpImpl = *pTableObj->mpImpl;
- }
+ TableModelNotifyGuard aGuard( mpImpl ? mpImpl->mxTable.get() : 0 );
+
+ maLogicRect = rObj.maLogicRect;
+ aRect = rObj.aRect;
+ aGeo = rObj.aGeo;
+ eTextKind = rObj.eTextKind;
+ bTextFrame = rObj.bTextFrame;
+ aTextSize = rObj.aTextSize;
+ bTextSizeDirty = rObj.bTextSizeDirty;
+ bNoShear = rObj.bNoShear;
+ bNoRotate = rObj.bNoRotate;
+ bNoMirror = rObj.bNoMirror;
+ bDisableAutoWidthOnDragging = rObj.bDisableAutoWidthOnDragging;
+
+ if( rObj.mpImpl )
+ *mpImpl = *rObj.mpImpl;
+ return *this;
}
// --------------------------------------------------------------------