chart2/source/view/charttypes/AreaChart.cxx |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 06b7f930a51d396bf9e3b6b8d0b3fcbd034730b4
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Feb 22 09:53:35 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Feb 22 11:39:19 2022 +0100

    tdf#64914 small improvements
    
    (1) do not read the config inside a hot loop
    
    (2) do not create a SvxShapeGroup only to remove it
    
    Change-Id: I8ff3840d0972d2f617a326a67d18260e44220f56
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130331
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index 9160ad8d93ee..dc5ee63b001d 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -636,6 +636,8 @@ void AreaChart::createShapes()
         }
     }
 
+    const bool bUseErrorRectangle = ConfigAccess::getUseErrorRectangle();
+
     sal_Int32 nZ=1;
     for( auto const& rZSlot : m_aZSlots )
     {
@@ -794,12 +796,6 @@ void AreaChart::createShapes()
                             !bCreateXErrorBar && 
!pSeries->getDataPointLabelIfLabel(nIndex) )
                         continue;
 
-                    //create a group shape for this point and add to the 
series shape:
-                    OUString aPointCID = ObjectIdentifier::createPointCID(
-                            pSeries->getPointCID_Stub(), nIndex );
-                    rtl::Reference<SvxShapeGroupAnyD> xPointGroupShape_Shapes(
-                            
createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
-
                     {
                         nCreatedPoints++;
 
@@ -809,6 +805,13 @@ void AreaChart::createShapes()
                         {
                             if(m_nDimension!=3)
                             {
+                                //create a group shape for this point and add 
to the series shape:
+                                OUString aPointCID = 
ObjectIdentifier::createPointCID(
+                                        pSeries->getPointCID_Stub(), nIndex );
+                                rtl::Reference<SvxShapeGroupAnyD> 
xPointGroupShape_Shapes;
+                                if (pSymbolProperties->Style == 
SymbolStyle_STANDARD || pSymbolProperties->Style == SymbolStyle_GRAPHIC)
+                                    xPointGroupShape_Shapes = 
createGroupShape(xSeriesGroupShape_Shapes,aPointCID);
+
                                 if (pSymbolProperties->Style != 
SymbolStyle_NONE)
                                 {
                                     aSymbolSize.DirectionX = 
pSymbolProperties->Size.Width;
@@ -833,7 +836,7 @@ void AreaChart::createShapes()
                             }
                         }
                         //create error bars or rectangles, depending on 
configuration
-                        if ( ConfigAccess::getUseErrorRectangle() )
+                        if ( bUseErrorRectangle )
                         {
                             if ( bCreateXErrorBar || bCreateYErrorBar )
                             {
@@ -917,10 +920,6 @@ void AreaChart::createShapes()
                                     , rLogicYSumMap[nAttachedAxisIndex], 
aScreenPosition2D, eAlignment, nOffset );
                         }
                     }
-
-                    //remove PointGroupShape if empty
-                    if(!xPointGroupShape_Shapes->getCount())
-                        
xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shapes);
                 }
 
             }//next series in x slot (next y slot)

Reply via email to