diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-12 16:07:58 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-11 20:32:49 +0200 |
commit | 79d58ee14da8fbf636fb087453834abb7173d3fc (patch) | |
tree | 2eda9470235311bdfaf542ceeaf8237406458015 /xmloff/source/xforms | |
parent | c88f76035cd1d088cc06067270677618340fd839 (diff) |
Simplify Sequence iterations in xmloff/source/{style..xforms}
Use range-based loops or replace with comphelper or STL functions
Change-Id: Ie268d80b9c01d38c745c14a81c219d9930860562
Reviewed-on: https://gerrit.libreoffice.org/72189
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/xforms')
-rw-r--r-- | xmloff/source/xforms/xformsapi.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/xforms/xformsexport.cxx | 19 |
2 files changed, 11 insertions, 17 deletions
diff --git a/xmloff/source/xforms/xformsapi.cxx b/xmloff/source/xforms/xformsapi.cxx index f52aac6272b6..19d2f1a051b7 100644 --- a/xmloff/source/xforms/xformsapi.cxx +++ b/xmloff/source/xforms/xformsapi.cxx @@ -114,12 +114,10 @@ static Reference<XPropertySet> lcl_findXFormsBindingOrSubmission( { // iterate over all models Sequence<OUString> aNames = xForms->getElementNames(); - const OUString* pNames = aNames.getConstArray(); - sal_Int32 nNames = aNames.getLength(); - for( sal_Int32 n = 0; (n < nNames) && !xRet.is(); n++ ) + for( const auto& rName : aNames ) { Reference<xforms::XModel2> xModel( - xForms->getByName( pNames[n] ), UNO_QUERY ); + xForms->getByName( rName ), UNO_QUERY ); if( xModel.is() ) { // ask model for bindings @@ -134,6 +132,9 @@ static Reference<XPropertySet> lcl_findXFormsBindingOrSubmission( xRet.set( xBindings->getByName( rBindingID ), UNO_QUERY ); } + + if (xRet.is()) + break; } } } diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx index 5d432ffe6eb5..edd3b1434918 100644 --- a/xmloff/source/xforms/xformsexport.cxx +++ b/xmloff/source/xforms/xformsexport.cxx @@ -87,12 +87,10 @@ void exportXForms( SvXMLExport& rExport ) if( xForms.is() ) { Sequence<OUString> aNames = xForms->getElementNames(); - const OUString* pNames = aNames.getConstArray(); - sal_Int32 nNames = aNames.getLength(); - for( sal_Int32 n = 0; n < nNames; n++ ) + for( const auto& rName : aNames ) { - Reference<XPropertySet> xModel( xForms->getByName( pNames[n] ), + Reference<XPropertySet> xModel( xForms->getByName( rName ), UNO_QUERY ); exportXFormsModel( rExport, xModel ); } @@ -219,12 +217,10 @@ void exportXFormsInstance( SvXMLExport& rExport, OUString sURL; Reference<XDocument> xDoc; - const PropertyValue* pInstance = xInstance.getConstArray(); - sal_Int32 nCount = xInstance.getLength(); - for( sal_Int32 i = 0; i < nCount; i++ ) + for( const auto& rProp : xInstance ) { - OUString sName = pInstance[i].Name; - const Any& rAny = pInstance[i].Value; + OUString sName = rProp.Name; + const Any& rAny = rProp.Value; if ( sName == "ID" ) rAny >>= sId; else if ( sName == "URL" ) @@ -337,11 +333,8 @@ void exportXFormsBinding( SvXMLExport& rExport, { // iterate over Prefixes for this binding Sequence<OUString> aPrefixes = xNamespaces->getElementNames(); - const OUString* pPrefixes = aPrefixes.getConstArray(); - sal_Int32 nPrefixes = aPrefixes.getLength(); - for( sal_Int32 i = 0; i < nPrefixes; i++ ) + for( const OUString& rPrefix : aPrefixes ) { - const OUString& rPrefix = pPrefixes[i]; OUString sURI; xNamespaces->getByName( rPrefix ) >>= sURI; |