chart2/source/view/main/ChartView.cxx |   37 ++++++++++++++--------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

New commits:
commit 71dee51995d46d0c820c83790d521fbd6bdd568d
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Thu Apr 28 23:10:17 2022 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri May 6 11:23:19 2022 +0200

    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 <qui...@gmail.com>

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

Reply via email to