[Libreoffice-commits] .: svx/inc svx/source

Lubos Lunak llunak at kemper.freedesktop.org
Fri Mar 25 09:40:32 PDT 2011


 svx/inc/svx/cube3d.hxx           |    2 -
 svx/inc/svx/extrud3d.hxx         |    2 -
 svx/inc/svx/lathe3d.hxx          |    2 -
 svx/inc/svx/obj3d.hxx            |    6 +--
 svx/inc/svx/polygn3d.hxx         |    2 -
 svx/inc/svx/polysc3d.hxx         |    1 
 svx/inc/svx/scene3d.hxx          |    3 +
 svx/inc/svx/sphere3d.hxx         |    2 -
 svx/inc/svx/svdoashp.hxx         |    3 +
 svx/inc/svx/svdobj.hxx           |   26 ++++++++++++++-
 svx/inc/svx/svdocapt.hxx         |    2 -
 svx/inc/svx/svdocirc.hxx         |    2 -
 svx/inc/svx/svdoedge.hxx         |    3 +
 svx/inc/svx/svdograf.hxx         |    3 +
 svx/inc/svx/svdogrp.hxx          |    3 +
 svx/inc/svx/svdomeas.hxx         |    2 -
 svx/inc/svx/svdomedia.hxx        |    3 +
 svx/inc/svx/svdoole2.hxx         |    3 +
 svx/inc/svx/svdopage.hxx         |    3 +
 svx/inc/svx/svdopath.hxx         |    3 +
 svx/inc/svx/svdorect.hxx         |    2 -
 svx/inc/svx/svdotable.hxx        |    3 +
 svx/inc/svx/svdotext.hxx         |    3 +
 svx/inc/svx/svdouno.hxx          |    3 +
 svx/inc/svx/svdovirt.hxx         |    4 +-
 svx/inc/svx/svdpage.hxx          |    2 -
 svx/source/engine3d/cube3d.cxx   |   19 +----------
 svx/source/engine3d/extrud3d.cxx |   16 +--------
 svx/source/engine3d/lathe3d.cxx  |   16 +--------
 svx/source/engine3d/obj3d.cxx    |   28 ++++++-----------
 svx/source/engine3d/polygn3d.cxx |   19 +----------
 svx/source/engine3d/polysc3d.cxx |    5 +++
 svx/source/engine3d/scene3d.cxx  |   10 +++++-
 svx/source/engine3d/sphere3d.cxx |   17 +---------
 svx/source/form/fmobj.cxx        |   41 +++++++++++-------------
 svx/source/inc/fmobj.hxx         |    4 +-
 svx/source/svdraw/svdoashp.cxx   |   14 ++++++--
 svx/source/svdraw/svdobj.cxx     |   18 +++++-----
 svx/source/svdraw/svdocapt.cxx   |    5 +--
 svx/source/svdraw/svdocirc.cxx   |    7 +---
 svx/source/svdraw/svdoedge.cxx   |   20 ++++++++----
 svx/source/svdraw/svdograf.cxx   |   24 +++++++++-----
 svx/source/svdraw/svdogrp.cxx    |   43 ++++++++++++++------------
 svx/source/svdraw/svdomeas.cxx   |    7 +---
 svx/source/svdraw/svdomedia.cxx  |   19 ++++++-----
 svx/source/svdraw/svdoole2.cxx   |    8 ++++
 svx/source/svdraw/svdopage.cxx   |   12 ++++++-
 svx/source/svdraw/svdopath.cxx   |   13 ++++++-
 svx/source/svdraw/svdorect.cxx   |    4 +-
 svx/source/svdraw/svdotext.cxx   |   64 ++++++++++++++++++++-------------------
 svx/source/svdraw/svdouno.cxx    |   18 +++++++---
 svx/source/svdraw/svdovirt.cxx   |   10 +++---
 svx/source/svdraw/svdpage.cxx    |    5 ++-
 svx/source/table/svdotable.cxx   |   46 +++++++++++++++-------------
 54 files changed, 320 insertions(+), 285 deletions(-)

New commits:
commit b95a6c26809b1fa18bde2596594b5079ae41a48f
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Mar 25 17:33:24 2011 +0100

    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.

diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx
index c3aca2e..c748c7a 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 0df8d1e..6cd65bb 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 5e5e86a..2d1f23b 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 953a9cd..c28e304 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 907cb69..5fd24a3 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 f31929a..dddddf5 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 e56f8bb..0ba52d4 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 6c71b79..4e6271e 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 7727a35..4a7f868 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 f166070..4cf6bd4 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 454a6b1..9c90a1e 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 9b65e45..9522cbf 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 6186670..abc3690 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 f361f01..4944bb3 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 c34ff72..1792a89 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 e635256..044ef99 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 87ed2f5..3234a1c 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 515ad8d..c480cc2 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 31c607e..bbd074e 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 57ebf01..0ecc398 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 e17bd4a..6114875 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 22f80d3..3df9a2a 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 7148b74..fb3a552 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 09acde6..8bfee66 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 022638e..52284ca 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 d44fa60..f09b6bc 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 fc45231..7035abb 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 d0cabc2..c67a520 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 e4f6afb..d4c0fde 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 7f4570d..8991691 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 fd19f55..119e47d 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 0855f08..b9964c7 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 646b33e..b47b00b 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 3d7b0a6..c76f63f 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 de51c8b..b985c20 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 54f7f32..ef93c88 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 cf7dfd8..5fdd50c 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 4bff483..715dc98 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 a884e67..f41c581 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 a740e57..722bbe9 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 2b7175c..42a51f5 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 2e8c65a..e51a268 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 5c73ea0..bd751c4 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 09a0d6a..b893462 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 c5f61c9..ce79e9d 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
 {
+    return CloneHelper< SdrMediaObj >();
+}
+
+SdrMediaObj& SdrMediaObj::operator=(const SdrMediaObj& rObj)
+{
+    if( this == &rObj )
+        return *this;
     SdrRectObj::operator=( rObj );
     
-    if( rObj.ISA( SdrMediaObj ) )
-    {
-        const SdrMediaObj& rMediaObj = static_cast< const SdrMediaObj& >( 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 b5ba3e2..36f9a36 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 06ae40c..2c73c59 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 84f2a6a..1f919ed 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 9d32092..f8bb958 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 28d0461..d12495f 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 5eeda04..2e113d7 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 8d32538..50235ac 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 d168229..0bebd81 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 600a4a1..b2c39fc 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;
 }
 
 // --------------------------------------------------------------------


More information about the Libreoffice-commits mailing list