diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-11-07 10:42:55 +0100 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-11-07 10:45:16 +0100 |
commit | 4c9aa743fc83b3f3c5b35eeff79c1ffdae90c1fa (patch) | |
tree | 937ea954937a4c37eadd66684d34eb13f6589575 | |
parent | 78657d31ca3118759b7e817d12886f3b713aea07 (diff) |
Swapping Graphic is a privilage of GraphicObject.
This means more things:
* Graphic won't swap out itself, so those classes which uses
Graphic without GraphicObject won't need to deal with swapping.
* When a Graphic is queried from GraphicObject the caller won't
need to deal with swapping, because GraphicObject swaps it in
before return.
* GraphicObject will swap in the Graphic always when a swapping
dependent data is queried (e.g. whole graphic, transformed graphic
or AnimationNotifyHdl)
Change-Id: I2bf6e37291ec94146f10aac4a35084682437ed16
-rw-r--r-- | include/svtools/grfmgr.hxx | 2 | ||||
-rw-r--r-- | include/vcl/graph.hxx | 3 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 13 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 6 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 5 | ||||
-rw-r--r-- | vcl/source/gdi/cvtgrf.cxx | 2 |
7 files changed, 7 insertions, 26 deletions
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx index d9c19544c548..d51577345347 100644 --- a/include/svtools/grfmgr.hxx +++ b/include/svtools/grfmgr.hxx @@ -412,7 +412,7 @@ public: bool IsAnimated() const { return mbAnimated; } bool IsEPS() const { return mbEPS; } - Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); } + Link GetAnimationNotifyHdl() const { return GetGraphic().GetAnimationNotifyHdl(); } bool SwapOut(); bool SwapOut( SvStream* pOStm ); diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index b55e79015cec..8727b9c13e2b 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -176,6 +176,8 @@ public: const OUString& GetDocFileName() const; sal_uLong GetDocFilePos() const; +private: + friend class GraphicObject; bool SwapOut(); void SwapOutAsLink(); bool SwapOut( SvStream* pOStm ); @@ -183,6 +185,7 @@ public: bool SwapIn( SvStream* pIStm ); bool IsSwapOut() const; +public: void SetLink( const GfxLink& ); GfxLink GetLink() const; bool IsLink() const; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 7a9689b8a91a..6b0e4dc73ff0 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -866,19 +866,6 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia ) GraphicType aType = rGraphic.GetType(); if ( aType == GRAPHIC_BITMAP || aType == GRAPHIC_GDIMETAFILE) { - bool bSwapped = rGraphic.IsSwapOut(); - - //Warn rather than just happily swap in because of the comments - //in the sw export filters about needing to go through the - //hairy SwGrfNode::SwapIn which we would subvert by swapping in - //without it knowing about it, so while those ones are fixed we - //probably have to assume that we should ideally be presented - //here with already swapped in graphics. - SAL_WARN_IF(bSwapped, "oox", "attempted to output swapped out graphic"); - - if (bSwapped) - const_cast<Graphic&>(rGraphic).SwapIn(); - if ( aType == GRAPHIC_BITMAP ) { GraphicConverter::Export( aStream, rGraphic, CVT_PNG ); diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index fa87a2ec8c4f..63a3b9d7183e 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -694,9 +694,7 @@ void GraphicObject::StopAnimation( OutputDevice* pOut, long nExtraData ) const Graphic& GraphicObject::GetGraphic() const { GraphicObject *pThis = const_cast<GraphicObject*>(this); - - if (mbAutoSwapped) - pThis->ImplAutoSwapIn(); + pThis->SwapIn(); //fdo#50697 If we've been asked to provide the graphic, then reset //the cache timeout to start from now and not remain at the @@ -736,7 +734,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const OUString& rLink ) Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const { // #104550# Extracted from svx/source/svdraw/svdograf.cxx - Graphic aTransGraphic( maGraphic ); + Graphic aTransGraphic( GetGraphic() ); const GraphicType eType = GetType(); const Size aSrcSize( aTransGraphic.GetPrefSize() ); diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 7f93bf96f9d7..d054ab36053d 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -279,7 +279,7 @@ bool GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, const Graphic& rGraphic = rObj.GetGraphic(); bool bRet = false; - if( rGraphic.IsSupportedGraphic() && !rGraphic.IsSwapOut() ) + if( rGraphic.IsSupportedGraphic() && !rObj.IsSwappedOut() ) { if( GRAPHIC_BITMAP == rGraphic.GetType() ) { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index c563f6aeb9c6..e7305fd21e82 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4089,11 +4089,6 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size // Not in cache, then need to write it. m_rDrawingML.SetFS( m_pSerializer ); // to be sure that we write to the right stream - if (pGraphic->IsSwapOut() && !pGrfNode) - { - const_cast<Graphic*>(pGraphic)->SwapIn(); - } - OUString aImageId = m_rDrawingML.WriteImage( *pGraphic ); aRelId = OUStringToOString( aImageId, RTL_TEXTENCODING_UTF8 ); diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx index 68e4e076449f..65cc9193292b 100644 --- a/vcl/source/gdi/cvtgrf.cxx +++ b/vcl/source/gdi/cvtgrf.cxx @@ -56,8 +56,6 @@ sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, sal_uLon sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sal_uLong nFormat ) { - SAL_WARN_IF(rGraphic.IsSwapOut(), "vcl.filter", "exporting a swapped out graphic!"); - GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter; sal_uLong nRet = ERRCODE_IO_GENERAL; |