diff options
-rw-r--r-- | include/svx/svdograf.hxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index dcf170099ea4..e86673b74899 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -112,6 +112,7 @@ private: bool ImpUpdateGraphicLink( bool bAsynchron = true ) const; void ImpSetLinkedGraphic( const Graphic& rGraphic ); DECL_LINK( ImpSwapHdl, const GraphicObject*, SvStream* ); + DECL_LINK( ReplacementSwapHdl, const GraphicObject*, SvStream* ); void onGraphicChanged(); GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const; diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 59c5a57e9125..d0f042ca0b71 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -439,8 +439,15 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement()); } else if (pGraphic->GetGraphic().getPdfData().hasElements()) + { // Replacement graphic for bitmap + PDF is just the bitmap. const_cast<SdrGrafObj*>(this)->mpReplacementGraphic = new GraphicObject(pGraphic->GetGraphic().GetBitmapEx()); + } + if (mpReplacementGraphic) + { + mpReplacementGraphic->SetSwapStreamHdl( + LINK(const_cast<SdrGrafObj*>(this), SdrGrafObj, ReplacementSwapHdl)); + } } return mpReplacementGraphic; @@ -1279,6 +1286,29 @@ void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrink } } +IMPL_LINK(SdrGrafObj, ReplacementSwapHdl, const GraphicObject*, pO, SvStream*) +{ + // replacement image is always swapped + if (pO->IsInSwapOut()) + { + SdrSwapGraphicsMode const nSwapMode(pModel->GetSwapGraphicsMode()); + if (nSwapMode & SdrSwapGraphicsMode::TEMP) + { + return GRFMGR_AUTOSWAPSTREAM_TEMP; + } + } + else if (pO->IsInSwapIn()) + { + return GRFMGR_AUTOSWAPSTREAM_TEMP; + } + else + { + assert(!"why is swap handler being called?"); + } + + return GRFMGR_AUTOSWAPSTREAM_NONE; +} + IMPL_LINK( SdrGrafObj, ImpSwapHdl, const GraphicObject*, pO, SvStream* ) { SvStream* pRet = GRFMGR_AUTOSWAPSTREAM_NONE; |