summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2020-11-02 10:28:51 +0100
committerLászló Németh <nemeth@numbertext.org>2020-11-12 13:58:17 +0100
commitd23aed9a1fbb6549ca3b8a3e2ab5d779c84e3fb5 (patch)
tree0bfb17366f954885d0205e581618ebf14f407268
parent3238606c8470f3eaeada3fc601e186ec5cfac925 (diff)
tdf#137874 Chart OOXML import: fix pie chart legend entries
Pie chart legend changed when VaryColorsByPoint was false. Change-Id: I8022e5290f2269a902b4417f91d2e454f088c553 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105172 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--chart2/qa/extras/chart2import.cxx16
-rw-r--r--chart2/qa/extras/data/xlsx/piechart_legend.xlsxbin0 -> 13426 bytes
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx4
3 files changed, 19 insertions, 1 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 62f9b85c1d76..883d50ca88d9 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -171,6 +171,7 @@ public:
void testTdf136752();
void testTdf137505();
void testTdf137734();
+ void testTdf137874();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -288,6 +289,7 @@ public:
CPPUNIT_TEST(testTdf136752);
CPPUNIT_TEST(testTdf137505);
CPPUNIT_TEST(testTdf137734);
+ CPPUNIT_TEST(testTdf137874);
CPPUNIT_TEST_SUITE_END();
@@ -2753,6 +2755,20 @@ void Chart2ImportTest::testTdf137734()
CPPUNIT_ASSERT_EQUAL(0.0, nRotation);
}
+void Chart2ImportTest::testTdf137874()
+{
+ load("/chart2/qa/extras/data/xlsx/", "piechart_legend.xlsx");
+ Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0, mxComponent),
+ UNO_QUERY_THROW);
+ Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
+ Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
+ Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW);
+ Reference<drawing::XShape> xLegendEntry;
+ xLegendEntry
+ = getShapeByName(xShapes, "CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=0:LegendEntry=0");
+ CPPUNIT_ASSERT(xLegendEntry.is());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/piechart_legend.xlsx b/chart2/qa/extras/data/xlsx/piechart_legend.xlsx
new file mode 100644
index 000000000000..baea1de9b0b9
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/piechart_legend.xlsx
Binary files differ
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index d40d52e7bc7a..b502efd83fe5 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2668,7 +2668,9 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries(
ViewLegendEntry aEntry;
OUString aLabelText;
bool bVaryColorsByPoint = rSeries.isVaryColorsByPoint();
- if( bVaryColorsByPoint )
+ if (bVaryColorsByPoint
+ || m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(
+ CHART2_SERVICE_NAME_CHARTTYPE_PIE))
{
Sequence< OUString > aCategoryNames;
if( m_pExplicitCategoriesProvider )