Kaydet (Commit) 2c2d6bb0 authored tarafından Luboš Luňák's avatar Luboš Luňák

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.
üst 9bdccd88
......@@ -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;
......
......@@ -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.
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment