summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-05-23 12:10:44 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-05-23 15:24:18 +0200
commit252e524094893063e4bcc822571a14c4558e1d00 (patch)
tree029ccf5bf9de49818fc02748cda2e7c3bf072f68 /svtools
parentd24a9a7513805f1baee3ff7c9b8a25eb467a0f6b (diff)
svtools: add GraphicProvider::queryGraphics()
This allows moving the for() loop from oox to svtools when importing multiple images. That means in case later we parallelize that loop, then the performance benefit won't be restricted to oox, but also will be available for all clients of the graphic provider. Change-Id: Icd7bd447e7ae623b0a8548e020d8f6ab38da47bb Reviewed-on: https://gerrit.libreoffice.org/37945 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/graphic/provider.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 6106bef363a8..faec3fcd4d9b 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -34,7 +34,7 @@
#include <vcl/virdev.hxx>
#include <vcl/settings.hxx>
#include <com/sun/star/awt/XBitmap.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/XGraphicProvider2.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/text/GraphicCrop.hpp>
@@ -48,6 +48,7 @@
#include <rtl/ref.hxx>
#include <svtools/grfmgr.hxx>
#include <vcl/dibtools.hxx>
+#include <comphelper/sequence.hxx>
#include <memory>
using namespace com::sun::star;
@@ -56,7 +57,7 @@ namespace {
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-class GraphicProvider : public ::cppu::WeakImplHelper< css::graphic::XGraphicProvider,
+class GraphicProvider : public ::cppu::WeakImplHelper< css::graphic::XGraphicProvider2,
css::lang::XServiceInfo >
{
public:
@@ -79,6 +80,9 @@ protected:
virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL queryGraphic( const css::uno::Sequence< css::beans::PropertyValue >& MediaProperties ) override;
virtual void SAL_CALL storeGraphic( const css::uno::Reference< css::graphic::XGraphic >& Graphic, const css::uno::Sequence< css::beans::PropertyValue >& MediaProperties ) override;
+ // XGraphicProvider2
+ uno::Sequence< uno::Reference<graphic::XGraphic> > SAL_CALL queryGraphics(const uno::Sequence< uno::Sequence<beans::PropertyValue> >& MediaPropertiesSeq ) override;
+
private:
static css::uno::Reference< css::graphic::XGraphic > implLoadMemory( const OUString& rResourceURL );
@@ -432,6 +436,18 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
return xRet;
}
+uno::Sequence< uno::Reference<graphic::XGraphic> > SAL_CALL GraphicProvider::queryGraphics(const uno::Sequence< uno::Sequence<beans::PropertyValue> >& rMediaPropertiesSeq)
+{
+ std::vector< uno::Reference<graphic::XGraphic> > aRet;
+
+ for (const auto& rMediaProperties : rMediaPropertiesSeq)
+ {
+ aRet.push_back(queryGraphic(rMediaProperties));
+ }
+
+ return comphelper::containerToSequence(aRet);
+}
+
void ImplCalculateCropRect( ::Graphic& rGraphic, const text::GraphicCrop& rGraphicCropLogic, tools::Rectangle& rGraphicCropPixel )
{
if ( rGraphicCropLogic.Left || rGraphicCropLogic.Top || rGraphicCropLogic.Right || rGraphicCropLogic.Bottom )