[Libreoffice-commits] .: sw/inc sw/source
Lubos Lunak
llunak at kemper.freedesktop.org
Fri Mar 25 09:40:36 PDT 2011
sw/inc/dcontact.hxx | 4 ++--
sw/source/core/draw/dcontact.cxx | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
New commits:
commit 63659b2f21888d20eab141621fdb5a9e5865db8b
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Fri Mar 25 17:36:34 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/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index 99707b4..1da6eb3 100644
--- a/sw/inc/dcontact.hxx
+++ b/sw/inc/dcontact.hxx
@@ -272,8 +272,8 @@ class SwDrawVirtObj : public SdrVirtObj
// access to offset
virtual const Point GetOffset() const;
- virtual SdrObject* Clone() const;
- virtual void operator=( const SdrObject& rObj );
+ virtual SwDrawVirtObj* Clone() const;
+ SwDrawVirtObj& operator= (const SwDrawVirtObj& rObj);
// connection to writer layout
const SwAnchoredObject* GetAnchoredObj() const;
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 7ec32d2..ec6693c 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2272,20 +2272,21 @@ SwDrawVirtObj::SwDrawVirtObj( SdrObject& _rNewObj,
SwDrawVirtObj::~SwDrawVirtObj()
{}
-void SwDrawVirtObj::operator=( const SdrObject& rObj )
+SwDrawVirtObj& SwDrawVirtObj::operator=( const SwDrawVirtObj& rObj )
{
SdrVirtObj::operator=(rObj);
// Note: Members <maAnchoredDrawObj> and <mrDrawContact>
// haven't to be considered.
+ return *this;
}
-SdrObject* SwDrawVirtObj::Clone() const
+SwDrawVirtObj* SwDrawVirtObj::Clone() const
{
SwDrawVirtObj* pObj = new SwDrawVirtObj( rRefObj, mrDrawContact );
if ( pObj )
{
- pObj->operator=(static_cast<const SdrObject&>(*this));
+ pObj->operator=( *this );
// Note: Member <maAnchoredDrawObj> hasn't to be considered.
}
More information about the Libreoffice-commits
mailing list