include/xmloff/xmlexp.hxx | 1 + xmloff/source/core/xmlexp.cxx | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
New commits: commit 233a6332500a30ba4bd44d09635ac7cbfe91beb7 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Sat Feb 17 08:34:48 2018 +0900 GetEmbeddedXGraphicStream to read XGraphic as stream This is an alternative to GetEmbeddedGraphicObjectStream which uses URL as parameter and will be removed soon. Change-Id: I3c7431bdeed0bd4ed3c7f48517a52846d0944ed2 Reviewed-on: https://gerrit.libreoffice.org/49893 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx index 6024d9f877ca..2d367b433935 100644 --- a/include/xmloff/xmlexp.hxx +++ b/include/xmloff/xmlexp.hxx @@ -465,6 +465,7 @@ public: OUString AddEmbeddedXGraphic(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic, OUString const & rRequestedName = OUString()); bool AddEmbeddedXGraphicAsBase64(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic); + css::uno::Reference<css::io::XInputStream> GetEmbeddedXGraphicStream(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic); css::uno::Reference<css::io::XInputStream> GetEmbeddedGraphicObjectStream( const OUString& rGraphicObjectURL); diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 7f5df92e5875..4d3533ae4c09 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1926,6 +1926,23 @@ Reference< XInputStream > SvXMLExport::GetEmbeddedGraphicObjectStream( const OUS return nullptr; } +uno::Reference<io::XInputStream> SvXMLExport::GetEmbeddedXGraphicStream(uno::Reference<graphic::XGraphic> const & rxGraphic) +{ + uno::Reference<io::XInputStream> xInputStream; + + if ((getExportFlags() & SvXMLExportFlags::EMBEDDED) && mxGraphicResolver.is()) + { + uno::Reference<document::XGraphicStorageHandler> xGraphicStorageHandler(mxGraphicResolver, uno::UNO_QUERY); + + if (xGraphicStorageHandler.is()) + { + xInputStream = xGraphicStorageHandler->createInputStream(rxGraphic); + } + } + + return xInputStream; +} + bool SvXMLExport::AddEmbeddedXGraphicAsBase64(uno::Reference<graphic::XGraphic> const & rxGraphic) { if ((getExportFlags() & SvXMLExportFlags::EMBEDDED) && _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits