Kaydet (Commit) f394d911 authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) Markus Mohrhard

tdf#123400 OOXML Chart: Export Data Label Separator

Export the data label separator XML tag and
the separated character to OOXML.

Change-Id: I9b3bcb588e42a42494107ebde70f4a72492cfac4
Reviewed-on: https://gerrit.libreoffice.org/67753
Tested-by: Jenkins
Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
(cherry picked from commit e32e5e61)
Reviewed-on: https://gerrit.libreoffice.org/67772Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst a65e4b90
...@@ -117,6 +117,7 @@ public: ...@@ -117,6 +117,7 @@ public:
void testCustomDataLabel(); void testCustomDataLabel();
void testCustomDataLabelMultipleSeries(); void testCustomDataLabelMultipleSeries();
void testNumberFormatExportPPTX(); void testNumberFormatExportPPTX();
void testLabelSeparatorExportDOCX();
void testChartTitlePropertiesColorFillPPTX(); void testChartTitlePropertiesColorFillPPTX();
void testChartTitlePropertiesGradientFillPPTX(); void testChartTitlePropertiesGradientFillPPTX();
void testChartTitlePropertiesBitmapFillPPTX(); void testChartTitlePropertiesBitmapFillPPTX();
...@@ -203,6 +204,7 @@ public: ...@@ -203,6 +204,7 @@ public:
CPPUNIT_TEST(testCustomDataLabel); CPPUNIT_TEST(testCustomDataLabel);
CPPUNIT_TEST(testCustomDataLabelMultipleSeries); CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
CPPUNIT_TEST(testNumberFormatExportPPTX); CPPUNIT_TEST(testNumberFormatExportPPTX);
CPPUNIT_TEST(testLabelSeparatorExportDOCX);
CPPUNIT_TEST(testChartTitlePropertiesColorFillPPTX); CPPUNIT_TEST(testChartTitlePropertiesColorFillPPTX);
CPPUNIT_TEST(testChartTitlePropertiesGradientFillPPTX); CPPUNIT_TEST(testChartTitlePropertiesGradientFillPPTX);
CPPUNIT_TEST(testChartTitlePropertiesBitmapFillPPTX); CPPUNIT_TEST(testChartTitlePropertiesBitmapFillPPTX);
...@@ -1892,6 +1894,24 @@ void Chart2ExportTest::testNumberFormatExportPPTX() ...@@ -1892,6 +1894,24 @@ void Chart2ExportTest::testNumberFormatExportPPTX()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0");
} }
void Chart2ExportTest::testLabelSeparatorExportDOCX()
{
load("/chart2/qa/extras/data/docx/", "testLabelSeparator.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);
// The text separator should be a new line
assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:dLbls/c:separator", "\n");
// The text separator should be a comma
assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:dLbls/c:separator", ", ");
// The text separator should be a semicolon
assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[3]/c:dLbls/c:separator", "; ");
}
void Chart2ExportTest::testChartTitlePropertiesColorFillPPTX() void Chart2ExportTest::testChartTitlePropertiesColorFillPPTX()
{ {
load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesColorFill.pptx"); load("/chart2/qa/extras/data/pptx/", "testChartTitlePropertiesColorFill.pptx");
......
...@@ -3134,6 +3134,17 @@ void writeLabelProperties( const FSHelperPtr& pFS, ChartExport* pChartExport, ...@@ -3134,6 +3134,17 @@ void writeLabelProperties( const FSHelperPtr& pFS, ChartExport* pChartExport,
pFS->singleElement(FSNS(XML_c, XML_showCatName), XML_val, ToPsz10(aLabel.ShowCategoryName), FSEND); pFS->singleElement(FSNS(XML_c, XML_showCatName), XML_val, ToPsz10(aLabel.ShowCategoryName), FSEND);
pFS->singleElement(FSNS(XML_c, XML_showSerName), XML_val, ToPsz10(false), FSEND); pFS->singleElement(FSNS(XML_c, XML_showSerName), XML_val, ToPsz10(false), FSEND);
pFS->singleElement(FSNS(XML_c, XML_showPercent), XML_val, ToPsz10(aLabel.ShowNumberInPercent), FSEND); pFS->singleElement(FSNS(XML_c, XML_showPercent), XML_val, ToPsz10(aLabel.ShowNumberInPercent), FSEND);
// Export the text "separator" if exists
uno::Any aAny = xPropSet->getPropertyValue("LabelSeparator");
if( aAny.hasValue() )
{
OUString nLabelSeparator;
aAny >>= nLabelSeparator;
pFS->startElement( FSNS( XML_c, XML_separator ), FSEND );
pFS->writeEscaped( nLabelSeparator );
pFS->endElement( FSNS( XML_c, XML_separator ) );
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment