diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-06-11 15:48:32 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-06-11 23:59:32 +0200 |
commit | b342a445cd8b115e76d261860088b012b74c0b0e (patch) | |
tree | 26f55d7507adfeee46b1fc4363b43dc8ab11395b /vcl | |
parent | 381bc9d9acd461415cf81eef71ec3dd935a07b62 (diff) |
drop EMF+ also when converting WMF, not just EMF
A WMF may have EMF with EMF+ actions embedded. When we read that,
we drop drawing non-EMF+ actions if we use EMF+. But EMF+ actions
are stored as MetaCommentAction in the metafile, and WMF writer
(unlike EMF) writer simply ignores comments. So when writing WMF,
make sure to read non-EMF actions so that something is written.
This is an extension of 295626a0bd39540544b774094a63df23e5376839.
Change-Id: I37355f694fe656b661abe54274ea203934e68151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117062
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/wmf/wmf.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx index ccff80c20339..ee1ce77e4185 100644 --- a/vcl/source/filter/wmf/wmf.cxx +++ b/vcl/source/filter/wmf/wmf.cxx @@ -88,13 +88,15 @@ bool ConvertGraphicToWMF(const Graphic& rGraphic, SvStream& rTargetStream, FilterConfigItem const* pConfigItem, bool bPlaceable) { GfxLink aLink = rGraphic.GetGfxLink(); - if (aLink.IsEMF() && aLink.GetData() && aLink.GetDataSize()) + if (aLink.GetType() == GfxLinkType::NativeWmf && aLink.GetData() && aLink.GetDataSize()) { - // This may be an EMF+ file, converting that to WMF is better done by re-parsing EMF+ as EMF - // and converting that to WMF. + // 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. auto & rDataContainer = aLink.getDataContainer(); auto aVectorGraphicData - = std::make_shared<VectorGraphicData>(rDataContainer, VectorGraphicDataType::Emf); + = std::make_shared<VectorGraphicData>(rDataContainer, + aLink.IsEMF() ? VectorGraphicDataType::Emf : VectorGraphicDataType::Wmf); aVectorGraphicData->setEnableEMFPlus(false); Graphic aGraphic(aVectorGraphicData); bool bRet = ConvertGDIMetaFileToWMF(aGraphic.GetGDIMetaFile(), rTargetStream, pConfigItem, |