tdf#50934: Add a version comment, and more structure for of-pie

Change-Id: I9d7c25e47a3f4a78360f9b2deffe8650e378866d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156305
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index e0ddd62..7d79181 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -78,7 +78,7 @@ ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogControlle

    m_xSubTypeList->SetStyle(m_xSubTypeList->GetStyle() |
        WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK );
    m_xSubTypeList->SetColCount(4);
    m_xSubTypeList->SetColCount(6);
    m_xSubTypeList->SetLineCount(1);

    bool bEnableComplexChartTypes = true;
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index accf2078..2e67534 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -405,13 +405,11 @@ rtl::Reference< ::chart::ChartTypeTemplate > ChartTypeManager::createTemplate(
            break;
        case TEMPLATE_BAROFPIE:
            xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
                chart2::PieChartOffsetMode_ALL_EXPLODED, true,
                chart2::PieChartSubType_BAR ));
                chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_BAR ));
            break;
        case TEMPLATE_PIEOFPIE:
            xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
                chart2::PieChartOffsetMode_ALL_EXPLODED, true,
                chart2::PieChartSubType_PIE ));
                chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_PIE ));
            break;
        case TEMPLATE_THREEDPIE:
            xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index 2f8c7fb..322b752 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -266,6 +266,8 @@ void PieChartTypeTemplate::createChartTypes(
        rtl::Reference< ChartType > xCT = new PieChartType();
        xCT->setFastPropertyValue(
            PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
        xCT->setFastPropertyValue(
            PROP_PIECHARTTYPE_SUBTYPE, getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE )); // "SubType"
        rCoordSys[0]->setChartTypes( std::vector{xCT} );

        if( !aSeriesSeq.empty() )
@@ -294,10 +296,8 @@ bool PieChartTypeTemplate::matchesTemplate2(
    getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ) >>= bTemplateUsesRings;
    chart2::PieChartOffsetMode ePieOffsetMode;
    getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE ) >>= ePieOffsetMode;
    /*
    chart2::PieChartSubType ePieSubType;
    getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE ) >>= ePieSubType;
    */
    chart2::PieChartSubType eTemplateSubType;
    getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE ) >>= eTemplateSubType;

    //check offset-mode
    if( bResult )
@@ -372,6 +372,15 @@ bool PieChartTypeTemplate::matchesTemplate2(
            bResult = ( bTemplateUsesRings == bUseRings );
        }
    }
    if( bResult )
    {
        rtl::Reference< ChartType > xCTProp = xDiagram->getChartTypeByIndex( 0 );
        chart2::PieChartSubType eSubType = chart2::PieChartSubType_NONE;
        if( xCTProp->getFastPropertyValue( PROP_PIECHARTTYPE_SUBTYPE ) >>= eSubType )
        {
            bResult = ( eTemplateSubType == eSubType );
        }
    }

    return bResult;
}
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index d973242..7aeb18d 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -185,6 +185,7 @@ PieChart::PieChart( const rtl::Reference<ChartType>& xChartTypeModel
        , m_aPosHelper( (m_nDimension==3) ? 0.0 : 90.0 )
        , m_bUseRings(false)
        , m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning)
        , m_eSubType(PieChartSubType_NONE)
        , m_fMaxOffset(std::numeric_limits<double>::quiet_NaN())
{
    PlotterBase::m_pPosHelper = &m_aPosHelper;
@@ -209,6 +210,14 @@ PieChart::PieChart( const rtl::Reference<ChartType>& xChartTypeModel
    {
        TOOLS_WARN_EXCEPTION("chart2", "" );
    }
    try
    {
        xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_SUBTYPE) >>= m_eSubType; //  "SubType"
    }
    catch( const uno::Exception& )
    {
        TOOLS_WARN_EXCEPTION("chart2", "" );
    }
}

PieChart::~PieChart()
@@ -277,8 +286,14 @@ rtl::Reference<SvxShape> PieChart::createDataPoint(
            drawing::Position3D aNewOrigin = m_aPosHelper.transformUnitCircleToScene(fAngle, fRadius, rParam.mfLogicZ);
            aOffset = aNewOrigin - aOrigin;
        }
    } else if (m_eSubType != PieChartSubType_NONE) {
        drawing::Position3D aOrigin = m_aPosHelper.transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
        drawing::Position3D aNewOrigin = m_aPosHelper.transformUnitCircleToScene(180, 1.0, rParam.mfLogicZ);
        aOffset = aNewOrigin - aOrigin;
        fExplodedOuterRadius *= 2.0/3;
    }


    //create point
    rtl::Reference<SvxShape> xShape;
    if(m_nDimension==3)
diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx
index 5caacd4..d6792f0 100644
--- a/chart2/source/view/charttypes/PieChart.hxx
+++ b/chart2/source/view/charttypes/PieChart.hxx
@@ -24,6 +24,7 @@
#include <PlottingPositionHelper.hxx>
#include <basegfx/vector/b2ivector.hxx>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/chart2/PieChartSubType.hpp>

namespace chart
{
@@ -125,6 +126,7 @@ private: //member
    PiePositionHelper     m_aPosHelper;
    bool                  m_bUseRings;
    bool                  m_bSizeExcludesLabelsAndExplodedSegments;
    ::css::chart2::PieChartSubType m_eSubType;

    struct PieLabelInfo
    {
diff --git a/offapi/com/sun/star/chart2/PieChartSubType.idl b/offapi/com/sun/star/chart2/PieChartSubType.idl
index 9e5af14..8e93b79 100644
--- a/offapi/com/sun/star/chart2/PieChartSubType.idl
+++ b/offapi/com/sun/star/chart2/PieChartSubType.idl
@@ -28,6 +28,7 @@ module chart2

/** Mode used for a pie chart template to determine the initial state
    of exploded pies.
    @since LibreOffice 24.8
 */
enum PieChartSubType
{