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-11-29 16:44:12 +0100 |
commit | c2b36cd6f7cf70e77dac5938f18146b0687523e6 (patch) | |
tree | 74f1d2f6794160341aca848c2179770844b4009e /chart2 | |
parent | db0f4b28d9f1583d9977f76114d86bac489de161 (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>
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 8d42c8ac93ac..1645c1c1d1ae 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -149,6 +149,7 @@ public: void testTdf121744(); void testTdf122031(); void testTdf115012(); + void testTdf123206_customLabelText(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -261,6 +262,8 @@ public: CPPUNIT_TEST(testTdf121744); CPPUNIT_TEST(testTdf122031); CPPUNIT_TEST(testTdf115012); + CPPUNIT_TEST(testTdf123206_customLabelText); + CPPUNIT_TEST_SUITE_END(); protected: @@ -2386,6 +2389,19 @@ void Chart2ExportTest::testTdf115012() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:dispBlanksAs", "val", "zero"); } +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 |