[Libreoffice-commits] core.git: chart2/qa xmloff/source

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 30 09:18:55 UTC 2019


 chart2/qa/extras/chart2import.cxx         |   17 +++++++++++++++++
 chart2/qa/extras/data/ods/tdf128432.ods   |binary
 xmloff/source/chart/SchXMLAxisContext.cxx |   19 +++++++++++++++++++
 3 files changed, 36 insertions(+)

New commits:
commit d0aaad22a95d96f4da2c930d98bdba138d4e15a1
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Oct 29 16:55:40 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Oct 30 10:17:38 2019 +0100

    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: 111c260ab2883b7906f1a66e222dbf4dc3c58c4f
    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 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 ab1233b13110..134dec112caa 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -132,6 +132,7 @@ public:
     void testTdf114179();
     void testTdf124243();
     void testTdf127393();
+    void testTdf128432();
     void testDeletedDataLabel();
     void testDataPointInheritedColorDOCX();
     void testExternalStrRefsXLSX();
@@ -224,6 +225,7 @@ public:
     CPPUNIT_TEST(testTdf114179);
     CPPUNIT_TEST(testTdf124243);
     CPPUNIT_TEST(testTdf127393);
+    CPPUNIT_TEST(testTdf128432);
     CPPUNIT_TEST(testDeletedDataLabel);
     CPPUNIT_TEST(testDataPointInheritedColorDOCX);
     CPPUNIT_TEST(testExternalStrRefsXLSX);
@@ -1995,6 +1997,21 @@ void Chart2ImportTest::testTdf127393()
     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 {
 
 void checkDataLabelProperties(const Reference<chart2::XDataSeries>& xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible)
diff --git a/chart2/qa/extras/data/ods/tdf128432.ods b/chart2/qa/extras/data/ods/tdf128432.ods
new file mode 100644
index 000000000000..a93822fc9b66
Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf128432.ods differ
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx
index aaa3b6f75bf1..931983bc8c01 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -461,6 +461,25 @@ void SchXMLAxisContext::CreateAxis()
         if( m_bAxisTypeImported )
             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())
         {
             const SvXMLStylesContext* pStylesCtxt = m_rImportHelper.GetAutoStylesContext();


More information about the Libreoffice-commits mailing list