chart2/source/view/axes/VPolarAngleAxis.cxx        |    8 +-
 chart2/source/view/axes/VPolarAxis.cxx             |    3 
 chart2/source/view/axes/VPolarAxis.hxx             |    5 -
 chart2/source/view/axes/VPolarGrid.cxx             |    5 -
 chart2/source/view/axes/VPolarGrid.hxx             |    4 -
 chart2/source/view/charttypes/AreaChart.cxx        |    7 --
 chart2/source/view/charttypes/AreaChart.hxx        |    4 -
 chart2/source/view/charttypes/BarChart.cxx         |   11 +--
 chart2/source/view/charttypes/BarChart.hxx         |    4 -
 chart2/source/view/charttypes/CandleStickChart.cxx |    9 +-
 chart2/source/view/charttypes/CandleStickChart.hxx |    4 -
 chart2/source/view/charttypes/PieChart.cxx         |   71 ++++++++-------------
 chart2/source/view/charttypes/PieChart.hxx         |   17 ++++-
 13 files changed, 72 insertions(+), 80 deletions(-)

New commits:
commit 676d24f06303b4576f527b5a933e5cbec284bb8f
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Dec 15 20:47:16 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Dec 17 07:52:37 2023 +0100

    unique_ptr to optional in chart2
    
    Change-Id: I0cbf2e32030e5db772a9429997b7a078a4bfa2d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160836
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx 
b/chart2/source/view/axes/VPolarAngleAxis.cxx
index 13f66cec9cbf..279f784c3006 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.cxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -113,7 +113,7 @@ void VPolarAngleAxis::createTextShapes_ForAngleAxis(
             double fLogicAngle = pTickInfo->getUnscaledTickValue();
 
             LabelAlignment eLabelAlignment(LABEL_ALIGN_CENTER);
-            PolarLabelPositionHelper 
aPolarLabelPositionHelper(m_pPosHelper.get(), 2/*nDimensionCount*/, xTarget);
+            PolarLabelPositionHelper aPolarLabelPositionHelper(&m_aPosHelper, 
2/*nDimensionCount*/, xTarget);
             sal_Int32 nScreenValueOffsetInRadiusDirection = 
m_aAxisLabelProperties.m_aMaximumSpaceForLabels.Height/15;
             awt::Point aAnchorScreenPosition2D( 
aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
                     eLabelAlignment, fLogicAngle, fLogicRadius, fLogicZ, 
nScreenValueOffsetInRadiusDirection ));
@@ -156,7 +156,7 @@ void VPolarAngleAxis::createLabels()
     if( !prepareShapeCreation() )
         return;
 
-    double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
+    double fLogicRadius = m_aPosHelper.getOuterLogicRadius();
 
     if( !m_aAxisProperties.m_bDisplayLabels )
         return;
@@ -185,12 +185,12 @@ void VPolarAngleAxis::createShapes()
     if( !prepareShapeCreation() )
         return;
 
-    double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
+    double fLogicRadius = m_aPosHelper.getOuterLogicRadius();
     double const fLogicZ = 1.0;//as defined
 
     //create axis main lines
     drawing::PointSequenceSequence aPoints(1);
-    VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, 
m_aAllTickInfos, m_aIncrement, m_aScale, m_pPosHelper.get(), fLogicRadius, 
fLogicZ );
+    VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, 
m_aAllTickInfos, m_aIncrement, m_aScale, &m_aPosHelper, fLogicRadius, fLogicZ );
     rtl::Reference<SvxShapePolyPolygon> xShape = ShapeFactory::createLine2D(
             m_xGroupShape_Shapes, aPoints, 
&m_aAxisProperties.m_aLineProperties );
     //because of this name this line will be used for marking the axis
diff --git a/chart2/source/view/axes/VPolarAxis.cxx 
b/chart2/source/view/axes/VPolarAxis.cxx
index d9dfe08ec6f5..22297a561421 100644
--- a/chart2/source/view/axes/VPolarAxis.cxx
+++ b/chart2/source/view/axes/VPolarAxis.cxx
@@ -40,9 +40,8 @@ VPolarAxis::VPolarAxis( const AxisProperties& rAxisProperties
             , const uno::Reference< util::XNumberFormatsSupplier >& 
xNumberFormatsSupplier
             , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount )
             : VAxisBase( nDimensionIndex, nDimensionCount, rAxisProperties, 
xNumberFormatsSupplier )
-            , m_pPosHelper( new PolarPlottingPositionHelper() )
 {
-    PlotterBase::m_pPosHelper = m_pPosHelper.get();
+    PlotterBase::m_pPosHelper = &m_aPosHelper;
 }
 
 VPolarAxis::~VPolarAxis()
