diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-02 08:28:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-03-04 08:52:39 +0100 |
commit | 28239c40430ec4e613d9d936614c5c3853c332c4 (patch) | |
tree | 0fa6bc36c05f8f42a0799b884ed38eb3e569ff90 /svx/source/accessibility | |
parent | 85b7e7fdd7f283a3084e2db0dd8e71a48fac228d (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/source/accessibility')
-rw-r--r-- | svx/source/accessibility/AccessibleControlShape.cxx | 18 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleGraphicShape.cxx | 12 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleOLEShape.cxx | 15 |
3 files changed, 8 insertions, 37 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 |