[Libreoffice-commits] core.git: chart2/qa chart2/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 27 10:54:10 UTC 2020
chart2/qa/extras/chart2import.cxx | 17 +++++++++++++++++
chart2/qa/extras/data/odt/stock_chart_LO_6_2.odt |binary
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(-)
New commits:
commit 06a8f5d17061a8fd59fa37c0cdd1a89c72223337
Author: Tünde Tóth <tundeth at gmail.com>
AuthorDate: Wed Apr 22 16:00:49 2020 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Mon Apr 27 12:53:34 2020 +0200
tdf#132355 fix X axis position of stock charts
Set the ShiftedCategoryPosition for true in case of stock chart.
Regression from commit: 111c260ab2883b7906f1a66e222dbf4dc3c58c4f
(tdf#127777 OOXML chart export: fix "CrossBetween" for not imported charts)
Change-Id: I7ced1b03158908e838f7bb44c89dea23c5b347b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92759
Reviewed-by: Balazs Varga <balazs.varga991 at gmail.com>
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 844d7208bac0..df324ee5e7a3 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -158,6 +158,7 @@ public:
void testDataPointLabelCustomPos();
void testTdf130032();
void testTdf119138MissingAutoTitleDeleted();
+ void testStockChartShiftedCategoryPosition();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -264,6 +265,7 @@ public:
CPPUNIT_TEST(testDataPointLabelCustomPos);
CPPUNIT_TEST(testTdf130032);
CPPUNIT_TEST(testTdf119138MissingAutoTitleDeleted);
+ CPPUNIT_TEST(testStockChartShiftedCategoryPosition);
CPPUNIT_TEST_SUITE_END();
@@ -2465,6 +2467,21 @@ void Chart2ImportTest::testTdf119138MissingAutoTitleDeleted()
CPPUNIT_ASSERT_MESSAGE("Missing autoTitleDeleted is implied to be True if title text is present", xTitle.is());
}
+void Chart2ImportTest::testStockChartShiftedCategoryPosition()
+{
+ load("/chart2/qa/extras/data/odt/", "stock_chart_LO_6_2.odt");
+
+ uno::Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+ 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);
+}
+
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
new file mode 100644
index 000000000000..06e15a6b0ddc
Binary files /dev/null and b/chart2/qa/extras/data/odt/stock_chart_LO_6_2.odt differ
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index b4af58240460..f9ba155b397e 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -46,7 +46,6 @@ 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 646560d04adb..023becdd0698 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -626,10 +626,7 @@ void ChartTypeTemplate::adaptScales(
Reference< XChartType > xChartType(getChartTypeForNewSeries(Sequence< Reference< XChartType > >()));
if( aData.AxisType == AxisType::CATEGORY )
{
- if( !m_aServiceName.endsWith("ColumnWithLine") )
- aData.ShiftedCategoryPosition = ::chart::ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault(xChartType);
- else
- aData.ShiftedCategoryPosition = true;
+ aData.ShiftedCategoryPosition = m_aServiceName.indexOf("Column") != -1 || m_aServiceName.indexOf("Bar") != -1 || m_aServiceName.endsWith("Close");
}
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 b54e410bcb73..a8efdeecd8ec 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -447,19 +447,6 @@ 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())
More information about the Libreoffice-commits
mailing list