summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2020-11-16 15:12:43 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-11-24 14:58:29 +0100
commit3e8cdf07e8c987ebf43a1271ae26ac38f13c7e33 (patch)
treee2a30bbda023723b869a9e050f6fb014dc8310a1 /oox
parente0c1dcd97edc1194e4445a45a815406446c1c7d7 (diff)
tdf#138181 Chart OOXML: fix deleted legend entries of pie charts
The legend of the pie chart showed deleted legend entries too when VaryColorsByPoint was false. Change-Id: I6fc978af0db6e2d39d7f451e765d7ef81c73a05c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105943 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 3be5e428d669accd841949662d601a6f6e1cdb3f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106443 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/chart/titleconverter.cxx9
-rw-r--r--oox/source/export/chartexport.cxx9
2 files changed, 16 insertions, 2 deletions
diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx
index c4bf45dea739..f39929134b63 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -290,6 +290,13 @@ void LegendConverter::legendEntriesFormatting(const Reference<XDiagram>& rxDiagr
if (!xDSCont.is())
continue;
+ bool bIsPie
+ = rCT->getChartType().equalsIgnoreAsciiCase("com.sun.star.chart2.PieChartType");
+ if (bIsPie)
+ {
+ PropertySet xChartTypeProp(rCT);
+ bIsPie = !xChartTypeProp.getBoolProperty(PROP_UseRings);
+ }
const Sequence<Reference<XDataSeries>> aDataSeriesSeq = xDSCont->getDataSeries();
if (bSwapXAndY)
nIndex += aDataSeriesSeq.getLength() - 1;
@@ -298,7 +305,7 @@ void LegendConverter::legendEntriesFormatting(const Reference<XDiagram>& rxDiagr
PropertySet aSeriesProp(rDataSeries);
bool bVaryColorsByPoint = aSeriesProp.getBoolProperty(PROP_VaryColorsByPoint);
- if (bVaryColorsByPoint)
+ if (bVaryColorsByPoint || bIsPie)
{
Reference<XDataSource> xDSrc(rDataSeries, UNO_QUERY);
if (!xDSrc.is())
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 3ea7a1d7eb7a..38295504105b 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1183,6 +1183,13 @@ void ChartExport::exportLegend( const Reference< css::chart::XChartDocument >& x
if (!xDSCont.is())
continue;
+ OUString aChartType(rCT->getChartType());
+ bool bIsPie = lcl_getChartType(aChartType) == chart::TYPEID_PIE;
+ if (bIsPie)
+ {
+ PropertySet xChartTypeProp(rCT);
+ bIsPie = !xChartTypeProp.getBoolProperty(PROP_UseRings);
+ }
const Sequence<Reference<chart2::XDataSeries>> aDataSeriesSeq = xDSCont->getDataSeries();
if (bSwapXAndY)
nIndex += aDataSeriesSeq.getLength() - 1;
@@ -1190,7 +1197,7 @@ void ChartExport::exportLegend( const Reference< css::chart::XChartDocument >& x
{
PropertySet aSeriesProp(rDataSeries);
bool bVaryColorsByPoint = aSeriesProp.getBoolProperty(PROP_VaryColorsByPoint);
- if (bVaryColorsByPoint)
+ if (bVaryColorsByPoint || bIsPie)
{
Sequence<sal_Int32> deletedLegendEntriesSeq;
aSeriesProp.getProperty(deletedLegendEntriesSeq, PROP_DeletedLegendEntries);