diff options
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/compatibility.cxx | 4 | ||||
-rw-r--r-- | unotools/source/config/dynamicmenuoptions.cxx | 32 | ||||
-rw-r--r-- | unotools/source/config/eventcfg.cxx | 10 | ||||
-rw-r--r-- | unotools/source/config/fontcfg.cxx | 13 | ||||
-rw-r--r-- | unotools/source/config/options.cxx | 14 | ||||
-rw-r--r-- | unotools/source/misc/fontdefs.cxx | 6 | ||||
-rw-r--r-- | unotools/source/ucbhelper/ucbhelper.cxx | 17 |
7 files changed, 36 insertions, 60 deletions
diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx index ba5df9a01113..ce4ed63b8430 100644 --- a/unotools/source/config/compatibility.cxx +++ b/unotools/source/config/compatibility.cxx @@ -244,10 +244,10 @@ Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions_Impl::GetList() co lProperties[i].Name = SvtCompatibilityEntry::getName( SvtCompatibilityEntry::Index(i) ); sal_Int32 j = 0; - for ( std::vector< SvtCompatibilityEntry >::const_iterator pItem = m_aOptions.begin(); pItem != m_aOptions.end(); ++pItem ) + for ( const auto& rItem : m_aOptions ) { for ( int i = static_cast<int>(SvtCompatibilityEntry::Index::Name); i < static_cast<int>(SvtCompatibilityEntry::Index::INVALID); ++i ) - lProperties[i].Value = pItem->getValue( SvtCompatibilityEntry::Index(i) ); + lProperties[i].Value = rItem.getValue( SvtCompatibilityEntry::Index(i) ); lResult[ j++ ] = lProperties; } diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 871886b238d0..6c451d387dcb 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -94,8 +94,6 @@ class SvtDynMenu // convert internal list to external format // for using it on right menus really // Notice: We build a property list with 4 entries and set it on result list then. - // The while-loop starts with pointer on internal member list lSetupEntries, change to - // lUserEntries then and stop after that with NULL! // Separator entries will be packed in another way then normal entries! We define // special string "sSeparator" to perform too ... Sequence< Sequence< PropertyValue > > GetList() const @@ -106,20 +104,17 @@ class SvtDynMenu Sequence< PropertyValue > lProperties ( PROPERTYCOUNT ); Sequence< Sequence< PropertyValue > > lResult ( nSetupCount+nUserCount ); OUString sSeparator ( "private:separator" ); - const vector< SvtDynMenuEntry >* pList = &lSetupEntries; lProperties[OFFSET_URL ].Name = PROPERTYNAME_URL; lProperties[OFFSET_TITLE ].Name = PROPERTYNAME_TITLE; lProperties[OFFSET_IMAGEIDENTIFIER].Name = PROPERTYNAME_IMAGEIDENTIFIER; lProperties[OFFSET_TARGETNAME ].Name = PROPERTYNAME_TARGETNAME; - while( pList != nullptr ) + for( const auto& pList : {&lSetupEntries, &lUserEntries} ) { - for( vector< SvtDynMenuEntry >::const_iterator pItem =pList->begin(); - pItem!=pList->end(); - ++pItem ) + for( const auto& rItem : *pList ) { - if( pItem->sURL == sSeparator ) + if( rItem.sURL == sSeparator ) { lProperties[OFFSET_URL ].Value <<= sSeparator; lProperties[OFFSET_TITLE ].Value <<= OUString(); @@ -128,18 +123,14 @@ class SvtDynMenu } else { - lProperties[OFFSET_URL ].Value <<= pItem->sURL; - lProperties[OFFSET_TITLE ].Value <<= pItem->sTitle; - lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= pItem->sImageIdentifier; - lProperties[OFFSET_TARGETNAME ].Value <<= pItem->sTargetName; + lProperties[OFFSET_URL ].Value <<= rItem.sURL; + lProperties[OFFSET_TITLE ].Value <<= rItem.sTitle; + lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= rItem.sImageIdentifier; + lProperties[OFFSET_TARGETNAME ].Value <<= rItem.sTargetName; } lResult[nStep] = lProperties; ++nStep; } - if( pList == &lSetupEntries ) - pList = &lUserEntries; - else - pList = nullptr; } return lResult; } @@ -501,15 +492,12 @@ void SvtDynamicMenuOptions_Impl::impl_SortAndExpandPropertyNames( const Sequence // Copy sorted entries to destination and expand every item with // 4 supported sub properties. - for( vector< OUString >::const_iterator pItem =lTemp.begin(); - pItem!=lTemp.end(); - ++pItem ) + for( const auto& rItem : lTemp ) { - OUString sFixPath(sSetNode + PATHDELIMITER + *pItem + PATHDELIMITER); + OUString sFixPath(sSetNode + PATHDELIMITER + rItem + PATHDELIMITER); lDestination[nDestinationStep++] = sFixPath + PROPERTYNAME_URL; lDestination[nDestinationStep++] = sFixPath + PROPERTYNAME_TITLE; - lDestination[nDestinationStep++] = sFixPath - + PROPERTYNAME_IMAGEIDENTIFIER; + lDestination[nDestinationStep++] = sFixPath + PROPERTYNAME_IMAGEIDENTIFIER; lDestination[nDestinationStep++] = sFixPath + PROPERTYNAME_TARGETNAME; } } diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index 85ca9b2862f8..4f48ade2c34b 100644 --- a/unotools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -161,24 +161,22 @@ void GlobalEventConfig_Impl::ImplCommit() { //DF need to check it this is correct?? SAL_INFO("unotools", "In GlobalEventConfig_Impl::ImplCommit"); - EventBindingHash::const_iterator it = m_eventBindingHash.begin(); - EventBindingHash::const_iterator it_end = m_eventBindingHash.end(); // clear the existing nodes ClearNodeSet( SETNODE_BINDINGS ); Sequence< beans::PropertyValue > seqValues( 1 ); OUString sNode; //step through the list of events - for(int i=0;it!=it_end;++it,++i) + for(const auto& rEntry : m_eventBindingHash) { //no point in writing out empty bindings! - if(it->second.isEmpty() ) + if(rEntry.second.isEmpty() ) continue; sNode = SETNODE_BINDINGS PATHDELIMITER "BindingType['" + - it->first + + rEntry.first + "']" PATHDELIMITER PROPERTYNAME_BINDINGURL; SAL_INFO("unotools", "writing binding for: " << sNode); seqValues[ 0 ].Name = sNode; - seqValues[ 0 ].Value <<= it->second; + seqValues[ 0 ].Value <<= rEntry.second; //write the data to the registry SetSetProperties(SETNODE_BINDINGS,seqValues); } diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index c4b496bba09a..365cea68450b 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -216,10 +216,11 @@ OUString DefaultFontConfiguration::getDefaultFont( const LanguageTag& rLanguageT else { ::std::vector< OUString > aFallbacks( rLanguageTag.getFallbackStrings( false)); - for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); - it != aFallbacks.end() && aRet.isEmpty(); ++it) + for (const auto& rFallback : aFallbacks) { - aRet = tryLocale( *it, aType ); + aRet = tryLocale( rFallback, aType ); + if (!aRet.isEmpty()) + break; } } } @@ -1064,13 +1065,13 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const OUString& rFontN if (aLanguageTag.getLanguage() != "en") aFallbacks.emplace_back("en"); - for (::std::vector< OUString >::const_iterator fb( aFallbacks.begin()); fb != aFallbacks.end(); ++fb) + for (const auto& rFallback : aFallbacks) { - std::unordered_map< OUString, LocaleSubst >::const_iterator lang = m_aSubst.find( *fb ); + std::unordered_map< OUString, LocaleSubst >::const_iterator lang = m_aSubst.find( rFallback ); if( lang != m_aSubst.end() ) { if( ! lang->second.bConfigRead ) - readLocaleSubst( *fb ); + readLocaleSubst( rFallback ); // try to find an exact match // because the list is sorted this will also find fontnames of the form searchfontname* std::vector< FontNameAttr >::const_iterator it = ::std::lower_bound( lang->second.aSubstAttributes.begin(), lang->second.aSubstAttributes.end(), aSearchAttr, StrictStringSort() ); diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx index 977f185b42b8..4da44fa274b5 100644 --- a/unotools/source/config/options.cxx +++ b/unotools/source/config/options.cxx @@ -20,6 +20,8 @@ #include <sal/config.h> #include <unotools/options.hxx> +#include <algorithm> + using utl::detail::Options; using utl::ConfigurationBroadcaster; @@ -64,15 +66,9 @@ void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListene void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener const * pListener ) { if ( mpList ) { - for ( IMPL_ConfigurationListenerList::iterator it = mpList->begin(); - it != mpList->end(); - ++it - ) { - if ( *it == pListener ) { - mpList->erase( it ); - break; - } - } + auto it = std::find(mpList->begin(), mpList->end(), pListener); + if ( it != mpList->end() ) + mpList->erase( it ); } } diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 67f4d73a3fc3..be391cb82a5a 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -549,10 +549,10 @@ OUString GetSubsFontName( const OUString& rName, SubsFontFlags nFlags ) } if( ! pVector ) continue; - for( ::std::vector< OUString >::const_iterator it = pVector->begin(); it != pVector->end(); ++it ) - if( ! ImplIsFontToken( rName, *it ) ) + for( const auto& rSubstitution : *pVector ) + if( ! ImplIsFontToken( rName, rSubstitution ) ) { - ImplAppendFontToken( aName, *it ); + ImplAppendFontToken( aName, rSubstitution ); if( nFlags & SubsFontFlags::ONLYONE ) { i = 4; diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index ea4caeab8c46..80580698d88d 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -361,18 +361,11 @@ bool utl::UCBContentHelper::Exists(OUString const & url) { o.removeFinalSlash(); std::vector<OUString> cs( getContents(o.GetMainURL(INetURLObject::DecodeMechanism::NONE))); - for (std::vector<OUString>::iterator i(cs.begin()); i != cs.end(); - ++i) - { - if (INetURLObject(*i).getName( - INetURLObject::LAST_SEGMENT, true, - INetURLObject::DecodeMechanism::WithCharset). - equalsIgnoreAsciiCase(name)) - { - return true; - } - } - return false; + return std::any_of(cs.begin(), cs.end(), + [&name](const OUString& rItem) { + return INetURLObject(rItem). + getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset). + equalsIgnoreAsciiCase(name); }); } } |