summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/svdograf.hxx1
-rw-r--r--svx/source/svdraw/svdograf.cxx30
2 files changed, 31 insertions, 0 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index e8cb176ad10b..8622fd39f2c6 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();
public:
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index cc14814fc7dc..e0e349442da5 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -444,8 +444,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;
@@ -1282,6 +1289,29 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly )
}
}
+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;