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

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 19 15:55:44 UTC 2021


 oox/source/export/shapes.cxx        |    8 +++++++-
 sd/qa/unit/data/pptx/tdf131905.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   28 ++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 48f6ce530f3546570eabdf398388185ab988636b
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Mon Mar 8 16:07:59 2021 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Mar 19 16:55:03 2021 +0100

    tdf#131905 PPTX table export: fix vertical alignment
    
    Table cells lost their vertical alignment.
    
    Change-Id: Id5ca22550b5613566d7ea2a93e8a36fdca31860d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112171
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 13c52d22c56e..e889901c477c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1780,6 +1780,8 @@ void ShapeExport::WriteTable( const Reference< XShape >& rXShape  )
 void ShapeExport::WriteTableCellProperties(const Reference< XPropertySet>& xCellPropSet)
 {
     sal_Int32 nLeftMargin(0), nRightMargin(0);
+    TextVerticalAdjust eVerticalAlignment;
+    const char* sVerticalAlignment;
 
     Any aLeftMargin = xCellPropSet->getPropertyValue("TextLeftDistance");
     aLeftMargin >>= nLeftMargin;
@@ -1787,7 +1789,11 @@ void ShapeExport::WriteTableCellProperties(const Reference< XPropertySet>& xCell
     Any aRightMargin = xCellPropSet->getPropertyValue("TextRightDistance");
     aRightMargin >>= nRightMargin;
 
-    mpFS->startElementNS(XML_a, XML_tcPr,
+    Any aVerticalAlignment = xCellPropSet->getPropertyValue("TextVerticalAdjust");
+    aVerticalAlignment >>= eVerticalAlignment;
+    sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment);
+
+    mpFS->startElementNS(XML_a, XML_tcPr, XML_anchor, sVerticalAlignment,
     XML_marL, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeftMargin)), nLeftMargin > 0),
     XML_marR, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nRightMargin)), nRightMargin > 0));
 
diff --git a/sd/qa/unit/data/pptx/tdf131905.pptx b/sd/qa/unit/data/pptx/tdf131905.pptx
new file mode 100644
index 000000000000..4d203510f093
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf131905.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 9523d5718a46..3d8e93b8b003 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -87,6 +87,7 @@ static void assertMotionPath(const OUString &rStr1, const OUString &rStr2, const
 class SdOOXMLExportTest2 : public SdModelTestBaseXML
 {
 public:
+    void testTdf131905();
     void testTdf93883();
     void testTdf91378();
     void testBnc822341();
@@ -211,6 +212,7 @@ public:
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+    CPPUNIT_TEST(testTdf131905);
     CPPUNIT_TEST(testTdf93883);
     CPPUNIT_TEST(testTdf91378);
     CPPUNIT_TEST(testBnc822341);
@@ -366,6 +368,32 @@ public:
 
 };
 
+void SdOOXMLExportTest2::testTdf131905()
+{
+    ::sd::DrawDocShellRef xDocShRef
+        = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf131905.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+    xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+    assertXPath(
+        pXmlDocContent,
+        "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[1]/a:tc/a:tcPr",
+        "anchor", "t");
+
+    assertXPath(
+        pXmlDocContent,
+        "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[2]/a:tc/a:tcPr",
+        "anchor", "ctr");
+
+    assertXPath(
+        pXmlDocContent,
+        "/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr[3]/a:tc/a:tcPr",
+        "anchor", "b");
+
+    xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest2::testTdf93883()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf93883.odp"), ODP);


More information about the Libreoffice-commits mailing list