summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/accessibility/AccessibleControlShape.cxx18
-rw-r--r--svx/source/accessibility/AccessibleGraphicShape.cxx12
-rw-r--r--svx/source/accessibility/AccessibleOLEShape.cxx15
-rw-r--r--svx/source/form/fmdpage.cxx8
-rw-r--r--svx/source/table/cell.cxx13
-rw-r--r--svx/source/unodraw/unomod.cxx23
-rw-r--r--svx/source/unodraw/unopool.cxx17
-rw-r--r--svx/source/unogallery/unogalitem.cxx17
-rw-r--r--svx/source/unogallery/unogaltheme.cxx16
-rw-r--r--svx/source/unogallery/unogalthemeprovider.cxx16
10 files changed, 49 insertions, 106 deletions
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index 6746592d9d18..91fc5b2ded68 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -403,24 +403,8 @@ Sequence< Type > SAL_CALL AccessibleControlShape::getTypes()
if ( m_xControlContextTypeAccess.is() )
aAggregateTypes = m_xControlContextTypeAccess->getTypes();
- Sequence< Type > aAllTypes = comphelper::concatSequences( aShapeTypes, aOwnTypes, aAggregateTypes );
-
// remove duplicates
- Type* pBegin = aAllTypes.getArray();
- Type* pEnd = pBegin + aAllTypes.getLength();
- while ( pBegin != pEnd )
- {
- Type aThisRoundType = *pBegin;
- if ( ++pBegin != pEnd )
- {
- pEnd = ::std::remove( pBegin, pEnd, aThisRoundType );
- // now all types between begin and (the old) end which equal aThisRoundType
- // are moved behind the new end
- }
- }
- aAllTypes.realloc( pEnd - aAllTypes.getArray() );
-
- return aAllTypes;
+ return comphelper::combineSequences(comphelper::concatSequences( aShapeTypes, aOwnTypes), aAggregateTypes );
}
void SAL_CALL AccessibleControlShape::notifyEvent( const AccessibleEventObject& _rEvent )
diff --git a/svx/source/accessibility/AccessibleGraphicShape.cxx b/svx/source/accessibility/AccessibleGraphicShape.cxx
index fba25f4ad007..4169508d66e9 100644
--- a/svx/source/accessibility/AccessibleGraphicShape.cxx
+++ b/svx/source/accessibility/AccessibleGraphicShape.cxx
@@ -25,6 +25,7 @@
#include <svx/svdmodel.hxx>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/queryinterface.hxx>
using namespace ::accessibility;
@@ -120,15 +121,8 @@ uno::Sequence<uno::Type> SAL_CALL
AccessibleGraphicShape::getTypes()
{
// Get list of types from the context base implementation...
- uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
- // ...and add the additional type for the component.
- long nTypeCount = aTypeList.getLength();
- aTypeList.realloc (nTypeCount + 1);
- const uno::Type aImageType =
- cppu::UnoType<XAccessibleImage>::get();
- aTypeList[nTypeCount] = aImageType;
-
- return aTypeList;
+ return comphelper::concatSequences(AccessibleShape::getTypes(),
+ uno::Sequence { cppu::UnoType<XAccessibleImage>::get() });
}
diff --git a/svx/source/accessibility/AccessibleOLEShape.cxx b/svx/source/accessibility/AccessibleOLEShape.cxx
index fc2df2c76a9f..e3412599a3df 100644
--- a/svx/source/accessibility/AccessibleOLEShape.cxx
+++ b/svx/source/accessibility/AccessibleOLEShape.cxx
@@ -23,6 +23,7 @@
#include <svx/SvxShapeTypes.hxx>
#include <svx/svdoole2.hxx>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/queryinterface.hxx>
using namespace ::accessibility;
@@ -119,19 +120,11 @@ css::uno::Sequence< OUString> SAL_CALL
}
// XTypeProvider
-uno::Sequence<uno::Type> SAL_CALL
- AccessibleOLEShape::getTypes()
+uno::Sequence<uno::Type> SAL_CALL AccessibleOLEShape::getTypes()
{
// Get list of types from the context base implementation...
- uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
- // ...and add the additional type for the component.
- long nTypeCount = aTypeList.getLength();
- aTypeList.realloc (nTypeCount + 1);
- const uno::Type aActionType =
- cppu::UnoType<XAccessibleAction>::get();
- aTypeList[nTypeCount] = aActionType;
-
- return aTypeList;
+ return comphelper::concatSequences(AccessibleShape::getTypes(),
+ uno::Sequence { cppu::UnoType<XAccessibleAction>::get() } );
}
// XAccessibleExtendedAttributes
diff --git a/svx/source/form/fmdpage.cxx b/svx/source/form/fmdpage.cxx
index 45ac667c50eb..d39a3ba8371d 100644
--- a/svx/source/form/fmdpage.cxx
+++ b/svx/source/form/fmdpage.cxx
@@ -58,12 +58,8 @@ Any SAL_CALL SvxFmDrawPage::queryAggregation( const css::uno::Type& _rType )
css::uno::Sequence< css::uno::Type > SAL_CALL SvxFmDrawPage::getTypes( )
{
- css::uno::Sequence< css::uno::Type > aTypes(SvxDrawPage::getTypes());
- aTypes.realloc(aTypes.getLength() + 1);
- css::uno::Type* pTypes = aTypes.getArray();
-
- pTypes[aTypes.getLength()-1] = cppu::UnoType<css::form::XFormsSupplier>::get();
- return aTypes;
+ return comphelper::concatSequences(SvxDrawPage::getTypes(),
+ css::uno::Sequence { cppu::UnoType<css::form::XFormsSupplier>::get() });
}
SdrObject *SvxFmDrawPage::CreateSdrObject_( const css::uno::Reference< css::drawing::XShape > & xDescr )
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index da489f728846..c34723ab7b67 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/table/TableBorder.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <o3tl/any.hxx>
@@ -888,14 +889,10 @@ void SAL_CALL Cell::release() throw ()
Sequence< Type > SAL_CALL Cell::getTypes( )
{
- Sequence< Type > aTypes( SvxUnoTextBase::getTypes() );
-
- sal_Int32 nLen = aTypes.getLength();
- aTypes.realloc(nLen + 2);
- aTypes[nLen++] = cppu::UnoType<XMergeableCell>::get();
- aTypes[nLen++] = cppu::UnoType<XLayoutConstrains>::get();
-
- return aTypes;
+ return comphelper::concatSequences( SvxUnoTextBase::getTypes(),
+ Sequence {
+ cppu::UnoType<XMergeableCell>::get(),
+ cppu::UnoType<XLayoutConstrains>::get() });
}
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index f6e60d5b022a..bbbf62c9b398 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -301,24 +301,13 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawingModel::getTypes( )
{
if( maTypeSequence.getLength() == 0 )
{
- const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() );
- const sal_Int32 nBaseTypes = aBaseTypes.getLength();
- const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
-
- const sal_Int32 nOwnTypes = 4; // !DANGER! Keep this updated!
-
- maTypeSequence.realloc( nBaseTypes + nOwnTypes );
- uno::Type* pTypes = maTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XMultiServiceFactory>::get();
- *pTypes++ = cppu::UnoType<drawing::XDrawPagesSupplier>::get();
- *pTypes++ = cppu::UnoType<css::ucb::XAnyCompareFactory>::get();
-
- for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
- *pTypes++ = *pBaseTypes++;
+ maTypeSequence = comphelper::concatSequences( SfxBaseModel::getTypes(),
+ uno::Sequence {
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XMultiServiceFactory>::get(),
+ cppu::UnoType<drawing::XDrawPagesSupplier>::get(),
+ cppu::UnoType<css::ucb::XAnyCompareFactory>::get() });
}
-
return maTypeSequence;
}
diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx
index 9e78b7ea574d..d09758602172 100644
--- a/svx/source/unodraw/unopool.cxx
+++ b/svx/source/unodraw/unopool.cxx
@@ -358,16 +358,13 @@ void SAL_CALL SvxUnoDrawPool::release() throw ( )
uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawPool::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 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/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx
index 89a2b316c269..da2f64c9ae87 100644
--- a/svx/source/unogallery/unogalitem.cxx
+++ b/svx/source/unogallery/unogalitem.cxx
@@ -131,16 +131,13 @@ uno::Sequence< OUString > SAL_CALL GalleryItem::getSupportedServiceNames()
uno::Sequence< uno::Type > SAL_CALL GalleryItem::getTypes()
{
- uno::Sequence< uno::Type > aTypes( 6 );
- uno::Type* pTypes = aTypes.getArray();
-
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<gallery::XGalleryItem>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
-
+ static const uno::Sequence aTypes {
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<gallery::XGalleryItem>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get() };
return aTypes;
}
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index dbdfb5a2a79b..7d81cfc3e309 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -83,15 +83,13 @@ uno::Sequence< OUString > SAL_CALL GalleryTheme::getSupportedServiceNames()
uno::Sequence< uno::Type > SAL_CALL GalleryTheme::getTypes()
{
- uno::Sequence< uno::Type > aTypes( 5 );
- uno::Type* pTypes = aTypes.getArray();
-
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<container::XElementAccess>::get();
- *pTypes++ = cppu::UnoType<container::XIndexAccess>::get();
- *pTypes++ = cppu::UnoType<gallery::XGalleryTheme>::get();
-
+ static const uno::Sequence aTypes {
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<container::XElementAccess>::get(),
+ cppu::UnoType<container::XIndexAccess>::get(),
+ cppu::UnoType<gallery::XGalleryTheme>::get(),
+ };
return aTypes;
}
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
index 668ab6751ade..d044c347336a 100644
--- a/svx/source/unogallery/unogalthemeprovider.cxx
+++ b/svx/source/unogallery/unogalthemeprovider.cxx
@@ -103,15 +103,13 @@ uno::Sequence< OUString > SAL_CALL GalleryThemeProvider::getSupportedServiceName
uno::Sequence< uno::Type > SAL_CALL GalleryThemeProvider::getTypes()
{
- uno::Sequence< uno::Type > aTypes( 6 );
- uno::Type* pTypes = aTypes.getArray();
-
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XInitialization>::get();
- *pTypes++ = cppu::UnoType<container::XElementAccess>::get();
- *pTypes++ = cppu::UnoType<container::XNameAccess>::get();
- *pTypes++ = cppu::UnoType<gallery::XGalleryThemeProvider>::get();
+ static const uno::Sequence aTypes {
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XInitialization>::get(),
+ cppu::UnoType<container::XElementAccess>::get(),
+ cppu::UnoType<container::XNameAccess>::get(),
+ cppu::UnoType<gallery::XGalleryThemeProvider>::get() };
return aTypes;
}