tdf#168886 tdf#168237 oox: Detect EMF in NativeWmf GfxLink

GfxLinkType::NativeWmf stores both WMF and EMF formats. Without
checking IsEMF(), EMF files are exported to DOCX ZIP with .wmf
extension and image/x-wmf mime type, even though the binary content
is EMF.

Fix: check IsEMF() in the NativeWmf case and set the correct
image/x-emf mime type and .emf extension.

Change-Id: Icab34e29d06186fb78a4d7a4ac233fbc7c992ac5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203138
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
This commit is contained in:
Piotr Osada
2026-04-02 00:51:53 +02:00
committed by Bartosz Kosiorek
parent 2b97b8008b
commit aca4a0c073
+10 -2
View File
@@ -1495,8 +1495,16 @@ OUString GraphicExport::writeNewEntryToStorage(const Graphic& rGraphic, bool bRe
aExtension = u"tif"_ustr;
break;
case GfxLinkType::NativeWmf:
sMediaType = u"image/x-wmf"_ustr;
aExtension = u"wmf"_ustr;
if (aLink.IsEMF())
{
sMediaType = u"image/x-emf"_ustr;
aExtension = u"emf"_ustr;
}
else
{
sMediaType = u"image/x-wmf"_ustr;
aExtension = u"wmf"_ustr;
}
break;
case GfxLinkType::NativeMet:
sMediaType = u"image/x-met"_ustr;