diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-09 23:27:25 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-10 09:44:56 +0100 |
commit | 5b2fc10f0cc9f15525c7723764a1feebeceb0d5e (patch) | |
tree | 1d4159a006696d3072dc98fc989c3fbd58e32b7a /dbaccess/source/filter/xml | |
parent | 7c693fc3f7218e1ca0c85a0de76ae84226391256 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'dbaccess/source/filter/xml')
-rw-r--r-- | dbaccess/source/filter/xml/xmlAutoStyle.cxx | 12 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlExport.cxx | 15 |
2 files changed, 11 insertions, 16 deletions
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; } } |