sfx2/source/sidebar/Tools.cxx | 15 +++------------ vcl/source/image/Image.cxx | 24 ++++++++++++++++++------ 2 files changed, 21 insertions(+), 18 deletions(-)
New commits: commit f8072cc8e43b42e2bfa227bb33aa06be69233e46 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Apr 12 14:46:49 2018 +0900 Don't abuse loading of a Graphic to actually load an Image Change-Id: I816c46542088f36ef69b127cc13080e3bc8cdfc2 Reviewed-on: https://gerrit.libreoffice.org/52806 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index 727cd6f24bec..47c27adb2520 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -27,7 +27,6 @@ #include <vcl/gradient.hxx> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/frame/ModuleManager.hpp> @@ -60,18 +59,10 @@ Image Tools::GetImage ( const Image aPanelImage(vcl::CommandInfoProvider::GetImageForCommand(rsURL, rxFrame)); return aPanelImage; } - else + else if (rsURL.startsWith("private:graphicrepository")) { - const Reference<XComponentContext> xContext (::comphelper::getProcessComponentContext()); - const Reference<graphic::XGraphicProvider> xGraphicProvider = - graphic::GraphicProvider::create( xContext ); - ::comphelper::NamedValueCollection aMediaProperties; - aMediaProperties.put("URL", rsURL); - const Reference<graphic::XGraphic> xGraphic ( - xGraphicProvider->queryGraphic(aMediaProperties.getPropertyValues()), - UNO_QUERY); - if (xGraphic.is()) - return Image(xGraphic); + const Image aPanelImage(rsURL); + return aPanelImage; } } return Image(); diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index e99cccd0f256..e9e105c10bf0 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -54,13 +54,25 @@ Image::Image(const css::uno::Reference< css::graphic::XGraphic >& rxGraphic) Image::Image(const OUString & rFileUrl) { - OUString aPath; - osl::FileBase::getSystemPathFromFileURL(rFileUrl, aPath); - Graphic aGraphic; - const OUString aFilterName(IMP_PNG); - if (ERRCODE_NONE == GraphicFilter::LoadGraphic(aPath, aFilterName, aGraphic)) + sal_Int32 nIndex = 0; + if (rFileUrl.getToken( 0, '/', nIndex ) == "private:graphicrepository") { - ImplInit(aGraphic.GetBitmapEx()); + OUString sPathName(rFileUrl.copy(nIndex)); + BitmapEx aBitmapEx; + if (vcl::ImageRepository::loadImage(sPathName, aBitmapEx)) + { + ImplInit(aBitmapEx); + } + } + else + { + OUString aPath; + osl::FileBase::getSystemPathFromFileURL(rFileUrl, aPath); + Graphic aGraphic; + if (ERRCODE_NONE == GraphicFilter::LoadGraphic(aPath, IMP_PNG, aGraphic)) + { + ImplInit(aGraphic.GetBitmapEx()); + } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits