diff options
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 26 | ||||
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 2 | ||||
-rw-r--r-- | chart2/qa/extras/data/xlsx/custom_data_label.xlsx | bin | 0 -> 13944 bytes | |||
-rw-r--r-- | oox/source/drawingml/chart/seriesconverter.cxx | 1 |
4 files changed, 27 insertions, 2 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 628bdb98b213..f9b2651a922c 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -173,6 +173,7 @@ public: void testTdf133191(); void testTdf132594(); void testTdf134255(); + void testTdf134977(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -309,6 +310,7 @@ public: CPPUNIT_TEST(testTdf133191); CPPUNIT_TEST(testTdf132594); CPPUNIT_TEST(testTdf134255); + CPPUNIT_TEST(testTdf134977); CPPUNIT_TEST_SUITE_END(); @@ -2238,7 +2240,7 @@ void Chart2ExportTest::testCustomDataLabel() CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString()); aFields[5]->getPropertyValue("CharHeight") >>= nFontSize; aFields[5]->getPropertyValue("CharColor") >>= nFontColor; - CPPUNIT_ASSERT_EQUAL(static_cast<float>(13), nFontSize); + CPPUNIT_ASSERT_EQUAL(static_cast<float>(11.97), nFontSize); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xbf9000), nFontColor); CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE, aFields[6]->getFieldType()); @@ -2837,6 +2839,28 @@ void Chart2ExportTest::testTdf134255() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:txPr/a:bodyPr", "wrap", "square"); } +void Chart2ExportTest::testTdf134977() +{ + load("/chart2/qa/extras/data/xlsx/", "custom_data_label.xlsx"); + + //import test + uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc.is()); + Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc(xChartDoc, 0); + CPPUNIT_ASSERT(xDataSeries.is()); + uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW); + uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields; + float nFontSize; + xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields; + aFields[0]->getPropertyValue("CharHeight") >>= nFontSize; + CPPUNIT_ASSERT_EQUAL(static_cast<float>(9), nFontSize); + + //export test + xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML"); + CPPUNIT_ASSERT(pXmlDoc); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:r/a:rPr", "sz", "900"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 6c982238a5b3..d502d163fc64 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -1862,7 +1862,7 @@ void Chart2ImportTest::testTdf115107() CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString()); aFields[5]->getPropertyValue("CharHeight") >>= nFontSize; aFields[5]->getPropertyValue("CharColor") >>= nFontColor; - CPPUNIT_ASSERT_EQUAL(static_cast<float>(13), nFontSize); + CPPUNIT_ASSERT_EQUAL(static_cast<float>(11.97), nFontSize); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xbf9000), nFontColor); CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE, aFields[6]->getFieldType()); diff --git a/chart2/qa/extras/data/xlsx/custom_data_label.xlsx b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx Binary files differnew file mode 100644 index 000000000000..cc69aaf0dc66 --- /dev/null +++ b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index b34bc355ca4d..6e75fc89beab 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -315,6 +315,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat // Store properties oox::PropertySet aPropertySet( xCustomLabel ); + convertTextProperty( aPropertySet, getFormatter(), mrModel.mxText->mxTextBody ); pRun->getTextCharacterProperties().pushToPropSet( aPropertySet, getFilter() ); TextField* pField = nullptr; |