chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx |    7 +
 chart2/source/inc/ChartType.hxx                             |    6 +
 chart2/source/model/main/Diagram.cxx                        |    8 +
 chart2/source/model/template/PieChartType.hxx               |    1 
 chart2/source/model/template/PieChartTypeTemplate.cxx       |    3 
 chart2/source/view/inc/VDataSeries.hxx                      |    6 +
 chart2/source/view/main/SeriesPlotterContainer.cxx          |   10 +
 chart2/source/view/main/VDataSeries.cxx                     |   11 ++
 include/oox/export/chartexport.hxx                          |    2 
 oox/inc/drawingml/chart/typegroupcontext.hxx                |   14 ++
 oox/inc/drawingml/chart/typegroupconverter.hxx              |    3 
 oox/source/drawingml/chart/plotareacontext.cxx              |    3 
 oox/source/drawingml/chart/typegroupcontext.cxx             |   30 +++++
 oox/source/drawingml/chart/typegroupconverter.cxx           |   28 +++++
 oox/source/export/chartexport.cxx                           |   66 +++++++++---
 oox/source/token/properties.txt                             |    1 
 xmloff/inc/xmlprop.hxx                                      |    1 
 17 files changed, 184 insertions(+), 16 deletions(-)

New commits:
commit 1cda27cf69054b006aa1b16cab8f56339274588b
Author:     Kurt Nordback <kurt.nordb...@protonmail.com>
AuthorDate: Fri Dec 1 11:18:31 2023 -0700
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Feb 19 01:29:36 2024 +0100

    tdf#50934: OfPie inport from OOXML, plus initial work for export
    
    Change-Id: Ie17b583af28d274b3e7817c646dd4f5873e03fef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160733
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 711d3017a8ee..949aaa9a6dae 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -54,6 +54,7 @@
 #include <com/sun/star/chart/ChartDataRowSource.hpp>
 #include <com/sun/star/chart2/RelativeSize.hpp>
 #include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 #include <com/sun/star/chart/ChartSolidType.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 
@@ -102,6 +103,7 @@ enum
     PROP_DIAGRAM_SORT_BY_X_VALUES,
 
     PROP_DIAGRAM_STARTING_ANGLE,
+    PROP_DIAGRAM_OF_PIE_TYPE,
 
     PROP_DIAGRAM_RIGHT_ANGLED_AXES,
     PROP_DIAGRAM_PERSPECTIVE,
@@ -228,6 +230,11 @@ void lcl_AddPropertiesToVector(
                   cppu::UnoType<sal_Int32>::get(),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT );
