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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 28 09:01:12 UTC 2020


 chart2/qa/extras/chart2export.cxx              |   12 ++++++++++++
 chart2/qa/extras/data/xlsx/tdf108107.xlsx      |binary
 oox/source/drawingml/chart/seriesconverter.cxx |    3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 296f3f8e4a5337b82fc72845662b5d5749acdf99
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Sun Jan 26 20:59:21 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Jan 28 10:00:40 2020 +0100

    tdf#108107 OOXML chart: fix format of custom data point labels
    
    Do not overwrite the property of moved data point labels
    with default values, but use the data series properties for
    these labels.
    
    Change-Id: Id27fa1c2d8286584b2b87b7eb7a64fd9b416dc34
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87463
    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/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 96278053d59f..ea19e9d2ad0a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -86,6 +86,7 @@ public:
     void testDataLabelAreaChartDOCX();
     void testDataLabelDefaultLineChartDOCX();
     void testIndividualDataLabelProps();
+    void testTdf108107();
     void testChartTitlePropertiesColorFillDOCX();
     void testChartTitlePropertiesGradientFillDOCX();
     void testChartTitlePropertiesBitmapFillDOCX();
@@ -200,6 +201,7 @@ public:
     CPPUNIT_TEST(testDataLabelAreaChartDOCX);
     CPPUNIT_TEST(testDataLabelDefaultLineChartDOCX);
     CPPUNIT_TEST(testIndividualDataLabelProps);
+    CPPUNIT_TEST(testTdf108107);
     CPPUNIT_TEST(testChartTitlePropertiesColorFillDOCX);
     CPPUNIT_TEST(testChartTitlePropertiesGradientFillDOCX);
     CPPUNIT_TEST(testChartTitlePropertiesBitmapFillDOCX);
@@ -1208,6 +1210,16 @@ void Chart2ExportTest::testIndividualDataLabelProps()
     assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr/a:latin", "typeface", "Times New Roman");
 }
 
+void Chart2ExportTest::testTdf108107()
+{
+    load("/chart2/qa/extras/data/xlsx/", "tdf108107.xlsx");
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", "val", "1");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr", "b", "1");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr", "sz", "2000");
+}
+
 void Chart2ExportTest::testChartTitlePropertiesColorFillDOCX()
 {
     load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesColorFill.docx");
diff --git a/chart2/qa/extras/data/xlsx/tdf108107.xlsx b/chart2/qa/extras/data/xlsx/tdf108107.xlsx
new file mode 100644
index 000000000000..3f86326fa28e
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf108107.xlsx differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index dccd19713833..62f78a28e383 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -177,7 +177,8 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
         rFormatter.convertNumberFormat( rPropSet, rDataLabel.maNumberFormat, false, bShowPercent );
 
         // data label text formatting (frame formatting not supported by Chart2)
-        convertTextProperty(rPropSet, rFormatter, rDataLabel.mxTextProp);
+        if( bDataSeriesLabel || (rDataLabel.mxTextProp.is() && !rDataLabel.mxTextProp->getParagraphs().empty()) )
+            convertTextProperty(rPropSet, rFormatter, rDataLabel.mxTextProp);
 
         // data label separator (do not overwrite series separator, if no explicit point separator is present)
         // Set the data label separator to "new line" if the value is shown as percentage with a category name,


More information about the Libreoffice-commits mailing list