[Libreoffice-commits] core.git: xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 17 06:12:26 UTC 2018


 xmloff/source/forms/attriblistmerge.cxx              |   22 --
 xmloff/source/forms/elementexport.cxx                |    9 -
 xmloff/source/forms/elementimport.cxx                |  167 ++++++-------------
 xmloff/source/forms/eventimport.cxx                  |   17 -
 xmloff/source/forms/handler/vcl_date_handler.cxx     |    7 
 xmloff/source/forms/handler/vcl_time_handler.cxx     |    7 
 xmloff/source/forms/layerexport.cxx                  |   12 -
 xmloff/source/forms/layerimport.cxx                  |   29 +--
 xmloff/source/forms/propertyexport.cxx               |   15 -
 xmloff/source/forms/propertyimport.cxx               |    8 
 xmloff/source/meta/xmlmetae.cxx                      |    7 
 xmloff/source/script/XMLEventExport.cxx              |    8 
 xmloff/source/script/XMLEventImportHelper.cxx        |    7 
 xmloff/source/script/XMLEventsImportContext.cxx      |   15 -
 xmloff/source/style/PageMasterExportPropMapper.cxx   |    4 
 xmloff/source/style/PageMasterImportPropMapper.cxx   |    5 
 xmloff/source/style/XMLPageExport.cxx                |   19 +-
 xmloff/source/style/impastpl.cxx                     |    4 
 xmloff/source/style/prhdlfac.cxx                     |    4 
 xmloff/source/style/prstylei.cxx                     |   28 +--
 xmloff/source/style/xmlaustp.cxx                     |   32 +--
 xmloff/source/style/xmlimppr.cxx                     |    8 
 xmloff/source/style/xmlnumfe.cxx                     |   19 --
 xmloff/source/style/xmlnumi.cxx                      |   15 -
 xmloff/source/style/xmlprmap.cxx                     |   19 --
 xmloff/source/table/XMLTableExport.cxx               |   24 --
 xmloff/source/table/XMLTableImport.cxx               |   23 +-
 xmloff/source/text/XMLPropertyBackpatcher.cxx        |    6 
 xmloff/source/text/txtexppr.cxx                      |    6 
 xmloff/source/text/txtflde.cxx                       |   37 +---
 xmloff/source/text/txtimp.cxx                        |   24 +-
 xmloff/source/text/txtimppr.cxx                      |    6 
 xmloff/source/transform/ChartPlotAreaOOoTContext.cxx |   14 -
 xmloff/source/transform/MergeElemTContext.cxx        |    6 
 34 files changed, 232 insertions(+), 401 deletions(-)

New commits:
commit 30530afaaa715473a2f9c3f068beeed5f3a98daf
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sun Sep 16 13:53:43 2018 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Sep 17 08:12:03 2018 +0200

    Simplify containers iterations in xmloff/source/[f-t]*
    
    Use range-based loop or replace with STL functions.
    
    Change-Id: Ic94c7e292f44d460038d3ca99c7e4cc02958d8a3
    Reviewed-on: https://gerrit.libreoffice.org/60549
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmloff/source/forms/attriblistmerge.cxx b/xmloff/source/forms/attriblistmerge.cxx
index ed3dfa169382..6990841c54e2 100644
--- a/xmloff/source/forms/attriblistmerge.cxx
+++ b/xmloff/source/forms/attriblistmerge.cxx
@@ -21,6 +21,8 @@
 
 #include <osl/diagnose.h>
 