+    rOutProperties.emplace_back( "SubPieType",
+                  PROP_DIAGRAM_OF_PIE_TYPE,
+                  cppu::UnoType<chart2::PieChartSubType>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT );
 
     //new for 3D charts
     rOutProperties.emplace_back( "RightAngledAxes",
diff --git a/chart2/source/inc/ChartType.hxx b/chart2/source/inc/ChartType.hxx
index fa55cf05694f..fccafdb323b6 100644
--- a/chart2/source/inc/ChartType.hxx
+++ b/chart2/source/inc/ChartType.hxx
@@ -75,6 +75,12 @@ public:
     // ____ XChartType ____
     // still abstract ! implement !
     virtual OUString SAL_CALL getChartType() override = 0;
+#if 0
+    virtual ::com::sun::star::chart2::PieChartSubType SAL_CALL 
getPieChartSubType() override
+    {
+        return ::com::sun::star::chart2::PieChartSubType_NONE;
+    }
+#endif
     virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL
         createCoordinateSystem( ::sal_Int32 DimensionCount ) final override;
     virtual css::uno::Sequence< OUString > SAL_CALL
diff --git a/chart2/source/model/main/Diagram.cxx 
b/chart2/source/model/main/Diagram.cxx
index 2a4b63c73401..1ef884c796f9 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -51,6 +51,7 @@
 #include <com/sun/star/chart2/StackingDirection.hpp>
 #include <com/sun/star/chart2/RelativePosition.hpp>
 #include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 #include <com/sun/star/chart/MissingValueTreatment.hpp>
 #include <com/sun/star/container/NoSuchElementException.hpp>
 #include <com/sun/star/drawing/ShadeMode.hpp>
@@ -97,6 +98,7 @@ enum
     PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
     PROP_DIAGRAM_3DRELATIVEHEIGHT,
     PROP_DIAGRAM_DATATABLEHBORDER,
+    PROP_DIAGRAM_OF_PIE_TYPE,
     PROP_DIAGRAM_DATATABLEVBORDER,
     PROP_DIAGRAM_DATATABLEOUTLINE,
     PROP_DIAGRAM_EXTERNALDATA
@@ -183,6 +185,10 @@ void lcl_AddPropertiesToVector(
                   PROP_DIAGRAM_3DRELATIVEHEIGHT,
                   cppu::UnoType<sal_Int32>::get(),
                   beans::PropertyAttribute::MAYBEVOID );
+    rOutProperties.emplace_back( "SubPieType",
+                  PROP_DIAGRAM_OF_PIE_TYPE,
+                  cppu::UnoType<chart2::PieChartSubType>::get(),
+                  beans::PropertyAttribute::MAYBEVOID );
     rOutProperties.emplace_back( "ExternalData",
                   PROP_DIAGRAM_EXTERNALDATA,
                   cppu::UnoType<OUString>::get(),
@@ -202,6 +208,8 @@ const ::chart::tPropertyValueMap& StaticDiagramDefaults()
         ::chart::PropertyHelper::setPropertyValueDefault( aMap, 
PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
         ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, 
PROP_DIAGRAM_STARTING_ANGLE, 90 );
         ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aMap, 
PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
+        ::chart::PropertyHelper::setPropertyValueDefault< 
chart2::PieChartSubType >( aMap, PROP_DIAGRAM_OF_PIE_TYPE,
+                chart2::PieChartSubType_NONE);
         ::chart::SceneProperties::AddDefaultsToMap( aMap );
         return aMap;
     }();
diff --git a/chart2/source/model/template/PieChartType.hxx 
b/chart2/source/model/template/PieChartType.hxx
index 5a1e46f43d88..083bd78facd3 100644
--- a/chart2/source/model/template/PieChartType.hxx
+++ b/chart2/source/model/template/PieChartType.hxx
@@ -19,6 +19,7 @@
 #pragma once
 
 #include <ChartType.hxx>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 
 namespace chart
 {
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx 
b/chart2/source/model/template/PieChartTypeTemplate.cxx
index 322b75243fb9..20880808d10b 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -100,8 +100,7 @@ enum
                   PROP_PIE_TEMPLATE_USE_RINGS,
                   cppu::UnoType<bool>::get(),
                   beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEDEFAULT }
-                ,
+                  | beans::PropertyAttribute::MAYBEDEFAULT },
                 { "SubPieType",
                   PROP_PIE_TEMPLATE_SUB_PIE_TYPE,
                   cppu::UnoType<chart2::PieChartSubType>::get(),
diff --git a/chart2/source/view/inc/VDataSeries.hxx 
b/chart2/source/view/inc/VDataSeries.hxx
index 72f5fca80089..8e10b1a6756f 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/drawing/Position3D.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 #include <rtl/ref.hxx>
 #include <svx/unoshape.hxx>
 
@@ -141,6 +142,9 @@ public:
     void setStartingAngle( sal_Int32 nStartingAngle );
     sal_Int32 getStartingAngle() const;
 
+    void setPieChartSubType(css::chart2::PieChartSubType eSubType);
+    css::chart2::PieChartSubType getPieChartSubType() const;
+
     void setRoleOfSequenceForDataLabelNumberFormatDetection( 
std::u16string_view rRole );
 
     //this is only temporarily here for area chart:
@@ -231,6 +235,8 @@ private: //member
 
     sal_Int32               m_nStartingAngle;
 
+    css::chart2::PieChartSubType m_ePieChartSubType;
+
     OUString           m_aSeriesParticle;
     OUString           m_aCID;
     OUString           m_aPointCID_Stub;
diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx 
b/chart2/source/view/main/SeriesPlotterContainer.cxx
index 67e4d75c0b9b..b70e51510b7d 100644
--- a/chart2/source/view/main/SeriesPlotterContainer.cxx
+++ b/chart2/source/view/main/SeriesPlotterContainer.cxx
@@ -39,6 +39,7 @@
 
 #include <com/sun/star/chart/ChartAxisPosition.hpp>
 #include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 
 #include <comphelper/classids.hxx>
@@ -152,6 +153,7 @@ void 
SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart
     bool bSecondaryYaxisVisible = true;
     sal_Int32 nStartingAngle = 90;
     sal_Int32 n3DRelativeHeight = 100;
+    PieChartSubType ePieChartSubType = PieChartSubType_NONE;
     try
     {
         xDiagram->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= 
bSortByXValues;
@@ -164,6 +166,7 @@ void 
SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart
         {
             xDiagram->getPropertyValue("3DRelativeHeight") >>= 
n3DRelativeHeight;
         }
+        xDiagram->getPropertyValue("SubPieType") >>= ePieChartSubType;
     }
     catch (const uno::Exception&)
     {
@@ -225,6 +228,12 @@ void 
SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart
                 }
             }
 
