summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikhil Walvekar <nikhil.walvekar@synerzip.com>2013-12-12 17:50:37 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-19 03:55:05 +0100
commitcf5c3e97b66ef31f2b8db4dca4c8eb179754e694 (patch)
tree587de0af8785a0f6ad08653df744bde83967b857
parentba76bf5c7b705d3f5e8d807346a34d9da34127d3 (diff)
fdo#72304 Write Chart Data Table information back to XML.
During export access properties stored during import and write back those. Currently we just support basic chart data table information such as border and outline, there are more properties, which are pending. Conflicts: chart2/qa/extras/chart2export.cxx Change-Id: Icbc1245fc829f49833a8c307e029c3dd3dc2e0bd
-rw-r--r--chart2/qa/extras/chart2export.cxx13
-rw-r--r--chart2/qa/extras/data/docx/testChartDataTable.docxbin0 -> 18084 bytes
-rw-r--r--include/oox/export/chartexport.hxx1
-rw-r--r--oox/source/export/chartexport.cxx39
4 files changed, 51 insertions, 2 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index dbc0a0d2c9fc..eee9161d8bbb 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -35,6 +35,7 @@ public:
void testStockChart();
void testBarChart();
void testCrosses();
+ void testChartDataTable();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(test);
@@ -43,7 +44,7 @@ public:
CPPUNIT_TEST(testStockChart);
CPPUNIT_TEST(testBarChart);
CPPUNIT_TEST(testCrosses);
-
+ CPPUNIT_TEST(testChartDataTable);
CPPUNIT_TEST_SUITE_END();
protected:
@@ -434,6 +435,16 @@ void Chart2ExportTest::testCrosses()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero");
}
+void Chart2ExportTest::testChartDataTable()
+{
+ load("/chart2/qa/extras/data/docx/", "testChartDataTable.docx");
+
+ xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+ CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showHorzBorder", "val", "1");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showVertBorder", "val", "1");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dTable/c:showOutline", "val", "1");
+}
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
diff --git a/chart2/qa/extras/data/docx/testChartDataTable.docx b/chart2/qa/extras/data/docx/testChartDataTable.docx
new file mode 100644
index 000000000000..8663e8937ea9
--- /dev/null
+++ b/chart2/qa/extras/data/docx/testChartDataTable.docx
Binary files differ
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 1e6278ba4d82..a0f8d319468a 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -118,6 +118,7 @@ private:
void exportTitle( com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape > xShape );
void exportPlotArea( );
+ void exportDataTable( );
void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 75752636da03..6a759d0b101c 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1080,11 +1080,48 @@ void ChartExport::exportPlotArea( )
exportShapeProps( xWallPropSet );
}
}
-
+ exportDataTable();
pFS->endElement( FSNS( XML_c, XML_plotArea ) );
}
+void ChartExport::exportDataTable( )
+{
+ FSHelperPtr pFS = GetFS();
+ Reference< beans::XPropertySet > aPropSet( mxDiagram, uno::UNO_QUERY );
+
+ sal_Bool bShowVBorder = sal_False;
+ sal_Bool bShowHBorder = sal_False;
+ sal_Bool bShowOutline = sal_False;
+
+ if (GetProperty( aPropSet, "DataTableHBorder"))
+ mAny >>= bShowHBorder;
+ if (GetProperty( aPropSet, "DataTableVBorder"))
+ mAny >>= bShowVBorder;
+ if (GetProperty( aPropSet, "DataTableOutline"))
+ mAny >>= bShowOutline;
+
+ if (bShowVBorder || bShowHBorder || bShowOutline)
+ {
+ pFS->startElement( FSNS( XML_c, XML_dTable),
+ FSEND );
+ if (bShowHBorder)
+ pFS->singleElement( FSNS( XML_c, XML_showHorzBorder ),
+ XML_val, "1",
+ FSEND );
+ if (bShowVBorder)
+ pFS->singleElement( FSNS( XML_c, XML_showVertBorder ),
+ XML_val, "1",
+ FSEND );
+ if (bShowOutline)
+ pFS->singleElement( FSNS( XML_c, XML_showOutline ),
+ XML_val, "1",
+ FSEND );
+
+ pFS->endElement( FSNS( XML_c, XML_dTable));
+ }
+
+}
void ChartExport::exportAreaChart( Reference< chart2::XChartType > xChartType )
{
FSHelperPtr pFS = GetFS();