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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 31 09:29:39 UTC 2018


 oox/source/export/drawingml.cxx            |    6 ++++++
 sd/qa/unit/data/pptx/testShapeAutofit.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx         |   16 ++++++++++++++++
 3 files changed, 22 insertions(+)

New commits:
commit 4c52fbe77bee70c770f964fa3506ad6cdd43a312
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Sep 5 15:07:48 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Oct 31 10:29:16 2018 +0100

    tdf#119617 Fix export of Autofit property of shapes to PPTX
    
    With this patch the "Resize shape to fit text" property
    (TextAutoGrowHeight-->spAutofit/noAutofit) will be exported
    correctly to PPTX format.
    
    Change-Id: I5fa975c6390a17bad30c360b3b17aa944bbe72af
    Reviewed-on: https://gerrit.libreoffice.org/60043
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 86b14cc8bd910651cef422a0f7408adc0fc51a17)
    Reviewed-on: https://gerrit.libreoffice.org/60306
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index eba1e3014f33..85ab25cb2b01 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2457,6 +2457,12 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
                 mpFS->singleElementNS(XML_a, XML_normAutofit, XML_fontScale,
                     ( nFontScale < MAX_SCALE_VAL && nFontScale > 0 ) ? I32S(nFontScale) : nullptr, FSEND);
             }
+            else
+            {
+                bool bTextAutoGrowHeight = false;
+                GET(bTextAutoGrowHeight, TextAutoGrowHeight);
+                mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit : XML_noAutofit), FSEND);
+            }
         }
         mpFS->endElementNS((nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr);
     }
diff --git a/sd/qa/unit/data/pptx/testShapeAutofit.pptx b/sd/qa/unit/data/pptx/testShapeAutofit.pptx
new file mode 100755
index 000000000000..fd402c01c895
Binary files /dev/null and b/sd/qa/unit/data/pptx/testShapeAutofit.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 80cd202c533c..77ce54891494 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -132,6 +132,7 @@ public:
     void testTdf107608();
     void testTdf111786();
     void testFontScale();
+    void testShapeAutofitPPTX();
     void testTdf115394();
     void testTdf115394Zero();
     void testTdf115005();
@@ -202,6 +203,7 @@ public:
     CPPUNIT_TEST(testTdf107608);
     CPPUNIT_TEST(testTdf111786);
     CPPUNIT_TEST(testFontScale);
+    CPPUNIT_TEST(testShapeAutofitPPTX);
     CPPUNIT_TEST(testTdf115394);
     CPPUNIT_TEST(testTdf115394Zero);
     CPPUNIT_TEST(testTdf115005);
@@ -1476,6 +1478,20 @@ void SdOOXMLExportTest2::testFontScale()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testShapeAutofitPPTX()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/testShapeAutofit.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+    CPPUNIT_ASSERT(pXmlDocContent);
+
+    // TextAutoGrowHeight --> "Resize shape to fit text" --> true
+    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:spAutoFit", 1);
+    // TextAutoGrowHeight --> "Resize shape to fit text" --> false
+    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
+}
+
 void SdOOXMLExportTest2::testTdf115394()
 {
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394.pptx"), PPTX);


More information about the Libreoffice-commits mailing list