[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - chart2/qa include/oox oox/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Dec 20 10:24:01 UTC 2018
chart2/qa/extras/chart2export.cxx | 15 +++++++++++++++
chart2/qa/extras/data/docx/tdf121744.docx |binary
include/oox/export/chartexport.hxx | 2 +-
oox/source/export/chartexport.cxx | 26 ++++++++++++++++++--------
4 files changed, 34 insertions(+), 9 deletions(-)
New commits:
commit d58d92d72b00f45c56a3b0fe55ca9fd837d244a9
Author: Jozsef Szakacs <zmx3 at citromail.hu>
AuthorDate: Wed Nov 28 09:13:03 2018 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Thu Dec 20 11:23:38 2018 +0100
tdf#121744 XLSX Export Combinated Chart (Column and Line)
Each of the Column and Line Chart creates it's own x and y Axes.
So now the LineChart Exporter Method uses the same Axes as the BarChart.
Thanks for the help:
- Balazs Varga
- Adam Kovacs
Change-Id: Ie763cf831c2ce63ef204d1fdcbff634e7ca8fad5
Reviewed-on: https://gerrit.libreoffice.org/64146
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
Reviewed-on: https://gerrit.libreoffice.org/65449
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index d39a6829bd9f..45d9ff73f08f 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -123,6 +123,7 @@ public:
void testxAxisLabelsRotation();
void testTdf116163();
void testTdf119029();
+ void testTdf121744();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -208,6 +209,7 @@ public:
CPPUNIT_TEST(testxAxisLabelsRotation);
CPPUNIT_TEST(testTdf116163);
CPPUNIT_TEST(testTdf119029);
+ CPPUNIT_TEST(testTdf121744);
CPPUNIT_TEST_SUITE_END();
protected:
@@ -1949,6 +1951,19 @@ void Chart2ExportTest::testTdf119029()
"-5400000");
}
+void Chart2ExportTest::testTdf121744()
+{
+ load("/chart2/qa/extras/data/docx/", "tdf121744.docx");
+ xmlDocPtr pXmlDoc = parseExport("word/charts/chart","Office Open XML Text");
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ OUString XValueId = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[1]", "val");
+ OUString YValueId = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:axId[2]", "val");
+
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[1]", "val", XValueId );
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:axId[2]", "val", YValueId );
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf121744.docx b/chart2/qa/extras/data/docx/tdf121744.docx
new file mode 100644
index 000000000000..b5ff10098c6a
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf121744.docx differ
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index b974fc4c1ac7..c5f9e6ebd188 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -200,7 +200,7 @@ private:
sal_Int32 nAxisType,
const char* sAxisPos,
const AxisIdPair& rAxisIdPair );
- void exportAxesId(bool bPrimaryAxes);
+ void exportAxesId(bool bPrimaryAxes, bool bCheckCombinedAxes = false);
void exportView3D();
bool isDeep3dChart();
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 706f6c60265f..00b631688b14 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1662,7 +1662,7 @@ void ChartExport::exportLineChart( const Reference< chart2::XChartType >& xChart
FSEND );
}
- exportAxesId(bPrimaryAxes);
+ exportAxesId(bPrimaryAxes, true);
pFS->endElement( FSNS( XML_c, nTypeId ) );
}
@@ -3381,14 +3381,24 @@ void ChartExport::exportDataPoints(
}
}
-void ChartExport::exportAxesId(bool bPrimaryAxes)
+void ChartExport::exportAxesId(bool bPrimaryAxes, bool bCheckCombinedAxes)
{
- sal_Int32 nAxisIdx = lcl_generateRandomValue();
- sal_Int32 nAxisIdy = lcl_generateRandomValue();
- AxesType eXAxis = bPrimaryAxes ? AXIS_PRIMARY_X : AXIS_SECONDARY_X;
- AxesType eYAxis = bPrimaryAxes ? AXIS_PRIMARY_Y : AXIS_SECONDARY_Y;
- maAxes.emplace_back( eXAxis, nAxisIdx, nAxisIdy );
- maAxes.emplace_back( eYAxis, nAxisIdy, nAxisIdx );
+ sal_Int32 nAxisIdx, nAxisIdy;
+ // tdf#114181 keep axes of combined charts
+ if ( bCheckCombinedAxes && bPrimaryAxes && maAxes.size() == 2 )
+ {
+ nAxisIdx = maAxes[0].nAxisId;
+ nAxisIdy = maAxes[1].nAxisId;
+ }
+ else
+ {
+ nAxisIdx = lcl_generateRandomValue();
+ nAxisIdy = lcl_generateRandomValue();
+ AxesType eXAxis = bPrimaryAxes ? AXIS_PRIMARY_X : AXIS_SECONDARY_X;
+ AxesType eYAxis = bPrimaryAxes ? AXIS_PRIMARY_Y : AXIS_SECONDARY_Y;
+ maAxes.emplace_back( eXAxis, nAxisIdx, nAxisIdy );
+ maAxes.emplace_back( eYAxis, nAxisIdy, nAxisIdx );
+ }
FSHelperPtr pFS = GetFS();
pFS->singleElement( FSNS( XML_c, XML_axId ),
XML_val, I32S( nAxisIdx ),
More information about the Libreoffice-commits
mailing list