+#include <numeric>
+
 namespace xmloff
 {
 
@@ -57,14 +59,11 @@ namespace xmloff
 
     bool OAttribListMerger::seekToName(const OUString& _rName, Reference< xml::sax::XAttributeList >& _rSubList, sal_Int16& _rLocalIndex)
     {
-        for (   AttributeListArray::const_iterator aLookupSublist = m_aLists.begin();
-                aLookupSublist != m_aLists.end();
-                ++aLookupSublist
-            )
-            for (sal_Int16 i=0; i<(*aLookupSublist)->getLength(); ++i)
-                if ((*aLookupSublist)->getNameByIndex(i) == _rName)
+        for ( const auto& rLookupSublist : m_aLists )
+            for (sal_Int16 i=0; i<rLookupSublist->getLength(); ++i)
+                if (rLookupSublist->getNameByIndex(i) == _rName)
                 {
-                    _rSubList = *aLookupSublist;
+                    _rSubList = rLookupSublist;
                     _rLocalIndex = i;
                     return true;
                 }
@@ -75,13 +74,8 @@ namespace xmloff
 
     sal_Int16 SAL_CALL OAttribListMerger::getLength(  )
     {
-        sal_Int16 nCount = 0;
-        for (   AttributeListArray::const_iterator aAccumulate = m_aLists.begin();
-                aAccumulate != m_aLists.end();
-                ++aAccumulate
-            )
-            nCount = nCount + (*aAccumulate)->getLength();
-        return nCount;
+        return std::accumulate(m_aLists.begin(), m_aLists.end(), static_cast<sal_Int16>(0),
+            [](sal_Int16 sum, AttributeListArray::value_type& rAccumulate) { return sum + rAccumulate->getLength(); });
     }
 
     OUString SAL_CALL OAttribListMerger::getNameByIndex( sal_Int16 i )
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 393fd3c55e59..288b110f67f6 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -486,14 +486,11 @@ namespace xmloff
 
                     // retrieve the values for all those properties
                     PropertyValues aValues;
-                    for (   PropertyDescriptionList::iterator desc = descriptions.begin();
-                            desc != descriptions.end();
-                            ++desc
-                        )
+                    for ( const auto& desc : descriptions )
                     {
                         // TODO: XMultiPropertySet?
-                        const Any propValue = m_xProps->getPropertyValue( (*desc)->propertyName );
-                        aValues[ (*desc)->propertyId ] = propValue;
+                        const Any propValue = m_xProps->getPropertyValue( desc->propertyName );
+                        aValues[ desc->propertyId ] = propValue;
                     }
 
                     // let the handler translate into an XML attribute value
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 2d63175aa17e..70fbbd7293f4 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -219,15 +219,11 @@ namespace xmloff
         // (We do this in the non-pro version only. Doing it all the time would be much to expensive)
         if ( m_xInfo.is() )
         {
-            PropertyValueArray::const_iterator aEnd = m_aValues.end();
-            for (   PropertyValueArray::iterator aCheck = m_aValues.begin();
-                    aCheck != aEnd;
-                    ++aCheck
-                )
+            for ( const auto& rCheck : m_aValues )
             {
-                OSL_ENSURE(m_xInfo->hasPropertyByName(aCheck->Name),
+                OSL_ENSURE(m_xInfo->hasPropertyByName(rCheck.Name),
                         OStringBuffer("OElementImport::implApplySpecificProperties: read a property (").
-                    append(OUStringToOString(aCheck->Name, RTL_TEXTENCODING_ASCII_US)).
+                    append(OUStringToOString(rCheck.Name, RTL_TEXTENCODING_ASCII_US)).
                     append(") which does not exist on the element!").getStr());
             }
         }
@@ -251,14 +247,12 @@ namespace xmloff
             Any* pValues = aValues.getArray();
             // copy
 
-            PropertyValueArray::iterator aEnd = m_aValues.end();
-            for (   PropertyValueArray::iterator aPropValues = m_aValues.begin();
-                    aPropValues != aEnd;
-                    ++aPropValues, ++pNames, ++pValues
-                )
+            for ( const auto& rPropValues : m_aValues )
             {
-                *pNames = aPropValues->Name;
-                *pValues = aPropValues->Value;
+                *pNames = rPropValues.Name;
+                *pValues = rPropValues.Value;
+                ++pNames;
+                ++pValues;
             }
 
             try
@@ -275,23 +269,19 @@ namespace xmloff
 
         if (!bSuccess)
         {   // no XMultiPropertySet or setting all properties at once failed
-            PropertyValueArray::iterator aEnd = m_aValues.end();
-            for (   PropertyValueArray::iterator aPropValues = m_aValues.begin();
-                    aPropValues != aEnd;
-                    ++aPropValues
-                )
+            for ( const auto& rPropValues : m_aValues )
             {
                 // this try/catch here is expensive, but because this is just a fallback which should normally not be
                 // used it's acceptable this way ...
                 try
                 {
-                    m_xElement->setPropertyValue(aPropValues->Name, aPropValues->Value);
+                    m_xElement->setPropertyValue(rPropValues.Name, rPropValues.Value);
                 }
                 catch(const Exception&)
                 {
                     DBG_UNHANDLED_EXCEPTION("xmloff.forms");
                     OSL_FAIL(OStringBuffer("OElementImport::implApplySpecificProperties: could not set the property \"").
-                        append(OUStringToOString(aPropValues->Name, RTL_TEXTENCODING_ASCII_US)).
+                        append(OUStringToOString(rPropValues.Name, RTL_TEXTENCODING_ASCII_US)).
                         append("\"!").getStr());
                 }
             }
@@ -305,32 +295,28 @@ namespace xmloff
 
         Reference< XPropertyContainer > xDynamicProperties( m_xElement, UNO_QUERY );
 
-        PropertyValueArray::iterator aEnd = m_aGenericValues.end();
-        for (   PropertyValueArray::iterator aPropValues =
-                m_aGenericValues.begin();
-                aPropValues != aEnd;
-                ++aPropValues
-            )
+        // PropertyValueArray::iterator aEnd = m_aGenericValues.end();
+        for ( auto& rPropValues : m_aGenericValues )
         {
             // check property type for numeric types before setting
             // the property
             try
             {
                 // if such a property does not yet exist at the element, create it if necessary
-                const bool bExistentProperty = m_xInfo->hasPropertyByName( aPropValues->Name );
+                const bool bExistentProperty = m_xInfo->hasPropertyByName( rPropValues.Name );
                 if ( !bExistentProperty )
                 {
                     if ( !xDynamicProperties.is() )
                     {
                         SAL_WARN( "xmloff", "OElementImport::implApplyGenericProperties: encountered an unknown property ("
-                                    << aPropValues->Name << "), but component is no PropertyBag!");
+                                    << rPropValues.Name << "), but component is no PropertyBag!");
                         continue;
                     }
 
                     xDynamicProperties->addProperty(
-                        aPropValues->Name,
+                        rPropValues.Name,
                         PropertyAttribute::BOUND | PropertyAttribute::REMOVABLE,
-                        aPropValues->Value
+                        rPropValues.Value
                     );
 
                     // re-fetch the PropertySetInfo
@@ -338,16 +324,16 @@ namespace xmloff
                 }
 
                 // determine the type of the value (source for the following conversion)
-                TypeClass eValueTypeClass = aPropValues->Value.getValueTypeClass();
+                TypeClass eValueTypeClass = rPropValues.Value.getValueTypeClass();
                 const bool bValueIsSequence = TypeClass_SEQUENCE == eValueTypeClass;
                 if ( bValueIsSequence )
                 {
-                    uno::Type aSimpleType( getSequenceElementType( aPropValues->Value.getValueType() ) );
+                    uno::Type aSimpleType( getSequenceElementType( rPropValues.Value.getValueType() ) );
                     eValueTypeClass = aSimpleType.getTypeClass();
                 }
 
                 // determine the type of the property (target for the following conversion)
-                const Property aProperty( m_xInfo->getPropertyByName( aPropValues->Name ) );
+                const Property aProperty( m_xInfo->getPropertyByName( rPropValues.Name ) );
                 TypeClass ePropTypeClass = aProperty.Type.getTypeClass();
                 const bool bPropIsSequence = TypeClass_SEQUENCE == ePropTypeClass;
                 if( bPropIsSequence )
@@ -372,7 +358,7 @@ namespace xmloff
                         "OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!" );
 
                     Sequence< Any > aXMLValueList;
-                    aPropValues->Value >>= aXMLValueList;
+                    rPropValues.Value >>= aXMLValueList;
                     Sequence< sal_Int16 > aPropertyValueList( aXMLValueList.getLength() );
 
                     const Any*       pXMLValue = aXMLValueList.getConstArray();
@@ -386,7 +372,7 @@ namespace xmloff
                         *pPropValue = static_cast< sal_Int16 >( nVal );
                     }
 
-                    aPropValues->Value <<= aPropertyValueList;
+                    rPropValues.Value <<= aPropertyValueList;
                 }
                 else if ( ePropTypeClass != eValueTypeClass )
                 {
@@ -395,30 +381,30 @@ namespace xmloff
                     case TypeClass_DOUBLE:
                     {
                         double nVal = 0;
-                        aPropValues->Value >>= nVal;
+                        rPropValues.Value >>= nVal;
                         switch( ePropTypeClass )
                         {
                         case TypeClass_BYTE:
-                            aPropValues->Value <<= static_cast< sal_Int8 >( nVal );
+                            rPropValues.Value <<= static_cast< sal_Int8 >( nVal );
                             break;
                         case TypeClass_SHORT:
-                            aPropValues->Value <<= static_cast< sal_Int16 >( nVal );
+                            rPropValues.Value <<= static_cast< sal_Int16 >( nVal );
                             break;
                         case TypeClass_UNSIGNED_SHORT:
-                            aPropValues->Value <<= static_cast< sal_uInt16 >( nVal );
+                            rPropValues.Value <<= static_cast< sal_uInt16 >( nVal );
                             break;
                         case TypeClass_LONG:
                         case TypeClass_ENUM:
-                            aPropValues->Value <<= static_cast< sal_Int32 >( nVal );
+                            rPropValues.Value <<= static_cast< sal_Int32 >( nVal );
                             break;
                         case TypeClass_UNSIGNED_LONG:
-                            aPropValues->Value <<= static_cast< sal_uInt32 >( nVal );
+                            rPropValues.Value <<= static_cast< sal_uInt32 >( nVal );
                             break;
                         case TypeClass_UNSIGNED_HYPER:
-                            aPropValues->Value <<= static_cast< sal_uInt64 >( nVal );
+                            rPropValues.Value <<= static_cast< sal_uInt64 >( nVal );
                             break;
                         case TypeClass_HYPER:
-                            aPropValues->Value <<= static_cast< sal_Int64 >( nVal );
+                            rPropValues.Value <<= static_cast< sal_Int64 >( nVal );
                             break;
                         default:
                             OSL_FAIL( "OElementImport::implImportGenericProperties: unsupported value type!" );
@@ -432,13 +418,13 @@ namespace xmloff
                     }
                 }
 
-                m_xElement->setPropertyValue( aPropValues->Name, aPropValues->Value );
+                m_xElement->setPropertyValue( rPropValues.Name, rPropValues.Value );
             }
             catch(const Exception&)
             {
                 DBG_UNHANDLED_EXCEPTION("xmloff.forms");
                 OSL_FAIL(OStringBuffer("OElementImport::EndElement: could not set the property \"").
-                    append(OUStringToOString(aPropValues->Name, RTL_TEXTENCODING_ASCII_US)).
+                    append(OUStringToOString(rPropValues.Name, RTL_TEXTENCODING_ASCII_US)).
                     append("\"!").getStr());
             }
         }
@@ -481,32 +467,11 @@ namespace xmloff
     {
         ENSURE_OR_RETURN( m_xInfo.is(), "OElementImport::impl_matchPropertyGroup: no property set info!", i_propertyGroups.end() );
 
-        for (   PropertyGroups::const_iterator group = i_propertyGroups.begin();
-                group != i_propertyGroups.end();
-                ++group
-            )
-        {
-            bool missingProp = false;
-            for (   PropertyDescriptionList::const_iterator prop = group->begin();
-                    prop != group->end();
-                    ++prop
-                )
-            {
-                if ( !m_xInfo->hasPropertyByName( (*prop)->propertyName ) )
-                {
-                    missingProp = true;
-                    break;
-                }
-            }
-
-            if ( missingProp )
-                // try next group
-                continue;
-
-            return group;
-        }
-
-        return i_propertyGroups.end();
+        return std::find_if(i_propertyGroups.cbegin(), i_propertyGroups.cend(), [&](const PropertyDescriptionList& rGroup) {
+            return std::all_of(rGroup.cbegin(), rGroup.cend(), [&](const PropertyDescription* prop) {
+                return m_xInfo->hasPropertyByName( prop->propertyName );
+            });
+        });
     }
 
     bool OElementImport::tryGenericAttribute( sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue )
@@ -539,21 +504,15 @@ namespace xmloff
                 }
 
                 PropertyValues aValues;
-                for (   PropertyDescriptionList::const_iterator propDesc = rProperties.begin();
-                        propDesc != rProperties.end();
-                        ++propDesc
-                    )
+                for ( const auto& propDesc : rProperties )
                 {
-                    aValues[ (*propDesc)->propertyId ] = Any();
+                    aValues[ propDesc->propertyId ] = Any();
                 }
                 if ( handler->getPropertyValues( _rValue, aValues ) )
                 {
-                    for (   PropertyDescriptionList::const_iterator propDesc = rProperties.begin();
-                            propDesc != rProperties.end();
-                            ++propDesc
-                        )
+                    for ( const auto& propDesc : rProperties )
                     {
-                        implPushBackPropertyValue( (*propDesc)->propertyName, aValues[ (*propDesc)->propertyId ] );
+                        implPushBackPropertyValue( propDesc->propertyName, aValues[ propDesc->propertyId ] );
                     }
                 }
             }
@@ -829,14 +788,10 @@ namespace xmloff
         m_xElement->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
 
         // translate the value properties we collected in handleAttributes
