summaryrefslogtreecommitdiff
path: root/chart2/source/tools/AxisHelper.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-18 09:17:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-18 11:28:50 +0200
commit337a9a454c1bc95214111578d3f9c0622c55c509 (patch)
tree4eda99edf46e45ce804fcde98197cf0d96b7ac3d /chart2/source/tools/AxisHelper.cxx
parent6089755d197528d071906846c58a397add0876a5 (diff)
use for-range on Sequence in chart2
Change-Id: Ief02e5d5284b0cbad26b04c0a282dccfee577b90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94398 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/tools/AxisHelper.cxx')
-rw-r--r--chart2/source/tools/AxisHelper.cxx56
1 files changed, 24 insertions, 32 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 =