diff options
56 files changed, 326 insertions, 659 deletions
diff --git a/basctl/source/basicide/unomodel.cxx b/basctl/source/basicide/unomodel.cxx index b85090a04833..5bfe9e1c5b91 100644 --- a/basctl/source/basicide/unomodel.cxx +++ b/basctl/source/basicide/unomodel.cxx @@ -21,6 +21,7 @@ #include "basdoc.hxx" #include <iderdll.hxx> #include <com/sun/star/io/IOException.hpp> +#include <comphelper/sequence.hxx> #include <sfx2/objsh.hxx> #include <vcl/svapp.hxx> @@ -70,13 +71,9 @@ void SAL_CALL SIDEModel::release() throw() uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( ) { - uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes(); - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 1); - uno::Type* pTypes = aTypes.getArray(); - pTypes[nLen++] = cppu::UnoType<XServiceInfo>::get(); - - return aTypes; + return comphelper::concatSequences( + SfxBaseModel::getTypes(), + uno::Sequence { cppu::UnoType<XServiceInfo>::get() }); } OUString SIDEModel::getImplementationName() diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index c7da7a7f6e21..23a279485afa 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -38,6 +38,7 @@ #include <basic/basrdll.hxx> #include <sbobjmod.hxx> #include <basic/vbahelper.hxx> +#include <comphelper/sequence.hxx> #include <cppuhelper/implbase.hxx> #include <unotools/eventcfg.hxx> #include <com/sun/star/frame/Desktop.hpp> @@ -175,19 +176,8 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes() { sTypes = m_xAggregateTypeProv->getTypes(); } - m_Types.realloc( sTypes.getLength() + 1 ); - Type* pPtr = m_Types.getArray(); - for ( int i=0; i<m_Types.getLength(); ++i, ++pPtr ) - { - if ( i == 0 ) - { - *pPtr = cppu::UnoType<XInvocation>::get(); - } - else - { - *pPtr = sTypes[ i - 1 ]; - } - } + m_Types = comphelper::concatSequences(sTypes, + Sequence { cppu::UnoType<XInvocation>::get() }); } return m_Types; } diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 1940b16f04c3..c05047bce6af 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -631,15 +631,9 @@ uno::Sequence< uno::Type > SAL_CALL ChartModel::getTypes() if( (m_xOldModelAgg->queryAggregation( cppu::UnoType<decltype(xAggTypeProvider)>::get()) >>= xAggTypeProvider) && xAggTypeProvider.is()) { - uno::Sequence< uno::Type > aOwnTypes( impl::ChartModel_Base::getTypes()); - uno::Sequence< uno::Type > aAggTypes( xAggTypeProvider->getTypes()); - uno::Sequence< uno::Type > aResult( aOwnTypes.getLength() + aAggTypes.getLength()); - sal_Int32 i=0; - for( ;i<aOwnTypes.getLength(); ++i ) - aResult[i] = aOwnTypes[i]; - for( sal_Int32 j=0; i<aResult.getLength(); ++j, ++i) - aResult[i] = aAggTypes[j]; - return aResult; + return comphelper::concatSequences( + impl::ChartModel_Base::getTypes(), + xAggTypeProvider->getTypes()); } return impl::ChartModel_Base::getTypes(); diff --git a/comphelper/source/misc/proxyaggregation.cxx b/comphelper/source/misc/proxyaggregation.cxx index 764dc92d91f1..3ace74436dfc 100644 --- a/comphelper/source/misc/proxyaggregation.cxx +++ b/comphelper/source/misc/proxyaggregation.cxx @@ -206,14 +206,10 @@ namespace comphelper Sequence< Type > SAL_CALL OComponentProxyAggregation::getTypes( ) { - Sequence< Type > aTypes( OComponentProxyAggregationHelper::getTypes() ); - - // append XComponent, coming from WeakComponentImplHelperBase - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc( nLen + 1 ); - aTypes[ nLen ] = cppu::UnoType<XComponent>::get(); - - return aTypes; + return comphelper::concatSequences( + OComponentProxyAggregationHelper::getTypes(), + // append XComponent, coming from WeakComponentImplHelperBase + Sequence { cppu::UnoType<XComponent>::get() }); } diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index aaf94149ce40..af224f822ede 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -214,16 +214,12 @@ void SAL_CALL GenericPropertySet::release() throw() uno::Sequence< uno::Type > SAL_CALL GenericPropertySet::getTypes() { - uno::Sequence< uno::Type > aTypes( 5 ); - uno::Type* pTypes = aTypes.getArray(); - - *pTypes++ = cppu::UnoType<XAggregation>::get(); - *pTypes++ = cppu::UnoType<XServiceInfo>::get(); - *pTypes++ = cppu::UnoType<XTypeProvider>::get(); - *pTypes++ = cppu::UnoType<XPropertySet>::get(); - *pTypes++ = cppu::UnoType<XMultiPropertySet>::get(); - - return aTypes; + return uno::Sequence { + cppu::UnoType<XAggregation>::get(), + cppu::UnoType<XServiceInfo>::get(), + cppu::UnoType<XTypeProvider>::get(), + cppu::UnoType<XPropertySet>::get(), + cppu::UnoType<XMultiPropertySet>::get() }; } uno::Sequence< sal_Int8 > SAL_CALL GenericPropertySet::getImplementationId() diff --git a/comphelper/source/property/propstate.cxx b/comphelper/source/property/propstate.cxx index 346fcce44624..89cfa081df3f 100644 --- a/comphelper/source/property/propstate.cxx +++ b/comphelper/source/property/propstate.cxx @@ -187,12 +187,10 @@ namespace comphelper Sequence< Type > SAL_CALL OStatefulPropertySet::getTypes() { - Sequence< Type > aOwnTypes( 2 ); - aOwnTypes[0] = cppu::UnoType<XWeak>::get(); - aOwnTypes[1] = cppu::UnoType<XTypeProvider>::get(); - return concatSequences( - aOwnTypes, + Sequence { + cppu::UnoType<XWeak>::get(), + cppu::UnoType<XTypeProvider>::get() }, OPropertyStateHelper::getTypes() ); } diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx index 08a89a539a32..16493fddfe66 100644 --- a/connectivity/source/commontools/paramwrapper.cxx +++ b/connectivity/source/commontools/paramwrapper.cxx @@ -115,13 +115,13 @@ namespace param Sequence< Type > SAL_CALL ParameterWrapper::getTypes( ) { - Sequence< Type > aTypes( 5 ); - aTypes[ 0 ] = cppu::UnoType<XWeak>::get(); - aTypes[ 1 ] = cppu::UnoType<XTypeProvider>::get(); - aTypes[ 2 ] = cppu::UnoType<XPropertySet>::get(); - aTypes[ 3 ] = cppu::UnoType<XFastPropertySet>::get(); - aTypes[ 4 ] = cppu::UnoType<XMultiPropertySet>::get(); - return aTypes; + return Sequence< Type > { + cppu::UnoType<XWeak>::get(), + cppu::UnoType<XTypeProvider>::get(), + cppu::UnoType<XPropertySet>::get(), + cppu::UnoType<XFastPropertySet>::get(), + cppu::UnoType<XMultiPropertySet>::get() + }; } diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 42e7e18e3015..f88da7d73e38 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -185,13 +185,9 @@ Any SAL_CALL SbaXGridControl::queryInterface(const Type& _rType) Sequence< Type > SAL_CALL SbaXGridControl::getTypes( ) { - Sequence< Type > aTypes = FmXGridControl::getTypes(); - - sal_Int32 nTypes = aTypes.getLength(); - aTypes.realloc(nTypes + 1); - aTypes[nTypes] = cppu::UnoType<css::frame::XDispatch>::get(); - - return aTypes; + return comphelper::concatSequences( + FmXGridControl::getTypes(), + Sequence { cppu::UnoType<css::frame::XDispatch>::get() }); } Sequence< sal_Int8 > SAL_CALL SbaXGridControl::getImplementationId( ) @@ -521,12 +517,9 @@ const Sequence< sal_Int8 > & SbaXGridPeer::getUnoTunnelId() Sequence< Type > SAL_CALL SbaXGridPeer::getTypes() { - Sequence< Type > aTypes = FmXGridPeer::getTypes(); - sal_Int32 nOldLen = aTypes.getLength(); - aTypes.realloc(nOldLen + 1); - aTypes.getArray()[nOldLen] = cppu::UnoType<css::frame::XDispatch>::get(); - - return aTypes; + return comphelper::concatSequences( + FmXGridPeer::getTypes(), + Sequence { cppu::UnoType<css::frame::XDispatch>::get() }); } // return implementation specific data diff --git a/editeng/source/accessibility/AccessibleComponentBase.cxx b/editeng/source/accessibility/AccessibleComponentBase.cxx index 69052ea4dd65..4647f074ab76 100644 --- a/editeng/source/accessibility/AccessibleComponentBase.cxx +++ b/editeng/source/accessibility/AccessibleComponentBase.cxx @@ -143,16 +143,9 @@ OUString SAL_CALL AccessibleComponentBase::getToolTipText() uno::Sequence<uno::Type> AccessibleComponentBase::getTypes() { - // Get list of types from the context base implementation... - uno::Sequence<uno::Type> aTypeList (2); - // ...and add the additional type for the component. - const uno::Type aComponentType = - cppu::UnoType<XAccessibleComponent>::get(); - const uno::Type aExtendedComponentType = - cppu::UnoType<XAccessibleExtendedComponent>::get(); - aTypeList[0] = aComponentType; - aTypeList[1] = aExtendedComponentType; - + static const uno::Sequence aTypeList { + cppu::UnoType<XAccessibleComponent>::get(), + cppu::UnoType<XAccessibleExtendedComponent>::get() }; return aTypeList; } diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index de977939f430..ea19e3e5e5aa 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -30,6 +30,7 @@ #include <editeng/measfld.hxx> #include <editeng/unofield.hxx> #include <editeng/unotext.hxx> +#include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <sal/log.hxx> @@ -577,16 +578,13 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes() { if( maTypeSequence.getLength() == 0 ) { - maTypeSequence = OComponentHelper::getTypes(); - sal_Int32 nOldCount = maTypeSequence.getLength(); - - maTypeSequence.realloc( nOldCount + 4 ); // !DANGER! keep this updated - uno::Type* pTypes = &maTypeSequence.getArray()[nOldCount]; - - *pTypes++ = cppu::UnoType<text::XTextField>::get(); - *pTypes++ = cppu::UnoType<beans::XPropertySet>::get(); - *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get(); - *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get(); + maTypeSequence = comphelper::concatSequences( + OComponentHelper::getTypes(), + uno::Sequence { + cppu::UnoType<text::XTextField>::get(), + cppu::UnoType<beans::XPropertySet>::get(), + cppu::UnoType<lang::XServiceInfo>::get(), + cppu::UnoType<lang::XUnoTunnel>::get() }); } return maTypeSequence; } diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx index f4e864089e91..be989a78e6eb 100644 --- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx +++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx @@ -710,9 +710,8 @@ OUString SAL_CALL ScAccessibleCsvRuler::getImplementationName() Sequence< css::uno::Type > SAL_CALL ScAccessibleCsvRuler::getTypes() { - Sequence< css::uno::Type > aSeq( 1 ); - aSeq[ 0 ] = cppu::UnoType<XAccessibleText>::get(); - return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(), aSeq ); + return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(), + Sequence { cppu::UnoType<XAccessibleText>::get() }); } Sequence< sal_Int8 > SAL_CALL ScAccessibleCsvRuler::getImplementationId() @@ -1194,10 +1193,10 @@ OUString SAL_CALL ScAccessibleCsvGrid::getImplementationName() Sequence< css::uno::Type > SAL_CALL ScAccessibleCsvGrid::getTypes() { - Sequence< css::uno::Type > aSeq( 2 ); - aSeq[ 0 ] = cppu::UnoType<XAccessibleTable>::get(); - aSeq[ 1 ] = cppu::UnoType<XAccessibleSelection>::get(); - return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(), aSeq ); + return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(), + Sequence { + cppu::UnoType<XAccessibleTable>::get(), + cppu::UnoType<XAccessibleSelection>::get() }); } Sequence< sal_Int8 > SAL_CALL ScAccessibleCsvGrid::getImplementationId() diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 4afafe7c91fb..c87a185a9913 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -8483,10 +8483,9 @@ void SAL_CALL ScTableColumnObj::release() throw() uno::Sequence<uno::Type> SAL_CALL ScTableColumnObj::getTypes() { - static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences( + return comphelper::concatSequences( ScCellRangeObj::getTypes(), uno::Sequence<uno::Type> { cppu::UnoType<container::XNamed>::get() } ); - return aTypes; } uno::Sequence<sal_Int8> SAL_CALL ScTableColumnObj::getImplementationId() diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 8886ee8b4f51..b676dba40a46 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -67,7 +67,7 @@ void SAL_CALL ScCellCursorObj::release() throw() uno::Sequence<uno::Type> SAL_CALL ScCellCursorObj::getTypes() { - static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences( + return comphelper::concatSequences( ScCellRangeObj::getTypes(), uno::Sequence<uno::Type> { @@ -75,7 +75,6 @@ uno::Sequence<uno::Type> SAL_CALL ScCellCursorObj::getTypes() cppu::UnoType<sheet::XUsedAreaCursor>::get(), cppu::UnoType<table::XCellCursor>::get() } ); - return aTypes; } uno::Sequence<sal_Int8> SAL_CALL ScCellCursorObj::getImplementationId() diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index afb58aa355f3..ab921ea659b5 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1091,14 +1091,13 @@ void SAL_CALL ScDataPilotTableObj::release() throw() Sequence< uno::Type > SAL_CALL ScDataPilotTableObj::getTypes() { - static const Sequence< uno::Type > aTypes = comphelper::concatSequences( + return comphelper::concatSequences( ScDataPilotDescriptorBase::getTypes(), Sequence< uno::Type > { cppu::UnoType<XDataPilotTable2>::get(), cppu::UnoType<XModifyBroadcaster>::get() } ); - return aTypes; } Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId() diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 298d73392899..e7377282900d 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -1335,7 +1335,7 @@ uno::Sequence<OUString> SAL_CALL ScEditFieldObj::getSupportedServiceNames() uno::Sequence<uno::Type> SAL_CALL ScEditFieldObj::getTypes() { - static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences( + return comphelper::concatSequences( OComponentHelper::getTypes(), uno::Sequence<uno::Type> { @@ -1344,7 +1344,6 @@ uno::Sequence<uno::Type> SAL_CALL ScEditFieldObj::getTypes() cppu::UnoType<lang::XUnoTunnel>::get(), cppu::UnoType<lang::XServiceInfo>::get() } ); - return aTypes; } uno::Sequence<sal_Int8> SAL_CALL ScEditFieldObj::getImplementationId() diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 576a9d6e43a2..ebf219248295 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -157,7 +157,7 @@ uno::Any SAL_CALL ScViewPaneBase::queryInterface( const uno::Type& rType ) uno::Sequence<uno::Type> SAL_CALL ScViewPaneBase::getTypes() { - static uno::Sequence<uno::Type> aTypes + static const uno::Sequence<uno::Type> aTypes { cppu::UnoType<sheet::XViewPane>::get(), cppu::UnoType<sheet::XCellRangeReferrer>::get(), @@ -576,7 +576,7 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved ) uno::Sequence<uno::Type> SAL_CALL ScTabViewObj::getTypes() { - static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences( + return comphelper::concatSequences( ScViewPaneBase::getTypes(), SfxBaseController::getTypes(), uno::Sequence<uno::Type> @@ -594,7 +594,6 @@ uno::Sequence<uno::Type> SAL_CALL ScTabViewObj::getTypes() cppu::UnoType<sheet::XActivationBroadcaster>::get(), cppu::UnoType<datatransfer::XTransferableSupplier>::get() } ); - return aTypes; } uno::Sequence<sal_Int8> SAL_CALL ScTabViewObj::getImplementationId() 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; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index a3ae716c8e4d..73dc76130dc6 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/script/XLibraryContainer.hpp> #include <comphelper/propertysetinfo.hxx> +#include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/moduleoptions.hxx> @@ -343,17 +344,12 @@ void SAL_CALL SmModel::release() throw() uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes( ) { - SolarMutexGuard aGuard; - uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes(); - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 4); - uno::Type* pTypes = aTypes.getArray(); - pTypes[nLen++] = cppu::UnoType<XServiceInfo>::get(); - pTypes[nLen++] = cppu::UnoType<XPropertySet>::get(); - pTypes[nLen++] = cppu::UnoType<XMultiPropertySet>::get(); - pTypes[nLen++] = cppu::UnoType<XRenderable>::get(); - - return aTypes; + return comphelper::concatSequences(SfxBaseModel::getTypes(), + uno::Sequence { + cppu::UnoType<XServiceInfo>::get(), + cppu::UnoType<XPropertySet>::get(), + cppu::UnoType<XMultiPropertySet>::get(), + cppu::UnoType<XRenderable>::get() }); } namespace diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index a4eec6a2fb76..81358c62cd59 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -18,6 +18,7 @@ */ #include <osl/mutex.hxx> +#include <comphelper/sequence.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/weak.hxx> @@ -50,6 +51,7 @@ #include <com/sun/star/registry/XRegistryKey.hpp> #include <memory> +#include <vector> #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> @@ -971,62 +973,38 @@ void Invocation_Impl::fillInfoForMethod Sequence< Type > SAL_CALL Invocation_Impl::getTypes() { static Sequence<Type> s_types = [this]() { - Sequence<Type> types(4 + 10); - Type* pTypes = types.getArray(); - sal_Int32 n = 0; - - pTypes[n++] = cppu::UnoType<XTypeProvider>::get(); - pTypes[n++] = cppu::UnoType<XWeak>::get(); - pTypes[n++] = cppu::UnoType<XInvocation>::get(); - pTypes[n++] = cppu::UnoType<XMaterialHolder>::get(); + std::vector<Type> tmp { + cppu::UnoType<XTypeProvider>::get(), + cppu::UnoType<XWeak>::get(), + cppu::UnoType<XInvocation>::get(), + cppu::UnoType<XMaterialHolder>::get() }; // Invocation does not support XExactName if direct object supports // XInvocation, but not XExactName. if ((_xDirect.is() && _xENDirect.is()) || (!_xDirect.is() && _xENIntrospection.is())) - { - pTypes[n++] = cppu::UnoType<XExactName>::get(); - } + tmp.push_back(cppu::UnoType<XExactName>::get()); if (_xNameContainer.is()) - { - pTypes[n++] = cppu::UnoType<XNameContainer>::get(); - } + tmp.push_back(cppu::UnoType<XNameContainer>::get()); if (_xNameReplace.is()) - { - pTypes[n++] = cppu::UnoType<XNameReplace>::get(); - } + tmp.push_back(cppu::UnoType<XNameReplace>::get()); if (_xNameAccess.is()) - { - pTypes[n++] = cppu::UnoType<XNameAccess>::get(); - } + tmp.push_back(cppu::UnoType<XNameAccess>::get()); if (_xIndexContainer.is()) - { - pTypes[n++] = cppu::UnoType<XIndexContainer>::get(); - } + tmp.push_back(cppu::UnoType<XIndexContainer>::get()); if (_xIndexReplace.is()) - { - pTypes[n++] = cppu::UnoType<XIndexReplace>::get(); - } + tmp.push_back(cppu::UnoType<XIndexReplace>::get()); if (_xIndexAccess.is()) - { - pTypes[n++] = cppu::UnoType<XIndexAccess>::get(); - } + tmp.push_back(cppu::UnoType<XIndexAccess>::get()); if (_xEnumerationAccess.is()) - { - pTypes[n++] = cppu::UnoType<XEnumerationAccess>::get(); - } + tmp.push_back(cppu::UnoType<XEnumerationAccess>::get()); if (_xElementAccess.is()) - { - pTypes[n++] = cppu::UnoType<XElementAccess>::get(); - } + tmp.push_back(cppu::UnoType<XElementAccess>::get()); // Invocation does not support XInvocation2, if direct object supports // XInvocation, but not XInvocation2. if ((_xDirect.is() && _xDirect2.is()) || (!_xDirect.is() && _xIntrospectionAccess.is())) - { - pTypes[n++] = cppu::UnoType<XInvocation2>::get(); - } + tmp.push_back(cppu::UnoType<XInvocation2>::get()); - types.realloc(n); - return types; + return comphelper::containerToSequence(tmp); }(); return s_types; } diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index f928c278500b..d3eae55b363b 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -68,16 +68,11 @@ using namespace ::com::sun::star; struct FSStorage_Impl { OUString const m_aURL; - ::ucbhelper::Content m_aContent; sal_Int32 const m_nMode; - std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pListenersContainer; // list of listeners - std::unique_ptr<::cppu::OTypeCollection> m_pTypeCollection; - uno::Reference< uno::XComponentContext > m_xContext; - FSStorage_Impl( const ::ucbhelper::Content& aContent, sal_Int32 nMode, uno::Reference< uno::XComponentContext > const & xContext ) : m_aURL( aContent.getURL() ) , m_aContent( aContent ) @@ -259,21 +254,12 @@ void SAL_CALL FSStorage::release() throw() uno::Sequence< uno::Type > SAL_CALL FSStorage::getTypes() { - if ( m_pImpl->m_pTypeCollection == nullptr ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pImpl->m_pTypeCollection == nullptr ) - { - m_pImpl->m_pTypeCollection.reset(new ::cppu::OTypeCollection - ( cppu::UnoType<lang::XTypeProvider>::get() - , cppu::UnoType<embed::XStorage>::get() - , cppu::UnoType<embed::XHierarchicalStorageAccess>::get() - , cppu::UnoType<beans::XPropertySet>::get()) ); - } - } - - return m_pImpl->m_pTypeCollection->getTypes() ; + static const uno::Sequence<uno::Type> aTypes { + cppu::UnoType<lang::XTypeProvider>::get(), + cppu::UnoType<embed::XStorage>::get(), + cppu::UnoType<embed::XHierarchicalStorageAccess>::get(), + cppu::UnoType<beans::XPropertySet>::get() }; + return aTypes; } uno::Sequence< sal_Int8 > SAL_CALL FSStorage::getImplementationId() diff --git a/svl/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx index a26077b3c1f4..85a919df2b7c 100644 --- a/svl/source/fsstor/ostreamcontainer.cxx +++ b/svl/source/fsstor/ostreamcontainer.cxx @@ -20,6 +20,7 @@ #include "ostreamcontainer.hxx" #include <cppuhelper/queryinterface.hxx> +#include <comphelper/sequence.hxx> using namespace ::com::sun::star; @@ -28,7 +29,6 @@ OFSStreamContainer::OFSStreamContainer( const uno::Reference < io::XStream >& xS : m_bDisposed( false ) , m_bInputClosed( false ) , m_bOutputClosed( false ) -, m_pTypeCollection( nullptr ) { try { @@ -137,42 +137,31 @@ void SAL_CALL OFSStreamContainer::release() // XTypeProvider uno::Sequence< uno::Type > SAL_CALL OFSStreamContainer::getTypes() { - if ( m_pTypeCollection == nullptr ) + if ( m_aTypes.getLength() == 0 ) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pTypeCollection == nullptr ) + if ( m_aTypes.getLength() == 0 ) { - ::cppu::OTypeCollection aTypeCollection - ( cppu::UnoType<lang::XTypeProvider>::get() - , cppu::UnoType<embed::XExtendedStorageStream>::get()); + std::vector<uno::Type> tmp; + tmp.push_back(cppu::UnoType<lang::XTypeProvider>::get()); + tmp.push_back(cppu::UnoType<embed::XExtendedStorageStream>::get()); if ( m_xSeekable.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( cppu::UnoType<io::XSeekable>::get(), - aTypeCollection.getTypes() ); + tmp.push_back(cppu::UnoType<io::XSeekable>::get()); if ( m_xInputStream.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( cppu::UnoType<io::XInputStream>::get(), - aTypeCollection.getTypes() ); - + tmp.push_back(cppu::UnoType<io::XInputStream>::get()); if ( m_xOutputStream.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( cppu::UnoType<io::XOutputStream>::get(), - aTypeCollection.getTypes() ); + tmp.push_back(cppu::UnoType<io::XOutputStream>::get()); if ( m_xTruncate.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( cppu::UnoType<io::XTruncate>::get(), - aTypeCollection.getTypes() ); + tmp.push_back(cppu::UnoType<io::XTruncate>::get()); if ( m_xAsyncOutputMonitor.is() ) - aTypeCollection = ::cppu::OTypeCollection - ( cppu::UnoType<io::XAsyncOutputMonitor>::get(), - aTypeCollection.getTypes() ); + tmp.push_back(cppu::UnoType<io::XAsyncOutputMonitor>::get()); - m_pTypeCollection = new ::cppu::OTypeCollection( aTypeCollection ); + m_aTypes = comphelper::containerToSequence(tmp); } } - return m_pTypeCollection->getTypes() ; + return m_aTypes; } uno::Sequence< sal_Int8 > SAL_CALL OFSStreamContainer::getImplementationId() diff --git a/svl/source/fsstor/ostreamcontainer.hxx b/svl/source/fsstor/ostreamcontainer.hxx index a631817d05ba..5d255f44aab3 100644 --- a/svl/source/fsstor/ostreamcontainer.hxx +++ b/svl/source/fsstor/ostreamcontainer.hxx @@ -58,7 +58,7 @@ class OFSStreamContainer : public cppu::OWeakObject, bool m_bOutputClosed; std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pListenersContainer; // list of listeners - ::cppu::OTypeCollection* m_pTypeCollection; + css::uno::Sequence<css::uno::Type> m_aTypes; public: explicit OFSStreamContainer( const css::uno::Reference < css::io::XStream >& xStream ); diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index e39b860e3649..d8b971566980 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -158,17 +158,14 @@ uno::Sequence< OUString > SAL_CALL GraphicRendererVCL::getSupportedServiceNames( uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes() { - uno::Sequence< uno::Type > aTypes( 7 ); - 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(); - *pTypes++ = cppu::UnoType<graphic::XGraphicRenderer>::get(); - + static const uno::Sequence< uno::Type > 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(), + cppu::UnoType<graphic::XGraphicRenderer>::get() }; return aTypes; } diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 60a11d427659..e73dce78c1ee 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -149,14 +149,8 @@ void SAL_CALL ToolboxController::release() throw () css::uno::Sequence<css::uno::Type> ToolboxController::getTypes() { - css::uno::Sequence<css::uno::Type> s1(ToolboxController_Base::getTypes()); - css::uno::Sequence<css::uno::Type> s2(getBaseTypes()); - sal_Int32 n = s1.getLength(); - s1.realloc(n + s2.getLength()); - for (sal_Int32 i = 0; i != s2.getLength(); ++i) { - s1[n + i] = s2[i]; - } - return s1; + return comphelper::concatSequences(ToolboxController_Base::getTypes(), + getBaseTypes()); } void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments ) diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index cbfe92690b66..5e86ecf5c7df 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -338,17 +338,14 @@ void SAL_CALL SvUnoImageMapObject::release() throw() uno::Sequence< uno::Type > SAL_CALL SvUnoImageMapObject::getTypes() { - uno::Sequence< uno::Type > aTypes( 7 ); - uno::Type* pTypes = aTypes.getArray(); - - *pTypes++ = cppu::UnoType<XAggregation>::get(); - *pTypes++ = cppu::UnoType<XEventsSupplier>::get(); - *pTypes++ = cppu::UnoType<XServiceInfo>::get(); - *pTypes++ = cppu::UnoType<XPropertySet>::get(); - *pTypes++ = cppu::UnoType<XMultiPropertySet>::get(); - *pTypes++ = cppu::UnoType<XTypeProvider>::get(); - *pTypes++ = cppu::UnoType<XUnoTunnel>::get(); - + static const uno::Sequence< uno::Type > aTypes { + cppu::UnoType<XAggregation>::get(), + cppu::UnoType<XEventsSupplier>::get(), + cppu::UnoType<XServiceInfo>::get(), + cppu::UnoType<XPropertySet>::get(), + cppu::UnoType<XMultiPropertySet>::get(), + cppu::UnoType<XTypeProvider>::get(), + cppu::UnoType<XUnoTunnel>::get() }; return aTypes; } 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; } diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index f36b4f86691b..ac80522b1cb0 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -309,15 +309,9 @@ uno::Any SwAccessibleCell::queryInterface( const uno::Type& rType ) // XTypeProvider uno::Sequence< uno::Type > SAL_CALL SwAccessibleCell::getTypes() { - uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() ); - - sal_Int32 nIndex = aTypes.getLength(); - aTypes.realloc( nIndex + 1 ); - - uno::Type* pTypes = aTypes.getArray(); - pTypes[nIndex] = ::cppu::UnoType<XAccessibleValue>::get(); - - return aTypes; + return cppu::OTypeCollection( + ::cppu::UnoType<XAccessibleValue>::get(), + SwAccessibleContext::getTypes() ).getTypes(); } uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleCell::getImplementationId() diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index 414c24968dc1..a88b9ee4fdba 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -469,15 +469,9 @@ uno::Any SwAccessibleDocument::queryInterface( // XTypeProvider uno::Sequence< uno::Type > SAL_CALL SwAccessibleDocument::getTypes() { - uno::Sequence< uno::Type > aTypes( SwAccessibleDocumentBase::getTypes() ); - - sal_Int32 nIndex = aTypes.getLength(); - //Reset types memory alloc - aTypes.realloc( nIndex + 1 ); - - uno::Type* pTypes = aTypes.getArray(); - pTypes[nIndex] = cppu::UnoType<XAccessibleSelection>::get(); - return aTypes; + return cppu::OTypeCollection( + cppu::UnoType<XAccessibleSelection>::get(), + SwAccessibleDocumentBase::getTypes() ).getTypes(); } uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleDocument::getImplementationId() diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx index fbe78a96d170..b78e534ab4e0 100644 --- a/sw/source/core/access/accnotextframe.cxx +++ b/sw/source/core/access/accnotextframe.cxx @@ -216,15 +216,9 @@ uno::Any SAL_CALL SwAccessibleNoTextFrame::queryInterface( const uno::Type& aTyp uno::Sequence< uno::Type > SAL_CALL SwAccessibleNoTextFrame::getTypes() { - uno::Sequence< uno::Type > aTypes( SwAccessibleFrameBase::getTypes() ); - - sal_Int32 nIndex = aTypes.getLength(); - aTypes.realloc( nIndex + 1 ); - - uno::Type* pTypes = aTypes.getArray(); - pTypes[nIndex] = ::cppu::UnoType<XAccessibleImage>::get(); - - return aTypes; + return cppu::OTypeCollection( + ::cppu::UnoType<XAccessibleImage>::get(), + SwAccessibleFrameBase::getTypes() ).getTypes(); } /// XAccessibleImage diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index ac2bb5a8c83c..3abbd7a60826 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1002,23 +1002,16 @@ uno::Any SwAccessibleParagraph::queryInterface( const uno::Type& rType ) // XTypeProvider uno::Sequence< uno::Type > SAL_CALL SwAccessibleParagraph::getTypes() { - uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() ); - - sal_Int32 nIndex = aTypes.getLength(); // #i63870# - add type accessibility::XAccessibleTextAttributes // #i89175# - add type accessibility::XAccessibleTextMarkup and - // accessibility::XAccessibleMultiLineText - aTypes.realloc( nIndex + 6 ); - - uno::Type* pTypes = aTypes.getArray(); - pTypes[nIndex++] = cppu::UnoType<XAccessibleEditableText>::get(); - pTypes[nIndex++] = cppu::UnoType<XAccessibleTextAttributes>::get(); - pTypes[nIndex++] = ::cppu::UnoType<XAccessibleSelection>::get(); - pTypes[nIndex++] = cppu::UnoType<XAccessibleTextMarkup>::get(); - pTypes[nIndex++] = cppu::UnoType<XAccessibleMultiLineText>::get(); - pTypes[nIndex] = cppu::UnoType<XAccessibleHypertext>::get(); - - return aTypes; + return cppu::OTypeCollection( + cppu::UnoType<XAccessibleEditableText>::get(), + cppu::UnoType<XAccessibleTextAttributes>::get(), + ::cppu::UnoType<XAccessibleSelection>::get(), + cppu::UnoType<XAccessibleTextMarkup>::get(), + cppu::UnoType<XAccessibleMultiLineText>::get(), + cppu::UnoType<XAccessibleHypertext>::get(), + SwAccessibleContext::getTypes() ).getTypes(); } uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleParagraph::getImplementationId() diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index d1cfb08c29c6..9df77fac8b9e 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -52,6 +52,7 @@ #include <frmatr.hxx> #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/typeprovider.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; @@ -775,16 +776,10 @@ uno::Any SwAccessibleTable::queryInterface( const uno::Type& rType ) // XTypeProvider uno::Sequence< uno::Type > SAL_CALL SwAccessibleTable::getTypes() { - uno::Sequence< uno::Type > aTypes( SwAccessibleContext::getTypes() ); - - sal_Int32 nIndex = aTypes.getLength(); - aTypes.realloc( nIndex + 2 ); - - uno::Type* pTypes = aTypes.getArray(); - pTypes[nIndex++] = cppu::UnoType<XAccessibleSelection>::get(); - pTypes[nIndex++] = cppu::UnoType<XAccessibleTable>::get(); - - return aTypes; + return cppu::OTypeCollection( + cppu::UnoType<XAccessibleSelection>::get(), + cppu::UnoType<XAccessibleTable>::get(), + SwAccessibleContext::getTypes() ).getTypes(); } uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleTable::getImplementationId() diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index f5100e240f50..d8be8a2b5b53 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -512,21 +512,10 @@ uno::Any SwXDrawPage::queryInterface( const uno::Type& aType ) uno::Sequence< uno::Type > SwXDrawPage::getTypes() { - uno::Sequence< uno::Type > aPageTypes = SwXDrawPageBaseClass::getTypes(); - uno::Sequence< uno::Type > aSvxTypes = GetSvxPage()->getTypes(); - - long nIndex = aPageTypes.getLength(); - aPageTypes.realloc(aPageTypes.getLength() + aSvxTypes.getLength() + 1); - - uno::Type* pPageTypes = aPageTypes.getArray(); - const uno::Type* pSvxTypes = aSvxTypes.getConstArray(); - long nPos; - for(nPos = 0; nPos < aSvxTypes.getLength(); nPos++) - { - pPageTypes[nIndex++] = pSvxTypes[nPos]; - } - pPageTypes[nIndex] = cppu::UnoType<form::XFormsSupplier2>::get(); - return aPageTypes; + return comphelper::concatSequences( + SwXDrawPageBaseClass::getTypes(), + GetSvxPage()->getTypes(), + uno::Sequence { cppu::UnoType<form::XFormsSupplier2>::get() }); } sal_Int32 SwXDrawPage::getCount() @@ -1015,15 +1004,7 @@ uno::Sequence< uno::Type > SwXShape::getTypes( ) { uno::Reference< XTypeProvider > xAggProv; aProv >>= xAggProv; - uno::Sequence< uno::Type > aAggTypes = xAggProv->getTypes(); - const uno::Type* pAggTypes = aAggTypes.getConstArray(); - long nIndex = aRet.getLength(); - - aRet.realloc(nIndex + aAggTypes.getLength()); - uno::Type* pBaseTypes = aRet.getArray(); - - for(long i = 0; i < aAggTypes.getLength(); i++) - pBaseTypes[nIndex++] = pAggTypes[i]; + return comphelper::concatSequences(aRet, xAggProv->getTypes()); } } return aRet; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 01a9f3790bf4..63984f210c75 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -3135,27 +3135,11 @@ void SAL_CALL SwXTextFrame::release( )throw() uno::Sequence< uno::Type > SAL_CALL SwXTextFrame::getTypes( ) { - uno::Sequence< uno::Type > aTextFrameTypes = SwXTextFrameBaseClass::getTypes(); - uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes(); - uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes(); - - long nIndex = aTextFrameTypes.getLength(); - aTextFrameTypes.realloc( - aTextFrameTypes.getLength() + - aFrameTypes.getLength() + - aTextTypes.getLength()); - - uno::Type* pTextFrameTypes = aTextFrameTypes.getArray(); - const uno::Type* pFrameTypes = aFrameTypes.getConstArray(); - long nPos; - for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++) - pTextFrameTypes[nIndex++] = pFrameTypes[nPos]; - - const uno::Type* pTextTypes = aTextTypes.getConstArray(); - for(nPos = 0; nPos <aTextTypes.getLength(); nPos++) - pTextFrameTypes[nIndex++] = pTextTypes[nPos]; - - return aTextFrameTypes; + return comphelper::concatSequences( + SwXTextFrameBaseClass::getTypes(), + SwXFrame::getTypes(), + SwXText::getTypes() + ); } uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId( ) diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index c5492af982dd..b3f0f71d60de 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -82,15 +82,10 @@ uno::Any SwXRedlineText::queryInterface( const uno::Type& rType ) uno::Sequence<uno::Type> SwXRedlineText::getTypes() { - // SwXText::getTypes() - uno::Sequence<uno::Type> aTypes = SwXText::getTypes(); - - // add container::XEnumerationAccess - sal_Int32 nLength = aTypes.getLength(); - aTypes.realloc(nLength + 1); - aTypes[nLength] = cppu::UnoType<container::XEnumerationAccess>::get(); - - return aTypes; + return cppu::OTypeCollection( + cppu::UnoType<container::XEnumerationAccess>::get(), + SwXText::getTypes() + ).getTypes(); } uno::Sequence<sal_Int8> SwXRedlineText::getImplementationId() @@ -583,15 +578,10 @@ uno::Any SwXRedline::queryInterface( const uno::Type& rType ) uno::Sequence<uno::Type> SwXRedline::getTypes() { - uno::Sequence<uno::Type> aTypes = SwXText::getTypes(); - uno::Sequence<uno::Type> aBaseTypes = SwXRedlineBaseClass::getTypes(); - const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); - sal_Int32 nCurType = aTypes.getLength(); - aTypes.realloc(aTypes.getLength() + aBaseTypes.getLength()); - uno::Type* pTypes = aTypes.getArray(); - for(sal_Int32 nType = 0; nType < aBaseTypes.getLength(); nType++) - pTypes[nCurType++] = pBaseTypes[nType]; - return aTypes; + return comphelper::concatSequences( + SwXText::getTypes(), + SwXRedlineBaseClass::getTypes() + ); } uno::Sequence<sal_Int8> SwXRedline::getImplementationId() diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 2a3f9e228275..745f06e4ed44 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -3324,11 +3324,10 @@ const SfxPoolItem* SwXFrameStyle::GetItem(sal_uInt16 eAtr) uno::Sequence<uno::Type> SwXFrameStyle::getTypes() { - uno::Sequence<uno::Type> aTypes = SwXStyle::getTypes(); - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 1); - aTypes[nLen] = cppu::UnoType<XEventsSupplier>::get(); - return aTypes; + return cppu::OTypeCollection( + cppu::UnoType<XEventsSupplier>::get(), + SwXStyle::getTypes() + ).getTypes(); } uno::Any SwXFrameStyle::queryInterface(const uno::Type& rType) diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 8b5405e53970..76c7597bbcd2 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -786,16 +786,10 @@ sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId ) uno::Sequence< uno::Type > SAL_CALL SwXCell::getTypes( ) { - static uno::Sequence< uno::Type > aRetTypes = [&]() - { - const auto& rCellTypes = SwXCellBaseClass::getTypes(); - const auto& rTextTypes = SwXText::getTypes(); - auto tmp = uno::Sequence<uno::Type>(rCellTypes.getLength() + rTextTypes.getLength()); - std::copy_n(rCellTypes.begin(), rCellTypes.getLength(), tmp.begin()); - std::copy_n(rTextTypes.begin(), rTextTypes.getLength(), tmp.begin()+rCellTypes.getLength()); - return tmp; - }(); - return aRetTypes; + return comphelper::concatSequences( + SwXCellBaseClass::getTypes(), + SwXText::getTypes() + ); } uno::Sequence< sal_Int8 > SAL_CALL SwXCell::getImplementationId( ) diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 944851a47f2d..6caefea72e0f 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -262,22 +262,21 @@ SwXText::queryInterface(const uno::Type& rType) uno::Sequence< uno::Type > SAL_CALL SwXText::getTypes() { - uno::Sequence< uno::Type > aRet(12); - uno::Type* pTypes = aRet.getArray(); - pTypes[0] = cppu::UnoType<text::XText>::get(); - pTypes[1] = cppu::UnoType<text::XTextRangeCompare>::get(); - pTypes[2] = cppu::UnoType<text::XRelativeTextContentInsert>::get(); - pTypes[3] = cppu::UnoType<text::XRelativeTextContentRemove>::get(); - pTypes[4] = cppu::UnoType<lang::XUnoTunnel>::get(); - pTypes[5] = cppu::UnoType<beans::XPropertySet>::get(); - pTypes[6] = cppu::UnoType<text::XTextPortionAppend>::get(); - pTypes[7] = cppu::UnoType<text::XParagraphAppend>::get(); - pTypes[8] = cppu::UnoType<text::XTextContentAppend>::get(); - pTypes[9] = cppu::UnoType<text::XTextConvert>::get(); - pTypes[10] = cppu::UnoType<text::XTextAppend>::get(); - pTypes[11] = cppu::UnoType<text::XTextAppendAndConvert>::get(); - - return aRet; + static const uno::Sequence< uno::Type > aTypes { + cppu::UnoType<text::XText>::get(), + cppu::UnoType<text::XTextRangeCompare>::get(), + cppu::UnoType<text::XRelativeTextContentInsert>::get(), + cppu::UnoType<text::XRelativeTextContentRemove>::get(), + cppu::UnoType<lang::XUnoTunnel>::get(), + cppu::UnoType<beans::XPropertySet>::get(), + cppu::UnoType<text::XTextPortionAppend>::get(), + cppu::UnoType<text::XParagraphAppend>::get(), + cppu::UnoType<text::XTextContentAppend>::get(), + cppu::UnoType<text::XTextConvert>::get(), + cppu::UnoType<text::XTextAppend>::get(), + cppu::UnoType<text::XTextAppendAndConvert>::get() + }; + return aTypes; } // belongs the range in the text ? insert it then. diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 6d638bba6c20..aa512beb2a98 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -298,20 +298,15 @@ void SwXDocumentSettings::release () uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( ) { - SolarMutexGuard aGuard; - - uno::Sequence< uno::Type > aBaseTypes( 5 ); - uno::Type* pBaseTypes = aBaseTypes.getArray(); - - // from MasterPropertySet - pBaseTypes[0] = cppu::UnoType<XPropertySet>::get(); - pBaseTypes[1] = cppu::UnoType<XPropertyState>::get(); - pBaseTypes[2] = cppu::UnoType<XMultiPropertySet>::get(); - - pBaseTypes[3] = cppu::UnoType<XServiceInfo>::get(); - pBaseTypes[4] = cppu::UnoType<XTypeProvider>::get(); - - return aBaseTypes; + static const uno::Sequence< uno::Type > aTypes { + // from MasterPropertySet + cppu::UnoType<XPropertySet>::get(), + cppu::UnoType<XPropertyState>::get(), + cppu::UnoType<XMultiPropertySet>::get(), + cppu::UnoType<XServiceInfo>::get(), + cppu::UnoType<XTypeProvider>::get(), + }; + return aTypes; } uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( ) diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 8a4c1dd260d6..0a7c3d09b721 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -373,9 +373,6 @@ Reference< XAdapter > SwXTextDocument::queryAdapter( ) Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() { - Sequence< uno::Type > aBaseTypes = SfxBaseModel::getTypes(); - Sequence< uno::Type > aTextTypes = SwXTextDocumentBaseClass::getTypes(); - Sequence< uno::Type > aNumTypes; GetNumberFormatter(); if(xNumFormatAgg.is()) @@ -388,24 +385,13 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() aNumTypes = xNumProv->getTypes(); } } - long nIndex = aBaseTypes.getLength(); - // don't forget the lang::XMultiServiceFactory and the XTiledRenderable - aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 2); - uno::Type* pBaseTypes = aBaseTypes.getArray(); - const uno::Type* pTextTypes = aTextTypes.getConstArray(); - long nPos; - for(nPos = 0; nPos < aTextTypes.getLength(); nPos++) - { - pBaseTypes[nIndex++] = pTextTypes[nPos]; - } - const uno::Type* pNumTypes = aNumTypes.getConstArray(); - for(nPos = 0; nPos < aNumTypes.getLength(); nPos++) - { - pBaseTypes[nIndex++] = pNumTypes[nPos]; - } - pBaseTypes[nIndex++] = cppu::UnoType<lang::XMultiServiceFactory>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<tiledrendering::XTiledRenderable>::get(); - return aBaseTypes; + return comphelper::concatSequences( + SfxBaseModel::getTypes(), + SwXTextDocumentBaseClass::getTypes(), + aNumTypes, + Sequence { + cppu::UnoType<lang::XMultiServiceFactory>::get(), + cppu::UnoType<tiledrendering::XTiledRenderable>::get()}); } SwXTextDocument::SwXTextDocument(SwDocShell* pShell) diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index bd27ee2035ec..8a81ae329455 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -133,22 +133,17 @@ void SwXTextView::Invalidate() Sequence< uno::Type > SAL_CALL SwXTextView::getTypes( ) { - uno::Sequence< uno::Type > aBaseTypes = SfxBaseController::getTypes(); - - long nIndex = aBaseTypes.getLength(); - aBaseTypes.realloc( - aBaseTypes.getLength() + 8 ); - - uno::Type* pBaseTypes = aBaseTypes.getArray(); - pBaseTypes[nIndex++] = cppu::UnoType<XSelectionSupplier>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<XServiceInfo>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<XFormLayerAccess>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<XTextViewCursorSupplier>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<XViewSettingsSupplier>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<XRubySelection>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<XPropertySet>::get(); - pBaseTypes[nIndex++] = cppu::UnoType<datatransfer::XTransferableSupplier>::get(); - return aBaseTypes; + return cppu::OTypeCollection( + cppu::UnoType<XSelectionSupplier>::get(), + cppu::UnoType<XServiceInfo>::get(), + cppu::UnoType<XFormLayerAccess>::get(), + cppu::UnoType<XTextViewCursorSupplier>::get(), + cppu::UnoType<XViewSettingsSupplier>::get(), + cppu::UnoType<XRubySelection>::get(), + cppu::UnoType<XPropertySet>::get(), + cppu::UnoType<datatransfer::XTransferableSupplier>::get(), + SfxBaseController::getTypes() + ).getTypes(); } Sequence< sal_Int8 > SAL_CALL SwXTextView::getImplementationId( ) diff --git a/unotools/source/accessibility/accessiblerelationsethelper.cxx b/unotools/source/accessibility/accessiblerelationsethelper.cxx index f50d641e87ea..0e2a57773bb1 100644 --- a/unotools/source/accessibility/accessiblerelationsethelper.cxx +++ b/unotools/source/accessibility/accessiblerelationsethelper.cxx @@ -210,12 +210,11 @@ void AccessibleRelationSetHelper::AddRelation(const AccessibleRelation& rRelatio uno::Sequence< css::uno::Type> AccessibleRelationSetHelper::getTypes() { - osl::MutexGuard aGuard (maMutex); - css::uno::Sequence< css::uno::Type> aTypeSequence { + static const uno::Sequence< css::uno::Type> aTypes { cppu::UnoType<XAccessibleRelationSet>::get(), cppu::UnoType<lang::XTypeProvider>::get() }; - return aTypeSequence; + return aTypes; } uno::Sequence<sal_Int8> SAL_CALL AccessibleRelationSetHelper::getImplementationId() diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx index 970a904519d8..bc2ce6349f55 100644 --- a/vcl/source/graphic/UnoGraphic.cxx +++ b/vcl/source/graphic/UnoGraphic.cxx @@ -26,6 +26,7 @@ #include <vcl/dibtools.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/typeprovider.hxx> #include <string.h> using namespace com::sun::star; @@ -108,14 +109,11 @@ uno::Sequence< OUString > SAL_CALL Graphic::getSupportedServiceNames() uno::Sequence< uno::Type > SAL_CALL Graphic::getTypes() { - uno::Sequence< uno::Type > aRet( ::unographic::GraphicDescriptor::getTypes() ); - sal_Int32 nOldCount = aRet.getLength(); - - aRet.realloc( nOldCount + 2 ); - aRet[ nOldCount ] = cppu::UnoType<graphic::XGraphic>::get(); - aRet[ nOldCount+1 ] = cppu::UnoType<awt::XBitmap>::get(); - - return aRet; + return cppu::OTypeCollection( + cppu::UnoType<graphic::XGraphic>::get(), + cppu::UnoType<awt::XBitmap>::get(), + ::unographic::GraphicDescriptor::getTypes() + ).getTypes(); } uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId() diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx b/vcl/source/graphic/UnoGraphicDescriptor.cxx index 7d89a8b7ca70..8b4f1fa79d89 100644 --- a/vcl/source/graphic/UnoGraphicDescriptor.cxx +++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx @@ -211,16 +211,13 @@ uno::Sequence< OUString > SAL_CALL GraphicDescriptor::getSupportedServiceNames() uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::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< uno::Type > 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/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx index 0da9c020155d..51d755b4515a 100644 --- a/vcl/source/graphic/UnoGraphicProvider.cxx +++ b/vcl/source/graphic/UnoGraphicProvider.cxx @@ -111,13 +111,11 @@ uno::Sequence< OUString > SAL_CALL GraphicProvider::getSupportedServiceNames() uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() { - uno::Sequence< uno::Type > aTypes( 3 ); - uno::Type* pTypes = aTypes.getArray(); - - *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get(); - *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get(); - *pTypes++ = cppu::UnoType<graphic::XGraphicProvider>::get(); - + static const uno::Sequence< uno::Type > aTypes { + cppu::UnoType<lang::XServiceInfo>::get(), + cppu::UnoType<lang::XTypeProvider>::get(), + cppu::UnoType<graphic::XGraphicProvider>::get() + }; return aTypes; } diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index c40160082e72..5d84e725de6f 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -44,6 +44,7 @@ #include "OOo2Oasis.hxx" #include "XMLFilterRegistration.hxx" #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/typeprovider.hxx> using namespace ::xmloff::token; using namespace ::com::sun::star::uno; @@ -1967,19 +1968,13 @@ Sequence< OUString > SAL_CALL OOo2OasisTransformer::getSupportedServiceNames( ) } // XTypeProvider -Sequence< css::uno::Type > SAL_CALL - OOo2OasisTransformer::getTypes() +Sequence< css::uno::Type > SAL_CALL OOo2OasisTransformer::getTypes() { - Sequence< css::uno::Type > aTypes( XMLTransformerBase::getTypes() ); - - sal_Int32 nIndex = aTypes.getLength(); - aTypes.realloc( nIndex + 2 ); - - css::uno::Type* pTypes = aTypes.getArray(); - pTypes[nIndex++] = cppu::UnoType<XImporter>::get(); - pTypes[nIndex++] = cppu::UnoType<XFilter>::get(); - - return aTypes; + return cppu::OTypeCollection( + cppu::UnoType<XImporter>::get(), + cppu::UnoType<XFilter>::get(), + XMLTransformerBase::getTypes() + ).getTypes(); } // Service registration |