-        PropertyValueArray::iterator aEnd = m_aValueProperties.end();
-        for (   PropertyValueArray::iterator aValueProps = m_aValueProperties.begin();
-                aValueProps != aEnd;
-                ++aValueProps
-            )
+        for ( auto& rValueProps : m_aValueProperties )
         {
             bool bSuccess = false;
-            switch (aValueProps->Handle)
+            switch (rValueProps.Handle)
             {
                 case PROPID_VALUE:
                 case PROPID_CURRENT_VALUE:
@@ -853,23 +808,23 @@ namespace xmloff
 
                         bRetrievedValues = true;
                     }
-                    if ( PROPID_VALUE == aValueProps->Handle && !pValueProperty )
+                    if ( PROPID_VALUE == rValueProps.Handle && !pValueProperty )
                     {
                         SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a value property!");
                         break;
                     }
 
-                    if ( PROPID_CURRENT_VALUE == aValueProps->Handle && !pCurrentValueProperty )
+                    if ( PROPID_CURRENT_VALUE == rValueProps.Handle && !pCurrentValueProperty )
                     {
                         SAL_WARN( "xmloff.forms", "OControlImport::StartElement: the control does not have a current-value property!");
                         break;
                     }
 
                     // transfer the name
-                    if (PROPID_VALUE == aValueProps->Handle)
-                        aValueProps->Name = OUString::createFromAscii(pValueProperty);
+                    if (PROPID_VALUE == rValueProps.Handle)
+                        rValueProps.Name = OUString::createFromAscii(pValueProperty);
                     else
-                        aValueProps->Name = OUString::createFromAscii(pCurrentValueProperty);
+                        rValueProps.Name = OUString::createFromAscii(pCurrentValueProperty);
                     bSuccess = true;
                 }
                 break;
@@ -888,16 +843,16 @@ namespace xmloff
 
                         bRetrievedValueLimits = true;
                     }
-                    OSL_ENSURE((PROPID_MIN_VALUE != aValueProps->Handle) || pMinValueProperty,
+                    OSL_ENSURE((PROPID_MIN_VALUE != rValueProps.Handle) || pMinValueProperty,
                         "OControlImport::StartElement: the control does not have a value property!");
-                    OSL_ENSURE((PROPID_MAX_VALUE != aValueProps->Handle) || pMaxValueProperty,
+                    OSL_ENSURE((PROPID_MAX_VALUE != rValueProps.Handle) || pMaxValueProperty,
                         "OControlImport::StartElement: the control does not have a current-value property!");
 
                     // transfer the name
-                    if (PROPID_MIN_VALUE == aValueProps->Handle)
-                        aValueProps->Name = OUString::createFromAscii(pMinValueProperty);
+                    if (PROPID_MIN_VALUE == rValueProps.Handle)
+                        rValueProps.Name = OUString::createFromAscii(pMinValueProperty);
                     else
-                        aValueProps->Name = OUString::createFromAscii(pMaxValueProperty);
+                        rValueProps.Name = OUString::createFromAscii(pMaxValueProperty);
                     bSuccess = true;
                 }
                 break;
@@ -907,9 +862,9 @@ namespace xmloff
                 continue;
 
             // translate the value
-            implTranslateValueProperty(m_xInfo, *aValueProps);
+            implTranslateValueProperty(m_xInfo, rValueProps);
             // add the property to the base class' array
-            implPushBackPropertyValue(*aValueProps);
+            implPushBackPropertyValue(rValueProps);
         }
 
     }
@@ -990,19 +945,15 @@ namespace xmloff
                 // is the "value property" part of the sequence?
 
             // look up this property in our sequence
-            PropertyValueArray::iterator aEnd = m_aValues.end();
-            for (   PropertyValueArray::iterator aCheck = m_aValues.begin();
-                    ( aCheck != aEnd );
-                    ++aCheck
-                )
+            for ( const auto& rCheck : m_aValues )
             {
-                if ( aCheck->Name.equalsAscii( pDefaultValueProperty ) )
+                if ( rCheck.Name.equalsAscii( pDefaultValueProperty ) )
                     bRestoreValuePropertyValue = true;
-                else if ( aCheck->Name.equalsAscii( pValueProperty ) )
+                else if ( rCheck.Name.equalsAscii( pValueProperty ) )
                 {
                     bNonDefaultValuePropertyValue = true;
                     // we need to restore the value property we found here, nothing else
-                    aValuePropertyValue = aCheck->Value;
+                    aValuePropertyValue = rCheck.Value;
                 }
             }
 
diff --git a/xmloff/source/forms/eventimport.cxx b/xmloff/source/forms/eventimport.cxx
index 256649dcc902..b30ce9dc953a 100644
--- a/xmloff/source/forms/eventimport.cxx
+++ b/xmloff/source/forms/eventimport.cxx
@@ -45,22 +45,19 @@ namespace xmloff
 
         // loop through the collected events and translate them
         sal_Int32 nSeparatorPos = -1;
-        for (   EventsVector::const_iterator aEvent = aCollectEvents.begin();
-                aEvent != aCollectEvents.end();
-                ++aEvent, ++pTranslated
-            )
+        for ( const auto& rEvent : aCollectEvents )
         {
             // the name of the event is built from ListenerType::EventMethod
-            nSeparatorPos = aEvent->first.indexOf(EVENT_NAME_SEPARATOR);
+            nSeparatorPos = rEvent.first.indexOf(EVENT_NAME_SEPARATOR);
             OSL_ENSURE(-1 != nSeparatorPos, "OFormEventsImportContext::EndElement: invalid (unrecognized) event name!");
-            pTranslated->ListenerType = aEvent->first.copy(0, nSeparatorPos);
-            pTranslated->EventMethod = aEvent->first.copy(nSeparatorPos + sizeof(EVENT_NAME_SEPARATOR) - 1);
+            pTranslated->ListenerType = rEvent.first.copy(0, nSeparatorPos);
+            pTranslated->EventMethod = rEvent.first.copy(nSeparatorPos + sizeof(EVENT_NAME_SEPARATOR) - 1);
 
             OUString sLibrary;
 
             // the local macro name and the event type are specified as properties
-            const PropertyValue* pEventDescription = aEvent->second.getConstArray();
-            const PropertyValue* pEventDescriptionEnd = pEventDescription + aEvent->second.getLength();
+            const PropertyValue* pEventDescription = rEvent.second.getConstArray();
+            const PropertyValue* pEventDescriptionEnd = pEventDescription + rEvent.second.getLength();
             for (;pEventDescription != pEventDescriptionEnd; ++pEventDescription)
             {
                 if (pEventDescription->Name == EVENT_LOCALMACRONAME ||
@@ -86,6 +83,8 @@ namespace xmloff
                 sLibrary += pTranslated->ScriptCode;
                 pTranslated->ScriptCode = sLibrary;
             }
+
+            ++pTranslated;
         }
 
         // register the events
diff --git a/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx
index ec518f9be94d..8821eec23361 100644
--- a/xmloff/source/forms/handler/vcl_date_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_date_handler.cxx
@@ -88,12 +88,9 @@ namespace xmloff
         const Any aPropertyValue( makeAny( aDate ) );
 
         OSL_ENSURE( o_propertyValues.size() == 1, "VCLDateHandler::getPropertyValues: date strings represent exactly one property - not more, not less!" );
-        for (   PropertyValues::iterator prop = o_propertyValues.begin();
-                prop != o_propertyValues.end();
-                ++prop
-            )
+        for ( auto& prop : o_propertyValues )
         {
-            prop->second = aPropertyValue;
+            prop.second = aPropertyValue;
         }
         return true;
     }
diff --git a/xmloff/source/forms/handler/vcl_time_handler.cxx b/xmloff/source/forms/handler/vcl_time_handler.cxx
index 2bedb56cc775..c37379b37b64 100644
--- a/xmloff/source/forms/handler/vcl_time_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_time_handler.cxx
@@ -91,12 +91,9 @@ namespace xmloff
         const Any aPropertyValue( makeAny( aTime ) );
 
         OSL_ENSURE( o_propertyValues.size() == 1, "VCLTimeHandler::getPropertyValues: time strings represent exactly one property - not more, not less!" );
-        for (   PropertyValues::iterator prop = o_propertyValues.begin();
-                prop != o_propertyValues.end();
-                ++prop
-            )
+        for ( auto& prop : o_propertyValues )
         {
-            prop->second = aPropertyValue;
+            prop.second = aPropertyValue;
         }
         return true;
     }
diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx
index 6ce24c9bfa95..957395408d03 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -478,16 +478,10 @@ namespace xmloff
             // Check if the id is already used. It shouldn't, as we currently have no mechanism for removing entries
             // from the map, so the approach used above (take the accumulated map size) should be sufficient. But if
             // somebody changes this (e.g. allows removing entries from the map), the assertion below probably will fail.
