[Libreoffice-commits] core.git: xmloff/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Mon Dec 4 14:26:14 UTC 2017


 xmloff/source/text/txtparae.cxx |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit a0647dfdbbea483ed3a8372b7a54e1934dfa1fe5
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Mon Dec 4 09:13:06 2017 +0100

    Related tdf#113696 Write fallback graphic for fodf files also
    
    Change-Id: I2db10b6a3bf14837160a56813681ba40fa253447
    Reviewed-on: https://gerrit.libreoffice.org/45777
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

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 );


More information about the Libreoffice-commits mailing list