summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx46
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx46
-rw-r--r--sd/source/ui/unoidl/unopage.cxx26
3 files changed, 38 insertions, 80 deletions
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index d52da42fd1ab..6ebc32ad74e9 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -428,40 +428,18 @@ css::uno::Sequence< css::uno::Type> SAL_CALL
{
ThrowIfDisposed ();
- // Get list of types from the context base implementation, ...
- uno::Sequence<uno::Type> aTypeList (AccessibleContextBase::getTypes());
- // ... get list of types from component base implementation, ...
- uno::Sequence<uno::Type> aComponentTypeList (AccessibleComponentBase::getTypes());
-
- // ...and add the additional type for the component, ...
- const uno::Type aLangEventListenerType =
- cppu::UnoType<lang::XEventListener>::get();
- const uno::Type aPropertyChangeListenerType =
- cppu::UnoType<beans::XPropertyChangeListener>::get();
- const uno::Type aWindowListenerType =
- cppu::UnoType<awt::XWindowListener>::get();
- const uno::Type aFocusListenerType =
- cppu::UnoType<awt::XFocusListener>::get();
- const uno::Type aEventBroadcaster =
- cppu::UnoType<XAccessibleEventBroadcaster>::get();
-
- // ... and merge them all into one list.
- sal_Int32 nTypeCount (aTypeList.getLength()),
- nComponentTypeCount (aComponentTypeList.getLength()),
- i;
-
- aTypeList.realloc (nTypeCount + nComponentTypeCount + 5);
-
- for (i=0; i<nComponentTypeCount; i++)
- aTypeList[nTypeCount + i] = aComponentTypeList[i];
-
- aTypeList[nTypeCount + i++ ] = aLangEventListenerType;
- aTypeList[nTypeCount + i++] = aPropertyChangeListenerType;
- aTypeList[nTypeCount + i++] = aWindowListenerType;
- aTypeList[nTypeCount + i++] = aFocusListenerType;
- aTypeList[nTypeCount + i++] = aEventBroadcaster;
-
- return aTypeList;
+ return comphelper::concatSequences(
+ // Get list of types from the context base implementation, ...
+ AccessibleContextBase::getTypes(),
+ // ... get list of types from component base implementation, ...
+ AccessibleComponentBase::getTypes(),
+ // ...and add the additional type for the component, ...
+ css::uno::Sequence {
+ cppu::UnoType<lang::XEventListener>::get(),
+ cppu::UnoType<beans::XPropertyChangeListener>::get(),
+ cppu::UnoType<awt::XWindowListener>::get(),
+ cppu::UnoType<awt::XFocusListener>::get(),
+ cppu::UnoType<XAccessibleEventBroadcaster>::get() });
}
void AccessibleDocumentViewBase::impl_dispose()
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b9e8463f38d3..ca453c80d2b5 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -375,35 +375,29 @@ uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::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 = mbImpressDoc ? 14 : 11; // !DANGER! Keep this updated!
-
- maTypeSequence.realloc( nBaseTypes + nOwnTypes );
- uno::Type* pTypes = maTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XMultiServiceFactory>::get();
- *pTypes++ = cppu::UnoType<drawing::XDrawPageDuplicator>::get();
- *pTypes++ = cppu::UnoType<drawing::XLayerSupplier>::get();
- *pTypes++ = cppu::UnoType<drawing::XMasterPagesSupplier>::get();
- *pTypes++ = cppu::UnoType<drawing::XDrawPagesSupplier>::get();
- *pTypes++ = cppu::UnoType<document::XLinkTargetSupplier>::get();
- *pTypes++ = cppu::UnoType<style::XStyleFamiliesSupplier>::get();
- *pTypes++ = cppu::UnoType<css::ucb::XAnyCompareFactory>::get();
- *pTypes++ = cppu::UnoType<view::XRenderable>::get();
+ uno::Sequence< uno::Type > aTypes( SfxBaseModel::getTypes() );
+ aTypes = comphelper::concatSequences(aTypes,
+ uno::Sequence {
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XMultiServiceFactory>::get(),
+ cppu::UnoType<drawing::XDrawPageDuplicator>::get(),
+ cppu::UnoType<drawing::XLayerSupplier>::get(),
+ cppu::UnoType<drawing::XMasterPagesSupplier>::get(),
+ cppu::UnoType<drawing::XDrawPagesSupplier>::get(),
+ cppu::UnoType<document::XLinkTargetSupplier>::get(),
+ cppu::UnoType<style::XStyleFamiliesSupplier>::get(),
+ cppu::UnoType<css::ucb::XAnyCompareFactory>::get(),
+ cppu::UnoType<view::XRenderable>::get() });
if( mbImpressDoc )
{
- *pTypes++ = cppu::UnoType<presentation::XPresentationSupplier>::get();
- *pTypes++ = cppu::UnoType<presentation::XCustomPresentationSupplier>::get();
- *pTypes++ = cppu::UnoType<presentation::XHandoutMasterSupplier>::get();
+ aTypes = comphelper::concatSequences(aTypes,
+ uno::Sequence {
+ cppu::UnoType<presentation::XPresentationSupplier>::get(),
+ cppu::UnoType<presentation::XCustomPresentationSupplier>::get(),
+ cppu::UnoType<presentation::XHandoutMasterSupplier>::get() });
}
-
- for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
- *pTypes++ = *pBaseTypes++;
+ maTypeSequence = aTypes;
}
return maTypeSequence;
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 48d6c0a56e43..7cf3e87c4a6c 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2081,17 +2081,10 @@ Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes()
aTypes.push_back(cppu::UnoType<XAnimationNodeSupplier>::get());
// Get types of base class.
- const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
- const sal_Int32 nBaseTypes = aBaseTypes.getLength();
- const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
-
// Join those types in a sequence.
- maTypeSequence.realloc(aTypes.size() + nBaseTypes);
- uno::Type* pTypes = maTypeSequence.getArray();
- for (const auto& rType : aTypes)
- *pTypes++ = rType;
- for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
- *pTypes++ = *pBaseTypes++;
+ return comphelper::concatSequences(
+ comphelper::containerToSequence(aTypes),
+ SdGenericDrawPage::getTypes() );
}
return maTypeSequence;
@@ -2705,17 +2698,10 @@ Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes()
aTypes.push_back(cppu::UnoType<XAnimationNodeSupplier>::get());
// Get types of base class.
- const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
- const sal_Int32 nBaseTypes = aBaseTypes.getLength();
- const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
-
// Join those types in a sequence.
- maTypeSequence.realloc(aTypes.size() + nBaseTypes);
- uno::Type* pTypes = maTypeSequence.getArray();
- for (const auto& rType : aTypes)
- *pTypes++ = rType;
- for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
- *pTypes++ = *pBaseTypes++;
+ return comphelper::concatSequences(
+ comphelper::containerToSequence(aTypes),
+ SdGenericDrawPage::getTypes() );
}
return maTypeSequence;