[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - chart2/qa oox/source

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 26 15:25:54 UTC 2020


 chart2/qa/extras/chart2import.cxx            |   17 +++++++++++++++++
 chart2/qa/extras/data/xlsx/tdf130657.xlsx    |binary
 oox/source/drawingml/chart/axisconverter.cxx |    4 +++-
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 4f73c78efe18071748f99b6ace43e1e0fe52c34c
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Feb 14 14:06:04 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Feb 26 16:25:23 2020 +0100

    tdf#130657 OOXML chart import: fix charts without CrossBetween
    
    by using default values for ShiftedCategoryPosition.
    
    Regression from commit 111c260ab2883b7906f1a66e222dbf4dc3c58c4f
    (tdf#127777 OOXML chart export: fix "CrossBetween" for not imported charts)
    
    Change-Id: Idd48a8343e7d6609b487daf7182e9716f2f5e01f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88709
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 8163f4ad81487ae187d00d3ce86214e520cb8b69)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89517
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 7b8aaed20371..5f91d39890ea 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -140,6 +140,7 @@ public:
     void testTdf128432();
     void testTdf128627();
     void testTdf128634();
+    void testTdf130657();
     void testDeletedDataLabel();
     void testDataPointInheritedColorDOCX();
     void testExternalStrRefsXLSX();
@@ -241,6 +242,7 @@ public:
     CPPUNIT_TEST(testTdf128432);
     CPPUNIT_TEST(testTdf128627);
     CPPUNIT_TEST(testTdf128634);
+    CPPUNIT_TEST(testTdf130657);
     CPPUNIT_TEST(testDeletedDataLabel);
     CPPUNIT_TEST(testDataPointInheritedColorDOCX);
     CPPUNIT_TEST(testExternalStrRefsXLSX);
@@ -2121,6 +2123,21 @@ void Chart2ImportTest::testTdf128634()
     CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition);
 }
 
+void Chart2ImportTest::testTdf130657()
+{
+    load("/chart2/qa/extras/data/xlsx/", "tdf130657.xlsx");
+    // Test ShiftedCategoryPosition for charts which is not contain a "crossbetween" OOXML tag.
+    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/tdf130657.xlsx b/chart2/qa/extras/data/xlsx/tdf130657.xlsx
new file mode 100644
index 000000000000..036da200ab9b
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf130657.xlsx differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 5f64586ffbb0..86764b241e52 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -219,8 +219,10 @@ void AxisConverter::convertFromModel(
                         aScaleData.ShiftedCategoryPosition = true;
                     else if( rTypeInfo.meTypeId == TYPEID_RADARLINE || rTypeInfo.meTypeId == TYPEID_RADARAREA )
                         aScaleData.ShiftedCategoryPosition = false;
-                    else
+                    else if( pCrossingAxis->mnCrossBetween != -1 ) /*because of backwards compatibility*/
                         aScaleData.ShiftedCategoryPosition = pCrossingAxis->mnCrossBetween == XML_between;
+                    else if( rTypeInfo.meTypeCategory == TYPECATEGORY_BAR || rTypeInfo.meTypeId == TYPEID_LINE || rTypeInfo.meTypeId == TYPEID_STOCK )
+                        aScaleData.ShiftedCategoryPosition = true;
                 }
                 else
                 {


More information about the Libreoffice-commits mailing list