diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-21 09:05:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-21 12:29:46 +0200 |
commit | 639511d7194726b188a2ecae9b3489a250532d03 (patch) | |
tree | af8195623e940c171934b9bbbe16acbc38e0d378 /oox | |
parent | cf46500243c51071227e08c5067041e414180ebc (diff) |
use for-range on Sequence in i18npool..sd
Change-Id: I19eba57bc6058c317473d0746f06699a09ba2830
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94608
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 4 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 3 | ||||
-rw-r--r-- | oox/source/helper/propertymap.cxx | 42 |
3 files changed, 24 insertions, 25 deletions
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index e7a355e2c7dd..03d68fc232c4 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -597,9 +597,9 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const Sequence< OU OUStringBuffer sRep; sRep.append( aItems[ 0 ] ); - for( sal_Int32 i = 1, end = aItems.getLength(); i < end; ++i ) + for( const OUString& rItem : aItems ) { - sRep.append( " " ).append( aItems[ i ] ); + sRep.append( " " ).append( rItem ); } writeElement( pDoc, nXmlElement, sRep.makeStringAndClear() ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 2d44aec64465..63fec0d6d18c 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3095,9 +3095,8 @@ bool DrawingML::WriteCustomGeometry( if ( pGeometrySeq ) { - for( int i = 0; i < pGeometrySeq->getLength(); ++i ) + for( const beans::PropertyValue& rProp : *pGeometrySeq ) { - const beans::PropertyValue& rProp = (*pGeometrySeq)[ i ]; if ( rProp.Name == "Path" ) { uno::Sequence<beans::PropertyValue> aPathProp; diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index f7016022b478..aff0e66452c4 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -378,9 +378,9 @@ static void lclDumpAnyValue( const Any& value) Sequence< PropertyValue > aBulletPropSeq; fprintf (stderr, "level %d\n", k); if (xNumRule->getByIndex (k) >>= aBulletPropSeq) { - for (int j=0; j<aBulletPropSeq.getLength(); j++) { - fprintf(stderr, "%46s = ", USS (aBulletPropSeq[j].Name)); - lclDumpAnyValue (aBulletPropSeq[j].Value); + for (const PropertyValue& rProp : std::as_const(aBulletPropSeq)) { + fprintf(stderr, "%46s = ", USS (rProp.Name)); + lclDumpAnyValue (rProp.Value); } } } @@ -444,18 +444,18 @@ static void lclDumpAnyValue( const Any& value) void PropertyMap::dump( const Reference< XPropertySet >& rXPropSet ) { Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); - Sequence< Property > props = info->getProperties (); + const Sequence< Property > props = info->getProperties (); SAL_INFO("oox", "dump props, len: " << props.getLength ()); - for (int i=0; i < props.getLength (); i++) { - OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8); + for (Property const & prop : props) { + OString name = OUStringToOString( prop.Name, RTL_TEXTENCODING_UTF8); fprintf (stderr,"%30s = ", name.getStr() ); try { - lclDumpAnyValue (rXPropSet->getPropertyValue( props [i].Name )); + lclDumpAnyValue (rXPropSet->getPropertyValue( prop.Name )); } catch (const Exception&) { - fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name)); + fprintf (stderr,"unable to get '%s' value\n", USS(prop.Name)); } } } @@ -807,9 +807,9 @@ static const char* lclDumpAnyValueCode( const Any& value, int level) Sequence< PropertyValue > aBulletPropSeq; fprintf (stderr, "level %d\n", k); if (xNumRule->getByIndex (k) >>= aBulletPropSeq) { - for (int j=0; j<aBulletPropSeq.getLength(); j++) { - fprintf(stderr, "%46s = ", USS (aBulletPropSeq[j].Name)); - lclDumpAnyValue (aBulletPropSeq[j].Value); + for (const PropertyValue& rProp : std::as_const(aBulletPropSeq)) { + fprintf(stderr, "%46s = ", USS (rProp.Name)); + lclDumpAnyValue (rProp.Value); } } } @@ -895,28 +895,28 @@ static const char* lclDumpAnyValueCode( const Any& value, int level) void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet ) { Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); - Sequence< Property > props = info->getProperties (); + const Sequence< Property > props = info->getProperties (); const OUString sType = "Type"; - for (int i=0; i < props.getLength (); i++) { + for (const Property& rProp : props) { // ignore Type, it is set elsewhere - if (props[i].Name == sType) + if (rProp.Name == sType) continue; - OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8); + OString name = OUStringToOString( rProp.Name, RTL_TEXTENCODING_UTF8); int level = 1; try { printLevel (level); fprintf (stderr, "{\n"); - const char* var = lclDumpAnyValueCode (rXPropSet->getPropertyValue (props [i].Name), level + 1); + const char* var = lclDumpAnyValueCode (rXPropSet->getPropertyValue (rProp.Name), level + 1); printLevel (level + 1); fprintf (stderr,"aPropertyMap.setProperty(PROP_%s, %s);\n", name.getStr(), var); printLevel (level); fprintf (stderr, "}\n"); } catch (const Exception&) { - fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name)); + fprintf (stderr,"unable to get '%s' value\n", USS(rProp.Name)); } } } @@ -924,12 +924,12 @@ void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet ) void PropertyMap::dumpData(const Reference<XPropertySet>& xPropertySet) { Reference<XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); - Sequence<Property> aProperties = xPropertySetInfo->getProperties(); + const Sequence<Property> aProperties = xPropertySetInfo->getProperties(); - for (int i = 0; i < aProperties.getLength(); ++i) + for (const Property& rProp : aProperties) { - std::cerr << aProperties[i].Name << std::endl; - std::cerr << comphelper::anyToString(xPropertySet->getPropertyValue(aProperties[i].Name)) << std::endl; + std::cerr << rProp.Name << std::endl; + std::cerr << comphelper::anyToString(xPropertySet->getPropertyValue(rProp.Name)) << std::endl; } } |