[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/qa sw/source

Tamás Zolnai tamas.zolnai at collabora.com
Thu Jan 4 09:07:20 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf113399.doc |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx  |   16 ++++++++++++++++
 sw/source/filter/ww8/docxsdrexport.cxx      |   13 +++++++++++++
 3 files changed, 29 insertions(+)

New commits:
commit 83e9a46615089de6979c950a2b62e0464e93e486
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Wed Dec 27 18:06:35 2017 +0100

    tdf#113399: DOT IMPORT, DOCX EXPORT: Page number not shown correctly
    
    We need to export 0 padding explicitely to DOCX file.
    
    Change-Id: I7126cfd1dbf4ebd1fb5e09c3642e0da159488258
    Reviewed-on: https://gerrit.libreoffice.org/47090
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/47103
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf113399.doc b/sw/qa/extras/ooxmlexport/data/tdf113399.doc
new file mode 100755
index 000000000000..1f3ddc993d06
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf113399.doc differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index e2af3250cb07..a5f808f070b3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -120,6 +120,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113547, "tdf113547.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-635), aProps["FirstLineIndent"].get<sal_Int32>());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf113399, "tdf113399.doc")
+{
+    // 0 padding was not preserved
+    // In LO 0 is the defualt, but in OOXML format the default is 254 / 127
+    uno::Reference<beans::XPropertySet> xPropSet(getShape(1), uno::UNO_QUERY);
+    sal_Int32 nPaddingValue;
+    xPropSet->getPropertyValue("TextLeftDistance") >>= nPaddingValue;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nPaddingValue);
+    xPropSet->getPropertyValue("TextRightDistance") >>= nPaddingValue;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nPaddingValue);
+    xPropSet->getPropertyValue("TextUpperDistance") >>= nPaddingValue;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nPaddingValue);
+    xPropSet->getPropertyValue("TextLowerDistance") >>= nPaddingValue;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nPaddingValue);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 8b33ea440ca9..4c02bb7c1077 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1592,6 +1592,19 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
         pFS->endElementNS(XML_w, XML_txbxContent);
         pFS->endElementNS(XML_wps, XML_txbx);
     }
+
+    // We need to init padding to 0, if it's not set.
+    // In LO the default is 0 and so ins attributes are not set when padding is 0
+    // but in MSO the default is 254 / 127, so we need to set 0 padding explicitely
+    if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_lIns))
+        m_pImpl->m_pBodyPrAttrList->add(XML_lIns, OString::number(0));
+    if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_tIns))
+        m_pImpl->m_pBodyPrAttrList->add(XML_tIns, OString::number(0));
+    if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_rIns))
+        m_pImpl->m_pBodyPrAttrList->add(XML_rIns, OString::number(0));
+    if(!m_pImpl->m_pBodyPrAttrList->hasAttribute(XML_bIns))
+        m_pImpl->m_pBodyPrAttrList->add(XML_bIns, OString::number(0));
+
     sax_fastparser::XFastAttributeListRef xBodyPrAttrList(m_pImpl->m_pBodyPrAttrList);
     m_pImpl->m_pBodyPrAttrList = nullptr;
     if (!bTextBoxOnly)


More information about the Libreoffice-commits mailing list