diff --git a/chart2/source/view/axes/VPolarAxis.hxx 
b/chart2/source/view/axes/VPolarAxis.hxx
index 42e22ae7dfe9..dc6233a71e02 100644
--- a/chart2/source/view/axes/VPolarAxis.hxx
+++ b/chart2/source/view/axes/VPolarAxis.hxx
@@ -19,13 +19,12 @@
 #pragma once
 
 #include "VAxisBase.hxx"
+#include <PlottingPositionHelper.hxx>
 #include <memory>
 
 namespace chart
 {
 
-class PolarPlottingPositionHelper;
-
 class VPolarAxis : public VAxisBase
 {
 public:
@@ -45,7 +44,7 @@ protected:
            , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount );
 
 protected: //member
-    std::unique_ptr<PolarPlottingPositionHelper> m_pPosHelper;
+    PolarPlottingPositionHelper m_aPosHelper;
     std::vector< ExplicitIncrementData >   m_aIncrements;
 };
 
diff --git a/chart2/source/view/axes/VPolarGrid.cxx 
b/chart2/source/view/axes/VPolarGrid.cxx
index 9a2929eac354..7c49842640a7 100644
--- a/chart2/source/view/axes/VPolarGrid.cxx
+++ b/chart2/source/view/axes/VPolarGrid.cxx
@@ -42,9 +42,8 @@ VPolarGrid::VPolarGrid( sal_Int32 nDimensionIndex, sal_Int32 
nDimensionCount
                        , std::vector< rtl::Reference< ::chart::GridProperties 
> > aGridPropertiesList )
             : VAxisOrGridBase( nDimensionIndex, nDimensionCount )
             , m_aGridPropertiesList( std::move(aGridPropertiesList) )
-            , m_pPosHelper( new PolarPlottingPositionHelper() )
 {
-    PlotterBase::m_pPosHelper = m_pPosHelper.get();
+    PlotterBase::m_pPosHelper = &m_aPosHelper;
 }
 
 VPolarGrid::~VPolarGrid()
@@ -204,7 +203,7 @@ void VPolarGrid::create2DRadiusGrid( const 
rtl::Reference<SvxShapeGroupAnyD>& xL
 
             drawing::PointSequenceSequence aPoints(1);
             VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, 
rAngleTickInfos
-                , rAngleIncrement, rAngleScale, m_pPosHelper.get(), 
fLogicRadius, fLogicZ );
+                , rAngleIncrement, rAngleScale, &m_aPosHelper, fLogicRadius, 
fLogicZ );
             if(aPoints[0].getLength())
                 appendPointSequence( aAllPoints, aPoints );
         }
diff --git a/chart2/source/view/axes/VPolarGrid.hxx 
b/chart2/source/view/axes/VPolarGrid.hxx
index c451ae5d56f5..5c0a21bb4733 100644
--- a/chart2/source/view/axes/VPolarGrid.hxx
+++ b/chart2/source/view/axes/VPolarGrid.hxx
@@ -20,6 +20,7 @@
 
 #include "VAxisOrGridBase.hxx"
 #include "Tickmarks.hxx"
+#include <PlottingPositionHelper.hxx>
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
 #include <memory>
 
