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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 16 11:38:53 UTC 2020


 chart2/qa/extras/chart2import.cxx              |   22 ++++++++++++++++++++++
 chart2/qa/extras/data/docx/tdf133632.docx      |binary
 oox/source/drawingml/chart/seriesconverter.cxx |    2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 8da86149f3b7a04fb3a442e6f8733ba463945a57
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Thu Jun 4 11:33:06 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 16 13:38:22 2020 +0200

    tdf#133632 Chart DOCX Import: fix percentage number format
    
    Set the LinkNumberFormatToSource to false only if we have
    an inner data table and the labels are shown as values.
    
    Regression from commit: e0da00d655ecca5986eea3812a8a670c6adbc40f
    (tdf#132174 Chart DOCX import: fix label number format)
    
    Change-Id: I879c5d81709995bfa49c18e0c84aaf6dc3dea41c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95493
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 53eeb419836f31bc4e16a2276a7ef875bea4ff97)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95984
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 0b70320d1e9a..4a6f07d5f310 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -91,6 +91,7 @@ public:
     void testTextBreakXLSX();
     void testNumberFormatsXLSX();
     void testNumberFormatsDOCX();
+    void testPercentageNumberFormatsDOCX();
 
     void testTransparentBackground(OUString const & filename);
 
@@ -209,6 +210,7 @@ public:
     CPPUNIT_TEST(testTextBreakXLSX);
     CPPUNIT_TEST(testNumberFormatsXLSX);
     CPPUNIT_TEST(testNumberFormatsDOCX);
+    CPPUNIT_TEST(testPercentageNumberFormatsDOCX);
     CPPUNIT_TEST(testAutoTitleDelDefaultValue2007XLSX);
     CPPUNIT_TEST(testAutoTitleDelDefaultValue2013XLSX);
     CPPUNIT_TEST(testDispBlanksAsDefaultValue2007XLSX);
@@ -1314,6 +1316,26 @@ void Chart2ImportTest::testNumberFormatsDOCX()
     CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to false.", !bLinkNumberFormatToSource);
 }
 
+void Chart2ImportTest::testPercentageNumberFormatsDOCX()
+{
+    load("/chart2/qa/extras/data/docx/", "tdf133632.docx");
+    uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xChartDoc.is());
+
+    css::uno::Reference<chart2::XDiagram> xDiagram(xChartDoc->getFirstDiagram(), UNO_SET_THROW);
+    Reference<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
+    uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xPropertySet.is());
+
+    bool bLinkNumberFormatToSource = false;
+    chart2::DataPointLabel aLabel;
+    xPropertySet->getPropertyValue("Label") >>= aLabel;
+    CPPUNIT_ASSERT_EQUAL(sal_False, aLabel.ShowNumber);
+    CPPUNIT_ASSERT_EQUAL(sal_True, aLabel.ShowNumberInPercent);
+    bool bSuccess = xPropertySet->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkNumberFormatToSource;
+    CPPUNIT_ASSERT_MESSAGE("\"LinkNumberFormatToSource\" should be set to true.", bSuccess && bLinkNumberFormatToSource);
+}
+
 void Chart2ImportTest::testAutoTitleDelDefaultValue2007XLSX()
 {
     load("/chart2/qa/extras/data/xlsx/", "autotitledel_2007.xlsx");
diff --git a/chart2/qa/extras/data/docx/tdf133632.docx b/chart2/qa/extras/data/docx/tdf133632.docx
new file mode 100644
index 000000000000..b970e73f4c2f
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf133632.docx differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 5d08b28d8094..c55c3891a975 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -343,7 +343,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa
     {
         bool bMSO2007Doc = getFilter().isMSO2007Document();
         // tdf#132174: the inner data table has no own cell number format.
-        if( getChartDocument()->hasInternalDataProvider() )
+        if( getChartDocument()->hasInternalDataProvider() && mrModel.mobShowVal.get(!bMSO2007Doc) )
             mrModel.maNumberFormat.mbSourceLinked = false;
         lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, bMSO2007Doc );
 


More information about the Libreoffice-commits mailing list