summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-03-25 16:30:19 +0100
committerLászló Németh <nemeth@numbertext.org>2019-03-26 16:12:02 +0100
commit15e9e6d12aa2d49e114ec0cf8326f2264ccf2640 (patch)
tree0151eaa842eca4e5b46b2a2fa4b8c71e47e21532
parent9042a002a2902e231a98180b610cd438b4f43343 (diff)
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 <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/missing_newline.odtbin0 -> 10524 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx12
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
3 files changed, 13 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/missing_newline.odt
Binary files 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;