summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unotools/source/config/compatibility.cxx4
-rw-r--r--unotools/source/config/dynamicmenuoptions.cxx32
-rw-r--r--unotools/source/config/eventcfg.cxx10
-rw-r--r--unotools/source/config/fontcfg.cxx13
-rw-r--r--unotools/source/config/options.cxx14
-rw-r--r--unotools/source/misc/fontdefs.cxx6
-rw-r--r--unotools/source/ucbhelper/ucbhelper.cxx17
-rw-r--r--unoxml/source/dom/document.cxx17
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx6
-rw-r--r--unoxml/source/xpath/xpathapi.cxx19
-rw-r--r--uui/source/fltdlg.cxx6
-rw-r--r--uui/source/iahndl.cxx11
-rw-r--r--vbahelper/source/vbahelper/vbacommandbarhelper.cxx11
-rw-r--r--vbahelper/source/vbahelper/vbaeventshelperbase.cxx4
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx7
15 files changed, 63 insertions, 114 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); });
}
}
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 69a15862501a..2ba945fb7efa 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -110,10 +110,9 @@ namespace DOM
::osl::MutexGuard const g(m_Mutex);
#ifdef DBG_UTIL
// node map must be empty now, otherwise CDocument must not die!
- for (nodemap_t::iterator i = m_NodeMap.begin();
- i != m_NodeMap.end(); ++i)
+ for (const auto& rEntry : m_NodeMap)
{
- Reference<XNode> const xNode(i->second.first);
+ Reference<XNode> const xNode(rEntry.second.first);
OSL_ENSURE(!xNode.is(),
"CDocument::~CDocument(): ERROR: live node in document node map!");
}
@@ -377,11 +376,9 @@ namespace DOM
}
// notify listeners about start
- listenerlist_t::const_iterator iter1 = streamListeners.begin();
- while (iter1 != streamListeners.end()) {
- Reference< XStreamListener > aListener = *iter1;
+ for (const auto& rStreamListener : streamListeners) {
+ Reference< XStreamListener > aListener = rStreamListener;
aListener->started();
- ++iter1;
}
{
@@ -398,11 +395,9 @@ namespace DOM
}
// call listeners
- listenerlist_t::const_iterator iter2 = streamListeners.begin();
- while (iter2 != streamListeners.end()) {
- Reference< XStreamListener > aListener = *iter2;
+ for (const auto& rStreamListener : streamListeners) {
+ Reference< XStreamListener > aListener = rStreamListener;
aListener->closed();
- ++iter2;
}
}
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 995c3034d02f..4d0a1ca91f3f 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -1491,13 +1491,11 @@ void SAL_CALL librdf_Repository::setStatementRDFa(
}
try
{
- for (::std::vector< std::shared_ptr<librdf_TypeConverter::Resource> >
- ::iterator iter = predicates.begin(); iter != predicates.end();
- ++iter)
+ for (const auto& rPredicatePtr : predicates)
{
addStatementGraph_Lock(
librdf_TypeConverter::Statement(pSubject,
- std::dynamic_pointer_cast<librdf_TypeConverter::URI>(*iter),
+ std::dynamic_pointer_cast<librdf_TypeConverter::URI>(rPredicatePtr),
pContent),
sContext, true);
}
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index f62be771f611..74f216d59a7f 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -120,16 +120,14 @@ namespace XPath
xmlXPathContextPtr ctx,
const nsmap_t& nsmap)
{
- nsmap_t::const_iterator i = nsmap.begin();
OString oprefix, ouri;
- while (i != nsmap.end())
+ for (const auto& rEntry : nsmap)
{
- oprefix = OUStringToOString(i->first, RTL_TEXTENCODING_UTF8);
- ouri = OUStringToOString(i->second, RTL_TEXTENCODING_UTF8);
+ oprefix = OUStringToOString(rEntry.first, RTL_TEXTENCODING_UTF8);
+ ouri = OUStringToOString(rEntry.second, RTL_TEXTENCODING_UTF8);
xmlChar const *p = reinterpret_cast<xmlChar const *>(oprefix.getStr());
xmlChar const *u = reinterpret_cast<xmlChar const *>(ouri.getStr());
(void)xmlXPathRegisterNs(ctx, p, u);
- ++i;
}
}
@@ -166,10 +164,9 @@ namespace XPath
{
nsmap_t namespaces;
lcl_collectNamespaces(namespaces, xNamespaceNode);
- for (nsmap_t::const_iterator iter = namespaces.begin();
- iter != namespaces.end(); ++iter)
+ for (const auto& rEntry : namespaces)
{
- rAPI.registerNS(iter->first, iter->second);
+ rAPI.registerNS(rEntry.first, rEntry.second);
}
}
@@ -179,10 +176,9 @@ namespace XPath
xmlXPathContextPtr ctx,
const extensions_t& extensions)
{
- extensions_t::const_iterator i = extensions.begin();
- while (i != extensions.end())
+ for (const auto& rExtensionRef : extensions)
{
- Libxml2ExtensionHandle aHandle = (*i)->getLibxml2ExtensionHandle();
+ Libxml2ExtensionHandle aHandle = rExtensionRef->getLibxml2ExtensionHandle();
if ( aHandle.functionLookupFunction != 0 )
{
xmlXPathRegisterFuncLookup(ctx,
@@ -199,7 +195,6 @@ namespace XPath
reinterpret_cast<void*>(
sal::static_int_cast<sal_IntPtr>(aHandle.variableData)));
}
- ++i;
}
}
diff --git a/uui/source/fltdlg.cxx b/uui/source/fltdlg.cxx
index 100f0e90bcb2..fb9516a50498 100644
--- a/uui/source/fltdlg.cxx
+++ b/uui/source/fltdlg.cxx
@@ -93,11 +93,9 @@ void FilterDialog::ChangeFilters( const FilterNameList* pFilterNames )
m_xLbFilters->clear();
if( m_pFilterNames != nullptr )
{
- for( FilterNameListPtr pItem = m_pFilterNames->begin();
- pItem != m_pFilterNames->end() ;
- ++pItem )
+ for( const auto& rItem : *m_pFilterNames )
{
- m_xLbFilters->append_text(pItem->sUI);
+ m_xLbFilters->append_text(rItem.sUI);
}
}
}
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index eca18bd79a16..7b8ee8b8afe0 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -284,15 +284,8 @@ UUIInteractionHelper::tryOtherInteractionHandler(
InteractionHandlerDataList dataList;
getInteractionHandlerList(dataList);
- InteractionHandlerDataList::const_iterator aEnd(dataList.end());
- for (InteractionHandlerDataList::const_iterator aIt(dataList.begin());
- aIt != aEnd;
- ++aIt)
- {
- if ( handleCustomRequest( rRequest, aIt->ServiceName ) )
- return true;
- }
- return false;
+ return std::any_of(dataList.cbegin(), dataList.cend(),
+ [&](const InteractionHandlerData& rData) { return handleCustomRequest( rRequest, rData.ServiceName ); });
}
namespace
diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
index 058ddc2a4142..708b59a0da41 100644
--- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx
@@ -73,13 +73,10 @@ public:
OUString findBuildinToolbar( const OUString& sToolbarName )
{
- MSO2OOCommandbarMap::iterator it = maBuildinToolbarMap.begin();
- for(; it != maBuildinToolbarMap.end(); ++it )
- {
- OUString sName = it->first;
- if( sName.equalsIgnoreAsciiCase( sToolbarName ) )
- return it->second;
- }
+ auto it = std::find_if(maBuildinToolbarMap.begin(), maBuildinToolbarMap.end(),
+ [&sToolbarName](const MSO2OOCommandbarMap::value_type& rItem) { return rItem.first.equalsIgnoreAsciiCase( sToolbarName ); });
+ if( it != maBuildinToolbarMap.end() )
+ return it->second;
return OUString();
}
};
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
index cf30602f5e3c..99d49625c3e9 100644
--- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
@@ -344,9 +344,9 @@ VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( co
sal_Int32 nModuleType = getModuleType( rModuleName );
// search for all event handlers
ModulePathMap& rPathMap = maEventPaths[ rModuleName ];
- for( EventHandlerInfoMap::iterator aIt = maEventInfos.begin(), aEnd = maEventInfos.end(); aIt != aEnd; ++aIt )
+ for( const auto& rEventInfo : maEventInfos )
{
- const EventHandlerInfo& rInfo = aIt->second;
+ const EventHandlerInfo& rInfo = rEventInfo.second;
if( rInfo.mnModuleType == nModuleType )
rPathMap[ rInfo.mnEventId ] = resolveVBAMacro( mpShell, maLibraryName, rModuleName, rInfo.maMacroName );
}
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 4ebc80e743c4..e1a148274604 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -724,12 +724,9 @@ void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Point
}
}
- for ( ::std::vector< uno::Reference< frame::XController > >::const_iterator controller = aControllers.begin();
- controller != aControllers.end();
- ++controller
- )
+ for ( const auto& rController : aControllers )
{
- const uno::Reference< frame::XFrame > xFrame ( (*controller)->getFrame(), uno::UNO_SET_THROW );
+ const uno::Reference< frame::XFrame > xFrame ( rController->getFrame(), uno::UNO_SET_THROW );
const uno::Reference< awt::XWindow > xWindow ( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );