From 8d414f3a8de5c25bcd830b1d4d8a7be3c34a2ed4 Mon Sep 17 00:00:00 2001 From: Michael Warner Date: Sat, 30 May 2020 22:18:29 -0400 Subject: 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 Tested-by: Jenkins --- .../accessibility/AccessibleGraphicShape.cxx | 12 +----- svx/source/accessibility/AccessibleOLEShape.cxx | 12 +----- svx/source/accessibility/AccessibleShape.cxx | 45 ++++++---------------- svx/source/table/accessiblecell.cxx | 13 ++----- 4 files changed, 18 insertions(+), 64 deletions(-) (limited to 'svx') 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 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 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 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 #include #include +#include #include "AccessibleEmptyEditSource.hxx" #include @@ -863,16 +864,8 @@ uno::Sequence SAL_CALL AccessibleShape::getSupportedServiceNames() { ThrowIfDisposed (); - // Get list of supported service names from base class... - uno::Sequence 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 vals { "com.sun.star.drawing.AccessibleShape" }; + return comphelper::concatSequences(AccessibleContextBase::getSupportedServiceNames(), vals); } // XTypeProvider @@ -884,30 +877,14 @@ uno::Sequence SAL_CALL uno::Sequence aTypeList (AccessibleContextBase::getTypes()); // ... get list of types from component base implementation, ... uno::Sequence aComponentTypeList (AccessibleComponentBase::getTypes()); - // ... define local types, ... - const uno::Type aLangEventListenerType = - cppu::UnoType::get(); - const uno::Type aDocumentEventListenerType = - cppu::UnoType::get(); - const uno::Type aUnoTunnelType = - cppu::UnoType::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 localTypesList = { + cppu::UnoType::get(), + cppu::UnoType::get(), + cppu::UnoType::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 #include +#include #include #include #include @@ -461,16 +462,8 @@ OUString SAL_CALL AccessibleCell::getImplementationName() Sequence SAL_CALL AccessibleCell::getSupportedServiceNames() { ThrowIfDisposed (); - - // Get list of supported service names from base class... - uno::Sequence 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 vals { "com.sun.star.drawing.AccessibleCell" }; + return comphelper::concatSequences(AccessibleContextBase::getSupportedServiceNames(), vals); } -- cgit