From f07ff7ed8a23b4982ed9cd7d9e2083c9d0928384 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 5 May 2016 10:10:54 +0200 Subject: clang-tidy modernize-loop-convert in oox to sax Change-Id: If0d87b6679765fc6d1f9300c6972845cf3742b9c Reviewed-on: https://gerrit.libreoffice.org/24674 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- oox/source/drawingml/customshapegeometry.cxx | 4 ++-- oox/source/drawingml/fillpropertiesgroupcontext.cxx | 8 ++++---- oox/source/drawingml/shape.cxx | 6 +++--- oox/source/export/shapes.cxx | 12 ++++++------ oox/source/vml/vmlshape.cxx | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'oox') diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index a29ea074b220..d019c9fb8d82 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -423,8 +423,8 @@ static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperti if ( !pCommandHashMap ) { FormulaCommandHMap* pHM = new FormulaCommandHMap(); - for( sal_Int32 i = 0; i < FC_LAST; i++ ) - (*pHM)[ OUString::createFromAscii( pFormularCommandNameTable[ i ].pS ) ] = pFormularCommandNameTable[ i ].pE; + for(const FormularCommandNameTable& i : pFormularCommandNameTable) + (*pHM)[ OUString::createFromAscii( i.pS ) ] = i.pE; pCommandHashMap = pHM; } diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx index 78d4b16ecc9b..69175f4d647e 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -360,13 +360,13 @@ ContextHandlerRef ArtisticEffectContext::onCreateContext( XML_size, XML_brushSize, XML_scaling, XML_detail, XML_bright, XML_contrast, XML_colorTemp, XML_sat, XML_amount }; - for( sal_Int32 i=0; i<19; ++i ) + for(sal_Int32 nAttrib : aAttribs) { - if( rAttribs.hasAttribute( aAttribs[i] ) ) + if( rAttribs.hasAttribute( nAttrib ) ) { - OUString sName = ArtisticEffectProperties::getEffectString( aAttribs[i] ); + OUString sName = ArtisticEffectProperties::getEffectString( nAttrib ); if( !sName.isEmpty() ) - maEffect.maAttribs[sName] = uno::makeAny( rAttribs.getInteger( aAttribs[i], 0 ) ); + maEffect.maAttribs[sName] = uno::makeAny( rAttribs.getInteger( nAttrib, 0 ) ); } } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index fb5a30a2c649..eb7a5395e84b 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -833,13 +833,13 @@ Reference< XShape > Shape::createAndInsert( { PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i) + for (sal_Int32 nBorder : aBorders) { - css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get(); + css::table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get(); aBorderLine.Color = aShapeProps.getProperty(PROP_LineColor).get(); if (aLineProperties.moLineWidth.has()) aBorderLine.LineWidth = convertEmuToHmm(aLineProperties.moLineWidth.get()); - aShapeProps.setProperty(aBorders[i], uno::makeAny(aBorderLine)); + aShapeProps.setProperty(nBorder, uno::makeAny(aBorderLine)); } aShapeProps.erase(PROP_LineColor); } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index b14ad338372d..e389fc6db416 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -237,18 +237,18 @@ static uno::Reference lcl_StoreOwnAsOOXML( const char * pFilterName(nullptr); SvGlobalName const classId(xObj->getClassID()); - for (size_t i = 0; i < SAL_N_ELEMENTS(s_Mapping); ++i) + for (auto & i : s_Mapping) { - auto const& rId(s_Mapping[i].ClassId); + auto const& rId(i.ClassId); SvGlobalName const temp(rId.n1, rId.n2, rId.n3, rId.b8, rId.b9, rId.b10, rId.b11, rId.b12, rId.b13, rId.b14, rId.b15); if (temp == classId) { assert(SvGlobalName(SO3_SCH_CLASSID_60) != classId); // chart should be written elsewhere! assert(SvGlobalName(SO3_SM_CLASSID_60) != classId); // formula should be written elsewhere! - pFilterName = s_Mapping[i].pFilterName; - o_rMediaType = OUString::createFromAscii(s_Mapping[i].pMediaType); - o_rpProgID = s_Mapping[i].pProgID; - o_rSuffix = OUString::createFromAscii(s_Mapping[i].pSuffix); + pFilterName = i.pFilterName; + o_rMediaType = OUString::createFromAscii(i.pMediaType); + o_rpProgID = i.pProgID; + o_rSuffix = OUString::createFromAscii(i.pSuffix); o_rRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; break; } diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 34527f06a4fc..b58248f7e810 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -504,13 +504,13 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con static const sal_Int32 aBorders[] = { PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i) + for (sal_Int32 nBorder : aBorders) { - table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get(); + table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(nBorder)).get(); aBorderLine.Color = aPropMap.getProperty(PROP_LineColor).get(); if (oLineWidth) aBorderLine.LineWidth = *oLineWidth; - aPropMap.setProperty(aBorders[i], uno::makeAny(aBorderLine)); + aPropMap.setProperty(nBorder, uno::makeAny(aBorderLine)); } aPropMap.erase(PROP_LineColor); } -- cgit