diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-08-24 19:45:53 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-08-24 19:45:53 +0100 |
commit | f853fc635313eb1a5263c47bc40b49ad94a9fbaa (patch) | |
tree | f30efcff5c465a47ac018c87f97aa863ed35000d | |
parent | 3a84b1724a800ef3177b5c51843636200970b0fe (diff) |
Make GraphicObjects immutable, create a new one to change it.
Change-Id: Iaa5c520d2246412c46420fe1822b5d25583bc509
-rw-r--r-- | include/svtools/grfmgr.hxx | 3 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 56 |
2 files changed, 5 insertions, 54 deletions
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx index 6261f51cfbee..14ad6b563636 100644 --- a/include/svtools/grfmgr.hxx +++ b/include/svtools/grfmgr.hxx @@ -176,7 +176,6 @@ private: explicit GraphicObject(); GraphicObject( const Graphic& rGraphic ); GraphicObject( const GraphicObject& rCacheObj ); - GraphicObject& operator=( const GraphicObject& rCacheObj ); explicit GraphicObject( const OString& rUniqueID ); @@ -385,8 +384,6 @@ public: void ReleaseFromCache(); const Graphic& GetGraphic() const; - void SetGraphic( const Graphic& rGraphic, const rtl::Reference< GraphicObject >& pCopyObj = rtl::Reference< GraphicObject >() ); - void SetGraphic( const Graphic& rGraphic, const String& rLink ); /** Get graphic transformed according to given attributes diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 1f80f8e76ef8..8a67cce38940 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -101,7 +101,7 @@ GraphicObject::GraphicObject( const OString& rUniqueID, const GraphicManager* pM // assign default properties ImplAssignGraphicData(); - ImplSetGraphicManager(&rUniqueID ); + ImplSetGraphicManager(&rUniqueID); // update properties ImplAssignGraphicData(); @@ -141,8 +141,10 @@ void SAL_CALL GraphicObject::setGraphic( const css::uno::Reference< css::graphic { SolarMutexGuard aSolarGuard; - Graphic aGraphic( xGraphic ); - SetGraphic( aGraphic ); + // GraphicObjects should be superficially immutable, and refer to one object. + assert( "this setGraphic method seems like a pretty horrible design flaw, and awfully un-necessary - please construct a new object" ); +// Graphic aGraphic( xGraphic ); +// SetGraphic( aGraphic ); } OUString SAL_CALL GraphicObject::getUniqueID() @@ -349,35 +351,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& return bRet; } -GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj ) -{ - // FIXME: mmeeks this operator should be removed [!] ... - assert(false); - - if( &rGraphicObj != this ) - { - mpMgr->ImplUnregisterObj( *this ); - - delete mpSwapStreamHdl, mpSwapStreamHdl = NULL; - delete mpSimpleCache, mpSimpleCache = NULL; - delete mpLink; - delete mpUserData; - - maGraphic = rGraphicObj.GetGraphic(); - maAttr = rGraphicObj.maAttr; - mpLink = rGraphicObj.mpLink ? new String( *rGraphicObj.mpLink ) : NULL; - mpUserData = rGraphicObj.mpUserData ? new String( *rGraphicObj.mpUserData ) : NULL; - ImplAssignGraphicData(); - mbAutoSwapped = sal_False; - mpMgr = rGraphicObj.mpMgr; - - mpMgr->ImplRegisterObj( *this, maGraphic, NULL, - GraphicObject::Create( &rGraphicObj ) ); - } - - return *this; -} - sal_Bool GraphicObject::operator==( const GraphicObject& rGraphicObj ) const { return( ( rGraphicObj.maGraphic == maGraphic ) && @@ -770,25 +743,6 @@ const Graphic& GraphicObject::GetGraphic() const return maGraphic; } -void GraphicObject::SetGraphic( const Graphic& rGraphic, const rtl::Reference< GraphicObject > &xCopyObj ) -{ - mpMgr->ImplUnregisterObj( *this ); - - if( mpSwapOutTimer ) - mpSwapOutTimer->Stop(); - - maGraphic = rGraphic; - mbAutoSwapped = sal_False; - ImplAssignGraphicData(); - delete mpLink, mpLink = NULL; - delete mpSimpleCache, mpSimpleCache = NULL; - - mpMgr->ImplRegisterObj( *this, maGraphic, 0, xCopyObj); - - if( mpSwapOutTimer ) - mpSwapOutTimer->Start(); -} - void GraphicObject::SetGraphic( const Graphic& rGraphic, const String& rLink ) { SetGraphic( rGraphic ); |