diff -r 44ff200e2e39 svtools/inc/svtools/embedhlp.hxx --- a/svtools/inc/svtools/embedhlp.hxx Fri Sep 04 08:26:45 2009 +0000 +++ b/svtools/inc/svtools/embedhlp.hxx Thu Sep 10 15:10:06 2009 +0200 @@ -131,6 +131,13 @@ BOOL is() const { return mxObj.is(); } BOOL IsChart() const; + + // #i104867# + // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally, + // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a + // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively + // fetching the Graphic what would be too expensive e.g. for charts + sal_uInt32 getGraphicVersion() const; }; } diff -r 44ff200e2e39 svtools/source/misc/embedhlp.cxx --- a/svtools/source/misc/embedhlp.cxx Fri Sep 04 08:26:45 2009 +0000 +++ b/svtools/source/misc/embedhlp.cxx Thu Sep 10 15:10:06 2009 +0200 @@ -249,6 +249,9 @@ sal_Int64 nViewAspect; BOOL bIsLocked; sal_Bool bNeedUpdate; + + // #i104867# + sal_uInt32 mnGraphicVersion; }; void EmbeddedObjectRef::Construct_Impl() @@ -260,6 +263,7 @@ mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT; mpImp->bIsLocked = FALSE; mpImp->bNeedUpdate = sal_False; + mpImp->mnGraphicVersion = 0; } EmbeddedObjectRef::EmbeddedObjectRef() @@ -293,12 +297,14 @@ mpImp->pGraphic = 0; mpImp->pHCGraphic = 0; + mpImp->mnGraphicVersion = 0; } EmbeddedObjectRef::~EmbeddedObjectRef() { delete mpImp->pGraphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); Clear(); } /* @@ -441,10 +447,15 @@ DELETEZ( mpImp->pGraphic ); mpImp->aMediaType = ::rtl::OUString(); mpImp->pGraphic = new Graphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; } else if ( !mpImp->pGraphic ) + { mpImp->pGraphic = new Graphic; + mpImp->mnGraphicVersion++; + } else { DBG_ERROR("No update, but replacement exists already!"); @@ -457,6 +468,7 @@ GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); if( mpImp->pGraphic ) pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; delete pGraphicStream; } } @@ -586,6 +598,7 @@ mpImp->pHCGraphic = pGraphic; else delete pGraphic; + mpImp->mnGraphicVersion++; } delete pStream; @@ -603,7 +616,9 @@ delete mpImp->pGraphic; mpImp->pGraphic = new Graphic(); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( xInGrStream ); @@ -611,6 +626,7 @@ { GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) { @@ -633,7 +649,9 @@ delete mpImp->pGraphic; mpImp->pGraphic = new Graphic( rGraphic ); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) SetGraphicToContainer( rGraphic, *mpImp->pContainer, mpImp->aPersistName, rMediaType ); @@ -868,7 +886,9 @@ { DELETEZ( mpImp->pGraphic ); mpImp->bNeedUpdate = sal_True; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if( mpImp->pContainer ) { @@ -902,4 +922,10 @@ return sal_False; } +// #i104867# +sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const +{ + return mpImp->mnGraphicVersion; } + +} diff -r 44ff200e2e39 svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx --- a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx Fri Sep 04 08:26:45 2009 +0000 +++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx Thu Sep 10 15:10:06 2009 +0200 @@ -53,6 +53,11 @@ SdrObjectWeakRef mpSdrOle2Obj; basegfx::B2DHomMatrix maObjectTransform; + // #i104867# The GraphicVersion number to identify in operator== if + // the graphic has changed, but without fetching it (which may + // be expensive, e.g. triggering chart creation) + sal_uInt32 mnGraphicVersion; + // bitfield unsigned mbHighContrast : 1; @@ -64,6 +69,7 @@ SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast); // compare operator @@ -74,6 +80,7 @@ // data access const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + sal_uInt32 getGraphicVersion() const { return mnGraphicVersion; } bool getHighContrast() const { return mbHighContrast; } // provide unique ID diff -r 44ff200e2e39 svx/source/sdr/contact/viewcontactofsdrole2obj.cxx --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx Fri Sep 04 08:26:45 2009 +0000 +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx Thu Sep 10 15:10:06 2009 +0200 @@ -113,6 +113,11 @@ new drawinglayer::primitive2d::SdrOleContentPrimitive2D( GetOle2Obj(), aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + bHighContrast)); // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. diff -r 44ff200e2e39 svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx Fri Sep 04 08:26:45 2009 +0000 +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx Thu Sep 10 15:10:06 2009 +0200 @@ -157,10 +157,12 @@ SdrOleContentPrimitive2D::SdrOleContentPrimitive2D( const SdrOle2Obj& rSdrOle2Obj, const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion, bool bHighContrast) : BasePrimitive2D(), mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), maObjectTransform(rObjectTransform), + mnGraphicVersion(nGraphicVersion), mbHighContrast(bHighContrast) { } @@ -176,6 +178,11 @@ return ((bBothNot || bBothAndEqual) && getObjectTransform() == rCompare.getObjectTransform() + + // #i104867# to find out if the Graphic content of the + // OLE has changed, use GraphicVersion number + && getGraphicVersion() == rCompare.getGraphicVersion() + && getHighContrast() == rCompare.getHighContrast()); }