diff options
author | Michael Warner <michael.warner.ut+libreoffice@gmail.com> | 2020-05-30 22:18:29 -0400 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-06-10 08:17:31 +0200 |
commit | 8d414f3a8de5c25bcd830b1d4d8a7be3c34a2ed4 (patch) | |
tree | 691330daeb9d5512933a752a67b705cd2b7dcdc8 /svx | |
parent | 7f6d7a0eb624d67421cd5af6462ee2a662fdff3a (diff) |
tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctor
Change-Id: Id747848b222f69af3293a2095a62542f1e1116d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95215
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/accessibility/AccessibleGraphicShape.cxx | 12 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleOLEShape.cxx | 12 | ||||
-rw-r--r-- | svx/source/accessibility/AccessibleShape.cxx | 45 | ||||
-rw-r--r-- | svx/source/table/accessiblecell.cxx | 13 |
4 files changed, 18 insertions, 64 deletions
diff --git a/svx/source/accessibility/AccessibleGraphicShape.cxx b/svx/source/accessibility/AccessibleGraphicShape.cxx index 10f42222d8b2..c7fe3c6fe40b 100644 --- a/svx/source/accessibility/AccessibleGraphicShape.cxx +++ b/svx/source/accessibility/AccessibleGraphicShape.cxx @@ -104,16 +104,8 @@ css::uno::Sequence< OUString> SAL_CALL AccessibleGraphicShape::getSupportedServiceNames() { ThrowIfDisposed (); - // Get list of supported service names from base class... - uno::Sequence<OUString> aServiceNames = - AccessibleShape::getSupportedServiceNames(); - sal_Int32 nCount (aServiceNames.getLength()); - - // ...and add additional names. - aServiceNames.realloc (nCount + 1); - aServiceNames[nCount] = "com.sun.star.drawing.AccessibleGraphicShape"; - - return aServiceNames; + const css::uno::Sequence<OUString> vals { "com.sun.star.drawing.AccessibleGraphicShape" }; + return comphelper::concatSequences(AccessibleShape::getSupportedServiceNames(), vals); } // XTypeProvider diff --git a/svx/source/accessibility/AccessibleOLEShape.cxx b/svx/source/accessibility/AccessibleOLEShape.cxx index daf3fb29c42b..ea5aca82dc07 100644 --- a/svx/source/accessibility/AccessibleOLEShape.cxx +++ b/svx/source/accessibility/AccessibleOLEShape.cxx @@ -111,16 +111,8 @@ css::uno::Sequence< OUString> SAL_CALL AccessibleOLEShape::getSupportedServiceNames() { ThrowIfDisposed(); - // Get list of supported service names from base class... - uno::Sequence< OUString > aServiceNames = - AccessibleShape::getSupportedServiceNames(); - sal_Int32 nCount (aServiceNames.getLength()); - - // ...and add additional names. - aServiceNames.realloc (nCount + 1); - aServiceNames[nCount] = "com.sun.star.drawing.AccessibleOLEShape"; - - return aServiceNames; + const css::uno::Sequence<OUString> vals { "com.sun.star.drawing.AccessibleOLEShape" }; + return comphelper::concatSequences(AccessibleShape::getSupportedServiceNames(), vals); } // XTypeProvider diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 6842d7655544..3285f1ceb037 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -48,6 +48,7 @@ #include <svx/svdview.hxx> #include <tools/diagnose_ex.h> #include <cppuhelper/queryinterface.hxx> +#include <comphelper/sequence.hxx> #include "AccessibleEmptyEditSource.hxx" #include <algorithm> @@ -863,16 +864,8 @@ uno::Sequence<OUString> SAL_CALL AccessibleShape::getSupportedServiceNames() { ThrowIfDisposed (); - // Get list of supported service names from base class... - uno::Sequence<OUString> aServiceNames = - AccessibleContextBase::getSupportedServiceNames(); - sal_Int32 nCount (aServiceNames.getLength()); - - // ...and add additional names. - aServiceNames.realloc (nCount + 1); - aServiceNames[nCount] = "com.sun.star.drawing.AccessibleShape"; - - return aServiceNames; + const css::uno::Sequence<OUString> vals { "com.sun.star.drawing.AccessibleShape" }; + return comphelper::concatSequences(AccessibleContextBase::getSupportedServiceNames(), vals); } // XTypeProvider @@ -884,30 +877,14 @@ uno::Sequence<uno::Type> SAL_CALL uno::Sequence<uno::Type> aTypeList (AccessibleContextBase::getTypes()); // ... get list of types from component base implementation, ... uno::Sequence<uno::Type> aComponentTypeList (AccessibleComponentBase::getTypes()); - // ... define local types, ... - const uno::Type aLangEventListenerType = - cppu::UnoType<lang::XEventListener>::get(); - const uno::Type aDocumentEventListenerType = - cppu::UnoType<document::XEventListener>::get(); - const uno::Type aUnoTunnelType = - cppu::UnoType<lang::XUnoTunnel>::get(); - - // ... and merge them all into one list. - sal_Int32 nTypeCount (aTypeList.getLength()), - nComponentTypeCount (aComponentTypeList.getLength()); - - aTypeList.realloc (nTypeCount + nComponentTypeCount + 3); - - std::copy(aComponentTypeList.begin(), aComponentTypeList.end(), - std::next(aTypeList.begin(), nTypeCount)); - - int i = nTypeCount + nComponentTypeCount; - - aTypeList[ i++ ] = aLangEventListenerType; - aTypeList[ i++ ] = aDocumentEventListenerType; - aTypeList[ i ] = aUnoTunnelType; - - return aTypeList; + // ... define local types + uno::Sequence<uno::Type> localTypesList = { + cppu::UnoType<lang::XEventListener>::get(), + cppu::UnoType<document::XEventListener>::get(), + cppu::UnoType<lang::XUnoTunnel>::get() + }; + + return comphelper::concatSequences(aTypeList, aComponentTypeList, localTypesList); } // lang::XEventListener diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 9c4b689490c0..2a584ff58dd8 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -34,6 +34,7 @@ #include <unotools/accessiblestatesethelper.hxx> #include <comphelper/string.hxx> +#include <comphelper/sequence.hxx> #include <svx/IAccessibleViewForwarder.hxx> #include <svx/unoshtxt.hxx> #include <svx/svdotext.hxx> @@ -461,16 +462,8 @@ OUString SAL_CALL AccessibleCell::getImplementationName() Sequence<OUString> SAL_CALL AccessibleCell::getSupportedServiceNames() { ThrowIfDisposed (); - - // Get list of supported service names from base class... - uno::Sequence<OUString> aServiceNames = AccessibleContextBase::getSupportedServiceNames(); - sal_Int32 nCount (aServiceNames.getLength()); - - // ...and add additional names. - aServiceNames.realloc (nCount + 1); - aServiceNames[nCount] = "com.sun.star.drawing.AccessibleCell"; - - return aServiceNames; + const css::uno::Sequence<OUString> vals { "com.sun.star.drawing.AccessibleCell" }; + return comphelper::concatSequences(AccessibleContextBase::getSupportedServiceNames(), vals); } |