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.grandin@collabora.co.uk>
This commit is contained in:
Kurt Nordback 2024-05-10 09:59:52 -06:00 committed by Noel Grandin
parent 3563fca550
commit 4425741937
3 changed files with 6 additions and 11 deletions

View file

@ -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;

View file

@ -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>

View file

@ -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)