diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-07-14 14:32:22 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-07-31 12:03:54 +0200 |
commit | b88f7e2a7009756945abb5849fc6305be056efd2 (patch) | |
tree | b905089991021ffedbba4f9e86f0543701d35cca /sw/source/core/graphic | |
parent | a6b7bd710adb29b8738563d86e1b39caf4822b07 (diff) |
sw: make SwGrfNode::mpReplacementGraphic swappable
Same as previous commit, but for sw.
(cherry picked from commit a03a0cfb1e41c357950a40623c2f8b6f5507e97d)
loplugin:staticmethods
(cherry picked from commit 3039b7cae36abb7e9bfffa4fbbba023721376568)
Reviewed-on: https://gerrit.libreoffice.org/39968
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 524377f1815773a678721c8ad179be9dbdaf7716)
Reviewed-on: https://gerrit.libreoffice.org/40179
(cherry picked from commit 7d229d287ebc2ac961ee36ea048273dcc7ec405a)
Change-Id: Id678de3f512204437e37aaedf24e24aff7a9e592
Diffstat (limited to 'sw/source/core/graphic')
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index d124d909c08c..a1c1ed456783 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 bitmap, without the pdf data. const_cast<SwGrfNode*>(this)->mpReplacementGraphic = new GraphicObject(GetGrfObj().GetGraphic().GetBitmapEx()); + } + 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; |