chart2/qa/extras/chart2export.cxx | 22 ++++++++++++++++++++++ chart2/qa/extras/data/docx/testStockChart.docx |binary oox/source/export/chartexport.cxx | 6 ++++-- oox/source/export/shapes.cxx | 25 +++++++++++++++---------- 4 files changed, 41 insertions(+), 12 deletions(-)
New commits: commit e516f8be79ddc9d845d8141075f7d558c25c1636 Author: Pallavi Jadhav <pallavi.jad...@synerzip.com> Date: Wed Dec 4 15:03:00 2013 +0530 fdo#72226: Fix for Stock chart Invalid RT Issue : In chart1.xml, <c:chart> <c:plotArea> <c:stockChart> there are four types of series as Open,Low,High and Close. For Open series, <c:ser> <c:idx val="0" /> <c:order val="0" /> an attribute "val" should be 1 and not 0. i.e. index should start from 1 and not from 0. Implementation : - In ChartExport::exportCandleStickSeries(), Using idx variable, we are writing index value which should be greater than 0. So for idx=0, we are adding value 1 while writing index value. - Added Unit tese case for chart export Conflicts: chart2/qa/extras/chart2export.cxx Change-Id: I4d5ffefbc8fcf62b50c13ca1b3ed80290962fc4e Reviewed-on: https://gerrit.libreoffice.org/6925 Tested-by: Norbert Thiebaud <nthieb...@gmail.com> Reviewed-by: Norbert Thiebaud <nthieb...@gmail.com> diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index fa4d619..77a823a 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -23,10 +23,13 @@ public: void testErrorBarXLSX(); void testTrendline(); + void testStockChart(); + CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(test); CPPUNIT_TEST(testErrorBarXLSX); CPPUNIT_TEST(testTrendline); + CPPUNIT_TEST(testStockChart); CPPUNIT_TEST_SUITE_END(); private: @@ -255,6 +258,25 @@ void Chart2ExportTest::testTrendline() } +void Chart2ExportTest::testStockChart() +{ + /* For attached file Stock_Chart.docx, in chart1.xml, + * <c:stockChart>, there are four types of series as + * Open,Low,High and Close. + * For Open series, in <c:idx val="0" /> + * an attribute val of index should start from 1 and not from 0. + * Which was problem area. + */ + load("/chart2/qa/extras/data/docx/", "testStockChart.docx"); + { + xmlDocPtr pXmlDoc = parseExport("word/charts/chart1.xml"); + if (!pXmlDoc) + return; + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:idx", "val", "1"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:order", "val", "1"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v", "Open"); + } +} CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/docx/testStockChart.docx b/chart2/qa/extras/data/docx/testStockChart.docx new file mode 100644 index 0000000..a804e7d Binary files /dev/null and b/chart2/qa/extras/data/docx/testStockChart.docx differ diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 3768cd3..9655f3e 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1626,6 +1626,7 @@ void ChartExport::exportCandleStickSeries( Reference< chart2::XChartDocument > xNewDoc( getModel(), uno::UNO_QUERY ); const char* sSeries[] = {"values-first","values-max","values-min","values-last",0}; + for( sal_Int32 idx = 0; sSeries[idx] != 0 ; idx++ ) { Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( lcl_getDataSequenceByRole( aSeqCnt, OUString::createFromAscii(sSeries[idx]) ) ); @@ -1639,11 +1640,12 @@ void ChartExport::exportCandleStickSeries( FSEND ); // TODO: idx and order + // idx attribute should start from 1 and not from 0. pFS->singleElement( FSNS( XML_c, XML_idx ), - XML_val, I32S(idx), + XML_val, I32S(idx+1), FSEND ); pFS->singleElement( FSNS( XML_c, XML_order ), - XML_val, I32S(idx), + XML_val, I32S(idx+1), FSEND ); // export label commit 784d3e2b49fb55bfc46723a99fd00d43f31e090a Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Dec 11 17:07:16 2013 +0100 drawingml export: fix EllipseShape for docx Change-Id: Ifc5e6ae2f3161e33f93b1485269f6dc164f74e40 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index d63e8e7..3616c4e 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -338,19 +338,24 @@ ShapeExport& ShapeExport::WriteEllipseShape( Reference< XShape > xShape ) FSHelperPtr pFS = GetFS(); - pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); + pFS->startElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp), FSEND ); // TODO: arc, section, cut, connector // non visual shape properties - pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); - pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, - XML_id, I32S( GetNewShapeID( xShape ) ), - XML_name, IDS( Ellipse ), - FSEND ); - pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND ); - WriteNonVisualProperties( xShape ); - pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); + if (GetDocumentType() != DOCUMENT_DOCX) + { + pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); + pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, + XML_id, I32S( GetNewShapeID( xShape ) ), + XML_name, IDS( Ellipse ), + FSEND ); + pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND ); + WriteNonVisualProperties( xShape ); + pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); + } + else + pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr, FSEND); // visual shape properties pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); @@ -367,7 +372,7 @@ ShapeExport& ShapeExport::WriteEllipseShape( Reference< XShape > xShape ) // write text WriteTextBox( xShape, mnXmlNamespace ); - pFS->endElementNS( mnXmlNamespace, XML_sp ); + pFS->endElementNS( mnXmlNamespace, (GetDocumentType() != DOCUMENT_DOCX ? XML_sp : XML_wsp) ); return *this; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits