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

Attila Bakos (NISZ) (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 8 12:12:05 UTC 2021


 oox/source/export/drawingml.cxx                       |    3 --
 sd/qa/unit/data/odp/placeholder-box-textalignment.odp |binary
 sd/qa/unit/export-tests-ooxml3.cxx                    |   20 ++++++++++++++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx              |    9 +++++++-
 4 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 3518b4cebdddc0446cf923c38acee52bf5d6a9b1
Author:     Attila Bakos (NISZ) <bakos.attilakaroly at nisz.hu>
AuthorDate: Tue Jun 8 12:25:41 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jul 8 14:11:30 2021 +0200

    tdf#142235 PPTX export: fix styles with placeholders
    
    inserting icons and alignment.
    
    Regression from commit b6b02e0b4c9d739836e1f61a886ea45b01e6696e
    (tdf#111903 tdf#137152 PPTX export: fix placeholders).
    
    Note: in the unit test document, check fixed vertical position
    of the second text boxes of Slide 2–4.
    
    Change-Id: I3c649db69f94a2e9f49ae7aa11d9cd9d9f6d80d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116828
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118446
    Tested-by: Jenkins

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0372ae804b13..d27b28cb7d1f 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2988,8 +2988,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
     const char* sVerticalAlignment = nullptr;
     if (GetProperty(rXPropSet, "TextVerticalAdjust"))
         mAny >>= eVerticalAlignment;
-    if( eVerticalAlignment != TextVerticalAdjust_TOP )
-        sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment);
+    sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment);
 
     const char* sWritingMode = nullptr;
     bool bVertical = false;
diff --git a/sd/qa/unit/data/odp/placeholder-box-textalignment.odp b/sd/qa/unit/data/odp/placeholder-box-textalignment.odp
new file mode 100644
index 000000000000..df33291fbd40
Binary files /dev/null and b/sd/qa/unit/data/odp/placeholder-box-textalignment.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx
index fb2db18e8d22..6632934e430e 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -116,6 +116,7 @@ public:
     void testTdf125560_textDeflate();
     void testTdf125560_textInflateTop();
     void testTdf96061_textHighlight();
+    void testTdf142235_TestPlaceholderTextAlignment();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
 
@@ -184,6 +185,7 @@ public:
     CPPUNIT_TEST(testTdf125560_textDeflate);
     CPPUNIT_TEST(testTdf125560_textInflateTop);
     CPPUNIT_TEST(testTdf96061_textHighlight);
+    CPPUNIT_TEST(testTdf142235_TestPlaceholderTextAlignment);
     CPPUNIT_TEST_SUITE_END();
 
     virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1688,6 +1690,24 @@ void SdOOXMLExportTest3::testTdf125560_textInflateTop()
                 "type", "mso-spt164");
 }
 
+void SdOOXMLExportTest3::testTdf142235_TestPlaceholderTextAlignment()
+{
+    auto xDocShRef = loadURL(
+        m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/placeholder-box-textalignment.odp"), ODP);
+
+    utl::TempFile tmpfile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tmpfile);
+    xDocShRef->DoClose();
+
+    xmlDocUniquePtr pXml1 = parseExport(tmpfile, "ppt/slides/slide2.xml");
+    xmlDocUniquePtr pXml2 = parseExport(tmpfile, "ppt/slides/slide3.xml");
+
+    // Without the fix in place many of these asserts failed, because alignment was bad.
+
+    assertXPath(pXml1, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", "t");
+    assertXPath(pXml2, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr", "anchor", "t");
+}
+
 void SdOOXMLExportTest3::testTdf96061_textHighlight()
 {
     ::sd::DrawDocShellRef xDocShRef
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 6a8502361061..f30a4d040fc6 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1555,8 +1555,15 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShap
     default:
         SAL_INFO("sd.eppt", "warning: unhandled placeholder type: " << ePlaceholder);
     }
+
     SAL_INFO("sd.eppt", "write placeholder " << pType);
-    mpFS->singleElementNS(XML_p, XML_ph, XML_type, pType);
+
+    if ((mePageType == PageType::LAYOUT || mePageType == PageType::NORMAL)
+        && ePlaceholder == Outliner)
+        mpFS->singleElementNS(XML_p, XML_ph);
+    else
+        mpFS->singleElementNS(XML_p, XML_ph, XML_type, pType);
+
     mpFS->endElementNS(XML_p, XML_nvPr);
     mpFS->endElementNS(XML_p, XML_nvSpPr);
 


More information about the Libreoffice-commits mailing list