summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/qa/extras/chart2export.cxx27
-rw-r--r--chart2/qa/extras/data/xlsx/tdf138204.xlsxbin0 -> 15138 bytes
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx1
-rw-r--r--offapi/com/sun/star/chart2/DataPointCustomLabelFieldType.idl3
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx2
-rw-r--r--oox/source/export/chartexport.cxx3
6 files changed, 35 insertions, 1 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
new file mode 100644
index 000000000000..04c2e50d799c
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/tdf138204.xlsx
Binary files 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;
}