diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-04-28 23:10:17 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-05-06 11:23:19 +0200 |
commit | 71dee51995d46d0c820c83790d521fbd6bdd568d (patch) | |
tree | d4f5bf99abbbbb4c98fd429cadde12c8b9f4bcf1 | |
parent | 92f93f300371d2011b53d48d3491870b24cff0b4 (diff) |
chart2: use range for loop to iterate rVCooSysList in ChartView
We always just iterate the rVCooSysList and don't need the index,
so change the code to use a range for loop.
Change-Id: I3148d5d251c27d8d8f457446508e3152ae86dcc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133920
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 6f22d5f438ae..cfed056234ae 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -525,19 +525,18 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D //create VAxis, so they can give necessary information for automatic scaling uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( mrChartModel.getNumberFormatsSupplier()); - size_t nC = 0; - for( nC=0; nC < rVCooSysList.size(); nC++) + + for (auto& rpVCooSys : rVCooSysList) { - VCoordinateSystem* pVCooSys = rVCooSysList[nC].get(); - if(nDimensionCount==3) + if (nDimensionCount == 3) { CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( xDiagram ) ); CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( xDiagram ) ); CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( xDiagram ) ); - pVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, eBottomPos ); + rpVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, eBottomPos ); } - pVCooSys->createVAxisList(&mrChartModel, rPageSize, rParam.maRemainingSpace, rParam.mbUseFixedInnerSize); + rpVCooSys->createVAxisList(&mrChartModel, rPageSize, rParam.maRemainingSpace, rParam.mbUseFixedInnerSize); } // - prepare list of all axis and how they are used @@ -574,15 +573,14 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D // - create axis and grids for all coordinate systems //init all coordinate systems - for( nC=0; nC < rVCooSysList.size(); nC++) + for (auto& rpVCooSys : rVCooSysList) { - VCoordinateSystem* pVCooSys = rVCooSysList[nC].get(); - pVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis,xTextTargetShapes,xSeriesTargetBehindAxis); + rpVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis, xTextTargetShapes, xSeriesTargetBehindAxis); - pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( + rpVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) )); - pVCooSys->initVAxisInList(); + rpVCooSys->initVAxisInList(); } //calculate resulting size respecting axis label layout and fontscaling @@ -645,15 +643,13 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D } //create axes and grids for the final size - for( nC=0; nC < rVCooSysList.size(); nC++) + for (auto& rpVCooSys : rVCooSysList) { - VCoordinateSystem* pVCooSys = rVCooSysList[nC].get(); - - pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( + rpVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) )); - pVCooSys->createAxesShapes(); - pVCooSys->createGridShapes(); + rpVCooSys->createAxesShapes(); + rpVCooSys->createGridShapes(); } // - create data series for all charttypes @@ -712,11 +708,10 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D ShapeFactory::removeSubShapes( xTextTargetShapes ); //set new transformation - for( nC=0; nC < rVCooSysList.size(); nC++) + for (auto& rpVCooSys : rVCooSysList) { - VCoordinateSystem* pVCooSys = rVCooSysList[nC].get(); - pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( - createTransformationSceneToScreen( aNewInnerRect ) )); + auto aMatrix = createTransformationSceneToScreen(aNewInnerRect); + rpVCooSys->setTransformationSceneToScreen(B3DHomMatrixToHomogenMatrix(aMatrix)); } // - create data series for all charttypes |