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: 111c260ab2
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>
This commit is contained in:
Balazs Varga
2019-10-29 16:55:40 +01:00
committed by László Németh
parent f903af07aa
commit d0aaad22a9
3 changed files with 36 additions and 0 deletions

View File

@@ -132,6 +132,7 @@ public:
void testTdf114179(); void testTdf114179();
void testTdf124243(); void testTdf124243();
void testTdf127393(); void testTdf127393();
void testTdf128432();
void testDeletedDataLabel(); void testDeletedDataLabel();
void testDataPointInheritedColorDOCX(); void testDataPointInheritedColorDOCX();
void testExternalStrRefsXLSX(); void testExternalStrRefsXLSX();
@@ -224,6 +225,7 @@ public:
CPPUNIT_TEST(testTdf114179); CPPUNIT_TEST(testTdf114179);
CPPUNIT_TEST(testTdf124243); CPPUNIT_TEST(testTdf124243);
CPPUNIT_TEST(testTdf127393); CPPUNIT_TEST(testTdf127393);
CPPUNIT_TEST(testTdf128432);
CPPUNIT_TEST(testDeletedDataLabel); CPPUNIT_TEST(testDeletedDataLabel);
CPPUNIT_TEST(testDataPointInheritedColorDOCX); CPPUNIT_TEST(testDataPointInheritedColorDOCX);
CPPUNIT_TEST(testExternalStrRefsXLSX); CPPUNIT_TEST(testExternalStrRefsXLSX);
@@ -1995,6 +1997,21 @@ void Chart2ImportTest::testTdf127393()
CPPUNIT_ASSERT(!aScaleData2.ShiftedCategoryPosition); 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 { namespace {
void checkDataLabelProperties(const Reference<chart2::XDataSeries>& xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible) void checkDataLabelProperties(const Reference<chart2::XDataSeries>& xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible)

Binary file not shown.

View File

@@ -461,6 +461,25 @@ void SchXMLAxisContext::CreateAxis()
if( m_bAxisTypeImported ) if( m_bAxisTypeImported )
m_xAxisProps->setPropertyValue("AxisType", uno::makeAny(m_nAxisType) ); 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()) if( !m_aAutoStyleName.isEmpty())
{ {
const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext(); const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext();