sw/qa/extras/ooxmlexport/data/tdf139128.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   12 ++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 ++
 3 files changed, 14 insertions(+)

New commits:
commit 14c4c6c1d764142a0f0ca8c02ccd2028d378e21e
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Tue Jul 12 11:50:35 2022 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sat Jul 23 14:07:38 2022 +0200

    tdf#139128 DOCX: fix export of line break in text frames
    
    Line breaks (text:line-break) of ODF text frames
    (draw:text-box) were lost during DOCX export.
    
    Change-Id: I2e1149234749437ceef0d4643b0e686d5ae92156
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136998
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 024d75681887dd33561917cb3ff6b213924fd59d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137327
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf139128.odt 
b/sw/qa/extras/ooxmlexport/data/tdf139128.odt
new file mode 100644
index 000000000000..544527c069a2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf139128.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 74ff724dbbd3..9ab04a6aa8c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -1050,6 +1050,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149089, "tdf149089.docx")
     CPPUNIT_ASSERT_EQUAL( sal_Int16(text::TextGridMode::LINES), nGridMode);   
// was LINES_AND_CHARS
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf139128)
+{
+    loadAndReload("tdf139128.odt");
+    xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+    CPPUNIT_ASSERT(pXmlDoc);
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 2
+    // - Actual  : 0
+    // i.e. the line break was lost on export.
+    assertXPath(pXmlDoc, "//w:br", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index a3a91a77827e..28e32a50929d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -150,6 +150,7 @@
 #include <com/sun/star/text/GraphicCrop.hpp>
 #include <com/sun/star/embed/EmbedStates.hpp>
 #include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
 
 #include <algorithm>
 #include <cstddef>
@@ -3394,6 +3395,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, 
rtl_TextEncoding /*eCh
                 prevUnicode = *pIt;
                 break;
             case 0x0b: // line break
+            case static_cast<sal_Unicode>(text::ControlCharacter::LINE_BREAK):
                 {
                     if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ) || prevUnicode < 0x0020)
                     {

Reply via email to