chart2/qa/extras/chart2export.cxx | 27 +++++++++++ chart2/qa/extras/data/xlsx/tdf138204.xlsx |binary chart2/source/view/charttypes/VSeriesPlotter.cxx | 1 offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl | 3 - oox/source/drawingml/chart/seriesconverter.cxx | 2 oox/source/export/chartexport.cxx | 3 + 6 files changed, 35 insertions(+), 1 deletion(-)
New commits: commit 4930749294475cc28afd06cd11fdf56a157ad9ce Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Mon Nov 16 14:44:45 2020 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Tue Nov 17 11:10:09 2020 +0100 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> 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 new file mode 100644 index 000000000000..04c2e50d799c Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf138204.xlsx differ 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(); diff --git a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl index 05c26a738684..f5ea79ca68d5 100644 --- a/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl +++ b/offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl @@ -24,7 +24,8 @@ enum DataPointCustomLabelFieldType CATEGORYNAME, CELLREF, NEWLINE, - PERCENTAGE + PERCENTAGE, + CELLRANGE }; }; }; }; }; diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 416e6c32e638..2de8ee82d2f9 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -249,6 +249,8 @@ DataPointCustomLabelFieldType lcl_ConvertFieldNameToFieldEnum( const OUString& r return DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CATEGORYNAME; else if (rField == "CELLREF") return DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLREF; + else if (rField == "CELLRANGE") + return DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_CELLRANGE; else if (rField == "PERCENTAGE") return DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_PERCENTAGE; else diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 5f9a35b41ac5..3ea7a1d7eb7a 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -3397,6 +3397,9 @@ OUString getFieldTypeString( const chart2::DataPointCustomLabelFieldType aType ) case chart2::DataPointCustomLabelFieldType_CELLREF: return "CELLREF"; + case chart2::DataPointCustomLabelFieldType_CELLRANGE: + return "CELLRANGE"; + default: break; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits