From afac39ff8a614f3efbc0c3e2d75ad81e1da8792d Mon Sep 17 00:00:00 2001 From: Gülşah Köse Date: Tue, 25 Aug 2020 13:06:27 +0300 Subject: Revert tdf#132355 fix due to reggression. This reverts commit 06a8f5d17061a8fd59fa37c0cdd1a89c72223337. Change-Id: Iee296e423e3e76d82db9556137459249b5d87508 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101326 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar --- chart2/qa/extras/chart2import.cxx | 17 ----------------- chart2/qa/extras/data/odt/stock_chart_LO_6_2.odt | Bin 16810 -> 0 bytes chart2/source/inc/ChartTypeHelper.hxx | 1 + chart2/source/model/template/ChartTypeTemplate.cxx | 5 ++++- chart2/source/tools/ChartTypeHelper.cxx | 13 +++++++++++++ 5 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 chart2/qa/extras/data/odt/stock_chart_LO_6_2.odt (limited to 'chart2') diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index a2b77a851002..103016fe7fc8 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -154,7 +154,6 @@ public: void testTdf121991(); void testTdf125444PercentageCustomLabel(); void testTdf123206CustomLabelField(); - void testStockChartShiftedCategoryPosition(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -258,7 +257,6 @@ public: CPPUNIT_TEST(testTdf121991); CPPUNIT_TEST(testTdf125444PercentageCustomLabel); CPPUNIT_TEST(testTdf123206CustomLabelField); - CPPUNIT_TEST(testStockChartShiftedCategoryPosition); CPPUNIT_TEST_SUITE_END(); @@ -2407,21 +2405,6 @@ void Chart2ImportTest::testTdf123206CustomLabelField() } -void Chart2ImportTest::testStockChartShiftedCategoryPosition() -{ - load("/chart2/qa/extras/data/odt/", "stock_chart_LO_6_2.odt"); - - uno::Reference xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); - CPPUNIT_ASSERT(xChartDoc.is()); - - Reference xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); - CPPUNIT_ASSERT(xAxis.is()); - - chart2::ScaleData aScaleData = xAxis->getScaleData(); - CPPUNIT_ASSERT(aScaleData.Categories.is()); - CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition); -} - CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/odt/stock_chart_LO_6_2.odt b/chart2/qa/extras/data/odt/stock_chart_LO_6_2.odt deleted file mode 100644 index 06e15a6b0ddc..000000000000 Binary files a/chart2/qa/extras/data/odt/stock_chart_LO_6_2.odt and /dev/null differ diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index f9ba155b397e..b4af58240460 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -46,6 +46,7 @@ public: static bool isSupportingStartingAngle( const css::uno::Reference< css::chart2::XChartType >& xChartType ); //starting value for bars or baseline for areas for example static bool isSupportingBaseValue( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool shiftCategoryPosAtXAxisPerDefault( const css::uno::Reference< css::chart2::XChartType >& xChartType ); static bool isSupportingAxisPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex ); static bool isSupportingComplexCategory( const css::uno::Reference< css::chart2::XChartType >& xChartType ); diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index cb7a0d387500..afd9eb0f048a 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -626,7 +626,10 @@ void ChartTypeTemplate::adaptScales( Reference< XChartType > xChartType(getChartTypeForNewSeries(Sequence< Reference< XChartType > >())); if( aData.AxisType == AxisType::CATEGORY ) { - aData.ShiftedCategoryPosition = m_aServiceName.indexOf("Column") != -1 || m_aServiceName.indexOf("Bar") != -1 || m_aServiceName.endsWith("Close"); + if( !m_aServiceName.endsWith("ColumnWithLine") ) + aData.ShiftedCategoryPosition = ::chart::ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault(xChartType); + else + aData.ShiftedCategoryPosition = true; } bool bSupportsDates = ::chart::ChartTypeHelper::isSupportingDateAxis( xChartType, nDimensionX ); if( aData.AxisType != AxisType::CATEGORY && ( aData.AxisType != AxisType::DATE || !bSupportsDates) ) diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index be46b0f19ac5..ebd2af04ab45 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -430,6 +430,19 @@ bool ChartTypeHelper::isSupportingComplexCategory( const uno::Reference< chart2: return true; } +bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType ) +{ + if(xChartType.is()) + { + OUString aChartTypeName = xChartType->getChartType(); + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) + return true; + } + return false; +} + bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XChartType >& xChartType ) { if(xChartType.is()) -- cgit