Kaydet (Commit) 73813f23 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 5a07c019
...@@ -979,16 +979,14 @@ void DlgEdObj::clonedFrom(const DlgEdObj* _pSource) ...@@ -979,16 +979,14 @@ void DlgEdObj::clonedFrom(const DlgEdObj* _pSource)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SdrObject* DlgEdObj::Clone() const DlgEdObj* DlgEdObj::Clone() const
{ {
SdrObject* pReturn = SdrUnoObj::Clone(); DlgEdObj* pDlgEdObj = CloneHelper< DlgEdObj >();
DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pReturn);
DBG_ASSERT( pDlgEdObj != NULL, "DlgEdObj::Clone: invalid clone!" ); DBG_ASSERT( pDlgEdObj != NULL, "DlgEdObj::Clone: invalid clone!" );
if ( pDlgEdObj ) if ( pDlgEdObj )
pDlgEdObj->clonedFrom( this ); pDlgEdObj->clonedFrom( this );
return pReturn; return pDlgEdObj;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -1005,13 +1003,6 @@ SdrObject* DlgEdObj::getFullDragClone() const ...@@ -1005,13 +1003,6 @@ SdrObject* DlgEdObj::getFullDragClone() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void DlgEdObj::operator= (const SdrObject& rObj)
{
SdrUnoObj::operator= (rObj);
}
//----------------------------------------------------------------------------
void DlgEdObj::NbcMove( const Size& rSize ) void DlgEdObj::NbcMove( const Size& rSize )
{ {
SdrUnoObj::NbcMove( rSize ); SdrUnoObj::NbcMove( rSize );
......
...@@ -104,8 +104,7 @@ public: ...@@ -104,8 +104,7 @@ public:
virtual sal_uInt32 GetObjInventor() const; virtual sal_uInt32 GetObjInventor() const;
virtual sal_uInt16 GetObjIdentifier() const; virtual sal_uInt16 GetObjIdentifier() const;
virtual SdrObject* Clone() const; // not working yet virtual DlgEdObj* Clone() const; // not working yet
virtual void operator= (const SdrObject& rObj); // not working yet
virtual void clonedFrom(const DlgEdObj* _pSource); // not working yet virtual void clonedFrom(const DlgEdObj* _pSource); // not working yet
// FullDrag support // FullDrag support
......
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