summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-03-02 08:28:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-04 08:52:39 +0100
commit28239c40430ec4e613d9d936614c5c3853c332c4 (patch)
tree0fa6bc36c05f8f42a0799b884ed38eb3e569ff90 /vcl
parent85b7e7fdd7f283a3084e2db0dd8e71a48fac228d (diff)
simplify UNO getTypes methods
Change-Id: Ia8b07edec54527fb4904536fabb03a18e8452550 Reviewed-on: https://gerrit.libreoffice.org/68659 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/graphic/UnoGraphic.cxx14
-rw-r--r--vcl/source/graphic/UnoGraphicDescriptor.cxx17
-rw-r--r--vcl/source/graphic/UnoGraphicProvider.cxx12
3 files changed, 18 insertions, 25 deletions
diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx
index 970a904519d8..bc2ce6349f55 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -26,6 +26,7 @@
#include <vcl/dibtools.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/typeprovider.hxx>
#include <string.h>
using namespace com::sun::star;
@@ -108,14 +109,11 @@ uno::Sequence< OUString > SAL_CALL Graphic::getSupportedServiceNames()
uno::Sequence< uno::Type > SAL_CALL Graphic::getTypes()
{
- uno::Sequence< uno::Type > aRet( ::unographic::GraphicDescriptor::getTypes() );
- sal_Int32 nOldCount = aRet.getLength();
-
- aRet.realloc( nOldCount + 2 );
- aRet[ nOldCount ] = cppu::UnoType<graphic::XGraphic>::get();
- aRet[ nOldCount+1 ] = cppu::UnoType<awt::XBitmap>::get();
-
- return aRet;
+ return cppu::OTypeCollection(
+ cppu::UnoType<graphic::XGraphic>::get(),
+ cppu::UnoType<awt::XBitmap>::get(),
+ ::unographic::GraphicDescriptor::getTypes()
+ ).getTypes();
}
uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId()
diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx b/vcl/source/graphic/UnoGraphicDescriptor.cxx
index 7d89a8b7ca70..8b4f1fa79d89 100644
--- a/vcl/source/graphic/UnoGraphicDescriptor.cxx
+++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx
@@ -211,16 +211,13 @@ uno::Sequence< OUString > SAL_CALL GraphicDescriptor::getSupportedServiceNames()
uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes()
{
- uno::Sequence< uno::Type > aTypes( 6 );
- uno::Type* pTypes = aTypes.getArray();
-
- *pTypes++ = cppu::UnoType<uno::XAggregation>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
-
+ static const uno::Sequence< uno::Type > aTypes {
+ cppu::UnoType<uno::XAggregation>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get() };
return aTypes;
}
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index 0da9c020155d..51d755b4515a 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -111,13 +111,11 @@ uno::Sequence< OUString > SAL_CALL GraphicProvider::getSupportedServiceNames()
uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes()
{
- uno::Sequence< uno::Type > aTypes( 3 );
- uno::Type* pTypes = aTypes.getArray();
-
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<graphic::XGraphicProvider>::get();
-
+ static const uno::Sequence< uno::Type > aTypes {
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<graphic::XGraphicProvider>::get()
+ };
return aTypes;
}