summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-19 13:43:23 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-11-20 08:14:13 +0000
commitfe3fd05966a668c1cdf53e8221b8614e9a07de65 (patch)
tree4c6c105b78d0cb9c45431c2fecd2583d6a2aa85c /framework
parent1d5c39192e81f950289dbdd7991a0e8a67c0aabc (diff)
add mapKeysToSequence/mapValuesToSequence methods to comphelper
and use them Change-Id: If4dc9df63db37185228aeaaab2979498d61304ec Reviewed-on: https://gerrit.libreoffice.org/20055 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'framework')
-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
6 files changed, 11 insertions, 61 deletions
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 )