diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2019-10-03 19:49:57 +0200 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2019-12-01 22:13:25 +0100 |
commit | 6afe2368a9ffa8e97148efc719d9983de803e2f9 (patch) | |
tree | f33781de69c394eb8778da0021d0bccbfc061d93 /chart2 | |
parent | 83574bfd3071f557ea67ad831f916fe75291b1e2 (diff) |
tdf#123206 Import/Export chart custom label text
OOX import supports custom label texts in chart diagrams (produced by
e.g. double clicking on a data label, and write custom text), but -
since embedded objects are exported and imported to odf right after migration -
it is not displayed in case of a Writer document.
In order to make it work, we have to support custom label text in the
odf structure. This commit only allows the import/export of pure text,
it should be improved to store and load formatted string.
A new XML token is added, which currently refers to an attribute of the
chart:data-point tag. If we want to store formatted string, something
more clever has to be done.
Change-Id: I80c4a3a0dbcf59f1dc732d795fb716da318411cb
Reviewed-on: https://gerrit.libreoffice.org/80156
Tested-by: Jenkins
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/84075
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 16 | ||||
-rwxr-xr-x | chart2/qa/extras/data/docx/tdf123206.docx | bin | 0 -> 24223 bytes |
2 files changed, 16 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 77bc24a7ac46..e15cd39a20da 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -127,6 +127,7 @@ public: void testTdf119029(); void testTdf121744(); void testTdf122031(); + void testTdf123206_customLabelText(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -216,6 +217,8 @@ public: CPPUNIT_TEST(testTdf119029); CPPUNIT_TEST(testTdf121744); CPPUNIT_TEST(testTdf122031); + CPPUNIT_TEST(testTdf123206_customLabelText); + CPPUNIT_TEST_SUITE_END(); protected: @@ -2022,6 +2025,19 @@ void Chart2ExportTest::testTdf122031() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[3]/c:numFmt", "formatCode", "0.000%"); } +void Chart2ExportTest::testTdf123206_customLabelText() +{ + load("/chart2/qa/extras/data/docx/", "tdf123206.docx"); + + Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xChartDoc.is()); + + xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text"); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r/a:t", "kiscica"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/docx/tdf123206.docx b/chart2/qa/extras/data/docx/tdf123206.docx Binary files differnew file mode 100755 index 000000000000..f47089fe3b1b --- /dev/null +++ b/chart2/qa/extras/data/docx/tdf123206.docx |