+            if (ePieChartSubType != PieChartSubType_NONE)
+            {
+                xChartType->setFastPropertyValue(PROP_PIECHARTTYPE_SUBTYPE,
+                                                 uno::Any(ePieChartSubType));
+            }
+
             if (nT == 0)
                 m_bChartTypeUsesShiftedCategoryPositionPerDefault
                     = 
ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault(xChartType);
@@ -269,6 +278,7 @@ void 
SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart
                 pSeries->setConnectBars(bConnectBars);
                 pSeries->setGroupBarsPerAxis(bGroupBarsPerAxis);
                 pSeries->setStartingAngle(nStartingAngle);
+                pSeries->setPieChartSubType(ePieChartSubType);
 
                 pSeries->setMissingValueTreatment(nMissingValueTreatment);
 
diff --git a/chart2/source/view/main/VDataSeries.cxx 
b/chart2/source/view/main/VDataSeries.cxx
index 17dc8f1a3beb..88462ebcf0b7 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -156,6 +156,7 @@ VDataSeries::VDataSeries( const rtl::Reference< DataSeries 
>& xDataSeries )
     , m_bConnectBars(false)
     , m_bGroupBarsPerAxis(true)
     , m_nStartingAngle(90)
+    , m_ePieChartSubType(PieChartSubType_NONE)
     , m_nGlobalSeriesIndex(0)
     , m_nCurrentAttributedPoint(-1)
     , m_nMissingValueTreatment(css::chart::MissingValueTreatment::LEAVE_GAP)
@@ -401,6 +402,16 @@ sal_Int32 VDataSeries::getStartingAngle() const
     return m_nStartingAngle;
 }
 
+void VDataSeries::setPieChartSubType(chart2::PieChartSubType eSubType)
+{
+    m_ePieChartSubType = eSubType;
+}
+
+chart2::PieChartSubType VDataSeries::getPieChartSubType() const
+{
+    return m_ePieChartSubType;
+}
+
 chart2::StackingDirection VDataSeries::getStackingDirection() const
 {
     return m_eStackingDirection;
diff --git a/include/oox/export/chartexport.hxx 
b/include/oox/export/chartexport.hxx
index 6a40254f6491..0bf4196a9800 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -192,6 +192,8 @@ private:
     void exportBubbleChart( const css::uno::Reference< css::chart2::XChartType 
>& xChartType );
     void exportDoughnutChart( const css::uno::Reference< 
css::chart2::XChartType >& xChartType );
     void exportLineChart( const css::uno::Reference< css::chart2::XChartType 
>& xChartType );
+    void exportOfPieChart( const css::uno::Reference< css::chart2::XChartType 
>&
+            xChartType, const char* s_subtype );
     void exportPieChart( const css::uno::Reference< css::chart2::XChartType >& 
xChartType );
     void exportRadarChart( const css::uno::Reference< css::chart2::XChartType 
>& xChartType );
     void exportScatterChart( const css::uno::Reference< 
css::chart2::XChartType >& xChartType );
diff --git a/oox/inc/drawingml/chart/typegroupcontext.hxx 
b/oox/inc/drawingml/chart/typegroupcontext.hxx
index 5d5306d31fe0..d3af8436d7ac 100644
--- a/oox/inc/drawingml/chart/typegroupcontext.hxx
+++ b/oox/inc/drawingml/chart/typegroupcontext.hxx
@@ -92,7 +92,7 @@ public:
 };
 
 
