diff options
-rw-r--r-- | sw/inc/ndgrf.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 307e8acfb715..3c5d209faf67 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -71,6 +71,7 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTextNode bool ImportGraphic( SvStream& rStrm ); DECL_LINK( SwapGraphic, const GraphicObject*, SvStream* ); + DECL_STATIC_LINK( SwGrfNode, SwapReplacement, const GraphicObject*, SvStream* ); /** helper method to determine stream for the embedded graphic. diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index c1c747d9decb..b7b825b6e407 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -403,8 +403,15 @@ const GraphicObject* SwGrfNode::GetReplacementGrfObj() const const_cast< SwGrfNode* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement()); } else if (GetGrfObj().GetGraphic().getPdfData().hasElements()) + { // This returns the metafile, without the pdf data. const_cast<SwGrfNode*>(this)->mpReplacementGraphic = new GraphicObject(GetGrfObj().GetGraphic().GetGDIMetaFile()); + } + if (mpReplacementGraphic) + { + mpReplacementGraphic->SetSwapStreamHdl( + LINK(const_cast<SwGrfNode*>(this), SwGrfNode, SwapReplacement)); + } } return mpReplacementGraphic; @@ -955,6 +962,25 @@ SwContentNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const return pGrfNd; } +IMPL_STATIC_LINK(SwGrfNode, SwapReplacement, const GraphicObject*, pGrfObj, SvStream*) +{ + // replacement image is always swapped + if (pGrfObj->IsInSwapOut()) + { + return GRFMGR_AUTOSWAPSTREAM_TEMP; + } + else if (pGrfObj->IsInSwapIn()) + { + return GRFMGR_AUTOSWAPSTREAM_TEMP; + } + else + { + assert(!"why is swap handler being called?"); + } + + return GRFMGR_AUTOSWAPSTREAM_NONE; +} + IMPL_LINK( SwGrfNode, SwapGraphic, const GraphicObject*, pGrfObj, SvStream* ) { SvStream* pRet; |