summaryrefslogtreecommitdiff
path: root/xmloff/source/forms
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-09-16 13:53:43 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-17 08:12:03 +0200
commit30530afaaa715473a2f9c3f068beeed5f3a98daf (patch)
tree5d5b499a75c4b363eec63e11b822de0da3cd5f60 /xmloff/source/forms
parentffe2b51a4919fb64a8debecb724d1e959abf343a (diff)
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@collabora.co.uk>
Diffstat (limited to 'xmloff/source/forms')
-rw-r--r--xmloff/source/forms/attriblistmerge.cxx22
-rw-r--r--xmloff/source/forms/elementexport.cxx9
-rw-r--r--xmloff/source/forms/elementimport.cxx167
-rw-r--r--xmloff/source/forms/eventimport.cxx17
-rw-r--r--xmloff/source/forms/handler/vcl_date_handler.cxx7
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.cxx7
-rw-r--r--xmloff/source/forms/layerexport.cxx12
-rw-r--r--xmloff/source/forms/layerimport.cxx29
-rw-r--r--xmloff/source/forms/propertyexport.cxx15
-rw-r--r--xmloff/source/forms/propertyimport.cxx8
10 files changed, 103 insertions, 190 deletions
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;