[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - chart2/qa oox/source
Szymon Kłos
szymon.klos at collabora.com
Wed Feb 28 08:08:46 UTC 2018
chart2/qa/extras/chart2export.cxx | 12 ++++++++++++
chart2/qa/extras/data/pptx/tdf115859.pptx |binary
oox/source/export/chartexport.cxx | 18 ++++++++++++++++++
3 files changed, 30 insertions(+)
New commits:
commit 61e3140a9ccf22fd19df0578d61833f8a1abbe08
Author: Szymon Kłos <szymon.klos at collabora.com>
Date: Mon Feb 19 18:18:20 2018 +0100
tdf#115859 Export number format for chart series
Change-Id: I65d30c6b92a530eadbd6fabe87fa8bd3416fee20
Reviewed-on: https://gerrit.libreoffice.org/50395
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index fed9f5996916..4b21f18f7248 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -101,6 +101,7 @@ public:
void testMultipleAxisXLSX();
void testAxisTitleRotationXLSX();
void testAxisCrossBetweenXSLX();
+ void testNumberFormatExportPPTX();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -166,6 +167,7 @@ public:
CPPUNIT_TEST(testMultipleAxisXLSX);
CPPUNIT_TEST(testAxisTitleRotationXLSX);
CPPUNIT_TEST(testAxisCrossBetweenXSLX);
+ CPPUNIT_TEST(testNumberFormatExportPPTX);
CPPUNIT_TEST_SUITE_END();
protected:
@@ -1561,6 +1563,16 @@ void Chart2ExportTest::testAxisCrossBetweenXSLX()
assertXPath(pXmlDoc, "(//c:crossBetween)[1]", "val", "midCat");
}
+void Chart2ExportTest::testNumberFormatExportPPTX()
+{
+ load("/chart2/qa/extras/data/pptx/", "tdf115859.pptx");
+ xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart1", "Impress MS PowerPoint 2007 XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "formatCode", "#,##0.00,\\K");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/pptx/tdf115859.pptx b/chart2/qa/extras/data/pptx/tdf115859.pptx
new file mode 100644
index 000000000000..07943041bed8
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf115859.pptx differ
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 128a166c6c4a..4e789f9b3c97 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2930,6 +2930,24 @@ void ChartExport::exportDataLabels(
FSHelperPtr pFS = GetFS();
pFS->startElement(FSNS(XML_c, XML_dLbls), FSEND);
+ bool bLinkedNumFmt = true;
+ if (GetProperty(xPropSet, "LinkNumberFormatToSource"))
+ mAny >>= bLinkedNumFmt;
+
+ if (GetProperty(xPropSet, "NumberFormat"))
+ {
+ sal_Int32 nKey = 0;
+ mAny >>= nKey;
+
+ OUString aNumberFormatString = getNumberFormatCode(nKey);
+ OString sNumberFormatString = OUStringToOString(aNumberFormatString, RTL_TEXTENCODING_UTF8);
+
+ pFS->singleElement(FSNS(XML_c, XML_numFmt),
+ XML_formatCode, sNumberFormatString.getStr(),
+ XML_sourceLinked, bLinkedNumFmt ? "1" : "0",
+ FSEND);
+ }
+
uno::Sequence<sal_Int32> aAttrLabelIndices;
xPropSet->getPropertyValue("AttributedDataPoints") >>= aAttrLabelIndices;
More information about the Libreoffice-commits
mailing list