diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2011-03-25 17:33:24 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2011-03-25 17:33:24 +0100 |
commit | 0527adbab1eca41ae6aeefa6e63c2e02a796c111 (patch) | |
tree | 7e010b157c25b63f38a1999047d3891e6c3b77fc /svx/source/engine3d/obj3d.cxx | |
parent | e71901089adf1ec3d62fef0c6c07559381e5a551 (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.
Diffstat (limited to 'svx/source/engine3d/obj3d.cxx')
-rwxr-xr-x | svx/source/engine3d/obj3d.cxx | 28 |
1 files changed, 11 insertions, 17 deletions
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 >(); } /************************************************************************* |