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 b7a294af40521d71e6583dad2908e09f3758649c Author: Tünde Tóth <toth.tu...@nisz.hu> AuthorDate: Tue Jul 12 11:50:35 2022 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Fri Jul 22 12:49:32 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> 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 038dca7cc92b..f139837b822a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -1077,6 +1077,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 28097d40c411..abbe2f8bb06f 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> @@ -3396,6 +3397,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) {