oox/source/core/relations.cxx | 14 +- oox/source/core/xmlfilterbase.cxx | 4 oox/source/docprop/docprophandler.cxx | 8 - oox/source/drawingml/chart/axisconverter.cxx | 5 oox/source/drawingml/chart/chartconverter.cxx | 4 oox/source/drawingml/chart/converterbase.cxx | 4 oox/source/drawingml/chart/datasourceconverter.cxx | 5 oox/source/drawingml/chart/plotareaconverter.cxx | 51 ++++--- oox/source/drawingml/chart/seriesconverter.cxx | 20 +-- oox/source/drawingml/chart/typegroupconverter.cxx | 20 +-- oox/source/drawingml/color.cxx | 64 ++++----- oox/source/drawingml/customshapeproperties.cxx | 15 +- oox/source/drawingml/diagram/diagram.cxx | 136 ++++++++------------- oox/source/drawingml/effectproperties.cxx | 6 oox/source/drawingml/fillproperties.cxx | 13 -- oox/source/drawingml/shape.cxx | 14 -- oox/source/drawingml/table/tableproperties.cxx | 22 +-- 17 files changed, 192 insertions(+), 213 deletions(-)
New commits: commit 22b061267efe28f3611fd38534a59e8d74bf1e77 Author: Julien Nabet <serval2...@yahoo.fr> Date: Fri Mar 30 22:14:59 2018 +0200 Use for-range loops in oox (part1) Change-Id: I3b8b3cdc818509598bc766f7eed27454c74c4e2d Reviewed-on: https://gerrit.libreoffice.org/52175 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/oox/source/core/relations.cxx b/oox/source/core/relations.cxx index 8bb5448d9bb8..49a84d368e56 100644 --- a/oox/source/core/relations.cxx +++ b/oox/source/core/relations.cxx @@ -64,19 +64,19 @@ const Relation* Relations::getRelationFromRelId( const OUString& rId ) const const Relation* Relations::getRelationFromFirstType( const OUString& rType ) const { - for( ::std::map< OUString, Relation >::const_iterator aIt = maMap.begin(), aEnd = maMap.end(); aIt != aEnd; ++aIt ) - if( aIt->second.maType.equalsIgnoreAsciiCase( rType ) ) - return &aIt->second; + for (auto const& elem : maMap) + if( elem.second.maType.equalsIgnoreAsciiCase( rType ) ) + return &elem.second; return nullptr; } RelationsRef Relations::getRelationsFromTypeFromOfficeDoc( const OUString& rType ) const { RelationsRef xRelations( new Relations( maFragmentPath ) ); - for( ::std::map< OUString, Relation >::const_iterator aIt = maMap.begin(), aEnd = maMap.end(); aIt != aEnd; ++aIt ) - if( aIt->second.maType.equalsIgnoreAsciiCase( createOfficeDocRelationTypeTransitional(rType) ) || - aIt->second.maType.equalsIgnoreAsciiCase( createOfficeDocRelationTypeStrict(rType) )) - xRelations->maMap[ aIt->first ] = aIt->second; + for (auto const& elem : maMap) + if( elem.second.maType.equalsIgnoreAsciiCase( createOfficeDocRelationTypeTransitional(rType) ) || + elem.second.maType.equalsIgnoreAsciiCase( createOfficeDocRelationTypeStrict(rType) )) + xRelations->maMap[ elem.first ] = elem.second; return xRelations; } diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 58333fb6c229..2bbb23a38721 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -164,8 +164,8 @@ void registerNamespaces( FastParser& rParser ) for (sal_Int32 i = 0; i < ids.getLength(); ++i) aSet.insert(ids[i].Second); - for (std::set<sal_Int32>::iterator it = aSet.begin(); it != aSet.end(); ++it) - rParser.registerNamespace(*it); + for (auto const& elem : aSet) + rParser.registerNamespace(elem); } } // namespace diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx index 206455c66307..ae8d4829a91c 100644 --- a/oox/source/docprop/docprophandler.cxx +++ b/oox/source/docprop/docprophandler.cxx @@ -201,9 +201,11 @@ uno::Sequence< OUString > OOXMLDocPropHandler::GetKeywordsSet( const OUString& a { uno::Sequence< OUString > aResult( aUtf8Result.size() ); OUString* pResultValues = aResult.getArray(); - for ( std::vector< std::string >::const_iterator i = aUtf8Result.begin(); - i != aUtf8Result.end(); ++i, ++pResultValues ) - *pResultValues = OUString( i->c_str(), static_cast< sal_Int32 >( i->size() ),RTL_TEXTENCODING_UTF8 ); + for (auto const& elem : aUtf8Result) + { + *pResultValues = OUString( elem.c_str(), static_cast< sal_Int32 >( elem.size() ),RTL_TEXTENCODING_UTF8 ); + ++pResultValues; + } return aResult; } diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 727c0f599489..5aead418e983 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -116,10 +116,9 @@ bool isPercent( const RefVector<TypeGroupConverter>& rTypeGroups ) if (rTypeGroups.empty()) return false; - RefVector<TypeGroupConverter>::const_iterator it = rTypeGroups.begin(), itEnd = rTypeGroups.end(); - for (; it != itEnd; ++it) + for (auto const& typeGroup : rTypeGroups) { - TypeGroupConverter& rConv = **it; + TypeGroupConverter& rConv = *typeGroup; if (!rConv.isPercent()) return false; } diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index 34ef0e72d822..4992758396ac 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -134,8 +134,8 @@ Reference< XDataSequence > ChartConverter::createDataSequence( { // create a single-row array from constant source data Matrix< Any > aMatrix( rDataSeq.mnPointCount, 1 ); - for( DataSequenceModel::AnyMap::const_iterator aDIt = rDataSeq.maData.begin(), aDEnd = rDataSeq.maData.end(); aDIt != aDEnd; ++aDIt ) - *aMatrix.at(aDIt->first, 0) = aDIt->second; + for (auto const& elem : rDataSeq.maData) + *aMatrix.at(elem.first, 0) = elem.second; aRangeRep = lclGenerateApiArray( aMatrix ); } diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx index 35ed591936f5..a0535671dbc6 100644 --- a/oox/source/drawingml/chart/converterbase.cxx +++ b/oox/source/drawingml/chart/converterbase.cxx @@ -274,8 +274,8 @@ void ConverterRoot::convertTitlePositions() try { Reference< cssc::XChartDocument > xChart1Doc( mxData->mxDoc, UNO_QUERY_THROW ); - for( ConverterData::TitleMap::iterator aIt = mxData->maTitles.begin(), aEnd = mxData->maTitles.end(); aIt != aEnd; ++aIt ) - aIt->second.convertTitlePos( *this, xChart1Doc ); + for (auto & title : mxData->maTitles) + title.second.convertTitlePos( *this, xChart1Doc ); } catch( Exception& ) { diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx index 701525d0bde0..bcfbf1bf8406 100644 --- a/oox/source/drawingml/chart/datasourceconverter.cxx +++ b/oox/source/drawingml/chart/datasourceconverter.cxx @@ -52,10 +52,9 @@ Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUSt mrModel.mnPointCount = std::min<sal_Int32>(mrModel.mnPointCount, 1); OUStringBuffer aTitle; bool bFirst = true; - for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(), - itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr) + for (auto const& elem : mrModel.maData) { - Any aAny = itr->second; + Any aAny = elem.second; if(aAny.has<OUString>()) { if(!bFirst) diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index 5861b8ef537c..f89044d277de 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -111,8 +111,8 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, // create type group converter objects for all type groups typedef RefVector< TypeGroupConverter > TypeGroupConvVector; TypeGroupConvVector aTypeGroups; - for( AxesSetModel::TypeGroupVector::iterator aIt = mrModel.maTypeGroups.begin(), aEnd = mrModel.maTypeGroups.end(); aIt != aEnd; ++aIt ) - aTypeGroups.push_back( std::make_shared<TypeGroupConverter>( *this, **aIt ) ); + for (auto const& typeGroup : mrModel.maTypeGroups) + aTypeGroups.push_back( std::make_shared<TypeGroupConverter>( *this, *typeGroup ) ); OSL_ENSURE( !aTypeGroups.empty(), "AxesSetConverter::convertFromModel - no type groups in axes set" ); if( !aTypeGroups.empty() ) try @@ -175,8 +175,8 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, } // convert all chart type groups, this converts all series data and formatting - for( TypeGroupConvVector::iterator aTIt = aTypeGroups.begin(), aTEnd = aTypeGroups.end(); aTIt != aTEnd; ++aTIt ) - (*aTIt)->convertFromModel( rxDiagram, xCoordSystem, nAxesSetIdx, bSupportsVaryColorsByPoint ); + for (auto const& typeGroup : aTypeGroups) + typeGroup->convertFromModel( rxDiagram, xCoordSystem, nAxesSetIdx, bSupportsVaryColorsByPoint ); } } catch( Exception& ) @@ -335,36 +335,40 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) // store all axis models in a map, keyed by axis identifier typedef ModelMap< sal_Int32, AxisModel > AxisMap; AxisMap aAxisMap; - for( PlotAreaModel::AxisVector::iterator aAIt = mrModel.maAxes.begin(), aAEnd = mrModel.maAxes.end(); aAIt != aAEnd; ++aAIt ) + for (auto const& axis : mrModel.maAxes) { - PlotAreaModel::AxisVector::value_type xAxis = *aAIt; - OSL_ENSURE( xAxis->mnAxisId >= 0, "PlotAreaConverter::convertFromModel - invalid axis identifier" ); - OSL_ENSURE( !aAxisMap.has( xAxis->mnAxisId ), "PlotAreaConverter::convertFromModel - axis identifiers not unique" ); - if( xAxis->mnAxisId != -1 ) - aAxisMap[ xAxis->mnAxisId ] = xAxis; + OSL_ENSURE( axis->mnAxisId >= 0, "PlotAreaConverter::convertFromModel - invalid axis identifier" ); + OSL_ENSURE( !aAxisMap.has( axis->mnAxisId ), "PlotAreaConverter::convertFromModel - axis identifiers not unique" ); + if( axis->mnAxisId != -1 ) + aAxisMap[ axis->mnAxisId ] = axis; } // group the type group models into different axes sets typedef ModelVector< AxesSetModel > AxesSetVector; AxesSetVector aAxesSets; sal_Int32 nMaxSeriesIdx = -1; - for( PlotAreaModel::TypeGroupVector::iterator aTIt = mrModel.maTypeGroups.begin(), aTEnd = mrModel.maTypeGroups.end(); aTIt != aTEnd; ++aTIt ) + for (auto const& typeGroup : mrModel.maTypeGroups) { - PlotAreaModel::TypeGroupVector::value_type xTypeGroup = *aTIt; - if( !xTypeGroup->maSeries.empty() ) + if( !typeGroup->maSeries.empty() ) { // try to find a compatible axes set for the type group AxesSetModel* pAxesSet = nullptr; - for( AxesSetVector::iterator aASIt = aAxesSets.begin(), aASEnd = aAxesSets.end(); !pAxesSet && (aASIt != aASEnd); ++aASIt ) - if( (*aASIt)->maTypeGroups.front()->maAxisIds == xTypeGroup->maAxisIds ) - pAxesSet = aASIt->get(); + for (auto const& axesSet : aAxesSets) + { + if( axesSet->maTypeGroups.front()->maAxisIds == typeGroup->maAxisIds ) + { + pAxesSet = axesSet.get(); + if (pAxesSet) + break; + } + } // not possible to insert into an existing axes set -> start a new axes set if( !pAxesSet ) { pAxesSet = &aAxesSets.create(); // find axis models used by the type group - const TypeGroupModel::AxisIdVector& rAxisIds = xTypeGroup->maAxisIds; + const TypeGroupModel::AxisIdVector& rAxisIds = typeGroup->maAxisIds; if( rAxisIds.size() >= 1 ) pAxesSet->maAxes[ API_X_AXIS ] = aAxisMap.get( rAxisIds[ 0 ] ); if( rAxisIds.size() >= 2 ) @@ -374,11 +378,11 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) } // insert the type group model - pAxesSet->maTypeGroups.push_back( xTypeGroup ); + pAxesSet->maTypeGroups.push_back( typeGroup ); // collect the maximum series index for automatic series formatting - for( TypeGroupModel::SeriesVector::iterator aSIt = xTypeGroup->maSeries.begin(), aSEnd = xTypeGroup->maSeries.end(); aSIt != aSEnd; ++aSIt ) - nMaxSeriesIdx = ::std::max( nMaxSeriesIdx, (*aSIt)->mnIndex ); + for (auto const& elemSeries : typeGroup->maSeries) + nMaxSeriesIdx = ::std::max( nMaxSeriesIdx, elemSeries->mnIndex ); } } getFormatter().setMaxSeriesIndex( nMaxSeriesIdx ); @@ -387,10 +391,10 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) bool bSupportsVaryColorsByPoint = mrModel.maTypeGroups.size() == 1; // convert all axes sets - for( AxesSetVector::iterator aASBeg = aAxesSets.begin(), aASIt = aASBeg, aASEnd = aAxesSets.end(); aASIt != aASEnd; ++aASIt ) + sal_Int32 nAxesSetIdx = 0; + for (auto const& axesSet : aAxesSets) { - AxesSetConverter aAxesSetConv( *this, **aASIt ); - sal_Int32 nAxesSetIdx = static_cast< sal_Int32 >( aASIt - aASBeg ); + AxesSetConverter aAxesSetConv(*this, *axesSet); aAxesSetConv.convertFromModel( xDiagram, rView3DModel, nAxesSetIdx, bSupportsVaryColorsByPoint ); if( nAxesSetIdx == 0 ) { @@ -403,6 +407,7 @@ void PlotAreaConverter::convertFromModel( View3DModel& rView3DModel ) { maAutoTitle.clear(); } + ++nAxesSetIdx; } DataTableConverter dataTableConverter (*this, mrModel.mxDataTable.getOrCreate()); diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index ac5977d115da..7e35fc6f2628 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -368,12 +368,12 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa } // data point label settings - for( DataLabelsModel::DataLabelVector::iterator aIt = mrModel.maPointLabels.begin(), aEnd = mrModel.maPointLabels.end(); aIt != aEnd; ++aIt ) + for (auto const& pointLabel : mrModel.maPointLabels) { - if ((*aIt)->maNumberFormat.maFormatCode.isEmpty()) - (*aIt)->maNumberFormat = mrModel.maNumberFormat; + if (pointLabel->maNumberFormat.maFormatCode.isEmpty()) + pointLabel->maNumberFormat = mrModel.maNumberFormat; - DataLabelConverter aLabelConv( *this, **aIt ); + DataLabelConverter aLabelConv(*this, *pointLabel); aLabelConv.convertFromModel( rxDataSeries, rTypeGroup, aPropSet ); } } @@ -712,16 +712,16 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve } // error bars - for( SeriesModel::ErrorBarVector::iterator aIt = mrModel.maErrorBars.begin(), aEnd = mrModel.maErrorBars.end(); aIt != aEnd; ++aIt ) + for (auto const& errorBar : mrModel.maErrorBars) { - ErrorBarConverter aErrorBarConv( *this, **aIt ); + ErrorBarConverter aErrorBarConv(*this, *errorBar); aErrorBarConv.convertFromModel( xDataSeries ); } // trendlines - for( SeriesModel::TrendlineVector::iterator aIt = mrModel.maTrendlines.begin(), aEnd = mrModel.maTrendlines.end(); aIt != aEnd; ++aIt ) + for (auto const& trendLine : mrModel.maTrendlines) { - TrendlineConverter aTrendlineConv( *this, **aIt ); + TrendlineConverter aTrendlineConv(*this, *trendLine); aTrendlineConv.convertFromModel( xDataSeries ); } @@ -775,9 +775,9 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve } // data point settings - for( SeriesModel::DataPointVector::iterator aIt = mrModel.maPoints.begin(), aEnd = mrModel.maPoints.end(); aIt != aEnd; ++aIt ) + for (auto const& point : mrModel.maPoints) { - DataPointConverter aPointConv( *this, **aIt ); + DataPointConverter aPointConv(*this, *point); aPointConv.convertFromModel( xDataSeries, rTypeGroup, mrModel ); } diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx index 66de768d8d8a..fb8a50f0203b 100644 --- a/oox/source/drawingml/chart/typegroupconverter.cxx +++ b/oox/source/drawingml/chart/typegroupconverter.cxx @@ -270,19 +270,21 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence() /* Find first existing category sequence. The bahaviour of Excel 2007 is different to Excel 2003, which always used the category sequence of the first series, even if it was empty. */ - for( TypeGroupModel::SeriesVector::iterator aIt = mrModel.maSeries.begin(), aEnd = mrModel.maSeries.end(); !xLabeledSeq.is() && (aIt != aEnd); ++aIt ) + for (auto const& elem : mrModel.maSeries) { - if( (*aIt)->maSources.has( SeriesModel::CATEGORIES ) ) + if( elem->maSources.has( SeriesModel::CATEGORIES ) ) { - SeriesConverter aSeriesConv( *this, **aIt ); + SeriesConverter aSeriesConv(*this, *elem); xLabeledSeq = aSeriesConv.createCategorySequence( "categories" ); } - else if( nMaxValues <= 0 && (*aIt)->maSources.has( SeriesModel::VALUES ) ) + else if( nMaxValues <= 0 && elem->maSources.has( SeriesModel::VALUES ) ) { - DataSourceModel *pValues = (*aIt)->maSources.get( SeriesModel::VALUES ).get(); + DataSourceModel *pValues = elem->maSources.get( SeriesModel::VALUES ).get(); if( pValues->mxDataSeq.is() ) nMaxValues = pValues->mxDataSeq.get()->maData.size(); } + if (xLabeledSeq.is()) + break; } /* n#839727 Create Category Sequence when none are found */ if( !xLabeledSeq.is() && mrModel.maSeries.size() > 0 ) { @@ -340,8 +342,8 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra // create converter objects for all series models typedef RefVector< SeriesConverter > SeriesConvVector; SeriesConvVector aSeries; - for( TypeGroupModel::SeriesVector::iterator aIt = mrModel.maSeries.begin(), aEnd = mrModel.maSeries.end(); aIt != aEnd; ++aIt ) - aSeries.push_back( std::make_shared<SeriesConverter>( *this, **aIt ) ); + for (auto const& elemSeries : mrModel.maSeries) + aSeries.push_back( std::make_shared<SeriesConverter>(*this, *elemSeries) ); // reverse series order for some unstacked 2D chart types if( maTypeInfo.mbReverseSeries && !mb3dChart && !isStacked() && !isPercent() ) @@ -413,9 +415,9 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra } else { - for( SeriesConvVector::iterator aIt = aSeries.begin(), aEnd = aSeries.end(); aIt != aEnd; ++aIt ) + for (auto const& elem : aSeries) { - SeriesConverter& rSeriesConv = **aIt; + SeriesConverter& rSeriesConv = *elem; Reference< XDataSeries > xDataSeries = rSeriesConv.createDataSeries( *this, bVaryColorsByPoint ); insertDataSeries( xChartType, xDataSeries, nAxesSetIdx ); diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx index ec4a18008719..f0ca6f509404 100644 --- a/oox/source/drawingml/color.cxx +++ b/oox/source/drawingml/color.cxx @@ -461,42 +461,42 @@ void Color::clearTransparence() // if color is UNUSED or turns to UNUSED in setResolvedRgb, do not perform transformations if( meMode != COLOR_UNUSED ) { - for( TransformVec::const_iterator aIt = maTransforms.begin(), aEnd = maTransforms.end(); aIt != aEnd; ++aIt ) + for (auto const& transform : maTransforms) { - switch( aIt->mnToken ) + switch( transform.mnToken ) { - case XML_red: toCrgb(); lclSetValue( mnC1, aIt->mnValue ); break; - case XML_redMod: toCrgb(); lclModValue( mnC1, aIt->mnValue ); break; - case XML_redOff: toCrgb(); lclOffValue( mnC1, aIt->mnValue ); break; - case XML_green: toCrgb(); lclSetValue( mnC2, aIt->mnValue ); break; - case XML_greenMod: toCrgb(); lclModValue( mnC2, aIt->mnValue ); break; - case XML_greenOff: toCrgb(); lclOffValue( mnC2, aIt->mnValue ); break; - case XML_blue: toCrgb(); lclSetValue( mnC3, aIt->mnValue ); break; - case XML_blueMod: toCrgb(); lclModValue( mnC3, aIt->mnValue ); break; - case XML_blueOff: toCrgb(); lclOffValue( mnC3, aIt->mnValue ); break; - - case XML_hue: toHsl(); lclSetValue( mnC1, aIt->mnValue, MAX_DEGREE ); break; - case XML_hueMod: toHsl(); lclModValue( mnC1, aIt->mnValue, MAX_DEGREE ); break; - case XML_hueOff: toHsl(); lclOffValue( mnC1, aIt->mnValue, MAX_DEGREE ); break; - case XML_sat: toHsl(); lclSetValue( mnC2, aIt->mnValue ); break; - case XML_satMod: toHsl(); lclModValue( mnC2, aIt->mnValue ); break; - case XML_satOff: toHsl(); lclOffValue( mnC2, aIt->mnValue ); break; + case XML_red: toCrgb(); lclSetValue( mnC1, transform.mnValue ); break; + case XML_redMod: toCrgb(); lclModValue( mnC1, transform.mnValue ); break; + case XML_redOff: toCrgb(); lclOffValue( mnC1, transform.mnValue ); break; + case XML_green: toCrgb(); lclSetValue( mnC2, transform.mnValue ); break; + case XML_greenMod: toCrgb(); lclModValue( mnC2, transform.mnValue ); break; + case XML_greenOff: toCrgb(); lclOffValue( mnC2, transform.mnValue ); break; + case XML_blue: toCrgb(); lclSetValue( mnC3, transform.mnValue ); break; + case XML_blueMod: toCrgb(); lclModValue( mnC3, transform.mnValue ); break; + case XML_blueOff: toCrgb(); lclOffValue( mnC3, transform.mnValue ); break; + + case XML_hue: toHsl(); lclSetValue( mnC1, transform.mnValue, MAX_DEGREE ); break; + case XML_hueMod: toHsl(); lclModValue( mnC1, transform.mnValue, MAX_DEGREE ); break; + case XML_hueOff: toHsl(); lclOffValue( mnC1, transform.mnValue, MAX_DEGREE ); break; + case XML_sat: toHsl(); lclSetValue( mnC2, transform.mnValue ); break; + case XML_satMod: toHsl(); lclModValue( mnC2, transform.mnValue ); break; + case XML_satOff: toHsl(); lclOffValue( mnC2, transform.mnValue ); break; case XML_lum: toHsl(); - lclSetValue( mnC3, aIt->mnValue ); + lclSetValue( mnC3, transform.mnValue ); // if color changes to black or white, it will stay gray if luminance changes again if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0; break; case XML_lumMod: toHsl(); - lclModValue( mnC3, aIt->mnValue ); + lclModValue( mnC3, transform.mnValue ); // if color changes to black or white, it will stay gray if luminance changes again if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0; break; case XML_lumOff: toHsl(); - lclOffValue( mnC3, aIt->mnValue ); + lclOffValue( mnC3, transform.mnValue ); // if color changes to black or white, it will stay gray if luminance changes again if( (mnC3 == 0) || (mnC3 == MAX_PERCENT) ) mnC2 = 0; break; @@ -504,10 +504,10 @@ void Color::clearTransparence() case XML_shade: // shade: 0% = black, 100% = original color toCrgb(); - OSL_ENSURE( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid shade value" ); - if( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) ) + OSL_ENSURE( (0 <= transform.mnValue) && (transform.mnValue <= MAX_PERCENT), "Color::getColor - invalid shade value" ); + if( (0 <= transform.mnValue) && (transform.mnValue <= MAX_PERCENT) ) { - double fFactor = static_cast< double >( aIt->mnValue ) / MAX_PERCENT; + double fFactor = static_cast< double >( transform.mnValue ) / MAX_PERCENT; mnC1 = static_cast< sal_Int32 >( mnC1 * fFactor ); mnC2 = static_cast< sal_Int32 >( mnC2 * fFactor ); mnC3 = static_cast< sal_Int32 >( mnC3 * fFactor ); @@ -516,10 +516,10 @@ void Color::clearTransparence() case XML_tint: // tint: 0% = white, 100% = original color toCrgb(); - OSL_ENSURE( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" ); - if( (0 <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) ) + OSL_ENSURE( (0 <= transform.mnValue) && (transform.mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" ); + if( (0 <= transform.mnValue) && (transform.mnValue <= MAX_PERCENT) ) { - double fFactor = static_cast< double >( aIt->mnValue ) / MAX_PERCENT; + double fFactor = static_cast< double >( transform.mnValue ) / MAX_PERCENT; mnC1 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC1) * fFactor ); mnC2 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC2) * fFactor ); mnC3 = static_cast< sal_Int32 >( MAX_PERCENT - (MAX_PERCENT - mnC3) * fFactor ); @@ -528,17 +528,17 @@ void Color::clearTransparence() case XLS_TOKEN( tint ): // Excel tint: move luminance relative to current value toHsl(); - OSL_ENSURE( (-MAX_PERCENT <= aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" ); - if( (-MAX_PERCENT <= aIt->mnValue) && (aIt->mnValue < 0) ) + OSL_ENSURE( (-MAX_PERCENT <= transform.mnValue) && (transform.mnValue <= MAX_PERCENT), "Color::getColor - invalid tint value" ); + if( (-MAX_PERCENT <= transform.mnValue) && (transform.mnValue < 0) ) { // negative: luminance towards 0% (black) - lclModValue( mnC3, aIt->mnValue + MAX_PERCENT ); + lclModValue( mnC3, transform.mnValue + MAX_PERCENT ); } - else if( (0 < aIt->mnValue) && (aIt->mnValue <= MAX_PERCENT) ) + else if( (0 < transform.mnValue) && (transform.mnValue <= MAX_PERCENT) ) { // positive: luminance towards 100% (white) mnC3 = MAX_PERCENT - mnC3; - lclModValue( mnC3, MAX_PERCENT - aIt->mnValue ); + lclModValue( mnC3, MAX_PERCENT - transform.mnValue ); mnC3 = MAX_PERCENT - mnC3; } break; diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 53cbf95844ea..7e87ea8d5248 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -189,25 +189,24 @@ void CustomShapeProperties::pushToPropSet( if ( aGeoPropSeq[ i ].Value >>= aAdjustmentSeq ) { int nIndex=0; - for (std::vector< CustomShapeGuide >::const_iterator aIter( maAdjustmentGuideList.begin() ), aEnd(maAdjustmentGuideList.end()); - aIter != aEnd; ++aIter) + for (auto const& adjustmentGuide : maAdjustmentGuideList) { - if ( (*aIter).maName.getLength() > 3 ) + if ( adjustmentGuide.maName.getLength() > 3 ) { - sal_Int32 nAdjustmentIndex = (*aIter).maName.copy( 3 ).toInt32() - 1; + sal_Int32 nAdjustmentIndex = adjustmentGuide.maName.copy( 3 ).toInt32() - 1; if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) ) { EnhancedCustomShapeAdjustmentValue aAdjustmentVal; - aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32(); + aAdjustmentVal.Value <<= adjustmentGuide.maFormula.toInt32(); aAdjustmentVal.State = PropertyState_DIRECT_VALUE; - aAdjustmentVal.Name = (*aIter).maName; + aAdjustmentVal.Name = adjustmentGuide.maName; aAdjustmentSeq[ nAdjustmentIndex ] = aAdjustmentVal; } } else if ( aAdjustmentSeq.getLength() > 0 ) { EnhancedCustomShapeAdjustmentValue aAdjustmentVal; - aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32(); + aAdjustmentVal.Value <<= adjustmentGuide.maFormula.toInt32(); aAdjustmentVal.State = PropertyState_DIRECT_VALUE; - aAdjustmentVal.Name = (*aIter).maName; + aAdjustmentVal.Name = adjustmentGuide.maName; aAdjustmentSeq[ nIndex++ ] = aAdjustmentVal; } } diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index e7696898c81c..e7a2df78bd5e 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -115,20 +115,17 @@ static sal_Int32 calcDepth( const OUString& rNodeName, const dgm::Connections& rCnx ) { // find length of longest path in 'isChild' graph, ending with rNodeName - dgm::Connections::const_iterator aCurrCxn( rCnx.begin() ); - const dgm::Connections::const_iterator aEndCxn( rCnx.end() ); - while( aCurrCxn != aEndCxn ) + for (auto const& elem : rCnx) { - if( !aCurrCxn->msParTransId.isEmpty() && - !aCurrCxn->msSibTransId.isEmpty() && - !aCurrCxn->msSourceId.isEmpty() && - !aCurrCxn->msDestId.isEmpty() && - aCurrCxn->mnType == XML_parOf && - rNodeName == aCurrCxn->msDestId ) + if( !elem.msParTransId.isEmpty() && + !elem.msSibTransId.isEmpty() && + !elem.msSourceId.isEmpty() && + !elem.msDestId.isEmpty() && + elem.mnType == XML_parOf && + rNodeName == elem.msDestId ) { - return calcDepth(aCurrCxn->msSourceId, rCnx) + 1; + return calcDepth(elem.msSourceId, rCnx) + 1; } - ++aCurrCxn; } return 0; @@ -143,27 +140,25 @@ void Diagram::build( ) output << "digraph datatree {" << std::endl; #endif dgm::Points& rPoints = getData()->getPoints(); - dgm::Points::iterator aCurrPoint(rPoints.begin()); - dgm::Points::iterator aEndPoint(rPoints.end()); - while( aCurrPoint != aEndPoint ) + for (auto & point : rPoints) { #ifdef DEBUG_OOX_DIAGRAM output << "\t" - << normalizeDotName(aCurrPoint->msModelId).getStr() + << normalizeDotName(point.msModelId).getStr() << "["; - if( !aCurrPoint->msPresentationLayoutName.isEmpty() ) + if( !point.msPresentationLayoutName.isEmpty() ) output << "label=\"" << OUStringToOString( - aCurrPoint->msPresentationLayoutName, + point.msPresentationLayoutName, RTL_TEXTENCODING_UTF8).getStr() << "\", "; else output << "label=\"" << OUStringToOString( - aCurrPoint->msModelId, + point.msModelId, RTL_TEXTENCODING_UTF8).getStr() << "\", "; - switch( aCurrPoint->mnType ) + switch( point.mnType ) { case XML_doc: output << "style=filled, color=red"; break; case XML_asst: output << "style=filled, color=green"; break; @@ -178,10 +173,10 @@ void Diagram::build( ) #endif // does currpoint have any text set? - if( aCurrPoint->mpShape && - aCurrPoint->mpShape->getTextBody() && - !aCurrPoint->mpShape->getTextBody()->getParagraphs().empty() && - !aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() ) + if( point.mpShape && + point.mpShape->getTextBody() && + !point.mpShape->getTextBody()->getParagraphs().empty() && + !point.mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() ) { #ifdef DEBUG_OOX_DIAGRAM static sal_Int32 nCount=0; @@ -190,11 +185,11 @@ void Diagram::build( ) << " [" << "label=\"" << OUStringToOString( - aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText(), + point.mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText(), RTL_TEXTENCODING_UTF8).getStr() << "\"" << "];" << std::endl; output << "\t" - << normalizeDotName(aCurrPoint->msModelId).getStr() + << normalizeDotName(point.msModelId).getStr() << " -> " << "textNode" << nCount++ << ";" << std::endl; @@ -202,107 +197,95 @@ void Diagram::build( ) } const bool bInserted1=getData()->getPointNameMap().insert( - std::make_pair(aCurrPoint->msModelId,&(*aCurrPoint))).second; + std::make_pair(point.msModelId,&point)).second; SAL_WARN_IF(!bInserted1, "oox.drawingml", "Diagram::build(): non-unique point model id"); - if( !aCurrPoint->msPresentationLayoutName.isEmpty() ) + if( !point.msPresentationLayoutName.isEmpty() ) { DiagramData::PointsNameMap::value_type::second_type& rVec= - getData()->getPointsPresNameMap()[aCurrPoint->msPresentationLayoutName]; - rVec.push_back(&(*aCurrPoint)); + getData()->getPointsPresNameMap()[point.msPresentationLayoutName]; + rVec.push_back(&point); } - ++aCurrPoint; } const dgm::Connections& rConnections = getData()->getConnections(); - dgm::Connections::const_iterator aCurrCxn(rConnections.begin()); - const dgm::Connections::const_iterator aEndCxn(rConnections.end()); - while( aCurrCxn != aEndCxn ) + for (auto const& connection : rConnections) { #ifdef DEBUG_OOX_DIAGRAM - if( !aCurrCxn->msParTransId.isEmpty() || - !aCurrCxn->msSibTransId.isEmpty() ) + if( !connection.msParTransId.isEmpty() || + !connection.msSibTransId.isEmpty() ) { - if( !aCurrCxn->msSourceId.isEmpty() || - !aCurrCxn->msDestId.isEmpty() ) + if( !connection.msSourceId.isEmpty() || + !connection.msDestId.isEmpty() ) { output << "\t" - << normalizeDotName(aCurrCxn->msSourceId).getStr() + << normalizeDotName(connection.msSourceId).getStr() << " -> " - << normalizeDotName(aCurrCxn->msParTransId).getStr() + << normalizeDotName(connection.msParTransId).getStr() << " -> " - << normalizeDotName(aCurrCxn->msSibTransId).getStr() + << normalizeDotName(connection.msSibTransId).getStr() << " -> " - << normalizeDotName(aCurrCxn->msDestId).getStr() + << normalizeDotName(connection.msDestId).getStr() << " [style=dotted," - << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " ")) + << ((connection.mnType == XML_presOf) ? " color=red, " : ((connection.mnType == XML_presParOf) ? " color=green, " : " ")) << "label=\"" - << OUStringToOString(aCurrCxn->msModelId, + << OUStringToOString(connection.msModelId, RTL_TEXTENCODING_UTF8 ).getStr() << "\"];" << std::endl; } else { output << "\t" - << normalizeDotName(aCurrCxn->msParTransId).getStr() + << normalizeDotName(connection.msParTransId).getStr() << " -> " - << normalizeDotName(aCurrCxn->msSibTransId).getStr() + << normalizeDotName(connection.msSibTransId).getStr() << " [" - << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " ")) + << ((connection.mnType == XML_presOf) ? " color=red, " : ((connection.mnType == XML_presParOf) ? " color=green, " : " ")) << "label=\"" - << OUStringToOString(aCurrCxn->msModelId, + << OUStringToOString(connection.msModelId, RTL_TEXTENCODING_UTF8 ).getStr() << "\"];" << std::endl; } } - else if( !aCurrCxn->msSourceId.isEmpty() || - !aCurrCxn->msDestId.isEmpty() ) + else if( !connection.msSourceId.isEmpty() || + !connection.msDestId.isEmpty() ) output << "\t" - << normalizeDotName(aCurrCxn->msSourceId).getStr() + << normalizeDotName(connection.msSourceId).getStr() << " -> " - << normalizeDotName(aCurrCxn->msDestId).getStr() + << normalizeDotName(connection.msDestId).getStr() << " [label=\"" - << OUStringToOString(aCurrCxn->msModelId, + << OUStringToOString(connection.msModelId, RTL_TEXTENCODING_UTF8 ).getStr() - << ((aCurrCxn->mnType == XML_presOf) ? "\", color=red]" : ((aCurrCxn->mnType == XML_presParOf) ? "\", color=green]" : "\"]")) + << ((connection.mnType == XML_presOf) ? "\", color=red]" : ((connection.mnType == XML_presParOf) ? "\", color=green]" : "\"]")) << ";" << std::endl; #endif const bool bInserted1=getData()->getConnectionNameMap().insert( - std::make_pair(aCurrCxn->msModelId,&(*aCurrCxn))).second; + std::make_pair(connection.msModelId,&connection)).second; SAL_WARN_IF(!bInserted1, "oox.drawingml", "Diagram::build(): non-unique connection model id"); - if( aCurrCxn->mnType == XML_presOf ) + if( connection.mnType == XML_presOf ) { - DiagramData::StringMap::value_type::second_type& rVec=getData()->getPresOfNameMap()[aCurrCxn->msDestId]; + DiagramData::StringMap::value_type::second_type& rVec=getData()->getPresOfNameMap()[connection.msDestId]; rVec.emplace_back( - aCurrCxn->msSourceId,sal_Int32(0)); + connection.msSourceId,sal_Int32(0)); } - - ++aCurrCxn; } // assign outline levels DiagramData::StringMap& rStringMap = getData()->getPresOfNameMap(); - DiagramData::StringMap::iterator aPresOfIter=rStringMap.begin(); - const DiagramData::StringMap::iterator aPresOfEnd=rStringMap.end(); - while( aPresOfIter != aPresOfEnd ) + for (auto & elemPresOf : rStringMap) { - DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeIterCalcLevel=aPresOfIter->second.begin(); - const DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeEnd=aPresOfIter->second.end(); - while(aPresOfNodeIterCalcLevel != aPresOfNodeEnd) + for (auto & elem : elemPresOf.second) { - const sal_Int32 nDepth=calcDepth(aPresOfNodeIterCalcLevel->first, + const sal_Int32 nDepth=calcDepth(elem.first, getData()->getConnections()); - aPresOfNodeIterCalcLevel->second = nDepth != 0 ? nDepth : -1; + elem.second = nDepth != 0 ? nDepth : -1; if (nDepth > getData()->getMaxDepth()) getData()->setMaxDepth(nDepth); - ++aPresOfNodeIterCalcLevel; } - - ++aPresOfIter; } #ifdef DEBUG_OOX_DIAGRAM output << "}" << std::endl; @@ -343,12 +326,10 @@ uno::Sequence<beans::PropertyValue> Diagram::getDomsAsPropertyValues() const uno::Sequence<beans::PropertyValue> aValue(length); beans::PropertyValue* pValue = aValue.getArray(); - for (DiagramDomMap::const_iterator i = maMainDomMap.begin(); - i != maMainDomMap.end(); - ++i) + for (auto const& mainDom : maMainDomMap) { - pValue->Name = i->first; - pValue->Value <<= i->second; + pValue->Name = mainDom.first; + pValue->Value <<= mainDom.second; ++pValue; } @@ -425,9 +406,8 @@ void loadDiagram( ShapePtr const & pShape, xRefDataModel->getFragmentPath(), "image" ); // Pass the info to pShape - for( ::std::vector<OUString>::const_iterator aIt = pData->getExtDrawings().begin(), aEnd = pData->getExtDrawings().end(); - aIt != aEnd; ++aIt ) - pShape->addExtDrawingRelId( *aIt ); + for (auto const& extDrawing : pData->getExtDrawings()) + pShape->addExtDrawingRelId(extDrawing); } // extLst is present, lets bet on that and ignore the rest of the data from here diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx index 602f6911a5e4..49f1d915a11c 100644 --- a/oox/source/drawingml/effectproperties.cxx +++ b/oox/source/drawingml/effectproperties.cxx @@ -80,10 +80,10 @@ css::beans::PropertyValue Effect::getEffect() css::uno::Sequence< css::beans::PropertyValue > aSeq( maAttribs.size() ); sal_uInt32 i = 0; - for( std::map< OUString, css::uno::Any >::iterator it = maAttribs.begin(); it != maAttribs.end(); ++it ) + for (auto const& attrib : maAttribs) { - aSeq[i].Name = it->first; - aSeq[i].Value = it->second; + aSeq[i].Name = attrib.first; + aSeq[i].Value = attrib.second; i++; } diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 9351b473068f..944a4dbee05d 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -429,13 +429,12 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, SAL_INFO("oox.drawingml.gradient", "symmetric: " << (bSymmetric ? "YES" : "NO") << ", number of stops: " << aGradientStops.size()); - for (GradientFillProperties::GradientStopMap::iterator p(aGradientStops.begin()); - p != aGradientStops.end(); - ++p) - SAL_INFO("oox.drawingml.gradient", " " << std::distance(aGradientStops.begin(), p) << ": " << - p->first << ": " << - std::hex << sal_Int32(p->second.getColor( rGraphicHelper, nPhClr )) << std::dec << - "@" << (100-p->second.getTransparency()) << "%"); + size_t nIndex = 0; + for (auto const& gradientStop : aGradientStops) + SAL_INFO("oox.drawingml.gradient", " " << nIndex++ << ": " << + gradientStop.first << ": " << + std::hex << sal_Int32(gradientStop.second.getColor( rGraphicHelper, nPhClr )) << std::dec << + "@" << (100 - gradientStop.second.getTransparency()) << "%"); // Now estimate the simple LO style gradient (only two stops, at n% and 100%, where n == // the "border") that best emulates the gradient between begin() and prior(end()). diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b3c48b0b67c7..5593e9656e9b 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -429,16 +429,14 @@ Reference< XShape > const & Shape::createAndInsert( if ( mpTablePropertiesPtr.get() && rServiceName == "com.sun.star.drawing.TableShape" ) { maSize.Width = 0; - for( std::vector< sal_Int32 >::const_iterator aTableColIter(mpTablePropertiesPtr->getTableGrid().begin()); - aTableColIter != mpTablePropertiesPtr->getTableGrid().end(); ++aTableColIter ) + for (auto const& elem : mpTablePropertiesPtr->getTableGrid()) { - maSize.Width += *aTableColIter; + maSize.Width += elem; } maSize.Height = 0; - for( std::vector< ::oox::drawingml::table::TableRow >::const_iterator aTableRowIter(mpTablePropertiesPtr->getTableRows().begin()); - aTableRowIter != mpTablePropertiesPtr->getTableRows().end(); ++aTableRowIter ) + for (auto const& elem : mpTablePropertiesPtr->getTableRows()) { - maSize.Height += (*aTableRowIter).getHeight(); + maSize.Height += elem.getHeight(); } } @@ -1568,11 +1566,11 @@ uno::Sequence< uno::Sequence< uno::Any > > Shape::resolveRelationshipsOfTypeFro if ( xImageRels ) { xRelListTemp.realloc( xImageRels->size() ); - for( ::std::map< OUString, core::Relation >::const_iterator aIt = xImageRels->begin(), aEnd = xImageRels->end(); aIt != aEnd; ++aIt ) + for (auto const& imageRel : *xImageRels) { uno::Sequence< uno::Any > diagramRelTuple (3); // [0] => RID, [1] => InputStream [2] => extension - OUString sRelId = aIt->second.maId; + OUString sRelId = imageRel.second.maId; diagramRelTuple[0] <<= sRelId; OUString sTarget = xImageRels->getFragmentPathFromRelId( sRelId ); diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index 527b65829d17..2c92390772e8 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -249,15 +249,13 @@ const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilt const std::vector< TableStyle >& rTableStyles( rBase.getTableStyles()->getTableStyles() ); const OUString aStyleId( getStyleId() ); - std::vector< TableStyle >::const_iterator aIter( rTableStyles.begin() ); - while( aIter != rTableStyles.end() ) + for (auto const& tableStyle : rTableStyles) { - if ( const_cast< TableStyle& >( *aIter ).getStyleId() == aStyleId ) + if ( const_cast< TableStyle& >(tableStyle).getStyleId() == aStyleId ) { - pTableStyle = &const_cast< TableStyle& >( *aIter ); + pTableStyle = &const_cast< TableStyle& >(tableStyle); break; // we get the correct style } - ++aIter; } //if the pptx just has table style id, but no table style content, we will create the table style ourselves if (!pTableStyle) @@ -285,16 +283,12 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa TableStyle* pTableStyleToDelete = nullptr; const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, pTableStyleToDelete ) ); sal_Int32 nRow = 0; - const std::vector< TableRow >::const_iterator aTableRowEnd( mvTableRows.end() ); - for (std::vector< TableRow >::iterator aTableRowIter( mvTableRows.begin() ); - aTableRowIter != aTableRowEnd ; ++aTableRowIter, ++nRow) + for (auto & tableRow : mvTableRows) { sal_Int32 nColumn = 0; - const std::vector< TableCell >::const_iterator aTableCellEnd( aTableRowIter->getTableCells().end() ); - for (std::vector< TableCell >::iterator aTableCellIter( aTableRowIter->getTableCells().begin() ); - aTableCellIter != aTableCellEnd ; ++aTableCellIter, ++nColumn) + for (auto & tableCell : tableRow.getTableCells()) { - TableCell& rTableCell( *aTableCellIter ); + TableCell& rTableCell(tableCell); if ( !rTableCell.getvMerge() && !rTableCell.gethMerge() ) { uno::Reference< XTable > xTable( xColumnRowRange, uno::UNO_QUERY_THROW ); @@ -303,9 +297,11 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa Reference< XCellRange > xCellRange( xTable, UNO_QUERY_THROW ); rTableCell.pushToXCell( rFilterBase, pMasterTextListStyle, xCellRange->getCellByPosition( nColumn, nRow ), *this, rTableStyle, - nColumn, aTableRowIter->getTableCells().size()-1, nRow, mvTableRows.size()-1 ); + nColumn, tableRow.getTableCells().size()-1, nRow, mvTableRows.size()-1 ); } + ++nColumn; } + ++nRow; } delete pTableStyleToDelete; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits