[Libreoffice-commits] core.git: chart2/qa oox/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 12 20:47:54 UTC 2019
chart2/qa/extras/chart2import.cxx | 34 +++++++++++++++++++++++++++
chart2/qa/extras/data/xlsx/tdf128627.xlsx |binary
chart2/qa/extras/data/xlsx/tdf128634.xlsx |binary
oox/source/drawingml/chart/axisconverter.cxx | 9 ++++++-
4 files changed, 42 insertions(+), 1 deletion(-)
New commits:
commit b5c14ba1987ba102ac98530e2e718100655e1042
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Thu Nov 7 13:49:09 2019 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Tue Nov 12 21:46:29 2019 +0100
tdf#128627 tdf#128634 Fix OOXML import of CrossBetween
Set default 'midCat' value during the import, for Radar charts,
because MSO created them with default 'midCat', but exported a
'between' value.
Set default 'between' value during the import, for 3D Bar and
Stock charts, because sometimes the OOXML file can contain a
wrong CrossBetween value, but MSO import them with default
values.
tdf#128627 regression from commit: 830e539547c463b932ce643517f880789185032d
(tdf#127393 OOXML chart import: fix X axis position setting "CrossBetween")
tdf#128634 regression from commit: 111c260ab2883b7906f1a66e222dbf4dc3c58c4f
(tdf#127777 OOXML chart export: fix "CrossBetween" for not imported charts)
Change-Id: Ie9763197b79c3a661e66043da7b89b4f0f00ba33
Reviewed-on: https://gerrit.libreoffice.org/82211
Tested-by: Jenkins
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 134dec112caa..f04b42d2db6f 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -133,6 +133,8 @@ public:
void testTdf124243();
void testTdf127393();
void testTdf128432();
+ void testTdf128627();
+ void testTdf128634();
void testDeletedDataLabel();
void testDataPointInheritedColorDOCX();
void testExternalStrRefsXLSX();
@@ -226,6 +228,8 @@ public:
CPPUNIT_TEST(testTdf124243);
CPPUNIT_TEST(testTdf127393);
CPPUNIT_TEST(testTdf128432);
+ CPPUNIT_TEST(testTdf128627);
+ CPPUNIT_TEST(testTdf128634);
CPPUNIT_TEST(testDeletedDataLabel);
CPPUNIT_TEST(testDataPointInheritedColorDOCX);
CPPUNIT_TEST(testExternalStrRefsXLSX);
@@ -2012,6 +2016,36 @@ void Chart2ImportTest::testTdf128432()
CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
}
+void Chart2ImportTest::testTdf128627()
+{
+ load("/chart2/qa/extras/data/xlsx/", "tdf128627.xlsx");
+ // Test ShiftedCategoryPosition for Radar Chart
+ uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT_MESSAGE("failed to load chart", 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);
+}
+
+void Chart2ImportTest::testTdf128634()
+{
+ load("/chart2/qa/extras/data/xlsx/", "tdf128634.xlsx");
+ // Test ShiftedCategoryPosition for 3D Charts
+ uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT_MESSAGE("failed to load chart", 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/xlsx/tdf128627.xlsx b/chart2/qa/extras/data/xlsx/tdf128627.xlsx
new file mode 100644
index 000000000000..419c1ad2f9be
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf128627.xlsx differ
diff --git a/chart2/qa/extras/data/xlsx/tdf128634.xlsx b/chart2/qa/extras/data/xlsx/tdf128634.xlsx
new file mode 100644
index 000000000000..91baa780cea2
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf128634.xlsx differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 9f2cc0f715dc..5f64586ffbb0 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -213,7 +213,14 @@ void AxisConverter::convertFromModel(
aScaleData.AxisType = (bDateAxis && !mrModel.mbAuto) ? cssc2::AxisType::DATE : cssc2::AxisType::CATEGORY;
aScaleData.AutoDateAxis = mrModel.mbAuto;
aScaleData.Categories = rTypeGroups.front()->createCategorySequence();
- aScaleData.ShiftedCategoryPosition = pCrossingAxis->mnCrossBetween == XML_between;
+ /* set default ShiftedCategoryPosition values for some charttype,
+ because the XML can contain wrong CrossBetween value, if came from MSO */
+ if( rTypeGroups.front()->is3dChart() && (rTypeInfo.meTypeId == TYPEID_BAR || rTypeInfo.meTypeId == TYPEID_HORBAR || rTypeInfo.meTypeId == TYPEID_STOCK) )
+ aScaleData.ShiftedCategoryPosition = true;
+ else if( rTypeInfo.meTypeId == TYPEID_RADARLINE || rTypeInfo.meTypeId == TYPEID_RADARAREA )
+ aScaleData.ShiftedCategoryPosition = false;
+ else
+ aScaleData.ShiftedCategoryPosition = pCrossingAxis->mnCrossBetween == XML_between;
}
else
{
More information about the Libreoffice-commits
mailing list