summaryrefslogtreecommitdiff
path: root/oox/source
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 /oox/source
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 'oox/source')
-rw-r--r--oox/source/helper/graphichelper.cxx29
1 files changed, 13 insertions, 16 deletions
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 7927daedd39e..692937baeb48 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -37,6 +37,7 @@
#include <vcl/svapp.hxx>
#include <tools/gen.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/sequence.hxx>
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/token/properties.hxx"
@@ -68,7 +69,7 @@ GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, c
{
OSL_ENSURE( mxContext.is(), "GraphicHelper::GraphicHelper - missing component context" );
if( mxContext.is() )
- mxGraphicProvider.set( graphic::GraphicProvider::create( mxContext ) );
+ mxGraphicProvider.set( graphic::GraphicProvider::create( mxContext ), uno::UNO_QUERY );
//! TODO: get colors from system
maSystemPalette[ XML_3dDkShadow ] = 0x716F64;
@@ -266,29 +267,25 @@ Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStrea
std::vector< uno::Reference<graphic::XGraphic> > GraphicHelper::importGraphics(const std::vector< uno::Reference<io::XInputStream> >& rStreams) const
{
- std::vector< uno::Reference<graphic::XGraphic> > aRet;
+ std::vector< uno::Sequence<beans::PropertyValue> > aArgsVec;
for (const auto& rStream : rStreams)
{
- uno::Reference<graphic::XGraphic> xGraphic;
- if (rStream.is() && mxGraphicProvider.is())
+ if (rStream.is())
{
- try
- {
- uno::Sequence<beans::PropertyValue > aArgs = comphelper::InitPropertySequence(
- {
- {"InputStream", uno::makeAny(rStream)}
- });
- xGraphic = mxGraphicProvider->queryGraphic(aArgs);
- }
- catch( const uno::Exception& rException)
+ uno::Sequence<beans::PropertyValue > aArgs = comphelper::InitPropertySequence(
{
- SAL_WARN("oox", "GraphicHelper::importGraphic: queryGraphics() failed: " << rException.Message);
- }
+ {"InputStream", uno::makeAny(rStream)}
+ });
+ aArgsVec.push_back(aArgs);
}
- aRet.push_back(xGraphic);
}
+ std::vector< uno::Reference<graphic::XGraphic> > aRet;
+
+ if (mxGraphicProvider.is())
+ aRet = comphelper::sequenceToContainer< std::vector< uno::Reference<graphic::XGraphic> > >(mxGraphicProvider->queryGraphics(comphelper::containerToSequence(aArgsVec)));
+
return aRet;
}