From 5b2fc10f0cc9f15525c7723764a1feebeceb0d5e Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 9 Mar 2018 23:27:25 +0100 Subject: Modernize a bit more dbaccess mainly by using for-range loops but also by simplifying some simple algo Change-Id: If04cd78e62f80f9575e24f3d50ff1e427454da79 Reviewed-on: https://gerrit.libreoffice.org/51019 Tested-by: Jenkins Reviewed-by: Julien Nabet --- dbaccess/source/filter/xml/xmlAutoStyle.cxx | 12 +++++------- dbaccess/source/filter/xml/xmlExport.cxx | 15 ++++++--------- 2 files changed, 11 insertions(+), 16 deletions(-) (limited to 'dbaccess/source/filter/xml') diff --git a/dbaccess/source/filter/xml/xmlAutoStyle.cxx b/dbaccess/source/filter/xml/xmlAutoStyle.cxx index cfa5829f2ad5..c9e328867b7a 100644 --- a/dbaccess/source/filter/xml/xmlAutoStyle.cxx +++ b/dbaccess/source/filter/xml/xmlAutoStyle.cxx @@ -39,24 +39,22 @@ void OXMLAutoStylePoolP::exportStyleAttributes( if ( nFamily == XML_STYLE_FAMILY_TABLE_COLUMN ) { rtl::Reference< XMLPropertySetMapper > aPropMapper = rODBExport.GetColumnStylesPropertySetMapper(); - std::vector< XMLPropertyState >::const_iterator i = rProperties.begin(); - std::vector< XMLPropertyState >::const_iterator aEnd = rProperties.end(); - for ( ; i != aEnd ; ++i ) + for (auto const& property : rProperties) { - sal_Int16 nContextID = aPropMapper->GetEntryContextId(i->mnIndex); + sal_Int16 nContextID = aPropMapper->GetEntryContextId(property.mnIndex); switch (nContextID) { case CTF_DB_NUMBERFORMAT : { sal_Int32 nNumberFormat = 0; - if ( i->maValue >>= nNumberFormat ) + if ( property.maValue >>= nNumberFormat ) { OUString sAttrValue = rODBExport.getDataStyleName(nNumberFormat); if ( !sAttrValue.isEmpty() ) { GetExport().AddAttribute( - aPropMapper->GetEntryNameSpace(i->mnIndex), - aPropMapper->GetEntryXMLName(i->mnIndex), + aPropMapper->GetEntryNameSpace(property.mnIndex), + aPropMapper->GetEntryXMLName(property.mnIndex), sAttrValue ); } } diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 5c7bfb047e67..29ecde32b0ce 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -1176,29 +1176,26 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) std::vector< XMLPropertyState > aPropStates = i.first->Filter( _xProp ); if ( !aPropStates.empty() ) { - std::vector< XMLPropertyState >::iterator aItr = aPropStates.begin(); - std::vector< XMLPropertyState >::const_iterator aEnd = aPropStates.end(); const rtl::Reference < XMLPropertySetMapper >& pStyle = i.first->getPropertySetMapper(); - while ( aItr != aEnd ) + for (auto & propState : aPropStates) { - if ( aItr->mnIndex != -1 ) + if ( propState.mnIndex != -1 ) { - switch ( pStyle->GetEntryContextId(aItr->mnIndex) ) + switch ( pStyle->GetEntryContextId(propState.mnIndex) ) { case CTF_DB_NUMBERFORMAT: { sal_Int32 nNumberFormat = -1; - if ( aItr->maValue >>= nNumberFormat ) + if ( propState.maValue >>= nNumberFormat ) addDataStyle(nNumberFormat); } break; case CTF_DB_COLUMN_TEXT_ALIGN: - if ( !aItr->maValue.hasValue() ) - aItr->maValue <<= css::awt::TextAlign::LEFT; + if ( !propState.maValue.hasValue() ) + propState.maValue <<= css::awt::TextAlign::LEFT; break; } } - ++aItr; } } -- cgit