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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 22 10:35:20 UTC 2019


 oox/source/export/drawingml.cxx                |    3 ++-
 sd/qa/unit/data/odp/testLegacyShapeAutofit.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx             |   18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit b50d1a42064c8333926166ec047d3467c83d2fd0
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Aug 21 16:00:42 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Aug 22 12:34:37 2019 +0200

    tdf#127030 PPTX export: keep fixed size of legacy shapes
    
    Classical/legacy shapes lost their fixed size by exporting them with the
    option "Resize shape to fit text".
    
    Regression from commit 86b14cc8bd910651cef422a0f7408adc0fc51a17
    (tdf#119617 Fix export of Autofit property of shapes to PPTX)
    
    Change-Id: Iab67db113edc61f4c94a89ec1bb8df0736c26f21
    Reviewed-on: https://gerrit.libreoffice.org/77888
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 021a1e0b1936..d4b35c8988f6 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2794,8 +2794,9 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
             }
             else
             {
+                // tdf#127030: Only custom shapes obey the TextAutoGrowHeight option.
                 bool bTextAutoGrowHeight = false;
-                if (GetProperty(rXPropSet, "TextAutoGrowHeight"))
+                if (dynamic_cast<SvxCustomShape*>(rXIface.get()) && GetProperty(rXPropSet, "TextAutoGrowHeight"))
                     mAny >>= bTextAutoGrowHeight;
                 mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit : XML_noAutofit));
             }
diff --git a/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp b/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp
new file mode 100755
index 000000000000..16a900b636c8
Binary files /dev/null and b/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 9cef83c85ac2..d17122744fdb 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -180,6 +180,7 @@ public:
     void testTdf111786();
     void testFontScale();
     void testShapeAutofitPPTX();
+    void testLegacyShapeAutofitPPTX();
     void testTdf115394();
     void testTdf115394Zero();
     void testTdf115005();
@@ -274,6 +275,7 @@ public:
     CPPUNIT_TEST(testTdf111786);
     CPPUNIT_TEST(testFontScale);
     CPPUNIT_TEST(testShapeAutofitPPTX);
+    CPPUNIT_TEST(testLegacyShapeAutofitPPTX);
     CPPUNIT_TEST(testTdf115394);
     CPPUNIT_TEST(testTdf115394Zero);
     CPPUNIT_TEST(testTdf115005);
@@ -1653,6 +1655,22 @@ void SdOOXMLExportTest2::testShapeAutofitPPTX()
     assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
 }
 
+void SdOOXMLExportTest2::testLegacyShapeAutofitPPTX()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp"), ODP);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+    CPPUNIT_ASSERT(pXmlDocContent);
+
+    // Text in a legacy rectangle
+    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:noAutofit", 1);
+    // Text in (closed) Polygon
+    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
+    // Text in a legacy ellipse
+    assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/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