Kaydet (Commit) 1d497297 authored tarafından sushil_shinde's avatar sushil_shinde Kaydeden (comit) Markus Mohrhard

fdo#74112 Write Chart Displayunits information back to XML.

   During export access properties stored during import
   and write back those. Currently we just support basic chart
   display unit information such as builtinunit, there are more
   properties ex. custUnit, dispUnitsLbl, extLst.
   which are pending.

Conflicts:

	chart2/qa/extras/chart2export.cxx

Change-Id: I87e0a8322fc0b0c3df2b8053b7f29fffea611040
Reviewed-on: https://gerrit.libreoffice.org/7722Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 83055835
...@@ -42,6 +42,7 @@ public: ...@@ -42,6 +42,7 @@ public:
void testAreaChartLoad(); void testAreaChartLoad();
void testUpDownBars(); void testUpDownBars();
void testDoughnutChart(); void testDoughnutChart();
void testDisplayUnits();
CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(test); CPPUNIT_TEST(test);
...@@ -56,6 +57,7 @@ public: ...@@ -56,6 +57,7 @@ public:
CPPUNIT_TEST(testAreaChartLoad); CPPUNIT_TEST(testAreaChartLoad);
CPPUNIT_TEST(testUpDownBars); CPPUNIT_TEST(testUpDownBars);
CPPUNIT_TEST(testDoughnutChart); CPPUNIT_TEST(testDoughnutChart);
CPPUNIT_TEST(testDisplayUnits);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
protected: protected:
...@@ -533,6 +535,14 @@ void Chart2ExportTest::testDoughnutChart() ...@@ -533,6 +535,14 @@ void Chart2ExportTest::testDoughnutChart()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart", "1"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:doughnutChart", "1");
} }
void Chart2ExportTest::testDisplayUnits()
{
load("/chart2/qa/extras/data/docx/", "DisplayUnits.docx");
xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
CPPUNIT_ASSERT(pXmlDoc);
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:dispUnits/c:builtInUnit", "val", "billions");
}
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -2389,6 +2389,31 @@ void ChartExport::_exportAxis( ...@@ -2389,6 +2389,31 @@ void ChartExport::_exportAxis(
FSEND ); FSEND );
} }
sal_Bool bDisplayUnits = sal_False;
if(GetProperty( xAxisProp, "DisplayUnits" ) )
{
mAny >>= bDisplayUnits;
if(bDisplayUnits)
{
OUString aVal;
pFS->startElement( FSNS( XML_c, XML_dispUnits ),
FSEND );
if(GetProperty( xAxisProp, "BuiltInUnit" ))
{
mAny >>= aVal;
if(!aVal.isEmpty())
{
OString aBuiltInUnit = OUStringToOString(aVal, RTL_TEXTENCODING_UTF8);
pFS->singleElement( FSNS( XML_c, XML_builtInUnit ),
XML_val, aBuiltInUnit.getStr(),
FSEND );
}
}
pFS->singleElement(FSNS( XML_c, XML_dispUnitsLbl ),FSEND);
pFS->endElement( FSNS( XML_c, XML_dispUnits ) );
}
}
// TODO: text properties // TODO: text properties
pFS->endElement( FSNS( XML_c, nAxisType ) ); pFS->endElement( FSNS( XML_c, nAxisType ) );
......
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