summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-06-11 15:51:32 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-06-11 23:59:46 +0200
commit6b349bcc32336664a31deed3f4463e40dd028f63 (patch)
tree796115d4b49deb879f23b961563a9ceb174730e5 /vcl/source
parentb342a445cd8b115e76d261860088b012b74c0b0e (diff)
when converting WMF to WMF, simply do a direct copy
Actually, if we have the graphics data, just copy the graphics data, that'll keep both the EMF+ and non-EMF+ content. Change-Id: Ia14df0ba2a94d4310ee745b49de1d2190e425f05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117063 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/filter/wmf/wmf.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx
index ee1ce77e4185..bf91502b426e 100644
--- a/vcl/source/filter/wmf/wmf.cxx
+++ b/vcl/source/filter/wmf/wmf.cxx
@@ -90,13 +90,14 @@ bool ConvertGraphicToWMF(const Graphic& rGraphic, SvStream& rTargetStream,
GfxLink aLink = rGraphic.GetGfxLink();
if (aLink.GetType() == GfxLinkType::NativeWmf && aLink.GetData() && aLink.GetDataSize())
{
- // This may be an EMF+ file or WMF file with EMF+ embedded. In EmfReader::ReadEnhWMF()
- // we normally drop non-EMF commands when reading EMF+, so converting that to WMF
- // is better done by re-parsing with EMF+ disabled.
+ if(!aLink.IsEMF()) // If WMF, just write directly.
+ return rTargetStream.WriteBytes(aLink.GetData(), aLink.GetDataSize()) == aLink.GetDataSize();
+
+ // This may be an EMF+ file. In EmfReader::ReadEnhWMF() we normally drop non-EMF commands
+ // when reading EMF+, so converting that to WMF is better done by re-parsing with EMF+ disabled.
auto & rDataContainer = aLink.getDataContainer();
auto aVectorGraphicData
- = std::make_shared<VectorGraphicData>(rDataContainer,
- aLink.IsEMF() ? VectorGraphicDataType::Emf : VectorGraphicDataType::Wmf);
+ = std::make_shared<VectorGraphicData>(rDataContainer, VectorGraphicDataType::Emf);
aVectorGraphicData->setEnableEMFPlus(false);
Graphic aGraphic(aVectorGraphicData);
bool bRet = ConvertGDIMetaFileToWMF(aGraphic.GetGDIMetaFile(), rTargetStream, pConfigItem,