sw/qa/extras/ooxmlexport/data/missing_newline.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx         |   12 ++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx      |    2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 15e9e6d12aa2d49e114ec0cf8326f2264ccf2640
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Mon Mar 25 16:30:19 2019 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Mar 26 16:12:02 2019 +0100

    tdf#124339 DOCX export: fix losing line break after tab
    
    characters, hard hyphen and control characters
    
    See also commit 637a96d1e7875043c28a93c9a543f33a862497cb
    "fdo#78887 <w:br> tag is not being preserved after export".
    
    Change-Id: I70b22061b3baca4e6fee8cb5a0c2655975e252bc
    Reviewed-on: https://gerrit.libreoffice.org/69697
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/missing_newline.odt 
b/sw/qa/extras/ooxmlexport/data/missing_newline.odt
new file mode 100644
index 000000000000..b0f10ade81f6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/missing_newline.odt 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 4ebf802cfa1d..74c85bbfab02 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -462,6 +462,18 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78887, "fdo78887.docx")
     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:br[2]", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO78887b, "missing_newline.odt")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+
+    assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[2]/w:br[1]", 1);
+    assertXPathContent(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:t[1]", "Tab and line break");
+    assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[5]/w:br[1]", 1);
+    assertXPathContent(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[1]/w:r[6]/w:t[1]", "New line");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo78651, "fdo78651.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index c40121040717..ed388364a1ba 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2709,7 +2709,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, 
rtl_TextEncoding /*eCh
                 break;
             case 0x0b: // line break
                 {
-                    if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ) || (prevUnicode == *pIt))
+                    if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ) || prevUnicode < 0x0020)
                     {
                         m_pSerializer->singleElementNS( XML_w, XML_br, FSEND );
                         prevUnicode = *pIt;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to