-            for (   MapPropertySet2Map::const_iterator outer = _rAllPagesControlIds.begin();
-                    outer != _rAllPagesControlIds.end();
-                    ++outer
-                )
-                for (   MapPropertySet2String::const_iterator inner = outer->second.begin();
-                        inner != outer->second.end();
-                        ++inner
-                    )
+            for ( const auto& outer : _rAllPagesControlIds )
+                for ( const auto& inner : outer.second )
                 {
-                    OSL_ENSURE( inner->second != sControlId,
+                    OSL_ENSURE( inner.second != sControlId,
                         "lcl_findFreeControlId: auto-generated control ID is already used!" );
                 }
         #endif
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index d08060356e6d..332da3c6708e 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -394,17 +394,13 @@ void OFormLayerXMLImport_Impl::endPage()
         OUString sSeparator(&s_nSeparator, 1);
         Reference< XPropertySet > xCurrentReferring;
         sal_Int32 nSeparator, nPrevSep;
-        ::std::vector< ModelStringPair >::const_iterator aEnd = m_aControlReferences.end();
-        for (   ::std::vector< ModelStringPair >::const_iterator aReferences = m_aControlReferences.begin();
-                aReferences != aEnd;
-                ++aReferences
-            )
+        for ( const auto& rReferences : m_aControlReferences )
         {
             // the list of control ids is comma separated
 
             // in a list of n ids there are only n-1 separators ... have to catch this last id
             // -> normalize the list
-            OUString sReferring = aReferences->second + sSeparator;
+            OUString sReferring = rReferences.second + sSeparator;
 
             nPrevSep = -1;
             while (-1 != (nSeparator = sReferring.indexOf(s_nSeparator, nPrevSep + 1)))
@@ -413,7 +409,7 @@ void OFormLayerXMLImport_Impl::endPage()
                 xCurrentReferring = lookupControlId(sCurrentReferring);
                 if (xCurrentReferring.is())
                     // if this condition fails, this is an error, but lookupControlId should have asserted this ...
-                    xCurrentReferring->setPropertyValue( PROPERTY_CONTROLLABEL, makeAny( aReferences->first ) );
+                    xCurrentReferring->setPropertyValue( PROPERTY_CONTROLLABEL, makeAny( rReferences.first ) );
 
                 nPrevSep = nSeparator;
             }
@@ -497,21 +493,17 @@ void OFormLayerXMLImport_Impl::documentDone( )
         &&  FormCellBindingHelper::isCellBindingAllowed( rImport.GetModel() )
         )
     {
-        ::std::vector< ModelStringPair >::const_iterator aEnd = m_aCellValueBindings.end();
-        for (   ::std::vector< ModelStringPair >::const_iterator aCellBindings = m_aCellValueBindings.begin();
-                aCellBindings != aEnd;
-                ++aCellBindings
-            )
+        for ( const auto& rCellBindings : m_aCellValueBindings )
         {
             try
             {
-                FormCellBindingHelper aHelper( aCellBindings->first, rImport.GetModel() );
+                FormCellBindingHelper aHelper( rCellBindings.first, rImport.GetModel() );
                 OSL_ENSURE( aHelper.isCellBindingAllowed(), "OFormLayerXMLImport_Impl::documentDone: can't bind this control model!" );
                 if ( aHelper.isCellBindingAllowed() )
                 {
                     // There are special bindings for listboxes. See
                     // OListAndComboImport::doRegisterCellValueBinding for a comment on this HACK.
-                    OUString sBoundCellAddress( aCellBindings->second );
+                    OUString sBoundCellAddress( rCellBindings.second );
                     sal_Int32 nIndicator = sBoundCellAddress.lastIndexOf( ":index" );
 
                     bool bUseIndexBinding = false;
@@ -537,18 +529,15 @@ void OFormLayerXMLImport_Impl::documentDone( )
         &&  FormCellBindingHelper::isListCellRangeAllowed( rImport.GetModel() )
         )
     {
-        for (   ::std::vector< ModelStringPair >::const_iterator aRangeBindings = m_aCellRangeListSources.begin();
-                aRangeBindings != m_aCellRangeListSources.end();
-                ++aRangeBindings
-            )
+        for ( const auto& rRangeBindings : m_aCellRangeListSources )
         {
             try
             {
-                FormCellBindingHelper aHelper( aRangeBindings->first, rImport.GetModel() );
+                FormCellBindingHelper aHelper( rRangeBindings.first, rImport.GetModel() );
                 OSL_ENSURE( aHelper.isListCellRangeAllowed(), "OFormLayerXMLImport_Impl::documentDone: can't bind this control model!" );
                 if ( aHelper.isListCellRangeAllowed() )
                 {
-                    aHelper.setListSource( aHelper.createCellListSourceFromStringAddress( aRangeBindings->second ) );
+                    aHelper.setListSource( aHelper.createCellListSourceFromStringAddress( rRangeBindings.second ) );
                 }
             }
             catch( const Exception& )
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
index c2f168917c04..73b49f19400c 100644
--- a/xmloff/source/forms/propertyexport.cxx
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -113,14 +113,11 @@ namespace xmloff
         OUString sValue;
 
         // loop through all the properties which are yet to be exported
-        for (   StringSet::const_iterator aProperty = m_aRemainingProps.begin();
-                aProperty != m_aRemainingProps.end();
-                ++aProperty
-            )
+        for ( const auto& rProperty : m_aRemainingProps )
         {
-            DBG_CHECK_PROPERTY_NO_TYPE(*aProperty);
+            DBG_CHECK_PROPERTY_NO_TYPE(rProperty);
 
-            if ( !shouldExportProperty( *aProperty ) )
+            if ( !shouldExportProperty( rProperty ) )
                 continue;
 
             // now that we have the first sub-tag we need the form:properties element
@@ -128,10 +125,10 @@ namespace xmloff
                 pPropertiesTag = o3tl::make_unique<SvXMLElementExport>(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, token::XML_PROPERTIES, true, true);
 
             // add the name attribute
-            AddAttribute(XML_NAMESPACE_FORM, token::XML_PROPERTY_NAME, *aProperty);
+            AddAttribute(XML_NAMESPACE_FORM, token::XML_PROPERTY_NAME, rProperty);
 
             // get the value
-            aValue = m_xProps->getPropertyValue(*aProperty);
+            aValue = m_xProps->getPropertyValue(rProperty);
 
             // the type to export
             Type aExportType;
@@ -150,7 +147,7 @@ namespace xmloff
             if ( bIsEmptyValue )
             {
                 css::beans::Property aPropDesc;
-                aPropDesc = m_xPropertyInfo->getPropertyByName( *aProperty );
+                aPropDesc = m_xPropertyInfo->getPropertyByName( rProperty );
                 aExportType = aPropDesc.Type;
             }
             token::XMLTokenEnum eValueType = implGetPropertyXMLType( aExportType );
diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx
index cee59ee8d1d7..540d670c8a0c 100644
--- a/xmloff/source/forms/propertyimport.cxx
+++ b/xmloff/source/forms/propertyimport.cxx
@@ -517,12 +517,10 @@ void OListPropertyContext::EndElement()
     Sequence< Any > aListElements( m_aListValues.size() );
     Any* pListElement = aListElements.getArray();
     css::uno::Type aType = PropertyConversion::xmlTypeToUnoType( m_sPropertyType );
-    for (   ::std::vector< OUString >::const_iterator values = m_aListValues.begin();
-            values != m_aListValues.end();
-            ++values, ++pListElement
-        )
+    for ( const auto& rListValue : m_aListValues )
     {
-        *pListElement = PropertyConversion::convertString( aType, *values );
+        *pListElement = PropertyConversion::convertString( aType, rListValue );
+        ++pListElement;
     }
 
     PropertyValue aSequenceValue;
diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx
index c6d32a8b0229..81dbff185087 100644
--- a/xmloff/source/meta/xmlmetae.cxx
+++ b/xmloff/source/meta/xmlmetae.cxx
@@ -394,9 +394,8 @@ SvXMLMetaExport::startElement(const OUString & i_rName,
 
     if (m_level == 1) {
         // attach preserved namespace decls from root node here
-        for (std::vector<beans::StringPair>::const_iterator iter =
-                m_preservedNSs.begin(); iter != m_preservedNSs.end(); ++iter) {
-            const OUString ns(iter->First);
+        for (const auto& rPreservedNS : m_preservedNSs) {
+            const OUString ns(rPreservedNS.First);
             bool found(false);
             // but only if it is not already there
             const sal_Int16 nCount = i_xAttribs->getLength();
@@ -408,7 +407,7 @@ SvXMLMetaExport::startElement(const OUString & i_rName,
                 }
             }
             if (!found) {
-                mrExport.AddAttribute(ns, iter->Second);
+                mrExport.AddAttribute(ns, rPreservedNS.Second);
             }
         }
     }
diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx
index eb0fc075c584..64e47a45919c 100644
--- a/xmloff/source/script/XMLEventExport.cxx
+++ b/xmloff/source/script/XMLEventExport.cxx
@@ -52,13 +52,9 @@ XMLEventExport::XMLEventExport(SvXMLExport& rExp) :
 XMLEventExport::~XMLEventExport()
 {
     // delete all handlers
-    HandlerMap::iterator aEnd = aHandlerMap.end();
-    for( HandlerMap::iterator aIter =
-             aHandlerMap.begin();
-         aIter != aEnd;
-         ++aIter )
+    for( auto& rEntry : aHandlerMap )
     {
-        delete aIter->second;
+        delete rEntry.second;
     }
     aHandlerMap.clear();
 }
diff --git a/xmloff/source/script/XMLEventImportHelper.cxx b/xmloff/source/script/XMLEventImportHelper.cxx
index 0e45525856af..0a719dee5d31 100644
--- a/xmloff/source/script/XMLEventImportHelper.cxx
+++ b/xmloff/source/script/XMLEventImportHelper.cxx
@@ -40,12 +40,9 @@ XMLEventImportHelper::XMLEventImportHelper() :
 XMLEventImportHelper::~XMLEventImportHelper()
 {
     // delete factories
-    FactoryMap::iterator aEnd = aFactoryMap.end();
-    for(FactoryMap::iterator aIter = aFactoryMap.begin();
-        aIter != aEnd;
-        ++aIter)
+    for(auto& rEntry : aFactoryMap)
     {
-        delete aIter->second;
+        delete rEntry.second;
     }
     aFactoryMap.clear();
 
diff --git a/xmloff/source/script/XMLEventsImportContext.cxx b/xmloff/source/script/XMLEventsImportContext.cxx
index c5c4d1621d1e..aea5eb9e62ac 100644
--- a/xmloff/source/script/XMLEventsImportContext.cxx
+++ b/xmloff/source/script/XMLEventsImportContext.cxx
@@ -145,12 +145,9 @@ void XMLEventsImportContext::SetEvents(
         xEvents = xNameRepl;
 
         // now iterate over vector and a) insert b) delete all elements
-        EventsVector::iterator aEnd = aCollectEvents.end();
-        for(EventsVector::iterator aIter = aCollectEvents.begin();
-            aIter != aEnd;
-            ++aIter)
+        for(const auto& rEvent : aCollectEvents)
         {
-            AddEventValues(aIter->first, aIter->second);
+            AddEventValues(rEvent.first, rEvent.second);
         }
         aCollectEvents.clear();
     }
@@ -164,12 +161,8 @@ void XMLEventsImportContext::GetEventSequence(
     // (This shouldn't take a lot of time, since this method should only get
     //  called if only one (or few) events are being expected)
 
-    // iterate over vector until end or rName is found;
-    EventsVector::iterator aIter = aCollectEvents.begin();
-    while( (aIter != aCollectEvents.end()) && (aIter->first != rName) )
-    {
-        ++aIter;
-    }
+    auto aIter = std::find_if(aCollectEvents.begin(), aCollectEvents.end(),
+        [&rName](EventNameValuesPair& rEvent) { return rEvent.first == rName; });
 
     // if we're not at the end, set the sequence
     if (aIter != aCollectEvents.end())
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index b49c5dedceeb..224ae8e95cbe 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -325,9 +325,9 @@ void XMLPageMasterExportPropMapper::ContextFilter(
 
     rtl::Reference < XMLPropertySetMapper > aPropMapper(getPropertySetMapper());
 
-    for( ::std::vector< XMLPropertyState >::iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter )
+    for( auto& rProp : rPropState )
     {
-        XMLPropertyState *pProp = &(*aIter);
+        XMLPropertyState *pProp = &rProp;
         sal_Int16 nContextId    = aPropMapper->GetEntryContextId( pProp->mnIndex );
         sal_Int16 nFlag         = nContextId & CTF_PM_FLAGMASK;
         sal_Int16 nSimpleId     = nContextId & (~CTF_PM_FLAGMASK | XML_PM_CTF_START);
diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx
index 5d7016c22e3b..422a7b5de18b 100644
--- a/xmloff/source/style/PageMasterImportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterImportPropMapper.cxx
@@ -125,10 +125,9 @@ void PageMasterImportPropertyMapper::finished(std::vector< XMLPropertyState >& r
     XMLPropertyState* pFooterMargins[4] = { nullptr, nullptr, nullptr, nullptr };
     std::unique_ptr<XMLPropertyState> pNewFooterMargins[4];
 
-    std::vector< XMLPropertyState >::iterator aEnd = rProperties.end();
-    for (std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != aEnd; ++aIter)
+    for (auto& rProp : rProperties)
     {
-        XMLPropertyState *property = &(*aIter);
+        XMLPropertyState *property = &rProp;
         sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(property->mnIndex);
         if (property->mnIndex >= nStartIndex && property->mnIndex < nEndIndex)
         {
diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx
index fd61ebcd6eee..c5f3efe60c46 100644
--- a/xmloff/source/style/XMLPageExport.cxx
+++ b/xmloff/source/style/XMLPageExport.cxx
@@ -47,15 +47,15 @@ static const OUStringLiteral gsFollowStyle( "FollowStyle" );
 
 bool XMLPageExport::findPageMasterName( const OUString& rStyleName, OUString& rPMName ) const
 {
-    for( ::std::vector< XMLPageExportNameEntry >::const_iterator pEntry = aNameVector.begin();
-            pEntry != aNameVector.end(); ++pEntry )
+    auto pEntry = std::find_if(aNameVector.cbegin(), aNameVector.cend(),
+        [&rStyleName](const XMLPageExportNameEntry& rEntry) { return rEntry.sStyleName == rStyleName; });
+
+    if( pEntry != aNameVector.cend() )
     {
-        if( pEntry->sStyleName == rStyleName )
-        {
-            rPMName = pEntry->sPageMasterName;
-            return true;
-        }
+        rPMName = pEntry->sPageMasterName;
+        return true;
     }
+
     return false;
 }
 
@@ -232,10 +232,9 @@ void XMLPageExport::exportDefaultStyle()
 
             bool bExport = false;
             rtl::Reference < XMLPropertySetMapper > aPropMapper(xPageMasterExportPropMapper->getPropertySetMapper());
-            for( ::std::vector< XMLPropertyState >::iterator aIter = aPropStates.begin(); aIter != aPropStates.end(); ++aIter )
+            for( const auto& rProp : aPropStates )
             {
-                XMLPropertyState *pProp = &(*aIter);
-                sal_Int16 nContextId    = aPropMapper->GetEntryContextId( pProp->mnIndex );
+                sal_Int16 nContextId    = aPropMapper->GetEntryContextId( rProp.mnIndex );
                 if( nContextId == CTF_PM_STANDARD_MODE )
                 {
                     bExport = true;
diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx
index 69f84263ca0a..ae227e7d2920 100644
--- a/xmloff/source/style/impastpl.cxx
+++ b/xmloff/source/style/impastpl.cxx
@@ -480,10 +480,10 @@ void SvXMLAutoStylePoolP_Impl::GetRegisteredNames(
         XMLAutoStyleFamily &rFamily = *aJ;
 
         // iterate over names
-        for (std::set<OUString>::const_iterator aI = rFamily.maNameSet.begin(); aI != rFamily.maNameSet.end(); ++aI)
+        for (const auto& rName : rFamily.maNameSet)
         {
             aFamilies.push_back( rFamily.mnFamily );
-            aNames.push_back( *aI );
+            aNames.push_back( rName );
         }
     }
 
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
index 8e3309774191..539967955d77 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -127,8 +127,8 @@ XMLPropertyHandlerFactory::XMLPropertyHandlerFactory() :
 
 XMLPropertyHandlerFactory::~XMLPropertyHandlerFactory()
 {
-    for( CacheMap::iterator pPos = mpImpl->maHandlerCache.begin(); pPos != mpImpl->maHandlerCache.end(); ++pPos )
-        delete pPos->second;
+    for( auto& rCacheEntry : mpImpl->maHandlerCache )
+        delete rCacheEntry.second;
 }
 
 // Interface
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 99ebee05b25f..5637e3cc959d 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -539,17 +539,17 @@ bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
 
         if(rMapper.is())
         {
-            for(::std::vector< XMLPropertyState >::const_iterator a = maProperties.begin(); a != maProperties.end(); ++a)
+            for(const auto& a : maProperties)
             {
-                if(a->mnIndex != -1)
+                if(a.mnIndex != -1)
                 {
-                    const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
+                    const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
 
                     if(rPropName == rFillStyleTag)
                     {
                         FillStyle eFillStyle(FillStyle_NONE);
 
-                        if(a->maValue >>= eFillStyle)
+                        if(a.maValue >>= eFillStyle)
                         {
                             // okay, type was good, FillStyle is set
                         }
@@ -558,7 +558,7 @@ bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(
                             // also try an int (see XFillStyleItem::PutValue)
                             sal_Int32 nFillStyle(0);
 
-                            if(a->maValue >>= nFillStyle)
+                            if(a.maValue >>= nFillStyle)
                             {
                                 eFillStyle = static_cast< FillStyle >(nFillStyle);
                             }
@@ -584,16 +584,16 @@ void XMLPropStyleContext::deactivateOldFillStyleDefinitions(
 
         if(rMapper.is())
         {
-            for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); ++a)
+            for(auto& a : maProperties)
             {
-                if(a->mnIndex != -1)
+                if(a.mnIndex != -1)
                 {
-                    const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
+                    const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
 
                     if(rHashSetOfTags.find(rPropName) != rHashSetOfTags.end())
                     {
                         // mark entry as inactive
-                        a->mnIndex = -1;
+                        a.mnIndex = -1;
                     }
                 }
             }
@@ -614,11 +614,11 @@ void XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToSt
             static OUString s_FillBitmapName("FillBitmapName");
             static OUString s_FillTransparenceGradientName("FillTransparenceGradientName");
 
-            for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); ++a)
+            for(auto& a : maProperties)
             {
-                if(a->mnIndex != -1)
+                if(a.mnIndex != -1)
                 {
-                    const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex);
+                    const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
                     sal_uInt16 aStyleFamily(0);
 
                     if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName)
@@ -638,9 +638,9 @@ void XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToSt
                     {
                         OUString sStyleName;
 
-                        a->maValue >>= sStyleName;
+                        a.maValue >>= sStyleName;
                         sStyleName = GetImport().GetStyleDisplayName( aStyleFamily, sStyleName );
-                        a->maValue <<= sStyleName;
+                        a.maValue <<= sStyleName;
                     }
                 }
             }
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
index c5256a49f12b..be82525c4566 100644
--- a/xmloff/source/style/xmlaustp.cxx
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -70,16 +70,13 @@ void SvXMLAutoStylePoolP::exportStyleAttributes(
     {   // it's a control-related style
         const rtl::Reference< XMLPropertySetMapper >& aPropertyMapper = rPropExp.getPropertySetMapper();
 
-        for (   vector< XMLPropertyState >::const_iterator pProp = rProperties.begin();
-                pProp != rProperties.end();
-                ++pProp
-            )
+        for (const auto& rProp : rProperties)
         {
-            if  (   ( pProp->mnIndex > -1 )
-                &&  ( CTF_FORMS_DATA_STYLE == aPropertyMapper->GetEntryContextId( pProp->mnIndex ) )
+            if  (   ( rProp.mnIndex > -1 )
+                &&  ( CTF_FORMS_DATA_STYLE == aPropertyMapper->GetEntryContextId( rProp.mnIndex ) )
                 )
             {   // it's the data-style for a grid column
-                lcl_exportDataStyle( GetExport(), aPropertyMapper, *pProp );
+                lcl_exportDataStyle( GetExport(), aPropertyMapper, rProp );
             }
         }
     }
@@ -92,14 +89,11 @@ void SvXMLAutoStylePoolP::exportStyleAttributes(
         bool bFoundControlShapeDataStyle = false;
         bool bFoundNumberingRulesName = false;
 
-        for (   vector< XMLPropertyState >::const_iterator pProp = rProperties.begin();
-                pProp != rProperties.end();
-                ++pProp
-            )
+        for (const auto& rProp : rProperties)
         {
-            if (pProp->mnIndex > -1)
+            if (rProp.mnIndex > -1)
             {   // it's a valid property
-                switch( aPropertyMapper->GetEntryContextId(pProp->mnIndex) )
+                switch( aPropertyMapper->GetEntryContextId(rProp.mnIndex) )
                 {
                 case CTF_SD_CONTROL_SHAPE_DATA_STYLE:
                     {   // it's the control shape data style property
@@ -111,7 +105,7 @@ void SvXMLAutoStylePoolP::exportStyleAttributes(
                             break;
                         }
 
-                        lcl_exportDataStyle( GetExport(), aPropertyMapper, *pProp );
+                        lcl_exportDataStyle( GetExport(), aPropertyMapper, rProp );
 
                         // check if there is another property with the special context id we're handling here
                         bFoundControlShapeDataStyle = true;
@@ -127,7 +121,7 @@ void SvXMLAutoStylePoolP::exportStyleAttributes(
                         }
 
                         uno::Reference< container::XIndexReplace > xNumRule;
-                        pProp->maValue >>= xNumRule;
+                        rProp.maValue >>= xNumRule;
                         if( xNumRule.is() && (xNumRule->getCount() > 0 ) )
                         {
                             const OUString sName(const_cast<XMLTextListAutoStylePool*>(&GetExport().GetTextParagraphExport()->GetListAutoStylePool())->Add( xNumRule ));
@@ -145,12 +139,12 @@ void SvXMLAutoStylePoolP::exportStyleAttributes(
 
     if( nFamily == XML_STYLE_FAMILY_PAGE_MASTER )
     {
-        for( vector< XMLPropertyState >::const_iterator pProp = rProperties.begin(); pProp != rProperties.end(); ++pProp )
+        for( const auto& rProp : rProperties )
         {
-            if (pProp->mnIndex > -1)
+            if (rProp.mnIndex > -1)
             {
                 const rtl::Reference< XMLPropertySetMapper >& aPropMapper = rPropExp.getPropertySetMapper();
-                sal_Int32 nIndex = pProp->mnIndex;
+                sal_Int32 nIndex = rProp.mnIndex;
                 sal_Int16 nContextID = aPropMapper->GetEntryContextId( nIndex );
                 switch( nContextID )
                 {
@@ -159,7 +153,7 @@ void SvXMLAutoStylePoolP::exportStyleAttributes(
                         OUString sValue;
                         const XMLPropertyHandler* pPropHdl = aPropMapper->GetPropertyHandler( nIndex );
                         if( pPropHdl &&
-                            pPropHdl->exportXML( sValue, pProp->maValue,
+                            pPropHdl->exportXML( sValue, rProp.maValue,
                                                  GetExport().GetMM100UnitConverter() ) &&
                             ( ! IsXMLToken( sValue, XML_ALL ) ) )
                         {
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index 4e9a28ea42e6..8ebaa88d3fde 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -627,12 +627,10 @@ void SvXMLImportPropertyMapper::PrepareForMultiPropertySet_(
 
     // copy values into sequences
     i = 0;
-    for( PropertyPairs::iterator aIter = aPropertyPairs.begin();
-         aIter != aPropertyPairs.end();
-         ++aIter )
+    for( const auto& rPropertyPair : aPropertyPairs )
     {
-        pNamesArray[i] = *(aIter->first);
-        pValuesArray[i++] = *(aIter->second);
+        pNamesArray[i] = *(rPropertyPair.first);
+        pValuesArray[i++] = *(rPropertyPair.second);
     }
 }
 
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 6e40bc92dccd..ddc70eec4733 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -190,11 +190,9 @@ uno::Sequence<sal_Int32> SvXMLNumUsedList_Impl::GetWasUsed()
     sal_Int32* pWasUsed = ret.getArray();
     if (pWasUsed)
     {
-        SvXMLuInt32Set::const_iterator aItr = aWasUsed.begin();
-        while (aItr != aWasUsed.end())
+        for (const auto nWasUsed : aWasUsed)
         {
-            *pWasUsed = *aItr;
-            ++aItr;
+            *pWasUsed = nWasUsed;
             ++pWasUsed;
         }
     }
@@ -1869,18 +1867,15 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle )
     {
         std::vector<LanguageType> aLanguages;
         pFormatter->GetUsedLanguages( aLanguages );
-        for (std::vector<LanguageType>::const_iterator it(aLanguages.begin()); it != aLanguages.end(); ++it)
+        for (const auto& nLang : aLanguages)
         {
-            LanguageType nLang = *it;
-
             sal_uInt32 nDefaultIndex = 0;
             SvNumberFormatTable& rTable = pFormatter->GetEntryTable(
                                          SvNumFormatType::DEFINED, nDefaultIndex, nLang );
-            SvNumberFormatTable::iterator it2 = rTable.begin();
-            while (it2 != rTable.end())
+            for (const auto& rTableEntry : rTable)
             {
-                nKey = it2->first;
-                pFormat = it2->second;
+                nKey = rTableEntry.first;
+                pFormat = rTableEntry.second;
                 if (!pUsedList->IsUsed(nKey))
                 {
                     DBG_ASSERT((pFormat->GetType() & SvNumFormatType::DEFINED), "a not user defined numberformat found");
@@ -1895,8 +1890,6 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle )
                     // if it is a user-defined Format it will be added else nothing will happen
                     pUsedList->SetUsed(nKey);
                 }
-
-                ++it2;
             }
         }
     }
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index df5fab3f49ea..3b60ce724f19 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -773,29 +773,28 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
             {
                 OUString sTmp;
                 sal_Int16 nTmp = 0;
-                ::std::vector< XMLPropertyState >::iterator i;
-                for( i = aProps.begin(); i != aProps.end(); ++i )
+                for( const auto& rProp : aProps )
                 {
-                    switch( i->mnIndex )
+                    switch( rProp.mnIndex )
                     {
                     case 0:
-                        i->maValue >>= sTmp;
+                        rProp.maValue >>= sTmp;
                         rListLevel.SetBulletFontName( sTmp);
                         break;
                     case 1:
-                        i->maValue >>= sTmp;
+                        rProp.maValue >>= sTmp;
                         rListLevel.SetBulletFontStyleName( sTmp );
                         break;
                     case 2:
-                        i->maValue >>= nTmp;
+                        rProp.maValue >>= nTmp;
                         rListLevel.SetBulletFontFamily( nTmp );
                         break;
                     case 3:
-                        i->maValue >>= nTmp;
+                        rProp.maValue >>= nTmp;
                         rListLevel.SetBulletFontPitch( nTmp );
                         break;
                     case 4:
-                        i->maValue >>= nTmp;
+                        rProp.maValue >>= nTmp;
                         rListLevel.SetBulletFontEncoding( nTmp );
                         break;
                     }
diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx
index 6ac9c37993b0..d86e553a2958 100644
--- a/xmloff/source/style/xmlprmap.cxx
+++ b/xmloff/source/style/xmlprmap.cxx
@@ -153,21 +153,15 @@ XMLPropertySetMapper::~XMLPropertySetMapper()
 void XMLPropertySetMapper::AddMapperEntry(
     const rtl::Reference < XMLPropertySetMapper >& rMapper )
 {
-    for( vector < rtl::Reference < XMLPropertyHandlerFactory > >::iterator
-            aFIter = rMapper->mpImpl->maHdlFactories.begin();
-         aFIter != rMapper->mpImpl->maHdlFactories.end();
-         ++aFIter )
+    for( const auto& rHdlFactory : rMapper->mpImpl->maHdlFactories )
     {
-        mpImpl->maHdlFactories.push_back(*aFIter);
+        mpImpl->maHdlFactories.push_back(rHdlFactory);
     }
 
-    for( vector < XMLPropertySetMapperEntry_Impl >::iterator
-            aEIter = rMapper->mpImpl->maMapEntries.begin();
-         aEIter != rMapper->mpImpl->maMapEntries.end();
-         ++aEIter )
+    for( const auto& rMapEntry : rMapper->mpImpl->maMapEntries )
     {
-        if (!mpImpl->mbOnlyExportMappings || !(*aEIter).bImportOnly)
-            mpImpl->maMapEntries.push_back( *aEIter );
+        if (!mpImpl->mbOnlyExportMappings || !rMapEntry.bImportOnly)
+            mpImpl->maMapEntries.push_back( rMapEntry );
     }
 }
 
@@ -341,8 +335,7 @@ void XMLPropertySetMapper::RemoveEntry( sal_Int32 nIndex )
     if( nIndex>=nEntries || nIndex<0 )
         return;
     vector < XMLPropertySetMapperEntry_Impl >::iterator aEIter = mpImpl->maMapEntries.begin();
-    for( sal_Int32 nN=0; nN<nIndex; nN++ )
-        ++aEIter;
+    std::advance(aEIter, nIndex);
     mpImpl->maMapEntries.erase( aEIter );
 }
 
diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx
index 3a4f8a5752bf..8018f2b1bc3d 100644
--- a/xmloff/source/table/XMLTableExport.cxx
+++ b/xmloff/source/table/XMLTableExport.cxx
@@ -130,14 +130,12 @@ void StringStatisticHelper::add( const OUString& rStyleName )
 sal_Int32 StringStatisticHelper::getModeString( OUString& rStyleName )
 {
     sal_Int32 nMax = 0;
-    const std::map< OUString, sal_Int32 >::const_iterator aEnd( mStats.end() );
-    for( std::map< OUString, sal_Int32 >::iterator iter( mStats.begin() );
-        iter != aEnd; ++iter)
+    for( const auto& rStatsEntry : mStats )
     {
-        if( (*iter).second > nMax )
+        if( rStatsEntry.second > nMax )
         {
-            rStyleName = (*iter).first;
-            nMax = (*iter).second;
+            rStyleName = rStatsEntry.first;
+            nMax = rStatsEntry.second;
         }
     }
 
@@ -206,18 +204,8 @@ XMLTableExport::~XMLTableExport ()
 
 static bool has_states( const std::vector< XMLPropertyState >& xPropStates )
 {
-    if( !xPropStates.empty() )
-    {
-        std::vector< XMLPropertyState >::const_iterator aIter( xPropStates.begin() );
-        std::vector< XMLPropertyState >::const_iterator aEnd( xPropStates.end() );
-        while( aIter != aEnd )
-        {
-            if( aIter->mnIndex != -1 )
-                return true;
-            ++aIter;
-        }
-    }
-    return false;
+    return std::any_of(xPropStates.cbegin(), xPropStates.cend(),
+        [](const XMLPropertyState& rPropertyState) { return rPropertyState.mnIndex != -1; });
 }
 
  void XMLTableExport::collectTableAutoStyles(const Reference < XColumnRowRange >& xColumnRowRange)
diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx
index b3c20b5bc7b3..9b2c646c3a09 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -270,10 +270,10 @@ void XMLTableImport::insertTabletemplate(const OUString& rsStyleName, bool bOver
 
         std::shared_ptr<XMLTableTemplate> xT(it->second);
 
-        for (auto aStyleIter=xT->begin(); aStyleIter != xT->end(); ++aStyleIter) try
+        for (const auto& rStyle : *xT) try
         {
-            const OUString sPropName((*aStyleIter).first);
-            const OUString sStyleName((*aStyleIter).second);
+            const OUString sPropName(rStyle.first);
+            const OUString sStyleName(rStyle.second);
             // Internally unassigned cell styles are stored by display name.
             // However table-template elements reference cell styles by its encoded name.
             // This loop is looking for cell style by their encoded names.
@@ -323,17 +323,17 @@ void XMLTableImport::finishStyles()
 
         Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
 
-        for( XMLTableTemplateMap::iterator aTemplateIter( maTableTemplates.begin() ); aTemplateIter != maTableTemplates.end(); ++aTemplateIter ) try
+        for( const auto& rTemplate : maTableTemplates ) try
         {
-            const OUString sTemplateName( (*aTemplateIter).first );
+            const OUString sTemplateName( rTemplate.first );
             Reference< XNameReplace > xTemplate( xFactory->createInstance(), UNO_QUERY_THROW );
 
-            std::shared_ptr< XMLTableTemplate > xT( (*aTemplateIter).second );
+            std::shared_ptr< XMLTableTemplate > xT( rTemplate.second );
 
-            for( XMLTableTemplate::iterator aStyleIter( xT->begin() ); aStyleIter != xT->end(); ++aStyleIter ) try
+            for( const auto& rStyle : *xT ) try
             {
-                const OUString sPropName( (*aStyleIter).first );
-                const OUString sStyleName( (*aStyleIter).second );
+                const OUString sPropName( rStyle.first );
+                const OUString sStyleName( rStyle.second );
                 xTemplate->replaceByName( sPropName, xCellFamily->getByName( sStyleName ) );
             }
             catch( Exception& )
@@ -596,10 +596,9 @@ void XMLTableImportContext::EndElement()
 {
     if( !maMergeInfos.empty() )
     {
-        MergeInfoVector::iterator aIter( maMergeInfos.begin() );
-        while( aIter != maMergeInfos.end() )
+        for( const auto& rMergeInfo : maMergeInfos )
         {
-            std::shared_ptr< MergeInfo > xInfo( (*aIter++) );
+            std::shared_ptr< MergeInfo > xInfo( rMergeInfo );
 
             if( xInfo.get() ) try
             {
diff --git a/xmloff/source/text/XMLPropertyBackpatcher.cxx b/xmloff/source/text/XMLPropertyBackpatcher.cxx
index 76f413a8a642..52b900acf808 100644
--- a/xmloff/source/text/XMLPropertyBackpatcher.cxx
+++ b/xmloff/source/text/XMLPropertyBackpatcher.cxx
@@ -67,11 +67,9 @@ void XMLPropertyBackpatcher<A>::ResolveId(
         //    (and preserve Property, if appropriate)
         Any aAny;
         aAny <<= aValue;
-        for(BackpatchListType::iterator aIter = pList->begin();
-            aIter != pList->end();
-            ++aIter)
+        for(auto& rBackpatch : *pList)
         {
-            (*aIter)->setPropertyValue(sPropertyName, aAny);
+            rBackpatch->setPropertyValue(sPropertyName, aAny);
         }
 
         // c) delete list
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 009b717894b7..8e963dbe9e0a 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -672,11 +672,9 @@ void XMLTextExportPropertySetMapper::ContextFilter(
 
     bool bNeedsAnchor = false;
 
-    for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
-         aIter != rProperties.end();
-         ++aIter )
+    for( auto& rPropertyState : rProperties )
     {
-        XMLPropertyState *propertyState = &(*aIter);
+        XMLPropertyState *propertyState = &rPropertyState;
         if( propertyState->mnIndex == -1 )
             continue;
 
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 63bbb7cee2ca..698fcb076477 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1927,11 +1927,10 @@ void XMLTextFieldExport::ExportFieldDeclarations(
                 // copy set to sequence
                 aFieldMasters.realloc( rOurMasters.size() );
                 sal_Int32 i = 0;
-                for( set<OUString>::iterator aSetIter = rOurMasters.begin();
-                     aSetIter != rOurMasters.end();
-                     ++aSetIter, ++i )
+                for( const auto& rMaster : rOurMasters )
                 {
-                    aFieldMasters[i] = *aSetIter;
+                    aFieldMasters[i] = rMaster;
+                    ++i;
                 }
 
                 pUsedMasters->erase(rText);
@@ -2007,12 +2006,8 @@ void XMLTextFieldExport::ExportFieldDeclarations(
                                   XML_VARIABLE_DECLS,
                                   true, true );
 
-        for (vector<OUString>::iterator aVarIter = aVarName.begin();
-             aVarIter != aVarName.end();
-             ++aVarIter) {
-
-            OUString sName = *aVarIter;
-
+        for (const auto& sName : aVarName)
+        {
             // get field master property set
             Reference<XPropertySet> xPropSet;
             Any aAny = xFieldMasterNameAccess->getByName(sName);
@@ -2066,12 +2061,8 @@ void XMLTextFieldExport::ExportFieldDeclarations(
                                   XML_SEQUENCE_DECLS,
                                   true, true );
 
-        for (vector<OUString>::iterator aSeqIter = aSeqName.begin();
-             aSeqIter != aSeqName.end();
-             ++aSeqIter) {
-
-            OUString sName = *aSeqIter;
-
+        for (const auto& sName : aSeqName)
+        {
             // get field master property set
             Reference<XPropertySet> xPropSet;
             Any aAny = xFieldMasterNameAccess->getByName(sName);
@@ -2108,12 +2099,8 @@ void XMLTextFieldExport::ExportFieldDeclarations(
                                   XML_USER_FIELD_DECLS,
                                   true, true );
 
-        for (vector<OUString>::iterator aUserIter = aUserName.begin();
-             aUserIter != aUserName.end();
-             ++aUserIter) {
-
-            OUString sName = *aUserIter;
-
+        for (const auto& sName : aUserName)
+        {
             // get field master property set
             Reference<XPropertySet> xPropSet;
             Any aAny = xFieldMasterNameAccess->getByName(sName);
@@ -2159,12 +2146,8 @@ void XMLTextFieldExport::ExportFieldDeclarations(
                                   XML_DDE_CONNECTION_DECLS,
                                   true, true );
 
-        for (vector<OUString>::iterator aDdeIter = aDdeName.begin();
-             aDdeIter != aDdeName.end();
-             ++aDdeIter)
+        for (const auto& sName : aDdeName)
         {
-            OUString sName = *aDdeIter;
-
             // get field master property set
             Reference<XPropertySet> xPropSet;
             Any aAny = xFieldMasterNameAccess->getByName(sName);
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index fddfca65f0d9..9ed8b7d0115a 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -853,27 +853,25 @@ namespace
     {
         ::std::vector<OUString> vListEntries;
         ::std::map<OUString, Any> vOutParams;
-        for(field_params_t::const_iterator pCurrent = m_pInParams->begin();
-            pCurrent != m_pInParams->end();
-            ++pCurrent)
+        for(const auto& rCurrent : *m_pInParams)
         {
-            if(pCurrent->first == ODF_FORMDROPDOWN_RESULT)
+            if(rCurrent.first == ODF_FORMDROPDOWN_RESULT)
             {
                 // sal_Int32
-                vOutParams[pCurrent->first] <<= pCurrent->second.toInt32();
+                vOutParams[rCurrent.first] <<= rCurrent.second.toInt32();
             }
-            else if(pCurrent->first == ODF_FORMCHECKBOX_RESULT)
+            else if(rCurrent.first == ODF_FORMCHECKBOX_RESULT)
             {
                 // bool
-                vOutParams[pCurrent->first] <<= pCurrent->second.toBoolean();
+                vOutParams[rCurrent.first] <<= rCurrent.second.toBoolean();
             }
-            else if(pCurrent->first == ODF_FORMDROPDOWN_LISTENTRY)
+            else if(rCurrent.first == ODF_FORMDROPDOWN_LISTENTRY)
             {
                 // sequence
-                vListEntries.push_back(pCurrent->second);
+                vListEntries.push_back(rCurrent.second);
             }
             else
-                vOutParams[pCurrent->first] <<= pCurrent->second;
+                vOutParams[rCurrent.first] <<= rCurrent.second;
         }
         if(!vListEntries.empty())
         {
@@ -881,13 +879,11 @@ namespace
             copy(vListEntries.begin(), vListEntries.end(), vListEntriesSeq.begin());
             vOutParams[OUString(ODF_FORMDROPDOWN_LISTENTRY)] <<= vListEntriesSeq;
         }
-        for(::std::map<OUString, Any>::const_iterator pCurrent = vOutParams.begin();
-            pCurrent != vOutParams.end();
-            ++pCurrent)
+        for(const auto& rCurrent : vOutParams)
         {
             try
             {
-                m_xOutParams->insertByName(pCurrent->first, pCurrent->second);
+                m_xOutParams->insertByName(rCurrent.first, rCurrent.second);
             }
             catch(const ElementExistException&)
             {
diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
index ee16204c39c2..25fa8ffb03f7 100644
--- a/xmloff/source/text/txtimppr.cxx
+++ b/xmloff/source/text/txtimppr.cxx
@@ -417,11 +417,9 @@ void XMLTextImportPropertyMapper::finished(
     XMLPropertyState* pFillStyle(nullptr);
     XMLPropertyState* pFillColor(nullptr);
 
-    for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
-         aIter != rProperties.end();
-         ++aIter )
+    for( auto& rProperty : rProperties )
     {
-        XMLPropertyState* property = &(*aIter);
+        XMLPropertyState* property = &rProperty;
         if( -1 == property->mnIndex )
             continue;
 
diff --git a/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
index ee9c86acfd68..770cf41f531c 100644
--- a/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
+++ b/xmloff/source/transform/ChartPlotAreaOOoTContext.cxx
@@ -138,13 +138,12 @@ rtl::Reference<XMLTransformerContext> XMLChartPlotAreaOOoTContext::CreateChildCo
         pContext.set(new XMLPersAttrListTContext( GetTransformer(), rQName ));
 
         // put categories at correct axis
-        XMLAxisContextVector::iterator aIter = m_aChildContexts.begin();
         bool bFound =false;
 
         // iterate over axis elements
-        for( ; ! bFound && aIter != m_aChildContexts.end(); ++aIter )
+        for( auto& rChildContext : m_aChildContexts )
         {
-            XMLAxisOOoContext * pAxisContext = (*aIter).get();
+            XMLAxisOOoContext * pAxisContext = rChildContext.get();
             if( pAxisContext != nullptr )
             {
                 // iterate over attributes to find category axis
@@ -169,6 +168,9 @@ rtl::Reference<XMLTransformerContext> XMLChartPlotAreaOOoTContext::CreateChildCo
                     }
                 }
             }
+
+            if (bFound)
+                break;
         }
         OSL_ENSURE( bFound, "No suitable axis for categories found." );
     }
@@ -198,11 +200,9 @@ void XMLChartPlotAreaOOoTContext::AddContent(rtl::Reference<XMLAxisOOoContext> c
 
 void XMLChartPlotAreaOOoTContext::ExportContent()
 {
-    XMLAxisContextVector::iterator aIter = m_aChildContexts.begin();
-
-    for( ; aIter != m_aChildContexts.end(); ++aIter )
+    for( auto& rChildContext : m_aChildContexts )
     {
-        (*aIter)->Export();
+        rChildContext->Export();
     }
 
     m_aChildContexts.clear();
diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx
index ba988a3cef17..dffdc817f315 100644
--- a/xmloff/source/transform/MergeElemTContext.cxx
+++ b/xmloff/source/transform/MergeElemTContext.cxx
@@ -93,11 +93,9 @@ void XMLPersTextContentRNGTransformTContext::Characters( const OUString& rChars
 
 void XMLMergeElemTransformerContext::ExportStartElement()
 {
-    XMLPersTextContentTContextVector::iterator aIter = m_aChildContexts.begin();
-
-    for( ; aIter != m_aChildContexts.end(); ++aIter )
+    for( const auto& rChildContext : m_aChildContexts )
     {
-        XMLPersTextContentTContext *pContext = (*aIter).get();
+        XMLPersTextContentTContext *pContext = rChildContext.get();
         static_cast< XMLMutableAttributeList * >( m_xAttrList.get() )
             ->AddAttribute( pContext->GetExportQName(),
                             pContext->GetTextContent() );


More information about the Libreoffice-commits mailing list