diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-02-19 21:52:33 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-02-22 09:28:12 +0100 |
commit | 1cf55d6397418dd3cd86eae59c2f75085dbb0d51 (patch) | |
tree | d35d2dd19703a6491c7c120dde5bceeb0b6753f1 /xmloff/source/draw/shapeexport.cxx | |
parent | 6a9f851e54f416820c61baf8caa79e4d91c8c61f (diff) |
Replace "ReplacementGraphicURL" with "ReplacementGraphic" property
To transport the replacement graphic we use "ReplacementGraphicURL"
property, but as it uses an GraphicObject URL it needs to be
replaced. The new "ReplacementGraphic" does this with an XGraphic
object as instead of the String URL.
Change-Id: Iddf01c9aecb2a31a467e7b9d399495e0428d1859
Reviewed-on: https://gerrit.libreoffice.org/49993
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'xmloff/source/draw/shapeexport.cxx')
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index b1b5ea0e1537..89a92f14229c 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2454,34 +2454,33 @@ void XMLShapeExport::ImpExportGraphicObjectShape( //fallback here if( !bIsEmptyPresObj ) { - OUString aReplacementUrl; - xPropSet->getPropertyValue("ReplacementGraphicURL") >>= aReplacementUrl; + uno::Reference<graphic::XGraphic> xReplacementGraphic; + xPropSet->getPropertyValue("ReplacementGraphic") >>= xReplacementGraphic; // If there is no url, then the graphic is empty - if(!aReplacementUrl.isEmpty()) + if (xReplacementGraphic.is()) { - const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl); + OUString aMimeType; + const OUString aHref = mrExport.AddEmbeddedXGraphic(xReplacementGraphic, aMimeType); - if(!aStr.isEmpty()) + if (aMimeType.isEmpty()) + mrExport.GetGraphicMimeTypeFromStream(xReplacementGraphic, aMimeType); + + if (!aHref.isEmpty()) { - mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr); + mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aHref); mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); } - uno::Reference<io::XInputStream> xInputStream( - mrExport.GetEmbeddedGraphicObjectStream(aReplacementUrl)); - OUString aMimeType( - comphelper::GraphicMimeTypeHelper::GetMimeTypeForImageStream(xInputStream)); if (!aMimeType.isEmpty()) - GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", aMimeType); + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", aMimeType); - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, true); + SvXMLElementExport aElement(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, true); // optional office:binary-data - mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl); - + mrExport.AddEmbeddedXGraphicAsBase64(xReplacementGraphic); } } } |