diff options
Diffstat (limited to 'svx/source/gallery2')
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 6 | ||||
-rw-r--r-- | svx/source/gallery2/galini.cxx | 8 | ||||
-rw-r--r-- | svx/source/gallery2/gallery1.cxx | 37 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 6 |
4 files changed, 21 insertions, 36 deletions
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 319944412d4b..dd19615bb66f 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -263,13 +263,11 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY ); css::uno::Reference< css::util::XURLTransformer > xTransformer( mpBrowser->GetURLTransformer() ); - CommandInfoMap::const_iterator aEnd = m_aCommandInfo.end(); - for ( CommandInfoMap::iterator it = m_aCommandInfo.begin(); - it != aEnd; ++it ) + for ( auto& rInfo : m_aCommandInfo ) { try { - CommandInfo &rCmdInfo = it->second; + CommandInfo &rCmdInfo = rInfo.second; if ( xTransformer.is() ) xTransformer->parseStrict( rCmdInfo.URL ); diff --git a/svx/source/gallery2/galini.cxx b/svx/source/gallery2/galini.cxx index 59c52719dd2d..1775aeb20142 100644 --- a/svx/source/gallery2/galini.cxx +++ b/svx/source/gallery2/galini.cxx @@ -77,14 +77,14 @@ OUString GalleryThemeEntry::ReadStrFromIni(const OUString &aKeyName ) /* FIXME-BCP47: what is this supposed to do? */ n = 0; OUString aLang = aLocale.replace('_','-'); - for( std::vector< OUString >::const_iterator i = aFallbacks.begin(); - i != aFallbacks.end(); ++i, ++n ) + for( const auto& rFallback : aFallbacks ) { - SAL_INFO( "svx", "compare '" << aLang << "' with '" << *i << "' rank " << nRank << " vs. " << n ); - if( *i == aLang && n < nRank ) { + SAL_INFO( "svx", "compare '" << aLang << "' with '" << rFallback << "' rank " << nRank << " vs. " << n ); + if( rFallback == aLang && n < nRank ) { nRank = n; // try to get the most accurate match aResult = aValue; } + ++n; } } } diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index daeaa702732c..81d7d73cd3cb 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -666,14 +666,10 @@ bool Gallery::RemoveTheme( const OUString& rThemeName ) KillFile( aStrURL ); } - auto aEnd = aThemeList.end(); - for ( auto it = aThemeList.begin(); it != aEnd; ++it ) - { - if ( pThemeEntry == it->get() ) { - aThemeList.erase( it ); - break; - } - } + auto it = std::find_if(aThemeList.begin(), aThemeList.end(), + [&pThemeEntry](const std::unique_ptr<GalleryThemeEntry>& rpEntry) { return pThemeEntry == rpEntry.get(); }); + if (it != aThemeList.end()) + aThemeList.erase( it ); Broadcast( GalleryHint( GalleryHintType::THEME_REMOVED, rThemeName ) ); @@ -689,14 +685,10 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry) if( pThemeEntry ) { - for (GalleryCacheThemeList::const_iterator it = aThemeCache.begin(); it != aThemeCache.end(); ++it) - { - if (pThemeEntry == (*it)->GetThemeEntry()) - { - pTheme = (*it)->GetTheme(); - break; - } - } + auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(), + [&pThemeEntry](const GalleryThemeCacheEntry* pEntry) { return pThemeEntry == pEntry->GetThemeEntry(); }); + if (it != aThemeCache.end()) + pTheme = (*it)->GetTheme(); if( !pTheme ) { @@ -736,15 +728,12 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry) void Gallery::ImplDeleteCachedTheme( GalleryTheme const * pTheme ) { - GalleryCacheThemeList::const_iterator aEnd = aThemeCache.end(); - for (GalleryCacheThemeList::iterator it = aThemeCache.begin(); it != aEnd; ++it) + auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(), + [&pTheme](const GalleryThemeCacheEntry* pEntry) { return pTheme == pEntry->GetTheme(); }); + if (it != aThemeCache.end()) { - if (pTheme == (*it)->GetTheme()) - { - delete *it; - aThemeCache.erase(it); - break; - } + delete *it; + aThemeCache.erase(it); } } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 5ac71a218e39..79b00202abad 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -1122,10 +1122,8 @@ bool GalleryTheme::InsertFileOrDirURL(const INetURLObject& rFileOrDirURL, sal_uI { } - ::std::vector< INetURLObject >::const_iterator aIter( aURLVector.begin() ), aEnd( aURLVector.end() ); - - while( aIter != aEnd ) - bRet = bRet || InsertURL( *aIter++, nInsertPos ); + for( const auto& rURL : aURLVector ) + bRet = bRet || InsertURL( rURL, nInsertPos ); return bRet; } |