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/svdraw/svdoedge.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/svdraw/svdoedge.cxx')
-rwxr-xr-x | svx/source/svdraw/svdoedge.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
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 |