summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accessibility/inc/accessibility/extended/textwindowaccessibility.hxx3
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx24
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx10
-rw-r--r--chart2/source/inc/ContainerHelper.hxx35
-rw-r--r--chart2/source/model/main/DataSeries.cxx12
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx5
-rw-r--r--comphelper/source/container/NamedPropertyValuesContainer.cxx9
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx8
-rw-r--r--comphelper/source/container/namecontainer.cxx11
-rw-r--r--comphelper/source/eventattachermgr/eventattachermgr.cxx12
-rw-r--r--connectivity/source/commontools/DriversConfig.cxx11
-rw-r--r--dbaccess/source/core/dataaccess/documentevents.cxx10
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx9
-rw-r--r--dtrans/source/generic/clipboardmanager.cxx10
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx6
-rw-r--r--extensions/source/propctrlr/genericpropertyhandler.cxx5
-rw-r--r--forms/source/misc/InterfaceContainer.cxx9
-rw-r--r--forms/source/xforms/NameContainer.hxx14
-rw-r--r--forms/source/xforms/convert.cxx6
-rw-r--r--forms/source/xforms/datatyperepository.cxx9
-rw-r--r--framework/source/uiconfiguration/graphicnameaccess.cxx10
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx8
-rw-r--r--framework/source/uiconfiguration/windowstateconfiguration.cxx13
-rw-r--r--framework/source/uielement/menubarwrapper.cxx13
-rw-r--r--framework/source/uielement/toolbarmanager.cxx16
-rw-r--r--framework/source/uielement/uicommanddescription.cxx12
-rw-r--r--include/comphelper/sequence.hxx25
-rw-r--r--sc/source/filter/excel/excimp8.cxx9
-rw-r--r--sc/source/ui/vba/vbawindow.cxx8
-rw-r--r--sc/source/ui/vba/vbawindows.cxx9
-rw-r--r--scripting/source/vbaevents/eventhelper.cxx8
-rw-r--r--sfx2/source/dialog/filtergrouping.cxx8
-rw-r--r--svx/source/form/formcontroller.cxx8
-rw-r--r--svx/source/table/tabledesign.cxx11
-rw-r--r--svx/source/unodraw/unoprov.cxx12
-rw-r--r--sw/source/core/access/accpara.cxx13
-rw-r--r--sw/source/core/unocore/unobkm.cxx7
-rw-r--r--sw/source/core/unocore/unocoll.cxx7
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx8
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.cxx13
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx9
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx9
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx5
-rw-r--r--xmloff/source/forms/eventexport.cxx11
44 files changed, 97 insertions, 373 deletions
diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
index ab1e0890d44c..01e8e3cd608f 100644
--- a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
@@ -642,9 +642,6 @@ private:
const css::uno::Sequence< OUString >& RequestedAttributes,
tPropValMap& rRunAttrSeq);
- static css::uno::Sequence< css::beans::PropertyValue >
- convertHashMapToSequence(tPropValMap& rAttrSeq);
-
css::uno::Reference< css::accessibility::XAccessible > m_xAccessible;
::TextEngine & m_rEngine;
::TextView & m_rView;
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index b21c77169dd0..fbf2cd7d0f29 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -23,6 +23,7 @@
#include <unotools/accessiblestatesethelper.hxx>
#include <vcl/window.hxx>
#include <toolkit/helper/convert.hxx>
+#include <comphelper/sequence.hxx>
#include <algorithm>
#include <vector>
@@ -1101,7 +1102,7 @@ Document::retrieveCharacterAttributes(
aCharAttrSeq[ pValues->Name ] = *pValues;
}
- css::uno::Sequence< css::beans::PropertyValue > aRes = convertHashMapToSequence( aCharAttrSeq );
+ css::uno::Sequence< css::beans::PropertyValue > aRes = comphelper::mapValuesToSequence( aCharAttrSeq );
// sort the attributes
sal_Int32 nLength = aRes.getLength();
@@ -1143,24 +1144,7 @@ Document::retrieveDefaultAttributes(
tPropValMap aDefAttrSeq;
retrieveDefaultAttributesImpl( pParagraph, RequestedAttributes, aDefAttrSeq );
- return convertHashMapToSequence( aDefAttrSeq );
-}
-
-// static
-css::uno::Sequence< css::beans::PropertyValue >
-Document::convertHashMapToSequence(tPropValMap& rAttrSeq)
-{
- css::uno::Sequence< css::beans::PropertyValue > aValues( rAttrSeq.size() );
- css::beans::PropertyValue* pValues = aValues.getArray();
- ::sal_Int32 i = 0;
- for ( tPropValMap::const_iterator aIter = rAttrSeq.begin();
- aIter != rAttrSeq.end();
- ++aIter )
- {
- pValues[i] = aIter->second;
- ++i;
- }
- return aValues;
+ return comphelper::mapValuesToSequence( aDefAttrSeq );
}
void Document::retrieveRunAttributesImpl(
@@ -1233,7 +1217,7 @@ Document::retrieveRunAttributes(
tPropValMap aRunAttrSeq;
retrieveRunAttributesImpl( pParagraph, Index, RequestedAttributes, aRunAttrSeq );
- return convertHashMapToSequence( aRunAttrSeq );
+ return comphelper::mapValuesToSequence( aRunAttrSeq );
}
void Document::changeParagraphText(Paragraph * pParagraph,
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 00611617d01b..035f7e9372ff 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1453,15 +1453,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstanceW
uno::Sequence< OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceNames()
throw (uno::RuntimeException, std::exception)
{
- tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
- uno::Sequence< OUString > aResult( rMap.size());
-
- ::std::transform( rMap.begin(), rMap.end(),
- aResult.getArray(),
- ::o3tl::select1st< tServiceNameMap::value_type >() );
-
- return aResult;
-
+ return comphelper::mapKeysToSequence( lcl_getStaticServiceNameMap() );
}
// ____ XAggregation ____
diff --git a/chart2/source/inc/ContainerHelper.hxx b/chart2/source/inc/ContainerHelper.hxx
index 9f01b47ab01b..a50554d8a0b0 100644
--- a/chart2/source/inc/ContainerHelper.hxx
+++ b/chart2/source/inc/ContainerHelper.hxx
@@ -70,41 +70,6 @@ template< typename T >
return SequenceToSTLSequenceContainer< ::std::vector< T > >( rSeq );
}
-/** converts the keys of a Pair Associative Container into a UNO sequence
-
- example:
-
- ::std::multimap< sal_Int32, OUString > aMyMultiMap;
- uno::Sequence< sal_Int32 > aMyKeys( ContainerHelper::MapKeysToSequence( aMyMultiMap ));
- // note: aMyKeys may contain duplicate keys here
- */
-template< class Map >
-::com::sun::star::uno::Sequence< typename Map::key_type > MapKeysToSequence(
- const Map & rCont )
-{
- ::com::sun::star::uno::Sequence< typename Map::key_type > aResult( rCont.size());
- ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
- ::o3tl::select1st< typename Map::value_type >() );
- return aResult;
-}
-
-/** converts the values of a Pair Associative Container into a UNO sequence
-
- example:
-
- ::std::map< sal_Int32, OUString > aMyMultiMap;
- uno::Sequence< OUString > aMyValues( ContainerHelper::MapValuesToSequence( aMyMultiMap ));
- */
-template< class Map >
-::com::sun::star::uno::Sequence< typename Map::mapped_type > MapValuesToSequence(
- const Map & rCont )
-{
- ::com::sun::star::uno::Sequence< typename Map::mapped_type > aResult( rCont.size());
- ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
- ::o3tl::select2nd< typename Map::value_type >() );
- return aResult;
-}
-
} // namespace ContainerHelper
} // namespace chart
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 1a42a726646e..11c617481f02 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -275,18 +275,8 @@ void SAL_CALL DataSeries::getFastPropertyValue
if( nHandle == DataSeriesProperties::PROP_DATASERIES_ATTRIBUTED_DATA_POINTS )
{
// TODO: only add those property sets that are really modified
- uno::Sequence< sal_Int32 > aSeq( m_aAttributedDataPoints.size());
- sal_Int32 * pIndexArray = aSeq.getArray();
- sal_Int32 i = 0;
- for( tDataPointAttributeContainer::const_iterator aIt( m_aAttributedDataPoints.begin());
- aIt != m_aAttributedDataPoints.end(); ++aIt )
- {
- pIndexArray[ i ] = (*aIt).first;
- ++i;
- }
-
- rValue <<= aSeq;
+ rValue <<= comphelper::mapKeysToSequence(m_aAttributedDataPoints);
}
else
OPropertySet::getFastPropertyValue( rValue, nHandle );
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index 9b588a706340..461752cfd84c 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
+#include <comphelper/sequence.hxx>
namespace chart
{
@@ -65,8 +66,8 @@ void PropertyMapper::setMappedProperties(
for( sal_Int32 nI=0; nI<aNames.getLength(); ++nI )
aNewMap[ aNames[nI] ] = aValues[nI];
lcl_overwriteOrAppendValues( aNewMap, *pOverwriteMap );
- aNames = ContainerHelper::MapKeysToSequence( aNewMap );
- aValues = ContainerHelper::MapValuesToSequence( aNewMap );
+ aNames = comphelper::mapKeysToSequence( aNewMap );
+ aValues = comphelper::mapValuesToSequence( aNewMap );
}
PropertyMapper::setMultiProperties( aNames, aValues, xTarget );
diff --git a/comphelper/source/container/NamedPropertyValuesContainer.cxx b/comphelper/source/container/NamedPropertyValuesContainer.cxx
index 69f2b384e80e..90ce4cd723d1 100644
--- a/comphelper/source/container/NamedPropertyValuesContainer.cxx
+++ b/comphelper/source/container/NamedPropertyValuesContainer.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/supportsservice.hxx>
@@ -151,13 +152,7 @@ css::uno::Any SAL_CALL NamedPropertyValuesContainer::getByName( const OUString&
css::uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer::getElementNames( )
throw(css::uno::RuntimeException, std::exception)
{
- uno::Sequence< OUString > aNames( maProperties.size() );
- OUString* pNames = aNames.getArray();
-
- for( const auto& rProperty : maProperties )
- *pNames++ = rProperty.first;
-
- return aNames;
+ return comphelper::mapKeysToSequence(maProperties);
}
sal_Bool SAL_CALL NamedPropertyValuesContainer::hasByName( const OUString& aName )
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 33814fbde73f..af4bc5ce3b77 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -230,13 +230,7 @@ OUString EmbeddedObjectContainer::CreateUniqueObjectName()
uno::Sequence < OUString > EmbeddedObjectContainer::GetObjectNames()
{
- uno::Sequence < OUString > aSeq( pImpl->maObjectContainer.size() );
- OUString* pNames = aSeq.getArray();
-
- for( const auto& rObj : pImpl->maObjectContainer )
- *pNames++ = rObj.first;
-
- return aSeq;
+ return comphelper::mapKeysToSequence(pImpl->maObjectContainer);
}
bool EmbeddedObjectContainer::HasEmbeddedObjects()
diff --git a/comphelper/source/container/namecontainer.cxx b/comphelper/source/container/namecontainer.cxx
index a7b419b9a74d..b04ada10cf08 100644
--- a/comphelper/source/container/namecontainer.cxx
+++ b/comphelper/source/container/namecontainer.cxx
@@ -22,6 +22,7 @@
#include <map>
#include <comphelper/namecontainer.hxx>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
@@ -160,15 +161,7 @@ Sequence< OUString > SAL_CALL NameContainer::getElementNames( )
{
MutexGuard aGuard( maMutex );
- Sequence< OUString > aNames( maProperties.size() );
- OUString* pNames = aNames.getArray();
-
- for( const auto& rProperty : maProperties )
- {
- *pNames++ = rProperty.first;
- }
-
- return aNames;
+ return comphelper::mapKeysToSequence(maProperties);
}
sal_Bool SAL_CALL NameContainer::hasByName( const OUString& aName )
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 12101471bc97..d782b744fc42 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -21,6 +21,7 @@
#include <osl/diagnose.h>
#include <comphelper/eventattachermgr.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <com/sun/star/beans/theIntrospection.hpp>
#include <com/sun/star/io/XObjectInputStream.hpp>
#include <com/sun/star/io/XPersistObject.hpp>
@@ -573,16 +574,7 @@ Sequence< ScriptEventDescriptor > SAL_CALL ImplEventAttacherManager::getScriptEv
{
Guard< Mutex > aGuard( aLock );
::std::deque<AttacherIndex_Impl>::iterator aIt = implCheckIndex( nIndex );
-
- Sequence< ScriptEventDescriptor > aSeq( aIt->aEventList.size() );
- ScriptEventDescriptor * pArray = aSeq.getArray();
-
- sal_Int32 i = 0;
- for( const auto& rEvt : aIt->aEventList )
- {
- pArray[i++] = rEvt;
- }
- return aSeq;
+ return comphelper::containerToSequence<ScriptEventDescriptor>(aIt->aEventList);
}
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx
index ef7c03ab30b5..f7b544105b01 100644
--- a/connectivity/source/commontools/DriversConfig.cxx
+++ b/connectivity/source/commontools/DriversConfig.cxx
@@ -19,6 +19,7 @@
#include <connectivity/DriversConfig.hxx>
#include <tools/wldcrd.hxx>
#include <svtools/miscopt.hxx>
+#include <comphelper/sequence.hxx>
using namespace connectivity;
using namespace utl;
@@ -241,15 +242,7 @@ const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const OUString
uno::Sequence< OUString > DriversConfig::getURLs() const
{
const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB);
- uno::Sequence< OUString > aRet(rDrivers.size());
- OUString* pIter = aRet.getArray();
- TInstalledDrivers::const_iterator aIter = rDrivers.begin();
- TInstalledDrivers::const_iterator aEnd = rDrivers.end();
- for(;aIter != aEnd;++aIter,++pIter)
- {
- *pIter = aIter->first;
- }
- return aRet;
+ return comphelper::mapKeysToSequence(rDrivers);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documentevents.cxx b/dbaccess/source/core/dataaccess/documentevents.cxx
index 5b77496bd043..3d0057650068 100644
--- a/dbaccess/source/core/dataaccess/documentevents.cxx
+++ b/dbaccess/source/core/dataaccess/documentevents.cxx
@@ -23,6 +23,7 @@
#include <osl/diagnose.h>
#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/sequence.hxx>
#include <algorithm>
#include <functional>
@@ -200,14 +201,7 @@ namespace dbaccess
{
::osl::MutexGuard aGuard( m_pData->rMutex );
- Sequence< OUString > aNames( m_pData->rEventsData.size() );
- ::std::transform(
- m_pData->rEventsData.begin(),
- m_pData->rEventsData.end(),
- aNames.getArray(),
- ::o3tl::select1st< DocumentEventsData::value_type >()
- );
- return aNames;
+ return comphelper::mapKeysToSequence( m_pData->rEventsData );
}
sal_Bool SAL_CALL DocumentEvents::hasByName( const OUString& _Name ) throw (RuntimeException, std::exception)
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 29efea37a09c..1230c17a3e84 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -1443,14 +1443,7 @@ Sequence< ::sal_Int16 > SAL_CALL OGenericUnoController::getSupportedCommandGroup
if ( aIter->second.GroupId != CommandGroup::INTERNAL )
aCmdHashMap.insert( CommandHashMap::value_type( aIter->second.GroupId, 0 ));
- Sequence< sal_Int16 > aCommandGroups( aCmdHashMap.size() );
- ::std::transform( aCmdHashMap.begin(),
- aCmdHashMap.end(),
- aCommandGroups.getArray(),
- ::o3tl::select1st< CommandHashMap::value_type >()
- );
-
- return aCommandGroups;
+ return comphelper::mapKeysToSequence( aCmdHashMap );
}
namespace
diff --git a/dtrans/source/generic/clipboardmanager.cxx b/dtrans/source/generic/clipboardmanager.cxx
index ad8d9e333e39..2a5af784742a 100644
--- a/dtrans/source/generic/clipboardmanager.cxx
+++ b/dtrans/source/generic/clipboardmanager.cxx
@@ -20,6 +20,7 @@
#include <clipboardmanager.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequence.hxx>
using namespace com::sun::star::container;
using namespace com::sun::star::datatransfer;
@@ -137,14 +138,7 @@ Sequence< OUString > SAL_CALL ClipboardManager::listClipboardNames()
if (rBHelper.bInDispose)
return Sequence< OUString > ();
- Sequence< OUString > aRet(m_aClipboardMap.size());
- ClipboardMap::iterator iter = m_aClipboardMap.begin();
- ClipboardMap::iterator imax = m_aClipboardMap.end();
-
- for (sal_Int32 n = 0; iter != imax; ++iter)
- aRet[n++] = iter->first;
-
- return aRet;
+ return comphelper::mapKeysToSequence(m_aClipboardMap);
}
void SAL_CALL ClipboardManager::dispose()
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index bfdc3d5cf286..eea512450eed 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -53,6 +53,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/evtmethodhelper.hxx>
+#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -773,10 +774,7 @@ namespace pcr
PropertyAttribute::BOUND );
}
- StlSyntaxSequence< Property > aReturn( aOrderedProperties.size() );
- ::std::transform( aOrderedProperties.begin(), aOrderedProperties.end(), aReturn.begin(),
- ::o3tl::select2nd< std::map< EventId, Property >::value_type >() );
- return aReturn;
+ return comphelper::mapValuesToSequence( aOrderedProperties );
}
Sequence< OUString > SAL_CALL EventHandler::getSupersededProperties( ) throw (RuntimeException, std::exception)
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx
index f76b07c3bf92..edd4f081c81c 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -528,10 +528,7 @@ namespace pcr
::osl::MutexGuard aGuard( m_aMutex );
impl_ensurePropertyMap();
- Sequence< Property > aReturn( m_aProperties.size() );
- ::std::transform( m_aProperties.begin(), m_aProperties.end(),
- aReturn.getArray(), ::o3tl::select2nd< PropertyMap::value_type >() );
- return aReturn;
+ return comphelper::mapValuesToSequence( m_aProperties );
}
Sequence< OUString > SAL_CALL GenericPropertyHandler::getSupersededProperties( ) throw (RuntimeException, std::exception)
diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index bc75f4eea26d..63aee56f9d5d 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -726,14 +726,7 @@ Any SAL_CALL OInterfaceContainer::getByName( const OUString& _rName ) throw(NoSu
css::uno::Sequence<OUString> SAL_CALL OInterfaceContainer::getElementNames() throw(RuntimeException, std::exception)
{
- css::uno::Sequence<OUString> aNameList(m_aItems.size());
- OUString* pStringArray = aNameList.getArray();
-
- for (OInterfaceMap::const_iterator i = m_aMap.begin(); i != m_aMap.end(); ++i, ++pStringArray)
- {
- *pStringArray = (*i).first;
- }
- return aNameList;
+ return comphelper::mapKeysToSequence(m_aMap);
}
diff --git a/forms/source/xforms/NameContainer.hxx b/forms/source/xforms/NameContainer.hxx
index c4a129febe78..f8879b02c3c0 100644
--- a/forms/source/xforms/NameContainer.hxx
+++ b/forms/source/xforms/NameContainer.hxx
@@ -20,6 +20,7 @@
#ifndef INCLUDED_FORMS_SOURCE_XFORMS_NAMECONTAINER_HXX
#define INCLUDED_FORMS_SOURCE_XFORMS_NAMECONTAINER_HXX
+#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <map>
@@ -123,18 +124,7 @@ public:
virtual css::uno::Sequence<OUString> SAL_CALL getElementNames()
throw( css::uno::RuntimeException, std::exception ) override
{
- css::uno::Sequence<OUString> aSequence( maItems.size() );
- typename map_t::const_iterator aIter = maItems.begin();
- OUString* pStrings = aSequence.getArray();
- while( aIter != maItems.end() )
- {
- *pStrings = aIter->first;
- ++aIter;
- ++pStrings;
- }
- OSL_ENSURE( pStrings == aSequence.getArray() + aSequence.getLength(),
- "sequence not of right size; possible buffer overflow" );
- return aSequence;
+ return comphelper::mapKeysToSequence(maItems);
}
virtual sal_Bool SAL_CALL hasByName(
diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index 0e05f2ef2221..da5eb7fa1e78 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/Time.hpp>
+#include <comphelper/sequence.hxx>
#include <unotools/datetime.hxx>
using xforms::Convert;
@@ -301,10 +302,7 @@ bool Convert::hasType( const css::uno::Type& rType )
css::uno::Sequence<css::uno::Type> Convert::getTypes()
{
- css::uno::Sequence<css::uno::Type> aTypes( maMap.size() );
- transform( maMap.begin(), maMap.end(), aTypes.getArray(),
- o3tl::select1st<Map_t::value_type>() );
- return aTypes;
+ return comphelper::mapKeysToSequence( maMap );
}
OUString Convert::toXSD( const css::uno::Any& rAny )
diff --git a/forms/source/xforms/datatyperepository.cxx b/forms/source/xforms/datatyperepository.cxx
index 0ea1e9c95a3d..ea35900c636e 100644
--- a/forms/source/xforms/datatyperepository.cxx
+++ b/forms/source/xforms/datatyperepository.cxx
@@ -178,14 +178,7 @@ namespace xforms
{
::osl::MutexGuard aGuard( m_aMutex );
- Sequence< OUString > aNames( m_aRepository.size() );
- ::std::transform(
- m_aRepository.begin(),
- m_aRepository.end(),
- aNames.getArray(),
- ::o3tl::select1st< Repository::value_type >()
- );
- return aNames;
+ return comphelper::mapKeysToSequence( m_aRepository );
}
diff --git a/framework/source/uiconfiguration/graphicnameaccess.cxx b/framework/source/uiconfiguration/graphicnameaccess.cxx
index 69c083da09ba..2b12988f5c2e 100644
--- a/framework/source/uiconfiguration/graphicnameaccess.cxx
+++ b/framework/source/uiconfiguration/graphicnameaccess.cxx
@@ -57,15 +57,7 @@ throw(css::uno::RuntimeException, std::exception)
{
if ( m_aSeq.getLength() == 0 )
{
- uno::Sequence< OUString > aSeq( m_aNameToElementMap.size() );
- NameGraphicHashMap::const_iterator pIter = m_aNameToElementMap.begin();
- sal_Int32 i( 0);
- while ( pIter != m_aNameToElementMap.end())
- {
- aSeq[i++] = pIter->first;
- ++pIter;
- }
- m_aSeq = aSeq;
+ m_aSeq = comphelper::mapKeysToSequence(m_aNameToElementMap);
}
return m_aSeq;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index caea44e3569f..bcddfa354a19 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -681,13 +681,7 @@ throw (css::uno::RuntimeException)
for ( i = 0; i < nUserCount; i++ )
aImageCmdNameMap.insert( ImageNameMap::value_type( rUserImageNames[i], sal_True ));
- Sequence< OUString > aImageNameSeq( aImageCmdNameMap.size() );
- ImageNameMap::const_iterator pIter;
- i = 0;
- for ( pIter = aImageCmdNameMap.begin(); pIter != aImageCmdNameMap.end(); ++pIter )
- aImageNameSeq[i++] = pIter->first;
-
- return aImageNameSeq;
+ return comphelper::mapKeysToSequence( aImageCmdNameMap );
}
bool ImageManagerImpl::hasImage( ::sal_Int16 nImageType, const OUString& aCommandURL )
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index 4082f7e1637f..8dd19b11a62f 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -40,6 +40,7 @@
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequence.hxx>
#include <tools/debug.hxx>
#include <unordered_map>
@@ -1426,17 +1427,7 @@ throw (css::uno::RuntimeException, std::exception)
{
osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
- Sequence< OUString > aSeq( m_aModuleToFileHashMap.size() );
-
- sal_Int32 n = 0;
- ModuleToWindowStateFileMap::const_iterator pIter = m_aModuleToFileHashMap.begin();
- while ( pIter != m_aModuleToFileHashMap.end() )
- {
- aSeq[n] = pIter->first;
- ++pIter;
- }
-
- return aSeq;
+ return comphelper::mapKeysToSequence( m_aModuleToFileHashMap );
}
sal_Bool SAL_CALL WindowStateConfiguration::hasByName( const OUString& aName )
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index b1f63fba368f..cc5820c8d59a 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/util/URLTransformer.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <vcl/svapp.hxx>
using namespace com::sun::star;
@@ -302,17 +303,7 @@ throw (css::uno::RuntimeException, std::exception)
fillPopupControllerCache();
- Sequence< OUString > aSeq( m_aPopupControllerCache.size() );
-
- sal_Int32 i( 0 );
- PopupControllerCache::const_iterator pIter = m_aPopupControllerCache.begin();
- while ( pIter != m_aPopupControllerCache.end() )
- {
- aSeq[i++] = pIter->first;
- ++pIter;
- }
-
- return aSeq;
+ return comphelper::mapKeysToSequence( m_aPopupControllerCache );
}
sal_Bool SAL_CALL MenuBarWrapper::hasByName(
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index ce608f7bbec2..49588d78f782 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1320,19 +1320,10 @@ void ToolBarManager::RequestImages()
{
// Request images from image manager
- Sequence< OUString > aCmdURLSeq( m_aCommandMap.size() );
+ Sequence< OUString > aCmdURLSeq( comphelper::mapKeysToSequence(m_aCommandMap) );
Sequence< Reference< XGraphic > > aDocGraphicSeq;
Sequence< Reference< XGraphic > > aModGraphicSeq;
- sal_uInt32 i = 0;
- CommandToInfoMap::iterator pIter = m_aCommandMap.begin();
- CommandToInfoMap::iterator pEnd = m_aCommandMap.end();
- while ( pIter != pEnd )
- {
- aCmdURLSeq[i++] = pIter->first;
- ++pIter;
- }
-
bool bBigImages( SvtMiscOptions().AreCurrentSymbolsLarge() );
sal_Int16 p = getImageTypeFromBools( SvtMiscOptions().AreCurrentSymbolsLarge() );
@@ -1340,8 +1331,9 @@ void ToolBarManager::RequestImages()
aDocGraphicSeq = m_xDocImageManager->getImages( p, aCmdURLSeq );
aModGraphicSeq = m_xModuleImageManager->getImages( p, aCmdURLSeq );
- i = 0;
- pIter = m_aCommandMap.begin();
+ sal_uInt32 i = 0;
+ CommandToInfoMap::iterator pIter = m_aCommandMap.begin();
+ CommandToInfoMap::iterator pEnd = m_aCommandMap.end();
while ( pIter != pEnd )
{
Image aImage;
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 01e9285d356b..462c69d77895 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -721,17 +721,7 @@ throw (css::uno::RuntimeException, std::exception)
{
osl::MutexGuard g(rBHelper.rMutex);
- Sequence< OUString > aSeq( m_aModuleToCommandFileMap.size() );
-
- sal_Int32 n = 0;
- ModuleToCommandFileMap::const_iterator pIter = m_aModuleToCommandFileMap.begin();
- while ( pIter != m_aModuleToCommandFileMap.end() )
- {
- aSeq[n++] = pIter->first;
- ++pIter;
- }
-
- return aSeq;
+ return comphelper::mapKeysToSequence( m_aModuleToCommandFileMap );
}
sal_Bool SAL_CALL UICommandDescription::hasByName( const OUString& aName )
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
index 47bf0c5af9c4..17d1b67c0d64 100644
--- a/include/comphelper/sequence.hxx
+++ b/include/comphelper/sequence.hxx
@@ -369,6 +369,31 @@ namespace comphelper
return o_Output;
}
+ /** Copy (keys or values) from a associate container into a Sequence
+
+ @tpl M map container type eg. std::map/std::unordered_map
+
+ @return the generated Sequence
+ */
+ template < typename M >
+ inline css::uno::Sequence< typename M::key_type > mapKeysToSequence( M const& map )
+ {
+ css::uno::Sequence< typename M::key_type > ret( static_cast<sal_Int32>(map.size()) );
+ typename M::key_type* pArray = ret.getArray();
+ for (const auto& i : map)
+ *pArray++ = i.first;
+ return ret;
+ }
+
+ template < typename M >
+ inline css::uno::Sequence< typename M::mapped_type > mapValuesToSequence( M const& map )
+ {
+ css::uno::Sequence< typename M::mapped_type > ret( static_cast<sal_Int32>(map.size()) );
+ typename M::mapped_type* pArray = ret.getArray();
+ for (const auto& i : map)
+ *pArray++ = i.second;
+ return ret;
+ }
} // namespace comphelper
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 8fcfcd359e68..d14e1f608e88 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -25,6 +25,7 @@
#include <scitems.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <unotools/fltrcfg.hxx>
#include <vcl/wmf.hxx>
@@ -137,13 +138,7 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) override
{
::osl::MutexGuard aGuard( m_aMutex );
- uno::Sequence< OUString > aResult( IdToOleNameHash.size() );
- NamedIndexToOleName::iterator it = IdToOleNameHash.begin();
- NamedIndexToOleName::iterator it_end = IdToOleNameHash.end();
- OUString* pName = aResult.getArray();
- for (; it != it_end; ++it, ++pName )
- *pName = it->first;
- return aResult;
+ return comphelper::mapKeysToSequence( IdToOleNameHash);
}
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) override
{
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index b18184d78398..ec58bc901a3f 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -167,13 +167,7 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) override
{
- uno::Sequence< OUString > names( namesToIndices.size() );
- OUString* pString = names.getArray();
- NameIndexHash::const_iterator it = namesToIndices.begin();
- NameIndexHash::const_iterator it_end = namesToIndices.end();
- for ( ; it != it_end; ++it, ++pString )
- *pString = it->first;
- return names;
+ return comphelper::mapKeysToSequence( namesToIndices );
}
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) override
diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx
index ede740dd69e0..1f90d035c3df 100644
--- a/sc/source/ui/vba/vbawindows.cxx
+++ b/sc/source/ui/vba/vbawindows.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <cppuhelper/implbase.hxx>
+#include <comphelper/sequence.hxx>
#include "vbawindow.hxx"
#include "vbaglobals.hxx"
@@ -178,13 +179,7 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) override
{
- uno::Sequence< OUString > names( namesToIndices.size() );
- OUString* pString = names.getArray();
- NameIndexHash::const_iterator it = namesToIndices.begin();
- NameIndexHash::const_iterator it_end = namesToIndices.end();
- for ( ; it != it_end; ++it, ++pString )
- *pString = it->first;
- return names;
+ return comphelper::mapKeysToSequence( namesToIndices );
}
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) override
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index d201f836306d..66b4f912b86b 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -520,13 +520,7 @@ ReadOnlyEventsNameContainer::getByName( const OUString& aName ) throw (container
Sequence< OUString > SAL_CALL
ReadOnlyEventsNameContainer::getElementNames( ) throw (RuntimeException, std::exception)
{
- Sequence< OUString > names(m_hEvents.size());
- OUString* pDest = names.getArray();
- EventSupplierHash::const_iterator it = m_hEvents.begin();
- EventSupplierHash::const_iterator it_end = m_hEvents.end();
- for ( sal_Int32 index = 0; it != it_end; ++index, ++pDest, ++it )
- *pDest = it->first;
- return names;
+ return comphelper::mapKeysToSequence(m_hEvents);
}
sal_Bool SAL_CALL
diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx
index c9a3d4310c1a..61af42268231 100644
--- a/sfx2/source/dialog/filtergrouping.cxx
+++ b/sfx2/source/dialog/filtergrouping.cxx
@@ -31,6 +31,7 @@
#include <unotools/confignode.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/sequence.hxx>
#include <comphelper/string.hxx>
#include <tools/diagnose_ex.h>
@@ -825,12 +826,7 @@ namespace sfx2
// create a representation of the group which is understandable by the XFilterGroupManager
if ( _rGroup.size() )
{
- Sequence< StringPair > aFilters( _rGroup.size() );
- ::std::copy(
- _rGroup.begin(),
- _rGroup.end(),
- aFilters.getArray()
- );
+ Sequence< StringPair > aFilters( comphelper::containerToSequence<StringPair>(_rGroup) );
if ( _bAddExtension )
{
StringPair* pFilters = aFilters.getArray();
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index b9883714d1d5..ce7fa4d60649 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -4046,13 +4046,7 @@ void SAL_CALL FormController::invalidateAllFeatures( ) throw (RuntimeException,
{
::osl::ClearableMutexGuard aGuard( m_aMutex );
- Sequence< sal_Int16 > aInterceptedFeatures( m_aFeatureDispatchers.size() );
- ::std::transform(
- m_aFeatureDispatchers.begin(),
- m_aFeatureDispatchers.end(),
- aInterceptedFeatures.getArray(),
- ::o3tl::select1st< DispatcherContainer::value_type >()
- );
+ Sequence< sal_Int16 > aInterceptedFeatures( comphelper::mapKeysToSequence(m_aFeatureDispatchers) );
aGuard.clear();
if ( aInterceptedFeatures.getLength() )
diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx
index 966f811c3756..c3cca01915f7 100644
--- a/svx/source/table/tabledesign.cxx
+++ b/svx/source/table/tabledesign.cxx
@@ -36,6 +36,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequence.hxx>
#include "svx/unoprov.hxx"
#include "svx/sdr/table/tabledesign.hxx"
@@ -301,15 +302,7 @@ Sequence< OUString > SAL_CALL TableDesignStyle::getElementNames() throw(RuntimeE
{
SolarMutexGuard aGuard;
- const CellStyleNameMap& rMap = getCellStyleNameMap();
- Sequence< OUString > aRet( rMap.size() );
- OUString* pName = aRet.getArray();
-
- CellStyleNameMap::const_iterator iter = rMap.begin();
- while( iter != rMap.end() )
- *pName++ = (*iter++).first;
-
- return aRet;
+ return comphelper::mapKeysToSequence( getCellStyleNameMap() );
}
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 7c9e150f9511..98472cf36e4f 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -31,6 +31,7 @@
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/propertysetinfo.hxx>
+#include <comphelper/sequence.hxx>
#include <svx/dialmgr.hxx>
#include "svx/unoapi.hxx"
#include <editeng/unotext.hxx>
@@ -874,16 +875,7 @@ OUString UHashMap::getNameFromId(sal_uInt32 nId)
uno::Sequence< OUString > UHashMap::getServiceNames()
{
- const UHashMapImpl &rMap = GetUHashImpl();
-
- uno::Sequence< OUString > aSeq( rMap.size() );
- OUString* pStrings = aSeq.getArray();
-
- int i = 0;
- for (UHashMapImpl::const_iterator it = rMap.begin(); it != rMap.end(); ++it)
- pStrings[i++] = it->first;
-
- return aSeq;
+ return comphelper::mapKeysToSequence( GetUHashImpl() );
}
sal_uInt32 UHashMap::getId( const OUString& rCompareString )
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index d18841e924eb..fdcf1ab6821f 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -2074,18 +2074,7 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes(
tAccParaPropValMap aRunAttrSeq;
_getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
- uno::Sequence< PropertyValue > aValues( aRunAttrSeq.size() );
- PropertyValue* pValues = aValues.getArray();
- sal_Int32 i = 0;
- for ( tAccParaPropValMap::const_iterator aIter = aRunAttrSeq.begin();
- aIter != aRunAttrSeq.end();
- ++aIter )
- {
- pValues[i] = aIter->second;
- ++i;
- }
-
- return aValues;
+ return comphelper::mapValuesToSequence( aRunAttrSeq );
}
void SwAccessibleParagraph::_getSupplementalAttributesImpl(
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 282502ca221c..dc049286e6d7 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -36,6 +36,7 @@
#include <docsh.hxx>
#include <xmloff/odffields.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/sequence.hxx>
using namespace ::sw::mark;
using namespace ::com::sun::star;
@@ -532,11 +533,7 @@ uno::Sequence<OUString> SwXFieldmarkParameters::getElementNames()
{
SolarMutexGuard aGuard;
IFieldmark::parameter_map_t* pParameters = getCoreParameters();
- uno::Sequence<OUString> vResult(pParameters->size());
- OUString* pOutEntry = vResult.getArray();
- for(IFieldmark::parameter_map_t::iterator pEntry = pParameters->begin(); pEntry!=pParameters->end(); ++pEntry, ++pOutEntry)
- *pOutEntry = pEntry->first;
- return vResult;
+ return comphelper::mapKeysToSequence(*pParameters);
}
sal_Bool SwXFieldmarkParameters::hasByName(const OUString& aName)
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 4cd09735e93f..51f1501a2900 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -194,12 +194,7 @@ public:
}
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (css::uno::RuntimeException, std::exception) override
{
- uno::Sequence< OUString > aElements( mTemplateToProject.size() );
- StringHashMap::iterator it_end = mTemplateToProject.end();
- sal_Int32 index = 0;
- for ( StringHashMap::iterator it = mTemplateToProject.begin(); it != it_end; ++it, ++index )
- aElements[ index ] = it->first;
- return aElements;
+ return comphelper::mapKeysToSequence( mTemplateToProject );
}
virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw ( css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, std::exception ) override
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index e46281434897..e7ae8201869a 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -102,13 +102,7 @@ public:
virtual Sequence< OUString > SAL_CALL getElementNames( ) throw(RuntimeException, std::exception) override
{
::osl::MutexGuard aGuard( m_aMutex );
- Sequence< OUString > aResult( things.size() );
- typename NamedThingsHash::iterator it = things.begin();
- typename NamedThingsHash::iterator it_end = things.end();
- OUString* pName = aResult.getArray();
- for (; it != it_end; ++it, ++pName )
- *pName = it->first;
- return aResult;
+ return comphelper::mapKeysToSequence( things );
}
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException, std::exception) override
{
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
index 18151f61e774..17f727b803ec 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
@@ -30,6 +30,7 @@
#include "comphelper/documentinfo.hxx"
#include "comphelper/namedvaluecollection.hxx"
+#include "comphelper/sequence.hxx"
#include "com/sun/star/awt/XTopWindow.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
@@ -550,17 +551,7 @@ uno::Sequence< OUString > OfficeDocumentsManager::queryDocuments()
{
osl::MutexGuard aGuard( m_aMtx );
- uno::Sequence< OUString > aRet( m_aDocs.size() );
- sal_Int32 nPos = 0;
-
- DocumentList::const_iterator it = m_aDocs.begin();
- while ( it != m_aDocs.end() )
- {
- aRet[ nPos ] = (*it).first;
- ++it;
- ++nPos;
- }
- return aRet;
+ return comphelper::mapKeysToSequence( m_aDocs );
}
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index c5a547735e2d..ae8098d8150f 100644
--- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
@@ -21,6 +21,7 @@
#include <unotools/mediadescriptor.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -184,13 +185,7 @@ public:
virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) override
{
- uno::Sequence< OUString > names( namesToIndices.size() );
- OUString* pString = names.getArray();
- NameIndexHash::const_iterator it = namesToIndices.begin();
- NameIndexHash::const_iterator it_end = namesToIndices.end();
- for ( ; it != it_end; ++it, ++pString )
- *pString = it->first;
- return names;
+ return comphelper::mapKeysToSequence( namesToIndices );
}
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) override
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 13a13da29e7f..729b0311fa95 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -34,6 +34,7 @@
#include <comphelper/processfactory.hxx>
#include <tools/globname.hxx>
#include <comphelper/classids.hxx>
+#include <comphelper/sequence.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -392,10 +393,7 @@ Sequence< Reference< chart2::data::XLabeledDataSequence > > lcl_getAllSeriesSequ
}
}
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aRet( aContainer.size());
- ::std::copy( aContainer.begin(), aContainer.end(), aRet.getArray());
-
- return aRet;
+ return comphelper::containerToSequence< Reference< chart2::data::XLabeledDataSequence > >( aContainer );
}
Reference< chart2::data::XLabeledDataSequence >
@@ -444,8 +442,7 @@ Reference< chart2::data::XDataSource > lcl_pressUsedDataIntoRectangularFormat( c
aLabeledSeqVector.push_back( aSeriesSeqVector[nN] );
}
- Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( aLabeledSeqVector.size() );
- ::std::copy( aLabeledSeqVector.begin(), aLabeledSeqVector.end(), aSeq.getArray() );
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( comphelper::containerToSequence(aLabeledSeqVector) );
return lcl_createDataSource( aSeq );
}
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index a895c8e13da6..3ac2e358bd8c 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -30,6 +30,7 @@
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/nmspmap.hxx>
+#include <comphelper/sequence.hxx>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
@@ -1020,9 +1021,7 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary(
if( static_cast<sal_Int32>(aRemainingSeries.size()) != aSeriesSeq.getLength() )
{
//remove the series that have only hidden data
- Sequence< Reference< chart2::XDataSeries > > aRemainingSeriesSeq( aRemainingSeries.size());
- ::std::copy( aRemainingSeries.begin(), aRemainingSeries.end(), aRemainingSeriesSeq.getArray());
- xSeriesContainer->setDataSeries( aRemainingSeriesSeq );
+ xSeriesContainer->setDataSeries( comphelper::containerToSequence(aRemainingSeries) );
//remove unused sequences
Reference< chart2::data::XDataSource > xDataSource( xChartDoc, uno::UNO_QUERY );
diff --git a/xmloff/source/forms/eventexport.cxx b/xmloff/source/forms/eventexport.cxx
index e26ed665ceec..57b995cd33f4 100644
--- a/xmloff/source/forms/eventexport.cxx
+++ b/xmloff/source/forms/eventexport.cxx
@@ -21,6 +21,7 @@
#include <osl/diagnose.h>
#include "strings.hxx"
#include <tools/debug.hxx>
+#include <comphelper/sequence.hxx>
namespace xmloff
{
@@ -106,15 +107,7 @@ namespace xmloff
Sequence< OUString > SAL_CALL OEventDescriptorMapper::getElementNames( ) throw(RuntimeException, std::exception)
{
- Sequence< OUString > aReturn(m_aMappedEvents.size());
- OUString* pReturn = aReturn.getArray();
- for ( MapString2PropertyValueSequence::const_iterator aCollect = m_aMappedEvents.begin();
- aCollect != m_aMappedEvents.end();
- ++aCollect, ++pReturn
- )
- *pReturn = aCollect->first;
-
- return aReturn;
+ return comphelper::mapKeysToSequence(m_aMappedEvents);
}
sal_Bool SAL_CALL OEventDescriptorMapper::hasByName( const OUString& _rName ) throw(RuntimeException, std::exception)