diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-11-16 14:44:45 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-11-17 11:10:09 +0100 |
commit | 4930749294475cc28afd06cd11fdf56a157ad9ce (patch) | |
tree | aaf87283eb47c7e44cd34361c8f5408d41f50456 /chart2 | |
parent | 1724b7a2cb16336b2c6e066504708396b8ecfa32 (diff) |
tdf#138204 Chart OOXML Import: doesn't show placeholder
for CELLRANGE data label field type. Add CELLRANGE to enum
com::sun::star::chart2::DataPointCustomLabelFieldType, like
we do at CELLREF, while both of them are not implemented, see
commit 790f9abeb1a1167ad5ab84c5fb855b36669c125b
(tdf#114821 import complex data labels in bar chart).
Regression from commit: 0d2340998415fb4b2f794054c62ef61c83e32155
(tdf#136061 Chart ODF/OOXML: fix missing custom labels)
Change-Id: I8e0f4ca9db6e613a190cbda31504a7542fc13a86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105934
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 27 | ||||
-rw-r--r-- | chart2/qa/extras/data/xlsx/tdf138204.xlsx | bin | 0 -> 15138 bytes | |||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 73f9166d176c..9637aebd4e53 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -182,6 +182,7 @@ public: void testTdf136267(); void testDataLabelPlacementPieChart(); void testTdf137917(); + void testTdf138204(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -326,6 +327,7 @@ public: CPPUNIT_TEST(testTdf136267); CPPUNIT_TEST(testDataLabelPlacementPieChart); CPPUNIT_TEST(testTdf137917); + CPPUNIT_TEST(testTdf138204); CPPUNIT_TEST_SUITE_END(); @@ -2984,6 +2986,31 @@ void Chart2ExportTest::testTdf137917() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:minorTimeUnit", "val", "days"); } +void Chart2ExportTest::testTdf138204() +{ + load("/chart2/qa/extras/data/xlsx/", "tdf138204.xlsx"); + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + CPPUNIT_ASSERT(pXmlDoc); + + // Check the first data label field type + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:fld", "type", "CELLRANGE"); + + Reference< chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc.is()); + + uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 1)); + CPPUNIT_ASSERT(xDataSeries.is()); + + uno::Reference<beans::XPropertySet> xPropertySet; + uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields; + xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW); + xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aFields.getLength()); + + CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE, aFields[0]->getFieldType()); + //CPPUNIT_ASSERT_EQUAL(OUString("67.5%"), aFields[0]->getString()); TODO: Not implemented yet +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/xlsx/tdf138204.xlsx b/chart2/qa/extras/data/xlsx/tdf138204.xlsx Binary files differnew file mode 100644 index 000000000000..04c2e50d799c --- /dev/null +++ b/chart2/qa/extras/data/xlsx/tdf138204.xlsx diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index b502efd83fe5..132903ba4d30 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -542,6 +542,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re break; } case DataPointCustomLabelFieldType_CELLREF: + case DataPointCustomLabelFieldType_CELLRANGE: { // TODO: for now doesn't show placeholder aTextList[i] = OUString(); |