Kaydet (Commit) 25e391fb authored tarafından Jozsef Szakacs's avatar Jozsef Szakacs Kaydeden (comit) Aron Budea

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

Reviewed-on: https://gerrit.libreoffice.org/64146
Tested-by: Jenkins
Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
Reviewed-on: https://gerrit.libreoffice.org/65449
(cherry picked from commit d58d92d7)

Change-Id: Ie763cf831c2ce63ef204d1fdcbff634e7ca8fad5
üst 0982652e
......@@ -121,6 +121,7 @@ public:
void testCustomDataLabelMultipleSeries();
void testTdf119029();
void testTdf122031();
void testTdf121744();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
......@@ -204,6 +205,7 @@ public:
CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
CPPUNIT_TEST(testTdf119029);
CPPUNIT_TEST(testTdf122031);
CPPUNIT_TEST(testTdf121744);
CPPUNIT_TEST_SUITE_END();
protected:
......@@ -1939,6 +1941,19 @@ void Chart2ExportTest::testTdf122031()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[3]/c:numFmt", "formatCode", "0.000%");
}
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();
......
......@@ -197,7 +197,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();
......
......@@ -1619,7 +1619,7 @@ void ChartExport::exportLineChart( const Reference< chart2::XChartType >& xChart
FSEND );
}
exportAxesId(bPrimaryAxes);
exportAxesId(bPrimaryAxes, true);
pFS->endElement( FSNS( XML_c, nTypeId ) );
}
......@@ -3333,14 +3333,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 ),
......
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