@@ -28,7 +29,6 @@ namespace chart { struct VLineProperties; }
 namespace chart
 {
 class GridProperties;
-class PolarPlottingPositionHelper;
 
 class VPolarGrid : public VAxisOrGridBase
 {
@@ -55,7 +55,7 @@ public:
 private: //member
     std::vector<
         rtl::Reference< ::chart::GridProperties > > 
m_aGridPropertiesList;//main grid, subgrid, subsubgrid etc
-    std::unique_ptr<PolarPlottingPositionHelper> m_pPosHelper;
+    PolarPlottingPositionHelper m_aPosHelper;
     std::vector< ExplicitIncrementData >   m_aIncrements;
 
     void getAllTickInfos( sal_Int32 nDimensionIndex, TickInfoArraysType& 
rAllTickInfos ) const;
diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index e8af8c86c8b8..3bab48585148 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -57,7 +57,6 @@ AreaChart::AreaChart( const rtl::Reference<ChartType>& 
xChartTypeModel
                      , bool bNoArea
                      )
         : VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis )
-        , m_pMainPosHelper(new PlottingPositionHelper())
         , m_bArea(!bNoArea)
         , m_bLine(bNoArea)
         , m_bSymbol( 
ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
@@ -65,12 +64,12 @@ AreaChart::AreaChart( const rtl::Reference<ChartType>& 
xChartTypeModel
         , m_nCurveResolution(20)
         , m_nSplineOrder(3)
 {
+    PlotterBase::m_pPosHelper = &m_aMainPosHelper;
+    VSeriesPlotter::m_pMainPosHelper = &m_aMainPosHelper;
+
     m_pMainPosHelper->AllowShiftXAxisPos(true);
     m_pMainPosHelper->AllowShiftZAxisPos(true);
 
-    PlotterBase::m_pPosHelper = m_pMainPosHelper.get();
-    VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper.get();
-
     try
     {
         if( m_xChartTypeModel.is() )
diff --git a/chart2/source/view/charttypes/AreaChart.hxx 
b/chart2/source/view/charttypes/AreaChart.hxx
index 2f7434f3c5c3..411b9d6642aa 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -21,6 +21,7 @@
 
 #include <memory>
 #include <VSeriesPlotter.hxx>
+#include <PlottingPositionHelper.hxx>
 #include <com/sun/star/chart2/CurveStyle.hpp>
 
 namespace chart
@@ -64,8 +65,7 @@ private: //methods
                 , std::vector<std::vector<css::drawing::Position3D>> &aPoly );
 
 private: //member
-    std::unique_ptr<PlottingPositionHelper>
-                                        m_pMainPosHelper;
+    PlottingPositionHelper              m_aMainPosHelper;
 
     bool                                m_bArea;//false -> line or symbol only
     bool                                m_bLine;
diff --git a/chart2/source/view/charttypes/BarChart.cxx 
b/chart2/source/view/charttypes/BarChart.cxx
index eeb30266351b..cd8ab4e86c48 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -46,10 +46,9 @@ using namespace ::com::sun::star::chart2;
 BarChart::BarChart( const rtl::Reference<ChartType>& xChartTypeModel
                     , sal_Int32 nDimensionCount )
         : VSeriesPlotter( xChartTypeModel, nDimensionCount )
-        , m_pMainPosHelper( new BarPositionHelper() )
 {
-    PlotterBase::m_pPosHelper = m_pMainPosHelper.get();
-    VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper.get();
+    PlotterBase::m_pPosHelper = &m_aMainPosHelper;
+    VSeriesPlotter::m_pMainPosHelper = &m_aMainPosHelper;
 
     try
     {
@@ -507,14 +506,14 @@ void BarChart::createShapes()
     {
         for( auto const& rZSlot : m_aZSlots )
         {
-            BarPositionHelper* pPosHelper = m_pMainPosHelper.get();
+            BarPositionHelper* pPosHelper = &m_aMainPosHelper;
             if( !rZSlot.empty() )
             {
                 sal_Int32 nAttachedAxisIndex = 
rZSlot.front().getAttachedAxisIndexForFirstSeries();
                 //2ND_AXIS_IN_BARS so far one can assume to have the same 
plotter for each z slot
                 pPosHelper = dynamic_cast<BarPositionHelper*>(&( 
getPlottingPositionHelper( nAttachedAxisIndex ) ) );
                 if(!pPosHelper)
-                    pPosHelper = m_pMainPosHelper.get();
+                    pPosHelper = &m_aMainPosHelper;
             }
             PlotterBase::m_pPosHelper = pPosHelper;
 
@@ -574,7 +573,7 @@ void BarChart::doZSlot(
         //2ND_AXIS_IN_BARS so far one can assume to have the same plotter for 
each z slot
         BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( 
getPlottingPositionHelper( nAttachedAxisIndex ) ) );
         if(!pPosHelper)
-            pPosHelper = m_pMainPosHelper.get();
+            pPosHelper = &m_aMainPosHelper;
 
         PlotterBase::m_pPosHelper = pPosHelper;
 
diff --git a/chart2/source/view/charttypes/BarChart.hxx 
b/chart2/source/view/charttypes/BarChart.hxx
index 52c3b6177765..ff46786afcbb 100644
--- a/chart2/source/view/charttypes/BarChart.hxx
+++ b/chart2/source/view/charttypes/BarChart.hxx
@@ -21,10 +21,10 @@
 
 #include <memory>
 #include <VSeriesPlotter.hxx>
+#include "BarPositionHelper.hxx"
 
 namespace chart
 {
-class BarPositionHelper;
 
 class BarChart : public VSeriesPlotter
 {
@@ -109,7 +109,7 @@ private: //methods
             sal_Int32 nAttachedAxisIndex);
 
 private: //member
-    std::unique_ptr<BarPositionHelper>   m_pMainPosHelper;
+    BarPositionHelper                    m_aMainPosHelper;
     css::uno::Sequence< sal_Int32 >      m_aOverlapSequence;
     css::uno::Sequence< sal_Int32 >      m_aGapwidthSequence;
 };
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx 
b/chart2/source/view/charttypes/CandleStickChart.cxx
index 20c53461d19b..3082a6d031b1 100644
--- a/chart2/source/view/charttypes/CandleStickChart.cxx
+++ b/chart2/source/view/charttypes/CandleStickChart.cxx
@@ -37,10 +37,9 @@ using namespace ::com::sun::star::chart2;
 CandleStickChart::CandleStickChart( const rtl::Reference<ChartType>& 
xChartTypeModel
                                     , sal_Int32 nDimensionCount )
         : VSeriesPlotter( xChartTypeModel, nDimensionCount )
-        , m_pMainPosHelper( new BarPositionHelper() )
 {
-    PlotterBase::m_pPosHelper = m_pMainPosHelper.get();
-    VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper.get();
+    PlotterBase::m_pPosHelper = &m_aMainPosHelper;
+    VSeriesPlotter::m_pMainPosHelper = &m_aMainPosHelper;
 }
 
 CandleStickChart::~CandleStickChart()
@@ -137,14 +136,14 @@ void CandleStickChart::createShapes()
     {
         for( auto const& rZSlot : m_aZSlots )
         {
-            BarPositionHelper* pPosHelper = m_pMainPosHelper.get();
+            BarPositionHelper* pPosHelper = &m_aMainPosHelper;
             if( !rZSlot.empty() )
             {
                 sal_Int32 nAttachedAxisIndex = 
rZSlot.front().getAttachedAxisIndexForFirstSeries();
                 //2ND_AXIS_IN_BARS so far one can assume to have the same 
plotter for each z slot
                 pPosHelper = dynamic_cast<BarPositionHelper*>(&( 
getPlottingPositionHelper( nAttachedAxisIndex ) ) );
                 if(!pPosHelper)
-                    pPosHelper = m_pMainPosHelper.get();
+                    pPosHelper = &m_aMainPosHelper;
             }
             PlotterBase::m_pPosHelper = pPosHelper;
 
diff --git a/chart2/source/view/charttypes/CandleStickChart.hxx 
b/chart2/source/view/charttypes/CandleStickChart.hxx
index 93571889ee6d..3202cf0d7eaf 100644
--- a/chart2/source/view/charttypes/CandleStickChart.hxx
+++ b/chart2/source/view/charttypes/CandleStickChart.hxx
@@ -20,11 +20,11 @@
 #pragma once
 
 #include <memory>
+#include "BarPositionHelper.hxx"
 #include <VSeriesPlotter.hxx>
 
 namespace chart
 {
-class BarPositionHelper;
 
 class CandleStickChart : public VSeriesPlotter
 {
@@ -47,7 +47,7 @@ public:
     virtual LegendSymbolStyle getLegendSymbolStyle() override;
 
 private: //member
-    std::unique_ptr<BarPositionHelper>           m_pMainPosHelper;
+    BarPositionHelper m_aMainPosHelper;
 };
 } //namespace chart
 
diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index 1c5f15d7ec00..68e65b15d949 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -20,7 +20,6 @@
 #include <BaseGFXHelper.hxx>
 #include <VLineProperties.hxx>
 #include "PieChart.hxx"
-#include <PlottingPositionHelper.hxx>
 #include <ShapeFactory.hxx>
 #include <PolarLabelPositionHelper.hxx>
 #include <CommonConverters.hxx>
@@ -125,18 +124,6 @@ bool lcl_isInsidePage(const awt::Point& rPos, const 
awt::Size& rSize, const awt:
 
 } //end anonymous namespace
 
-class PiePositionHelper : public PolarPlottingPositionHelper
-{
-public:
-    PiePositionHelper( double fAngleDegreeOffset );
-
-    bool    getInnerAndOuterRadius( double fCategoryX, double& 
fLogicInnerRadius, double& fLogicOuterRadius, bool bUseRings, double fMaxOffset 
) const;
-
-public:
-    //Distance between different category rings, seen relative to width of a 
ring:
-    double  m_fRingDistance; //>=0 m_fRingDistance=1 --> distance == width
-};
-
 PiePositionHelper::PiePositionHelper( double fAngleDegreeOffset )
         : m_fRingDistance(0.0)
 {
@@ -195,15 +182,15 @@ PieChart::PieChart( const rtl::Reference<ChartType>& 
xChartTypeModel
                    , sal_Int32 nDimensionCount
                    , bool bExcludingPositioning )
         : VSeriesPlotter( xChartTypeModel, nDimensionCount )
-        , m_pPosHelper( new PiePositionHelper( (m_nDimension==3) ? 0.0 : 90.0 
) )
+        , m_aPosHelper( (m_nDimension==3) ? 0.0 : 90.0 )
         , m_bUseRings(false)
         , m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning)
         , m_fMaxOffset(std::numeric_limits<double>::quiet_NaN())
 {
-    PlotterBase::m_pPosHelper = m_pPosHelper.get();
-    VSeriesPlotter::m_pMainPosHelper = m_pPosHelper.get();
-    m_pPosHelper->m_fRadiusOffset = 0.0;
-    m_pPosHelper->m_fRingDistance = 0.0;
+    PlotterBase::m_pPosHelper = &m_aPosHelper;
+    VSeriesPlotter::m_pMainPosHelper = &m_aPosHelper;
+    m_aPosHelper.m_fRadiusOffset = 0.0;
+    m_aPosHelper.m_fRingDistance = 0.0;
 
     if( !xChartTypeModel.is() )
         return;
@@ -213,9 +200,9 @@ PieChart::PieChart( const rtl::Reference<ChartType>& 
xChartTypeModel
         xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_USE_RINGS) >>= 
m_bUseRings; //  "UseRings"
         if( m_bUseRings )
         {
-            m_pPosHelper->m_fRadiusOffset = 1.0;
+            m_aPosHelper.m_fRadiusOffset = 1.0;
             if( nDimensionCount==3 )
-                m_pPosHelper->m_fRingDistance = 0.1;
+                m_aPosHelper.m_fRingDistance = 0.1;
         }
     }
     catch( const uno::Exception& )
@@ -231,7 +218,7 @@ PieChart::~PieChart()
 void PieChart::setScales( std::vector< ExplicitScaleData >&& rScales, bool /* 
bSwapXAndYAxis */ )
 {
     OSL_ENSURE(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension 
of Plotter does not fit two dimension of given scale sequence");
-    m_pPosHelper->setScales( std::move(rScales), true );
+    m_aPosHelper.setScales( std::move(rScales), true );
 }
 
 drawing::Direction3D PieChart::getPreferredDiagramAspectRatio() const
@@ -286,8 +273,8 @@ rtl::Reference<SvxShape> PieChart::createDataPoint(
             // but shift the circle origin
             double fAngle  = fStartAngle + fWidthAngle/2.0;
 
-            drawing::Position3D aOrigin = 
m_pPosHelper->transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
-            drawing::Position3D aNewOrigin = 
m_pPosHelper->transformUnitCircleToScene(fAngle, fRadius, rParam.mfLogicZ);
+            drawing::Position3D aOrigin = 
m_aPosHelper.transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
+            drawing::Position3D aNewOrigin = 
m_aPosHelper.transformUnitCircleToScene(fAngle, fRadius, rParam.mfLogicZ);
             aOffset = aNewOrigin - aOrigin;
         }
     }
@@ -299,7 +286,7 @@ rtl::Reference<SvxShape> PieChart::createDataPoint(
         xShape = ShapeFactory::createPieSegment( xTarget
             , fStartAngle, fWidthAngle
             , fExplodedInnerRadius, fExplodedOuterRadius
-            , aOffset, B3DHomMatrixToHomogenMatrix( 
m_pPosHelper->getUnitCartesianToScene() )
+            , aOffset, B3DHomMatrixToHomogenMatrix( 
m_aPosHelper.getUnitCartesianToScene() )
             , rParam.mfDepth );
     }
     else
@@ -307,7 +294,7 @@ rtl::Reference<SvxShape> PieChart::createDataPoint(
         xShape = ShapeFactory::createPieSegment2D( xTarget
             , fStartAngle, fWidthAngle
             , fExplodedInnerRadius, fExplodedOuterRadius
-            , aOffset, B3DHomMatrixToHomogenMatrix( 
m_pPosHelper->getUnitCartesianToScene() ) );
+            , aOffset, B3DHomMatrixToHomogenMatrix( 
m_aPosHelper.getUnitCartesianToScene() ) );
     }
     PropertyMapper::setMappedProperties( *xShape, xObjectProperties, 
PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
     return xShape;
@@ -335,7 +322,7 @@ void PieChart::createTextLabelShape(
     ///get the required label placement type. Available placements are
     ///`AVOID_OVERLAP`, `CENTER`, `OUTSIDE` and `INSIDE`;
     sal_Int32 nLabelPlacement = rSeries.getLabelPlacement(
-        nPointIndex, m_xChartTypeModel, m_pPosHelper->isSwapXAndY());
+        nPointIndex, m_xChartTypeModel, m_aPosHelper.isSwapXAndY());
 
     ///when the placement is of `AVOID_OVERLAP` type a later rearrangement of
     ///the label position is allowed; the `createTextLabelShape` treats the
@@ -366,7 +353,7 @@ void PieChart::createTextLabelShape(
     ///the scene position of the label anchor point is calculated (see notes 
for
     
///`PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCircleValues`),
     ///and immediately transformed into the screen position.
-    PolarLabelPositionHelper 
aPolarPosHelper(m_pPosHelper.get(),m_nDimension,m_xLogicTarget);
+    PolarLabelPositionHelper 
aPolarPosHelper(&m_aPosHelper,m_nDimension,m_xLogicTarget);
     awt::Point aScreenPosition2D(
         
aPolarPosHelper.getLabelScreenPositionAndAlignmentForUnitCircleValues(eAlignment,
 nLabelPlacement
         , rParam.mfUnitCircleStartAngleDegree, 
rParam.mfUnitCircleWidthAngleDegree
@@ -375,7 +362,7 @@ void PieChart::createTextLabelShape(
     ///the screen position of the pie/donut center is calculated.
     PieLabelInfo aPieLabelInfo;
     aPieLabelInfo.aFirstPosition = basegfx::B2IVector( aScreenPosition2D.X, 
aScreenPosition2D.Y );
-    awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( 
m_pPosHelper->transformUnitCircleToScene( 0.0, 0.0, rParam.mfLogicZ+1.0 ) ) );
+    awt::Point aOrigin( aPolarPosHelper.transformSceneToScreenPosition( 
m_aPosHelper.transformUnitCircleToScene( 0.0, 0.0, rParam.mfLogicZ+1.0 ) ) );
     aPieLabelInfo.aOrigin = basegfx::B2IVector( aOrigin.X, aOrigin.Y );
 
     ///add a scaling independent Offset if requested
@@ -389,7 +376,7 @@ void PieChart::createTextLabelShape(
 
    // compute outer pie radius
     awt::Point aOuterCirclePoint = 
PlottingPositionHelper::transformSceneToScreenPosition(
-            m_pPosHelper->transformUnitCircleToScene(
+            m_aPosHelper.transformUnitCircleToScene(
                     0,
                     rParam.mfUnitCircleOuterRadius,
                     0 ),
@@ -407,7 +394,7 @@ void PieChart::createTextLabelShape(
         fAngleDegree += 360.0;
 
     awt::Point aOuterPosition = 
PlottingPositionHelper::transformSceneToScreenPosition(
-        m_pPosHelper->transformUnitCircleToScene(fAngleDegree, 
rParam.mfUnitCircleOuterRadius, 0),
+        m_aPosHelper.transformUnitCircleToScene(fAngleDegree, 
rParam.mfUnitCircleOuterRadius, 0),
         m_xLogicTarget, m_nDimension);
     aPieLabelInfo.aOuterPosition = basegfx::B2IVector(aOuterPosition.X, 
aOuterPosition.Y);
 
@@ -445,7 +432,7 @@ void PieChart::createTextLabelShape(
          *  First off the routine try to place the label inside the related 
pie slice,
          *  if this is not possible the label is placed outside.
          */
-        if (rSeries.getLabelPlacement(nPointIndex, m_xChartTypeModel, 
m_pPosHelper->isSwapXAndY())
+        if (rSeries.getLabelPlacement(nPointIndex, m_xChartTypeModel, 
m_aPosHelper.isSwapXAndY())
                 == css::chart::DataLabelPlacement::CUSTOM
             || !performLabelBestFitInnerPlacement(rParam, aPieLabelInfo))
         {
@@ -724,7 +711,7 @@ void PieChart::createShapes()
     ///orientation is reversed (always!?) and we are dealing with a donut: in
     ///such a case the `explodeable` ring is the last one.
     std::vector< VDataSeriesGroup >::size_type nExplodeableSlot = 0;
-    if( m_pPosHelper->isMathematicalOrientationRadius() && m_bUseRings )
+    if( m_aPosHelper.isMathematicalOrientationRadius() && m_bUseRings )
         nExplodeableSlot = m_aZSlots.front().size()-1;
 
     m_aLabelInfoList.clear();
@@ -759,7 +746,7 @@ void PieChart::createShapes()
         /// The angle degree offset is set by the same property of the
         /// data series.
         /// Counter-clockwise offset from the 3 o'clock position.
-        m_pPosHelper->m_fAngleDegreeOffset = pSeries->getStartingAngle();
+        m_aPosHelper.m_fAngleDegreeOffset = pSeries->getStartingAngle();
 
         ///iterate through all points to get the sum of all entries of
         ///the current data series
@@ -795,7 +782,7 @@ void PieChart::createShapes()
             double fOffset = getMaxOffset();
 
             ///compute the outer and the inner radius for the current ring 
slice
-            bool bIsVisible = m_pPosHelper->getInnerAndOuterRadius( 
fSlotX+1.0, fLogicInnerRadius, fLogicOuterRadius, m_bUseRings, fOffset );
+            bool bIsVisible = m_aPosHelper.getInnerAndOuterRadius( fSlotX+1.0, 
fLogicInnerRadius, fLogicOuterRadius, m_bUseRings, fOffset );
             if( !bIsVisible )
                 continue;
 
@@ -835,10 +822,10 @@ void PieChart::createShapes()
 
                 ///see notes for `PolarPlottingPositionHelper` methods
                 ///transform to unit circle:
-                aParam.mfUnitCircleWidthAngleDegree = 
m_pPosHelper->getWidthAngleDegree( fLogicStartAngleValue, fLogicEndAngleValue );
-                aParam.mfUnitCircleStartAngleDegree = 
m_pPosHelper->transformToAngleDegree( fLogicStartAngleValue );
-                aParam.mfUnitCircleInnerRadius = 
m_pPosHelper->transformToRadius( fLogicInnerRadius );
-                aParam.mfUnitCircleOuterRadius = 
m_pPosHelper->transformToRadius( fLogicOuterRadius );
+                aParam.mfUnitCircleWidthAngleDegree = 
m_aPosHelper.getWidthAngleDegree( fLogicStartAngleValue, fLogicEndAngleValue );
+                aParam.mfUnitCircleStartAngleDegree = 
m_aPosHelper.transformToAngleDegree( fLogicStartAngleValue );
+                aParam.mfUnitCircleInnerRadius = 
m_aPosHelper.transformToRadius( fLogicInnerRadius );
+                aParam.mfUnitCircleOuterRadius = 
m_aPosHelper.transformToRadius( fLogicOuterRadius );
 
                 ///create data point
                 aParam.mfLogicZ = -1.0; // For 3D pie chart label position
@@ -881,8 +868,8 @@ void PieChart::createShapes()
 
                     double fAngle  = aParam.mfUnitCircleStartAngleDegree + 
aParam.mfUnitCircleWidthAngleDegree/2.0;
                     double fMaxDeltaRadius = 
aParam.mfUnitCircleOuterRadius-aParam.mfUnitCircleInnerRadius;
-                    drawing::Position3D aOrigin = 
m_pPosHelper->transformUnitCircleToScene( fAngle, 
aParam.mfUnitCircleOuterRadius, aParam.mfLogicZ );
-                    drawing::Position3D aNewOrigin = 
m_pPosHelper->transformUnitCircleToScene( fAngle, 
aParam.mfUnitCircleOuterRadius + fMaxDeltaRadius, aParam.mfLogicZ );
+                    drawing::Position3D aOrigin = 
m_aPosHelper.transformUnitCircleToScene( fAngle, 
aParam.mfUnitCircleOuterRadius, aParam.mfLogicZ );
+                    drawing::Position3D aNewOrigin = 
m_aPosHelper.transformUnitCircleToScene( fAngle, aParam.mfUnitCircleOuterRadius 
+ fMaxDeltaRadius, aParam.mfLogicZ );
 
                     sal_Int32 nOffsetPercent( 
static_cast<sal_Int32>(aParam.mfExplodePercentage * 100.0) );
 
@@ -1158,7 +1145,7 @@ bool PieChart::tryMoveLabels( PieLabelInfo const * 
pFirstBorder, PieLabelInfo co
     PieLabelInfo* p2 = pCenter->pNext;
     //return true when successful
 
-    bool bLabelOrderIsAntiClockWise = 
m_pPosHelper->isMathematicalOrientationAngle();
+    bool bLabelOrderIsAntiClockWise = 
m_aPosHelper.isMathematicalOrientationAngle();
 
     ///two loops are performed simultaneously: the outer loop iterates on
     ///`PieLabelInfo` objects in the list starting from the central element
@@ -1422,7 +1409,7 @@ bool 
PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab
     // get the middle point of the arc representing the pie slice border
     double fLogicZ = rShapeParam.mfLogicZ + 1.0;
     awt::Point aMiddleArcPoint = 
PlottingPositionHelper::transformSceneToScreenPosition(
-            m_pPosHelper->transformUnitCircleToScene(
+            m_aPosHelper.transformUnitCircleToScene(
                     fBisectingRayAngleDeg,
                     rShapeParam.mfUnitCircleOuterRadius,
                     fLogicZ ),
diff --git a/chart2/source/view/charttypes/PieChart.hxx 
b/chart2/source/view/charttypes/PieChart.hxx
index 9a5b7fb4c9d6..5caacd4db9b3 100644
--- a/chart2/source/view/charttypes/PieChart.hxx
+++ b/chart2/source/view/charttypes/PieChart.hxx
@@ -21,12 +21,24 @@
 
 #include <memory>
 #include <VSeriesPlotter.hxx>
+#include <PlottingPositionHelper.hxx>
 #include <basegfx/vector/b2ivector.hxx>
 #include <com/sun/star/awt/Point.hpp>
 
 namespace chart
 {
-class PiePositionHelper;
+
+class PiePositionHelper : public PolarPlottingPositionHelper
+{
+public:
+    PiePositionHelper( double fAngleDegreeOffset );
+
+    bool    getInnerAndOuterRadius( double fCategoryX, double& 
fLogicInnerRadius, double& fLogicOuterRadius, bool bUseRings, double fMaxOffset 
) const;
+
+public:
+    //Distance between different category rings, seen relative to width of a 
ring:
+    double  m_fRingDistance; //>=0 m_fRingDistance=1 --> distance == width
+};
 
 class PieChart : public VSeriesPlotter
 {
@@ -110,8 +122,7 @@ struct PieLabelInfo;
                                 , PieLabelInfo const & rPieLabelInfo );
 
 private: //member
-    std::unique_ptr<PiePositionHelper>
-                          m_pPosHelper;
+    PiePositionHelper     m_aPosHelper;
     bool                  m_bUseRings;
     bool                  m_bSizeExcludesLabelsAndExplodedSegments;
 

Reply via email to