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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 5 18:52:52 UTC 2021


 chart2/qa/extras/chart2export.cxx              |   22 ++++++++++++++++++++++
 chart2/qa/extras/data/docx/tdf134255.docx      |binary
 oox/source/drawingml/chart/objectformatter.cxx |    4 ++++
 3 files changed, 26 insertions(+)

New commits:
commit 1a49637f56b5d48c20c08a840d14cda6871a2ad1
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Jul 7 13:11:19 2020 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Tue Jan 5 19:52:18 2021 +0100

    tdf#134255 Chart OOXML Import: set the auto text wrap
    
    property to true, if we do not have text property attribute.
    
    Change-Id: I1a416f74c3f034f902fd583790f9db307f5e8881
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98252
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit c777cb492d12fb7038254f116102716b9cb84fa3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108726
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index b1bc22c61469..8310d3abb9aa 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -173,6 +173,7 @@ public:
     void testTdf133191();
     void testTdf132594();
     void testTdf136267();
+    void testTdf134255();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest);
     CPPUNIT_TEST(testErrorBarXLSX);
@@ -309,6 +310,7 @@ public:
     CPPUNIT_TEST(testTdf133191);
     CPPUNIT_TEST(testTdf132594);
     CPPUNIT_TEST(testTdf136267);
+    CPPUNIT_TEST(testTdf134255);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2827,6 +2829,26 @@ void Chart2ExportTest::testTdf136267()
     assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:cat/c:strRef/c:strCache/c:pt/c:v", "John");
 }
 
+void Chart2ExportTest::testTdf134255()
+{
+    load("/chart2/qa/extras/data/docx/", "tdf134255.docx");
+    Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xChartDoc.is());
+
+    // import test
+    Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
+    CPPUNIT_ASSERT(xDataSeries.is());
+    Reference< beans::XPropertySet > xPropSet(xDataSeries, UNO_QUERY_THROW);
+    bool bWrap = false;
+    CPPUNIT_ASSERT((xPropSet->getPropertyValue("TextWordWrap") >>= bWrap) && bWrap);
+
+    // export test
+    xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:txPr/a:bodyPr", "wrap", "square");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/tdf134255.docx b/chart2/qa/extras/data/docx/tdf134255.docx
new file mode 100644
index 000000000000..ff3cd8b67b53
Binary files /dev/null and b/chart2/qa/extras/data/docx/tdf134255.docx differ
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 60cac23952f9..5f0ebd8ac2cd 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -1077,7 +1077,11 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef
 void ObjectFormatter::convertTextWrap( PropertySet& rPropSet, const ModelRef< TextBody >& rxTextProp )
 {
     if( !rxTextProp.is() )
+    {
+        // set default value (in OOXML the default value is true)
+        rPropSet.setProperty( PROP_TextWordWrap, true );
         return;
+    }
 
     PropertyMap& aPropMap = rxTextProp->getTextProperties().maPropertyMap;
     if( aPropMap.hasProperty(PROP_TextWordWrap) )


More information about the Libreoffice-commits mailing list