diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-06-12 15:27:16 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-07-15 11:01:29 +0200 |
commit | 5868745db74ae930edb0058490076d82aaeafbe9 (patch) | |
tree | 78bea29cb44b770d9e3affef2a303d0d38722d85 /svx/source/xoutdev/_xoutbmp.cxx | |
parent | 83535a28c57ffb59f795dd35332d6b3426071e32 (diff) |
emfplus: make VectorFormats Emf/Wmf/Svg work
make complete turn around and internal buffering
for Emf/Wmf/Svg work, including images in ODF and
re-save from UI. The correct FileType has to be
determined. It has shown that *.wmf exist that really
contain *.emf, so this turn around will not alter
the binary data, but may change the mimetype
Change-Id: I4fd92629236c12114f7b7c30234a3d3a9917dfaf
Diffstat (limited to 'svx/source/xoutdev/_xoutbmp.cxx')
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index db5474ecf63c..939c5abbbb79 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -151,26 +151,32 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); if(aVectorGraphicDataPtr.get() - && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength() - && rFilterName.equalsIgnoreAsciiCase("svg")) + && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()) { - if(!(nFlags & XOutFlags::DontAddExtension)) - { - aURL.setExtension(rFilterName); - } + const bool bIsSvg(rFilterName.equalsIgnoreAsciiCase("svg") && VectorGraphicDataType::Svg == aVectorGraphicDataPtr->getVectorGraphicDataType()); + const bool bIsWmf(rFilterName.equalsIgnoreAsciiCase("wmf") && VectorGraphicDataType::Wmf == aVectorGraphicDataPtr->getVectorGraphicDataType()); + const bool bIsEmf(rFilterName.equalsIgnoreAsciiCase("emf") && VectorGraphicDataType::Emf == aVectorGraphicDataPtr->getVectorGraphicDataType()); - rFileName = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); - SfxMedium aMedium(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE|StreamMode::SHARE_DENYNONE|StreamMode::TRUNC); - SvStream* pOStm = aMedium.GetOutStream(); - - if(pOStm) + if (bIsSvg || bIsWmf || bIsEmf) { - pOStm->WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); - aMedium.Commit(); + if (!(nFlags & XOutFlags::DontAddExtension)) + { + aURL.setExtension(rFilterName); + } - if(!aMedium.GetError()) + rFileName = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); + SfxMedium aMedium(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE | StreamMode::SHARE_DENYNONE | StreamMode::TRUNC); + SvStream* pOStm = aMedium.GetOutStream(); + + if (pOStm) { - nErr = ERRCODE_NONE; + pOStm->WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); + aMedium.Commit(); + + if (!aMedium.GetError()) + { + nErr = ERRCODE_NONE; + } } } } |