chart2/qa/extras/chart2export.cxx                  |   14 ++++----------
 chart2/source/view/inc/VDataSeries.hxx             |    1 -
 chart2/source/view/main/SeriesPlotterContainer.cxx |    2 ++
 3 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 4425741937fbd240fe414a68a7d5e9ac4b40affd
Author:     Kurt Nordback <kurt.nordb...@protonmail.com>
AuthorDate: Fri May 10 09:59:52 2024 -0600
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri May 10 19:57:15 2024 +0200

    tdf#161013 Rendering error when changing chart type for saved of-pie chart
    
    Reset pie sub-type property in XDiagram after passing it down,
    so that it does not persist and overwrite the modified sub-type
    
    Change-Id: If23ef2b1cff29efa5232d49381676592a0f39d17
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167487
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index 1c4977f5d38b..4335ee9ff887 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -1147,11 +1147,8 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest, tdf50934_barOfPie)
             xChartType->getChartType());
 
     // Verify that it saves and loads as bar-of-pie
-    Reference< chart2::XDiagram> xDia(xChartDoc->getFirstDiagram());
-    CPPUNIT_ASSERT(xDia.is());
-    uno::Reference< beans::XPropertySet > xDiaProp( xDia, uno::UNO_QUERY );
-    CPPUNIT_ASSERT(xDiaProp.is());
-    uno::Any aAny = xDiaProp->getPropertyValue(u"SubPieType"_ustr);
+    Reference< beans::XPropertySet > xPropSet( xChartType, 
uno::UNO_QUERY_THROW );
+    uno::Any aAny = xPropSet->getPropertyValue(u"SubPieType"_ustr);
     CPPUNIT_ASSERT(aAny.hasValue());
     chart2::PieChartSubType subPieType;
     aAny >>= subPieType;
@@ -1173,11 +1170,8 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest, tdf50934_pieOfPie)
             xChartType->getChartType());
 
     // Verify that it saves and loads as pie-of-pie
-    Reference< chart2::XDiagram> xDia(xChartDoc->getFirstDiagram());
-    CPPUNIT_ASSERT(xDia.is());
-    uno::Reference< beans::XPropertySet > xDiaProp( xDia, uno::UNO_QUERY );
-    CPPUNIT_ASSERT(xDiaProp.is());
-    uno::Any aAny = xDiaProp->getPropertyValue(u"SubPieType"_ustr);
+    Reference< beans::XPropertySet > xPropSet( xChartType, 
uno::UNO_QUERY_THROW );
+    uno::Any aAny = xPropSet->getPropertyValue(u"SubPieType"_ustr);
     CPPUNIT_ASSERT(aAny.hasValue());
     chart2::PieChartSubType subPieType;
     aAny >>= subPieType;
diff --git a/chart2/source/view/inc/VDataSeries.hxx 
b/chart2/source/view/inc/VDataSeries.hxx
index dd5054d26bd8..72f5fca80089 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -26,7 +26,6 @@
 #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>
 
diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx 
b/chart2/source/view/main/SeriesPlotterContainer.cxx
index 557bbdae3c11..c76d96a4f20f 100644
--- a/chart2/source/view/main/SeriesPlotterContainer.cxx
+++ b/chart2/source/view/main/SeriesPlotterContainer.cxx
@@ -232,6 +232,8 @@ void 
SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart
             {
                 xChartType->setFastPropertyValue(PROP_PIECHARTTYPE_SUBTYPE,
                                                  uno::Any(ePieChartSubType));
+                // Reset the diagram-level property so it's not persistent.
+                xDiagram->setPropertyValue(u"SubPieType"_ustr, 
uno::Any(PieChartSubType_NONE));
             }
 
             if (nT == 0)

Reply via email to