diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-10-29 16:55:40 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-10-30 10:17:38 +0100 |
commit | d0aaad22a95d96f4da2c930d98bdba138d4e15a1 (patch) | |
tree | 4d40f03adec77aa9ad5db8bc23ae948d5d57861f | |
parent | f903af07aab03f94e36a74936deef7f28d05a779 (diff) |
tdf#128432 OOXML chart import: fix x axis scale regression of 3D charts
Set 3D charts ShiftedCategoryPosition value
to default true in case of BarDiagram and StockDiagram.
Regression from commit: 111c260ab2883b7906f1a66e222dbf4dc3c58c4f
tdf#127777 OOXML chart export: fix "CrossBetween" for not imported charts
Change-Id: I5bf0e6f6e7ad96e6c96c01ab18d74d51419f5e3c
Reviewed-on: https://gerrit.libreoffice.org/81695
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 17 | ||||
-rw-r--r-- | chart2/qa/extras/data/ods/tdf128432.ods | bin | 0 -> 13755 bytes | |||
-rw-r--r-- | xmloff/source/chart/SchXMLAxisContext.cxx | 19 |
3 files changed, 36 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index ab1233b13110..134dec112caa 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -132,6 +132,7 @@ public: void testTdf114179(); void testTdf124243(); void testTdf127393(); + void testTdf128432(); void testDeletedDataLabel(); void testDataPointInheritedColorDOCX(); void testExternalStrRefsXLSX(); @@ -224,6 +225,7 @@ public: CPPUNIT_TEST(testTdf114179); CPPUNIT_TEST(testTdf124243); CPPUNIT_TEST(testTdf127393); + CPPUNIT_TEST(testTdf128432); CPPUNIT_TEST(testDeletedDataLabel); CPPUNIT_TEST(testDataPointInheritedColorDOCX); CPPUNIT_TEST(testExternalStrRefsXLSX); @@ -1995,6 +1997,21 @@ void Chart2ImportTest::testTdf127393() CPPUNIT_ASSERT(!aScaleData2.ShiftedCategoryPosition); } +void Chart2ImportTest::testTdf128432() +{ + load("/chart2/qa/extras/data/ods/", "tdf128432.ods"); + + uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc.is()); + + Reference<chart2::XAxis> xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); + CPPUNIT_ASSERT(xAxis.is()); + + chart2::ScaleData aScaleData = xAxis->getScaleData(); + CPPUNIT_ASSERT(aScaleData.Categories.is()); + CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition); +} + namespace { void checkDataLabelProperties(const Reference<chart2::XDataSeries>& xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible) diff --git a/chart2/qa/extras/data/ods/tdf128432.ods b/chart2/qa/extras/data/ods/tdf128432.ods Binary files differnew file mode 100644 index 000000000000..a93822fc9b66 --- /dev/null +++ b/chart2/qa/extras/data/ods/tdf128432.ods diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index aaa3b6f75bf1..931983bc8c01 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -461,6 +461,25 @@ void SchXMLAxisContext::CreateAxis() if( m_bAxisTypeImported ) m_xAxisProps->setPropertyValue("AxisType", uno::makeAny(m_nAxisType) ); + if( m_aCurrentAxis.eDimension == SCH_XML_AXIS_X ) + { + bool bIs3DChart = false; + if( (xDiaProp->getPropertyValue("Dim3D") >>= bIs3DChart) && bIs3DChart ) + { + OUString sChartType = m_xDiagram->getDiagramType(); + if( sChartType == "com.sun.star.chart.BarDiagram" || sChartType == "com.sun.star.chart.StockDiagram" ) + { + Reference< chart2::XAxis > xAxis(lcl_getAxis(GetImport().GetModel(), m_aCurrentAxis.eDimension, m_aCurrentAxis.nAxisIndex)); + if( xAxis.is() ) + { + chart2::ScaleData aScaleData(xAxis->getScaleData()); + aScaleData.ShiftedCategoryPosition = true; + xAxis->setScaleData(aScaleData); + } + } + } + } + if( !m_aAutoStyleName.isEmpty()) { const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext(); |