diff options
Diffstat (limited to 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 56 | ||||
-rw-r--r-- | chart2/source/tools/ChartModelHelper.cxx | 8 | ||||
-rw-r--r-- | chart2/source/tools/ConfigColorScheme.cxx | 6 | ||||
-rw-r--r-- | chart2/source/tools/DataSeriesHelper.cxx | 44 | ||||
-rw-r--r-- | chart2/source/tools/DataSourceHelper.cxx | 16 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 120 | ||||
-rw-r--r-- | chart2/source/tools/ErrorBar.cxx | 6 | ||||
-rw-r--r-- | chart2/source/tools/MediaDescriptorHelper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 11 | ||||
-rw-r--r-- | chart2/source/tools/RangeHighlighter.cxx | 8 | ||||
-rw-r--r-- | chart2/source/tools/ReferenceSizeProvider.cxx | 30 | ||||
-rw-r--r-- | chart2/source/tools/RegressionCurveHelper.cxx | 60 | ||||
-rw-r--r-- | chart2/source/tools/TitleHelper.cxx | 6 | ||||
-rw-r--r-- | chart2/source/tools/WrappedPropertySet.cxx | 10 |
14 files changed, 180 insertions, 205 deletions
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 2f9a14c0442f..1d6e57d1913c 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -243,16 +243,15 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( OUString aRoleToMatch; if( nDimensionIndex == 0 ) aRoleToMatch = "values-x"; - Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes()); - for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) + const Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes()); + for( Reference< XChartType > const & chartType : aChartTypes ) { if( nDimensionIndex != 0 ) - aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] ); - Reference< XDataSeriesContainer > xDSCnt( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries()); - for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aDataSeriesSeq.getLength(); ++nSeriesIdx ) + aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( chartType ); + Reference< XDataSeriesContainer > xDSCnt( chartType, uno::UNO_QUERY_THROW ); + const Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries()); + for( Reference< chart2::XDataSeries > const & xDataSeries : aDataSeriesSeq ) { - Reference< chart2::XDataSeries > xDataSeries(aDataSeriesSeq[nSeriesIdx]); Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW ); if( nDimensionIndex == 1 ) @@ -457,9 +456,9 @@ void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bo AxisHelper::makeGridVisible( xAxis->getGridProperties() ); else { - Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); - for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++) - AxisHelper::makeGridVisible( aSubGrids[nN] ); + const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); + for( auto const & i : aSubGrids ) + AxisHelper::makeGridVisible( i ); } } @@ -534,9 +533,9 @@ void AxisHelper::hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bo AxisHelper::makeGridInvisible( xAxis->getGridProperties() ); else { - Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); - for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++) - AxisHelper::makeGridInvisible( aSubGrids[nN] ); + const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); + for( auto const & i : aSubGrids) + AxisHelper::makeGridInvisible( i ); } } @@ -850,11 +849,10 @@ Sequence< Reference< XAxis > > AxisHelper::getAllAxesOfDiagram( Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); if(xCooSysContainer.is()) { - Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems(); - sal_Int32 nC = 0; - for( nC=0; nC<aCooSysList.getLength(); ++nC ) + const Sequence< Reference< XCoordinateSystem > > aCooSysList = xCooSysContainer->getCoordinateSystems(); + for( Reference< XCoordinateSystem > const & coords : aCooSysList ) { - std::vector< Reference< XAxis > > aAxesPerCooSys( AxisHelper::getAllAxesOfCoordinateSystem( aCooSysList[nC], bOnlyVisible ) ); + std::vector< Reference< XAxis > > aAxesPerCooSys( AxisHelper::getAllAxesOfCoordinateSystem( coords, bOnlyVisible ) ); aAxisVector.insert( aAxisVector.end(), aAxesPerCooSys.begin(), aAxesPerCooSys.end() ); } } @@ -864,24 +862,20 @@ Sequence< Reference< XAxis > > AxisHelper::getAllAxesOfDiagram( Sequence< Reference< beans::XPropertySet > > AxisHelper::getAllGrids( const Reference< XDiagram >& xDiagram ) { - Sequence< Reference< XAxis > > aAllAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); + const Sequence< Reference< XAxis > > aAllAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); std::vector< Reference< beans::XPropertySet > > aGridVector; - sal_Int32 nA = 0; - for( nA=0; nA<aAllAxes.getLength(); ++nA ) + for( Reference< XAxis > const & xAxis : aAllAxes ) { - Reference< XAxis > xAxis( aAllAxes[nA] ); if(!xAxis.is()) continue; Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() ); if( xGridProperties.is() ) aGridVector.push_back( xGridProperties ); - Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); - sal_Int32 nSubGrid = 0; - for( nSubGrid = 0; nSubGrid < aSubGrids.getLength(); ++nSubGrid ) + const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); + for( Reference< beans::XPropertySet > const & xSubGrid : aSubGrids ) { - Reference< beans::XPropertySet > xSubGrid( aSubGrids[nSubGrid] ); if( xSubGrid.is() ) aGridVector.push_back( xSubGrid ); } @@ -914,10 +908,10 @@ bool AxisHelper::isSecondaryYAxisNeeded( const Reference< XCoordinateSystem >& x Reference< chart2::XChartTypeContainer > xCTCnt( xCooSys, uno::UNO_QUERY ); if( xCTCnt.is() ) { - Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes() ); - for( sal_Int32 i=0; i<aChartTypes.getLength(); ++i ) + const Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes() ); + for( Reference< chart2::XChartType > const & chartType : aChartTypes ) { - Reference< XDataSeriesContainer > xSeriesContainer( aChartTypes[i] , uno::UNO_QUERY ); + Reference< XDataSeriesContainer > xSeriesContainer( chartType, uno::UNO_QUERY ); if( !xSeriesContainer.is() ) continue; @@ -1037,11 +1031,9 @@ Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis( Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); if( xCooSysContainer.is() ) { - Reference< XCoordinateSystem > xCooSys; - Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); - for( sal_Int32 nCooSysIndex = 0; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex ) + const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + for( Reference< XCoordinateSystem > const & xCooSys : aCooSysList ) { - xCooSys = aCooSysList[nCooSysIndex]; std::vector< Reference< XAxis > > aAllAxis( AxisHelper::getAllAxesOfCoordinateSystem( xCooSys ) ); std::vector< Reference< XAxis > >::iterator aFound = diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index c6a294fe8a15..2d684b059355 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -254,13 +254,13 @@ bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, ChartMod if( xUsedData.is() ) { uno::Reference< beans::XPropertySet > xProp; - uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences()); - for( sal_Int32 i=0; i<aData.getLength(); ++i ) + const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences()); + for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledData : aData ) { - xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getValues(), uno::UNO_QUERY ) ); + xProp.set( uno::Reference< beans::XPropertySet >( labeledData->getValues(), uno::UNO_QUERY ) ); if(xProp.is()) xProp->setPropertyValue("IncludeHiddenCells", aNewValue ); - xProp.set( uno::Reference< beans::XPropertySet >( aData[i]->getLabel(), uno::UNO_QUERY ) ); + xProp.set( uno::Reference< beans::XPropertySet >( labeledData->getLabel(), uno::UNO_QUERY ) ); if(xProp.is()) xProp->setPropertyValue("IncludeHiddenCells", aNewValue ); } diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx index 1618733aa15c..e3bdb20fac04 100644 --- a/chart2/source/tools/ConfigColorScheme.cxx +++ b/chart2/source/tools/ConfigColorScheme.cxx @@ -73,10 +73,10 @@ ChartConfigItem::ChartConfigItem( ConfigColorScheme & rListener ) : void ChartConfigItem::Notify( const Sequence< OUString > & aPropertyNames ) { - for( sal_Int32 nIdx=0; nIdx<aPropertyNames.getLength(); ++nIdx ) + for( OUString const & s : aPropertyNames ) { - if( m_aPropertiesToNotify.find( aPropertyNames[nIdx] ) != m_aPropertiesToNotify.end()) - m_rListener.notify( aPropertyNames[nIdx] ); + if( m_aPropertiesToNotify.find( s ) != m_aPropertiesToNotify.end()) + m_rListener.notify( s ); } } diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index a772f11c5fb1..c90a356bf2ee 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -87,17 +87,17 @@ Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel( const Reference< chart2::data::XDataSource > & xDataSource ) { Reference< chart2::data::XLabeledDataSequence > xResult; - Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); + const Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); - for( sal_Int32 i=0; i<aSequences.getLength(); ++i ) + for( auto const & labeledData : aSequences ) { - OSL_ENSURE( aSequences[i].is(), "empty LabeledDataSequence" ); + OSL_ENSURE( labeledData.is(), "empty LabeledDataSequence" ); // no values are set but a label exists - if( aSequences[i].is() && - ( ! aSequences[i]->getValues().is() && - aSequences[i]->getLabel().is())) + if( labeledData.is() && + ( ! labeledData->getValues().is() && + labeledData->getLabel().is())) { - xResult.set( aSequences[i] ); + xResult.set( labeledData ); break; } } @@ -115,23 +115,23 @@ void lcl_getCooSysAndChartTypeOfSeries( if( !xCooSysCnt.is()) return; - Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) + const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); + for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq ) { - Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); - for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) + Reference< chart2::XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW ); + const Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); + for( Reference< chart2::XChartType > const & chartType : aChartTypes ) { - Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY ); + Reference< chart2::XDataSeriesContainer > xSeriesCnt( chartType, uno::UNO_QUERY ); if( xSeriesCnt.is()) { - Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries()); - for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx ) + const Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries()); + for( Reference< chart2::XDataSeries > const & dataSeries : aSeries ) { - if( aSeries[nSeriesIdx] == xSeries ) + if( dataSeries == xSeries ) { - xOutCooSys.set( aCooSysSeq[nCooSysIdx] ); - xOutChartType.set( aChartTypes[nCTIdx] ); + xOutCooSys.set( coords ); + xOutChartType.set( chartType ); } } } @@ -238,9 +238,9 @@ getAllDataSequences( const uno::Sequence<uno::Reference<chart2::XDataSeries> >& { std::vector< Reference< chart2::data::XLabeledDataSequence > > aSeqVec; - for( sal_Int32 i = 0; i < aSeries.getLength(); ++i ) + for( uno::Reference<chart2::XDataSeries> const & dataSeries : aSeries ) { - Reference< chart2::data::XDataSource > xSource( aSeries[ i ], uno::UNO_QUERY ); + Reference< chart2::data::XDataSource > xSource( dataSeries, uno::UNO_QUERY ); if( xSource.is()) { Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( xSource->getDataSequences()); @@ -392,11 +392,11 @@ void setStackModeAtSeries( : chart2::StackingDirection_NO_STACKING ); std::set< sal_Int32 > aAxisIndexSet; - for( sal_Int32 i=0; i<aSeries.getLength(); ++i ) + for( Reference< chart2::XDataSeries > const & dataSeries : aSeries ) { try { - Reference< beans::XPropertySet > xProp( aSeries[i], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( dataSeries, uno::UNO_QUERY ); if( xProp.is() ) { xProp->setPropertyValue( "StackingDirection", aPropValue ); diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index 3b6f08ef5420..50fd37347f09 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -239,7 +239,7 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoR std::vector< Reference< chart2::XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); uno::Reference< chart2::data::XDataSource > xSeriesSource( DataSeriesHelper::getDataSource( comphelper::containerToSequence(aSeriesVector) ) ); - Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSequences( xSeriesSource->getDataSequences() ); + const Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSequences( xSeriesSource->getDataSequences() ); //the first x-values is always the next sequence //todo ... other x-values get lost for old format Reference< chart2::data::XLabeledDataSequence > xXValues( @@ -248,11 +248,11 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoR aResultVector.push_back( xXValues ); //add all other sequences now without x-values - for( sal_Int32 nN=0; nN<aDataSequences.getLength(); nN++ ) + for( Reference< chart2::data::XLabeledDataSequence > const & labeledData : aDataSequences ) { - OUString aRole = DataSeriesHelper::getRole(aDataSequences[nN]); + OUString aRole = DataSeriesHelper::getRole(labeledData); if( aRole != "values-x" ) - aResultVector.push_back( aDataSequences[nN] ); + aResultVector.push_back( labeledData ); } return new DataSource( comphelper::containerToSequence(aResultVector) ); @@ -512,11 +512,11 @@ Sequence< OUString > DataSourceHelper::getRangesFromDataSource( const Reference< std::vector< OUString > aResult; if( xSource.is()) { - Sequence< Reference< data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences()); - for( sal_Int32 i=0; i<aLSeqSeq.getLength(); ++i ) + const Sequence< Reference< data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences()); + for( Reference< data::XLabeledDataSequence > const & labeledData : aLSeqSeq ) { - Reference< data::XDataSequence > xLabel( aLSeqSeq[i]->getLabel()); - Reference< data::XDataSequence > xValues( aLSeqSeq[i]->getValues()); + Reference< data::XDataSequence > xLabel( labeledData->getLabel()); + Reference< data::XDataSequence > xValues( labeledData->getValues()); if( xLabel.is()) aResult.push_back( xLabel->getSourceRangeRepresentation()); diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index ab93f06a8096..213d1787d1ce 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -117,12 +117,11 @@ void DiagramHelper::setVertical( if (!xCnt.is()) return; - Sequence< Reference<XCoordinateSystem> > aCooSys = xCnt->getCoordinateSystems(); + const Sequence< Reference<XCoordinateSystem> > aCooSys = xCnt->getCoordinateSystems(); uno::Any aValue; aValue <<= bVertical; - for( sal_Int32 i=0; i<aCooSys.getLength(); ++i ) + for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSys ) { - uno::Reference< XCoordinateSystem > xCooSys( aCooSys[i] ); Reference< beans::XPropertySet > xProp( xCooSys, uno::UNO_QUERY ); bool bChanged = false; if (xProp.is()) @@ -196,11 +195,11 @@ bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDia if (!xCnt.is()) return false; - Sequence< Reference<XCoordinateSystem> > aCooSys = xCnt->getCoordinateSystems(); + const Sequence< Reference<XCoordinateSystem> > aCooSys = xCnt->getCoordinateSystems(); - for (sal_Int32 i = 0; i < aCooSys.getLength(); ++i) + for (Reference<XCoordinateSystem> const & coords : aCooSys) { - Reference<beans::XPropertySet> xProp(aCooSys[i], uno::UNO_QUERY); + Reference<beans::XPropertySet> xProp(coords, uno::UNO_QUERY); if (!xProp.is()) continue; @@ -252,10 +251,9 @@ void DiagramHelper::setStackMode( uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); if( !xCooSysContainer.is() ) return; - uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); - for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS ) + const uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSysList ) { - uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] ); //set correct percent stacking const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(1); for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI) @@ -290,10 +288,10 @@ void DiagramHelper::setStackMode( if( !xDataSeriesContainer.is() ) continue; - uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); - for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS ) + const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); + for( uno::Reference< XDataSeries > const & dataSeries : aSeriesList ) { - Reference< beans::XPropertySet > xProp( aSeriesList[nS], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( dataSeries, uno::UNO_QUERY ); if(xProp.is()) xProp->setPropertyValue( "StackingDirection", aNewDirection ); } @@ -316,11 +314,9 @@ StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, b uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); if( !xCooSysContainer.is() ) return eGlobalStackMode; - uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); - for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS ) + const uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSysList ) { - uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] ); - //iterate through all chart types in the current coordinate system uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY ); if( !xChartTypeContainer.is() ) @@ -438,12 +434,11 @@ sal_Int32 DiagramHelper::getDimension( const Reference< XDiagram > & xDiagram ) Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY ); if( xCooSysCnt.is() ) { - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( + const Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i ) + for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq ) { - Reference< XCoordinateSystem > xCooSys( aCooSysSeq[i] ); if(xCooSys.is()) { nResult = xCooSys->getDimension(); @@ -627,31 +622,27 @@ uno::Reference< XChartType > DiagramHelper::getChartTypeOfSeries( if( !xCooSysContainer.is()) return nullptr; - uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); - for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS ) + const uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + for( uno::Reference< XCoordinateSystem > const & xCooSys : aCooSysList ) { - uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] ); - //iterate through all chart types in the current coordinate system uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY ); OSL_ASSERT( xChartTypeContainer.is()); if( !xChartTypeContainer.is() ) continue; - uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); - for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT ) + const uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); + for( uno::Reference< XChartType > const & xChartType : aChartTypeList ) { - uno::Reference< XChartType > xChartType( aChartTypeList[nT] ); - //iterate through all series in this chart type uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY ); OSL_ASSERT( xDataSeriesContainer.is()); if( !xDataSeriesContainer.is() ) continue; - uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); - for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS ) + const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); + for( uno::Reference< XDataSeries > const & dataSeries : aSeriesList ) { - if( xGivenDataSeries==aSeriesList[nS] ) + if( xGivenDataSeries==dataSeries ) return xChartType; } } @@ -669,15 +660,15 @@ std::vector< Reference< XDataSeries > > { Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( + const Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i ) + for( Reference< XCoordinateSystem > const & coords : aCooSysSeq ) { - Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW ); - Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); - for( sal_Int32 j=0; j<aChartTypeSeq.getLength(); ++j ) + Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW ); + const Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); + for( Reference< XChartType> const & chartType : aChartTypeSeq ) { - Reference< XDataSeriesContainer > xDSCnt( aChartTypeSeq[j], uno::UNO_QUERY_THROW ); + Reference< XDataSeriesContainer > xDSCnt( chartType, uno::UNO_QUERY_THROW ); Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() ); std::copy( aSeriesSeq.begin(), aSeriesSeq.end(), std::back_inserter( aResult )); @@ -701,17 +692,17 @@ Sequence< Sequence< Reference< XDataSeries > > > Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY ); if( xCooSysContainer.is() ) { - Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); - for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS ) + const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + for( Reference< XCoordinateSystem > const & coords : aCooSysList ) { //iterate through all chart types in the current coordinate system - Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], uno::UNO_QUERY ); + Reference< XChartTypeContainer > xChartTypeContainer( coords, uno::UNO_QUERY ); if( !xChartTypeContainer.is() ) continue; - Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); - for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT ) + const Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); + for( Reference< XChartType > const & chartType : aChartTypeList ) { - Reference< XDataSeriesContainer > xDataSeriesContainer( aChartTypeList[nT], uno::UNO_QUERY ); + Reference< XDataSeriesContainer > xDataSeriesContainer( chartType, uno::UNO_QUERY ); if( !xDataSeriesContainer.is() ) continue; aResult.push_back( xDataSeriesContainer->getDataSeries() ); @@ -731,11 +722,11 @@ Reference< XChartType > if( ! xCooSysContainer.is()) return xChartType; - Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); sal_Int32 nTypesSoFar = 0; - for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS ) + for( Reference< XCoordinateSystem > const & coords : aCooSysList ) { - Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], uno::UNO_QUERY ); + Reference< XChartTypeContainer > xChartTypeContainer( coords, uno::UNO_QUERY ); if( !xChartTypeContainer.is() ) continue; Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); @@ -764,11 +755,10 @@ std::vector< Reference< XAxis > > lcl_getAxisHoldingCategoriesFromDiagram( { Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( + const Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i ) + for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq ) { - Reference< XCoordinateSystem > xCooSys( aCooSysSeq[i] ); OSL_ASSERT( xCooSys.is()); for( sal_Int32 nN = xCooSys->getDimension(); nN--; ) { @@ -811,11 +801,10 @@ bool DiagramHelper::isCategoryDiagram( { Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( + const Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i ) + for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq ) { - Reference< XCoordinateSystem > xCooSys( aCooSysSeq[i] ); OSL_ASSERT( xCooSys.is()); for( sal_Int32 nN = xCooSys->getDimension(); nN--; ) { @@ -924,10 +913,10 @@ static void lcl_generateAutomaticCategoriesFromChartType( if( !xSeriesCnt.is() ) return; - Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() ); - for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ ) + const Sequence< Reference< XDataSeries > > aSeriesSeq( xSeriesCnt->getDataSeries() ); + for( Reference< XDataSeries > const & dataSeries : aSeriesSeq ) { - Reference< data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY ); + Reference< data::XDataSource > xDataSource( dataSeries, uno::UNO_QUERY ); if( !xDataSource.is() ) continue; Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( @@ -950,10 +939,10 @@ Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const Reference< XChartTypeContainer > xTypeCntr( xCooSys, uno::UNO_QUERY ); if( xTypeCntr.is() ) { - Sequence< Reference< XChartType > > aChartTypes( xTypeCntr->getChartTypes() ); - for( sal_Int32 nN=0; nN<aChartTypes.getLength(); nN++ ) + const Sequence< Reference< XChartType > > aChartTypes( xTypeCntr->getChartTypes() ); + for( Reference< XChartType > const & chartType : aChartTypes ) { - lcl_generateAutomaticCategoriesFromChartType( aRet, aChartTypes[nN] ); + lcl_generateAutomaticCategoriesFromChartType( aRet, chartType ); if( aRet.hasElements() ) return aRet; } @@ -1207,11 +1196,11 @@ Sequence< Reference< XChartType > > { Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( + const Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i ) + for( Reference< XCoordinateSystem > const & coords : aCooSysSeq ) { - Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW ); + Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW ); Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); std::copy( aChartTypeSeq.begin(), aChartTypeSeq.end(), std::back_inserter( aResult )); @@ -1449,11 +1438,10 @@ bool DiagramHelper::isSupportingFloorAndWall( const Reference< //todo: allow this in future again, if fileversion is available for OLE objects (metastream) //thus the wrong bottom can be removed on import - Sequence< Reference< chart2::XChartType > > aTypes( + const Sequence< Reference< chart2::XChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) + for( Reference< chart2::XChartType > const & xType : aTypes ) { - Reference< chart2::XChartType > xType( aTypes[nN] ); if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) return false; if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) @@ -1542,15 +1530,15 @@ sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( const Reference< chart2::XChartType >& xChartType ) { sal_Int32 nResult = css::chart::MissingValueTreatment::LEAVE_GAP; - uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments( + const uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments( ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) ); uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY ); if( xDiaProp.is() && (xDiaProp->getPropertyValue( "MissingValueTreatment" ) >>= nResult) ) { //ensure that the set value is supported by this charttype - for( sal_Int32 nN = 0; nN < aAvailableMissingValueTreatments.getLength(); nN++ ) - if( aAvailableMissingValueTreatments[nN] == nResult ) + for( sal_Int32 n : aAvailableMissingValueTreatments ) + if( n == nResult ) return nResult; //ok } diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx index 90c686f9f672..5191e4f3d64c 100644 --- a/chart2/source/tools/ErrorBar.cxx +++ b/chart2/source/tools/ErrorBar.cxx @@ -191,13 +191,13 @@ OUString getSourceRangeStrFromLabeledSequences( const uno::Sequence< uno::Refere else aDirection = "negative"; - for( sal_Int32 nI=0; nI< aSequences.getLength(); ++nI ) + for( uno::Reference< chart2::data::XLabeledDataSequence > const & labeledData : aSequences ) { try { - if( aSequences[nI].is()) + if( labeledData.is()) { - uno::Reference< chart2::data::XDataSequence > xSequence( aSequences[nI]->getValues()); + uno::Reference< chart2::data::XDataSequence > xSequence( labeledData->getValues()); uno::Reference< beans::XPropertySet > xSeqProp( xSequence, uno::UNO_QUERY_THROW ); OUString aRole; if( ( xSeqProp->getPropertyValue( "Role" ) >>= aRole ) && diff --git a/chart2/source/tools/MediaDescriptorHelper.cxx b/chart2/source/tools/MediaDescriptorHelper.cxx index d3ff5d6ca2d9..73c326fdcb38 100644 --- a/chart2/source/tools/MediaDescriptorHelper.cxx +++ b/chart2/source/tools/MediaDescriptorHelper.cxx @@ -52,10 +52,8 @@ MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence< }; //read given rMediaDescriptor and store in internal structures: - for( sal_Int32 i= rMediaDescriptor.getLength();i--;) + for( const beans::PropertyValue& rProp : rMediaDescriptor) { - const beans::PropertyValue& rProp = rMediaDescriptor[i]; - if (rProp.Name == "AsTemplate") { addModelProp(rProp); diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index b4c6632fff3c..be592b9522df 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -137,18 +137,17 @@ Reference<XChartType> lcl_getFirstStockChartType( const Reference< frame::XModel if( !xCooSysContainer.is()) return nullptr; - uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); - for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS ) + const uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() ); + for( Reference< XCoordinateSystem > const & coords : aCooSysList ) { //iterate through all chart types in the current coordinate system - Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], uno::UNO_QUERY ); + Reference< XChartTypeContainer > xChartTypeContainer( coords, uno::UNO_QUERY ); if( !xChartTypeContainer.is() ) continue; - uno::Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); - for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT ) + const uno::Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); + for( Reference< XChartType > const & xChartType : aChartTypeList ) { - Reference< XChartType > xChartType( aChartTypeList[nT] ); if(!xChartType.is()) continue; OUString aChartType = xChartType->getChartType(); diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx index 9efdbc5d439b..b326d0bacce9 100644 --- a/chart2/source/tools/RangeHighlighter.cxx +++ b/chart2/source/tools/RangeHighlighter.cxx @@ -274,11 +274,11 @@ void RangeHighlighter::fillRangesForDataPoint( const Reference< uno::XInterface Color nPreferredColor = defaultPreferredColor; std::vector< chart2::data::HighlightedRange > aHilightedRanges; - Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences()); - for( sal_Int32 i=0; i<aLSeqSeq.getLength(); ++i ) + const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqSeq( xSource->getDataSequences()); + for( Reference< chart2::data::XLabeledDataSequence > const & labelDataSeq : aLSeqSeq ) { - Reference< chart2::data::XDataSequence > xLabel( aLSeqSeq[i]->getLabel()); - Reference< chart2::data::XDataSequence > xValues( aLSeqSeq[i]->getValues()); + Reference< chart2::data::XDataSequence > xLabel( labelDataSeq->getLabel()); + Reference< chart2::data::XDataSequence > xValues( labelDataSeq->getValues()); if( xLabel.is()) aHilightedRanges.emplace_back( diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx index 865acc660c08..44109500552a 100644 --- a/chart2/source/tools/ReferenceSizeProvider.cxx +++ b/chart2/source/tools/ReferenceSizeProvider.cxx @@ -71,12 +71,12 @@ void ReferenceSizeProvider::setValuesAtTitle( // set from auto-resize on to off -> adapt font sizes at XFormattedStrings if( bHasOldRefSize && ! useAutoScale()) { - uno::Sequence< uno::Reference< XFormattedString > > aStrSeq( + const uno::Sequence< uno::Reference< XFormattedString > > aStrSeq( xTitle->getText()); - for( sal_Int32 i=0; i<aStrSeq.getLength(); ++i ) + for( uno::Reference< XFormattedString > const & formattedStr : aStrSeq ) { RelativeSizeHelper::adaptFontSizes( - Reference< beans::XPropertySet >( aStrSeq[i], uno::UNO_QUERY ), + Reference< beans::XPropertySet >( formattedStr, uno::UNO_QUERY ), aOldRefSize, getPageSize()); } } @@ -108,9 +108,9 @@ void ReferenceSizeProvider::setValuesAtAllDataSeries() { if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes ) { - for( sal_Int32 i=0; i< aPointIndexes.getLength(); ++i ) + for( sal_Int32 idx : aPointIndexes ) setValuesAtPropertySet( - elem->getDataPointByIndex( aPointIndexes[i] ) ); + elem->getDataPointByIndex( idx ) ); } } catch (const uno::Exception&) @@ -248,13 +248,13 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState return eResult; // Axes (incl. Axis Titles) - Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); - for( sal_Int32 i=0; i<aAxes.getLength(); ++i ) + const Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); + for( Reference< XAxis > const & axis : aAxes ) { - Reference< beans::XPropertySet > xProp( aAxes[i], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( axis, uno::UNO_QUERY ); if( xProp.is()) getAutoResizeFromPropSet( xProp, eResult ); - Reference< XTitled > xTitled( aAxes[i], uno::UNO_QUERY ); + Reference< XTitled > xTitled( axis, uno::UNO_QUERY ); if( xTitled.is()) { impl_getAutoResizeFromTitled( xTitled, eResult ); @@ -282,10 +282,10 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState { if( xSeriesProp->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes ) { - for( sal_Int32 i=0; i< aPointIndexes.getLength(); ++i ) + for( sal_Int32 idx : aPointIndexes ) { getAutoResizeFromPropSet( - elem->getDataPointByIndex( aPointIndexes[i] ), eResult ); + elem->getDataPointByIndex( idx ), eResult ); if( eResult == AUTO_RESIZE_AMBIGUOUS ) return eResult; } @@ -330,13 +330,13 @@ void ReferenceSizeProvider::setAutoResizeState( ReferenceSizeProvider::AutoResiz setValuesAtPropertySet( xLegendProp ); // Axes (incl. Axis Titles) - Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); - for( sal_Int32 i=0; i<aAxes.getLength(); ++i ) + const Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); + for( Reference< XAxis > const & axis : aAxes ) { - Reference< beans::XPropertySet > xProp( aAxes[i], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( axis, uno::UNO_QUERY ); if( xProp.is()) setValuesAtPropertySet( xProp ); - impl_setValuesAtTitled( Reference< XTitled >( aAxes[i], uno::UNO_QUERY )); + impl_setValuesAtTitled( Reference< XTitled >( axis, uno::UNO_QUERY )); } // DataSeries/Points diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 7e4a9dd17043..47f6a4b0ebfe 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -243,11 +243,11 @@ bool RegressionCurveHelper::hasMeanValueLine( try { - uno::Sequence< uno::Reference< XRegressionCurve > > aCurves( + const uno::Sequence< uno::Reference< XRegressionCurve > > aCurves( xRegCnt->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + for( uno::Reference< XRegressionCurve > const & curve : aCurves ) { - if( isMeanValueLine( aCurves[i] )) + if( isMeanValueLine( curve )) return true; } } @@ -276,12 +276,12 @@ uno::Reference< chart2::XRegressionCurve > { try { - uno::Sequence< uno::Reference< XRegressionCurve > > aCurves( + const uno::Sequence< uno::Reference< XRegressionCurve > > aCurves( xRegCnt->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + for( uno::Reference< XRegressionCurve > const & curve : aCurves ) { - if( isMeanValueLine( aCurves[i] )) - return aCurves[i]; + if( isMeanValueLine( curve )) + return curve; } } catch( const Exception & ) @@ -324,13 +324,13 @@ void RegressionCurveHelper::removeMeanValueLine( try { - Sequence< Reference< XRegressionCurve > > aCurves( + const Sequence< Reference< XRegressionCurve > > aCurves( xRegCnt->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + for( Reference< XRegressionCurve > const & curve : aCurves ) { - if( isMeanValueLine( aCurves[i] )) + if( isMeanValueLine( curve )) { - xRegCnt->removeRegressionCurve( aCurves[i] ); + xRegCnt->removeRegressionCurve( curve ); // attention: the iterator i has become invalid now // note: assume that there is only one mean-value curve @@ -403,14 +403,14 @@ bool RegressionCurveHelper::removeAllExceptMeanValueLine( { try { - uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( + const uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( xRegCnt->getRegressionCurves()); std::vector< uno::Reference< chart2::XRegressionCurve > > aCurvesToDelete; - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + for( uno::Reference< chart2::XRegressionCurve > const & curve : aCurves ) { - if( ! isMeanValueLine( aCurves[i] )) + if( ! isMeanValueLine( curve )) { - aCurvesToDelete.push_back( aCurves[ i ] ); + aCurvesToDelete.push_back( curve ); } } @@ -436,13 +436,13 @@ void RegressionCurveHelper::removeEquations( try { - uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( + const uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( xRegCnt->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + for( uno::Reference< chart2::XRegressionCurve > const & curve : aCurves ) { - if( !isMeanValueLine( aCurves[i] ) ) + if( !isMeanValueLine( curve ) ) { - uno::Reference< chart2::XRegressionCurve > xRegCurve( aCurves[ i ] ); + uno::Reference< chart2::XRegressionCurve > xRegCurve( curve ); if( xRegCurve.is() ) { uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties() ) ; @@ -484,13 +484,13 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveN try { - uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( + const uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( xRegCnt->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + for( uno::Reference< chart2::XRegressionCurve > const & curve : aCurves ) { - if( ! isMeanValueLine( aCurves[i] )) + if( ! isMeanValueLine( curve )) { - return aCurves[ i ]; + return curve; } } } @@ -583,11 +583,11 @@ SvxChartRegress RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( if( xRegCnt.is()) { - Sequence< Reference< XRegressionCurve > > aCurves( + const Sequence< Reference< XRegressionCurve > > aCurves( xRegCnt->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + for( Reference< XRegressionCurve > const & curve : aCurves ) { - SvxChartRegress eType = getRegressionType( aCurves[i] ); + SvxChartRegress eType = getRegressionType( curve ); if( eType != SvxChartRegress::MeanValue && eType != SvxChartRegress::Unknown ) { @@ -692,11 +692,11 @@ std::vector< Reference< chart2::XRegressionCurve > > Reference< chart2::XRegressionCurveContainer > xContainer(elem, uno::UNO_QUERY); if(xContainer.is()) { - uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(xContainer->getRegressionCurves()); - for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + const uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(xContainer->getRegressionCurves()); + for( Reference< XRegressionCurve > const & curve : aCurves ) { - if( ! isMeanValueLine( aCurves[i] )) - aResult.push_back( aCurves[i] ); + if( ! isMeanValueLine( curve )) + aResult.push_back( curve ); } } } diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index c384d03b08e7..3cdddbbeeb44 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -305,9 +305,9 @@ OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle if(!xTitle.is()) return OUString(); OUStringBuffer aRet; - uno::Sequence< uno::Reference< XFormattedString > > aStringList = xTitle->getText(); - for( sal_Int32 nN=0; nN<aStringList.getLength();nN++ ) - aRet.append( aStringList[nN]->getString() ); + const uno::Sequence< uno::Reference< XFormattedString > > aStringList = xTitle->getText(); + for( uno::Reference< XFormattedString > const & formattedStr : aStringList ) + aRet.append( formattedStr->getString() ); return aRet.makeStringAndClear(); } diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx index 959fe5ef5d70..26344a578adc 100644 --- a/chart2/source/tools/WrappedPropertySet.cxx +++ b/chart2/source/tools/WrappedPropertySet.cxx @@ -349,18 +349,16 @@ Any SAL_CALL WrappedPropertySet::getPropertyDefault( const OUString& rPropertyNa void SAL_CALL WrappedPropertySet::setAllPropertiesToDefault( ) { const Sequence< beans::Property >& rPropSeq = getPropertySequence(); - for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) + for(beans::Property const & prop : rPropSeq) { - OUString aPropertyName( rPropSeq[nN].Name ); - setPropertyToDefault( aPropertyName ); + setPropertyToDefault( prop.Name ); } } void SAL_CALL WrappedPropertySet::setPropertiesToDefault( const Sequence< OUString >& rNameSeq ) { - for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) + for(OUString const & s : rNameSeq) { - OUString aPropertyName( rNameSeq[nN] ); - setPropertyToDefault( aPropertyName ); + setPropertyToDefault( s ); } } Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence< OUString >& rNameSeq ) |