diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-12-04 09:13:06 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-12-04 15:25:06 +0100 |
commit | a0647dfdbbea483ed3a8372b7a54e1934dfa1fe5 (patch) | |
tree | fd34daadf8f9386f4ec93c5ecbe73903b3c205f8 /xmloff | |
parent | b360322c63d62b54b5e6adac4def3f8b761dc1da (diff) |
Related tdf#113696 Write fallback graphic for fodf files also
Change-Id: I2db10b6a3bf14837160a56813681ba40fa253447
Reviewed-on: https://gerrit.libreoffice.org/45777
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index eaaf3ff0f2aa..932505961e75 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -3050,7 +3050,7 @@ void XMLTextParagraphExport::_exportTextGraphic( SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_DRAW, XML_FRAME, false, true); // replacement graphic for backwards compatibility, but - // only for SVG currently + // only for SVG and metafiles currently OUString sReplacementOrigURL; rPropSet->getPropertyValue( sReplacementGraphicURL ) >>= sReplacementOrigURL; @@ -3110,15 +3110,20 @@ void XMLTextParagraphExport::_exportTextGraphic( GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE); GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED); GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD); + } - // xlink:href for replacement, only written for Svg content - SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, false, true); + uno::Reference<io::XInputStream> xInputStream( + GetExport().GetEmbeddedGraphicObjectStream(sReplacementOrigURL)); + OUString aMimeType( + comphelper::GraphicMimeTypeHelper::GetMimeTypeForImageStream(xInputStream)); + if (!aMimeType.isEmpty()) + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", aMimeType); - // optional office:binary-data - GetExport().AddEmbeddedGraphicObjectAsBase64(sReplacementURL); - } - } + SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, true, true); + // optional office:binary-data + GetExport().AddEmbeddedGraphicObjectAsBase64(sReplacementOrigURL); + } // script:events Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY ); |