-/** Handler for pie type group contexts (c:doughnutChart, c:ofPieChart,
+/** Handler for pie type group contexts (c:doughnutChart,
     c:pie3DChart, c:pieChart elements).
  */
 class PieTypeGroupContext final : public TypeGroupContextBase
@@ -105,6 +105,18 @@ public:
 };
 
 
+/** Handler for of-pie type group contexts (c:ofPieChart elements).
+ */
+class OfPieTypeGroupContext final : public TypeGroupContextBase
+{
+public:
+    explicit            OfPieTypeGroupContext( 
::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+    virtual             ~OfPieTypeGroupContext() override;
+
+    virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 
nElement, const AttributeList& rAttribs ) override;
+};
+
+
 /** Handler for radar type group context (c:radarChart element).
  */
 class RadarTypeGroupContext final : public TypeGroupContextBase
diff --git a/oox/inc/drawingml/chart/typegroupconverter.hxx 
b/oox/inc/drawingml/chart/typegroupconverter.hxx
index 6b780dd0ae15..e017f81e19c7 100644
--- a/oox/inc/drawingml/chart/typegroupconverter.hxx
+++ b/oox/inc/drawingml/chart/typegroupconverter.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
 
 #include <drawingml/chart/converterbase.hxx>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 
 namespace com::sun::star {
     namespace chart2 { class XChartType; }
@@ -160,6 +161,8 @@ public:
     void                convertPieRotation( PropertySet& rPropSet, sal_Int32 
nOoxAngle ) const;
     /** Sets the passed OOXML pie explosion at the passed property set. */
     void                convertPieExplosion( PropertySet& rPropSet, sal_Int32 
nOoxExplosion ) const;
+    /** Converts of-pie types */
+    css::chart2::PieChartSubType convertOfPieType(sal_Int32 nOoxOfPieType ) 
const;
 
 private:
     /** Inserts the passed series into the chart type. Adds additional 
properties to the series. */
diff --git a/oox/source/drawingml/chart/plotareacontext.cxx 
b/oox/source/drawingml/chart/plotareacontext.cxx
index 4afddee4700c..1004cdafb045 100644
--- a/oox/source/drawingml/chart/plotareacontext.cxx
+++ b/oox/source/drawingml/chart/plotareacontext.cxx
@@ -136,8 +136,9 @@ ContextHandlerRef PlotAreaContext::onCreateContext( 
sal_Int32 nElement, const At
                 case C_TOKEN( lineChart ):
                 case C_TOKEN( stockChart ):
                     return new LineTypeGroupContext( *this, 
mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
-                case C_TOKEN( doughnutChart ):
                 case C_TOKEN( ofPieChart ):
+                    return new OfPieTypeGroupContext( *this, 
mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
+                case C_TOKEN( doughnutChart ):
                 case C_TOKEN( pie3DChart ):
                 case C_TOKEN( pieChart ):
                     return new PieTypeGroupContext( *this, 
mrModel.maTypeGroups.create( nElement, bMSO2007Doc ) );
diff --git a/oox/source/drawingml/chart/typegroupcontext.cxx 
b/oox/source/drawingml/chart/typegroupcontext.cxx
index 96c4d6fc2bfc..9604e58a2507 100644
--- a/oox/source/drawingml/chart/typegroupcontext.cxx
+++ b/oox/source/drawingml/chart/typegroupcontext.cxx
@@ -255,6 +255,36 @@ ContextHandlerRef PieTypeGroupContext::onCreateContext( 
sal_Int32 nElement, cons
         case C_TOKEN( holeSize ):
             mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
             return nullptr;
+        case C_TOKEN( ser ):
+            return new PieSeriesContext( *this, 
mrModel.maSeries.create(bMSO2007Doc) );
+        case C_TOKEN( serLines ):
+            return new ShapePrWrapperContext( *this, 
mrModel.mxSerLines.create() );
+        case C_TOKEN( varyColors ):
+            mrModel.mbVaryColors = rAttribs.getBool( XML_val, !bMSO2007Doc );
+            return nullptr;
+    }
+    return nullptr;
+}
+
+OfPieTypeGroupContext::OfPieTypeGroupContext( ContextHandler2Helper& rParent, 
TypeGroupModel& rModel ) :
+    TypeGroupContextBase( rParent, rModel )
+{
+}
+
+OfPieTypeGroupContext::~OfPieTypeGroupContext()
+{
+}
+
+ContextHandlerRef OfPieTypeGroupContext::onCreateContext( sal_Int32 nElement, 
const AttributeList& rAttribs )
+{
+    bool bMSO2007Doc = getFilter().isMSO2007Document();
+    if( isRootElement() ) switch( nElement )
+    {
+        case C_TOKEN( dLbls ):
+            return new DataLabelsContext( *this, 
mrModel.mxLabels.create(bMSO2007Doc) );
+        case C_TOKEN( gapWidth ):
+            mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
+            return nullptr;
         case C_TOKEN( ofPieType ):
             mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
             return nullptr;
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx 
b/oox/source/drawingml/chart/typegroupconverter.cxx
index 327a855f708f..9e8691be5919 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/chart2/PolarCoordinateSystem3d.hpp>
 #include <com/sun/star/chart2/CurveStyle.hpp>
 #include <com/sun/star/chart2/DataPointGeometry3D.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 #include <com/sun/star/chart2/StackingDirection.hpp>
 #include <com/sun/star/chart2/Symbol.hpp>
 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
@@ -350,6 +351,13 @@ void TypeGroupConverter::convertFromModel( const 
Reference< XDiagram >& rxDiagra
                     not support pie rotation. */
                 if( !is3dChart() && (maTypeInfo.meTypeId != TYPEID_OFPIE) )
                     convertPieRotation( aDiaProp, mrModel.mnFirstAngle );
+
+                if (maTypeInfo.meTypeId == TYPEID_OFPIE) {
+                    aDiaProp.setProperty(PROP_SubPieType,
+                            convertOfPieType(mrModel.mnOfPieType));
+                } else {
+                    aDiaProp.setProperty(PROP_SubPieType, 
PieChartSubType_NONE);
+                }
             }
             break;
             default:;
@@ -575,6 +583,26 @@ void TypeGroupConverter::convertPieExplosion( PropertySet& 
rPropSet, sal_Int32 n
     }
 }
 
+PieChartSubType TypeGroupConverter::convertOfPieType(sal_Int32 nOoxOfPieType ) 
const
+{
+    if( maTypeInfo.meTypeCategory == TYPECATEGORY_PIE ) {
+        switch (nOoxOfPieType) {
+        case XML_pie:
+            return PieChartSubType_PIE;
+            break;
+        case XML_bar:
+            return PieChartSubType_BAR;
+            break;
+        default:
+            OSL_FAIL( "TypeGroupConverter::convertOfPieType - unknown of-pie 
type" );
+            return PieChartSubType_NONE;
+        }
+    } else {
+        return PieChartSubType_NONE;
+    }
+}
+
+
 // private --------------------------------------------------------------------
 
 void TypeGroupConverter::insertDataSeries( const Reference< XChartType >& 
rxChartType, const Reference< XDataSeries >& rxSeries, sal_Int32 nAxesSetIdx )
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index e980a4f18f35..58114eb2820e 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -65,6 +65,7 @@
 #include <com/sun/star/chart2/DataPointLabel.hpp>
 #include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
 #include <com/sun/star/chart2/DataPointCustomLabelFieldType.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
 #include <com/sun/star/chart2/Symbol.hpp>
 #include <com/sun/star/chart2/data/XDataSource.hpp>
 #include <com/sun/star/chart2/data/XDataProvider.hpp>
@@ -1691,14 +1692,44 @@ void ChartExport::exportPlotArea(const Reference< 
css::chart::XChartDocument >&
                         exportBubbleChart( xChartType );
                         break;
                     }
-                case chart::TYPEID_OFPIE:
-                    {
-                        break;
-                    }
-                case chart::TYPEID_DOUGHNUT:
+                case chart::TYPEID_DOUGHNUT: // doesn't currently happen
+                case chart::TYPEID_OFPIE:    // doesn't currently happen
                 case chart::TYPEID_PIE:
                     {
-                        exportPieChart( xChartType );
+                        sal_Int32 eCT = getChartType( );
+                        if(eCT == chart::TYPEID_DOUGHNUT)
+                        {
+                            exportDoughnutChart( xChartType );
+                        }
+                        else
+                        {
+
+                            PropertySet xChartTypeProp(rCT);
+                            chart2::PieChartSubType 
subtype(chart2::PieChartSubType_NONE);
+                            if (!xChartTypeProp.getProperty(subtype, 
PROP_SubPieType))
+                            {
+                                subtype = chart2::PieChartSubType_NONE;
+                            }
+                            if (subtype != chart2::PieChartSubType_NONE)
+                            {
+                                const char* sSubType = "pie";   // default
+                                switch (subtype) {
+                                    case chart2::PieChartSubType_PIE:
+                                        sSubType = "pie";
+                                        break;
+                                    case chart2::PieChartSubType_BAR:
+                                        sSubType = "bar";
+                                        break;
+                                    case chart2::PieChartSubType_NONE:
+                                    default:
+                                        assert(false);
+                                }
+
+                                exportOfPieChart(xChartType, sSubType);
+                            } else {
+                                exportPieChart( xChartType );
+                            }
+                        }
                         break;
                     }
                 case chart::TYPEID_RADARLINE:
@@ -2250,6 +2281,23 @@ void ChartExport::exportDoughnutChart( const Reference< 
chart2::XChartType >& xC
     pFS->endElement( FSNS( XML_c, XML_doughnutChart ) );
 }
 
+void ChartExport::exportOfPieChart(
+        const Reference< chart2::XChartType >& xChartType,
+        const char* sSubType )
+{
+    FSHelperPtr pFS = GetFS();
+    pFS->startElement(FSNS(XML_c, XML_ofPieChart));
+
+    pFS->singleElement(FSNS(XML_c, XML_ofPieType), XML_val, sSubType);
+
+    exportVaryColors(xChartType);
+
+    bool bPrimaryAxes = true;
+    exportAllSeries(xChartType, bPrimaryAxes);
+
+    pFS->endElement( FSNS( XML_c, XML_ofPieChart ) );
+}
+
 namespace {
 
 void writeDataLabelsRange(const FSHelperPtr& pFS, const XmlFilterBase* pFB, 
DataLabelsRange& rDLblsRange)
@@ -2330,12 +2378,6 @@ void ChartExport::exportLineChart( const Reference< 
chart2::XChartType >& xChart
 
 void ChartExport::exportPieChart( const Reference< chart2::XChartType >& 
xChartType )
 {
-    sal_Int32 eChartType = getChartType( );
-    if(eChartType == chart::TYPEID_DOUGHNUT)
-    {
-        exportDoughnutChart( xChartType );
-        return;
-    }
     FSHelperPtr pFS = GetFS();
     sal_Int32 nTypeId = XML_pieChart;
     if( mbIs3DChart )
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index a8764a432b5d..339e648b5f5b 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -535,6 +535,7 @@ StartWith
 StartingAngle
 State
 StringItemList
+SubPieType
 SubViewSize
 Subtotals
 Suffix
diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx
index 50978ed0fa75..b442dcb2b45c 100644
--- a/xmloff/inc/xmlprop.hxx
+++ b/xmloff/inc/xmlprop.hxx
@@ -593,6 +593,7 @@ inline constexpr OUString PROP_StandardPageMode = 
u"StandardPageMode"_ustr;
 inline constexpr OUString PROP_StartingAngle = u"StartingAngle"_ustr;
 inline constexpr OUString PROP_StepHelpCount = u"StepHelpCount"_ustr;
 inline constexpr OUString PROP_StepMain = u"StepMain"_ustr;
+inline constexpr OUString PROP_SubPieType = u"SubPieType"_ustr;
 inline constexpr OUString PROP_SurroundAnchorOnly = u"SurroundAnchorOnly"_ustr;
 inline constexpr OUString PROP_SurroundContour = u"SurroundContour"_ustr;
 inline constexpr OUString PROP_SymbolBitmap = u"SymbolBitmap"_ustr;

Reply via email to