From 60846212c7f5271a86fd43555d633f77d59f5a10 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 21 May 2020 09:11:25 +0200 Subject: use for-range on Sequence in sfx2..sw Change-Id: I09806869f2fdbae61f4c5d5c9db6859202bb63b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94609 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../accessibility/AccessibleControlShape.cxx | 4 ++-- svx/source/dialog/svxbmpnumvalueset.cxx | 27 +++++++++++----------- svx/source/items/customshapeitem.cxx | 7 +++--- 3 files changed, 18 insertions(+), 20 deletions(-) (limited to 'svx') diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index a775d572b254..2eaf8448f9c5 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -785,8 +785,8 @@ void AccessibleControlShape::initializeComposedState() // now, only states which are not in the responsibility of the UNO control should be part of this state set { Sequence< sal_Int16 > aInitStates = pComposedStates->getStates(); - for ( sal_Int32 i=0; igetByIndex(i); Sequence aLevel; aLevelAny >>= aLevel; - const PropertyValue* pValues = aLevel.getConstArray(); aNumberingTypes[i] = 0; aParentNumberings[i] = 0; - for(sal_Int32 nProperty = 0; nProperty < aLevel.getLength() - 1; nProperty++) + for(const PropertyValue& rProp : std::as_const(aLevel)) { - if ( pValues[nProperty].Name == "NumberingType" ) - pValues[nProperty].Value >>= aNumberingTypes[i]; - else if ( pValues[nProperty].Name == "BulletFontName" ) - pValues[nProperty].Value >>= sFontNames[i]; - else if ( pValues[nProperty].Name == "BulletChar" ) - pValues[nProperty].Value >>= sBulletChars[i]; - else if ( pValues[nProperty].Name == "Prefix" ) - pValues[nProperty].Value >>= sPrefixes[i]; - else if ( pValues[nProperty].Name == "Suffix" ) - pValues[nProperty].Value >>= sSuffixes[i]; - else if ( pValues[nProperty].Name == "ParentNumbering" ) - pValues[nProperty].Value >>= aParentNumberings[i]; + if ( rProp.Name == "NumberingType" ) + rProp.Value >>= aNumberingTypes[i]; + else if ( rProp.Name == "BulletFontName" ) + rProp.Value >>= sFontNames[i]; + else if ( rProp.Name == "BulletChar" ) + rProp.Value >>= sBulletChars[i]; + else if ( rProp.Name == "Prefix" ) + rProp.Value >>= sPrefixes[i]; + else if ( rProp.Name == "Suffix" ) + rProp.Value >>= sSuffixes[i]; + else if ( rProp.Name == "ParentNumbering" ) + rProp.Value >>= aParentNumberings[i]; } Sequence< PropertyValue > aProperties(2); PropertyValue* pProperties = aProperties.getArray(); diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx index 0b63b0e8ccea..8626d893ed7e 100644 --- a/svx/source/items/customshapeitem.cxx +++ b/svx/source/items/customshapeitem.cxx @@ -120,12 +120,11 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyVal css::uno::Any* pAny = GetPropertyValueByName( rPropVal.Name ); if ( pAny ) { // property is already available - sal_Int32 i; if ( auto rSecSequence = o3tl::tryAccess>(*pAny) ) { // old property is a sequence->each entry has to be removed from the HashPairMap - for ( i = 0; i < rSecSequence->getLength(); i++ ) + for ( auto const & i : *rSecSequence ) { - PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rPropVal.Name, (*rSecSequence)[ i ].Name ) ) ); + PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rPropVal.Name, i.Name ) ) ); if ( aHashIter != aPropPairHashMap.end() ) aPropPairHashMap.erase( aHashIter ); } @@ -133,7 +132,7 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyVal *pAny = rPropVal.Value; if ( auto rSecSequence = o3tl::tryAccess>(*pAny) ) { // the new property is a sequence->each entry has to be inserted into the HashPairMap - for ( i = 0; i < rSecSequence->getLength(); i++ ) + for ( sal_Int32 i = 0; i < rSecSequence->getLength(); i++ ) { beans::PropertyValue const & rPropVal2 = (*rSecSequence)[ i ]; aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = i; -- cgit