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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 18 11:49:02 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf118691.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   12 ++++++++++++
 writerfilter/source/ooxml/model.xml          |    4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 8693f6fa799c43304741f465c23e827c3ceafd9d
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Sep 17 13:36:09 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Tue Sep 18 13:48:38 2018 +0200

    tdf#118691 DOCX import: fix table loss caused by <w:cr>
    
    According to the OOXML standard, <w:cr> (carriage return –
    Unicode character 000D) is equivalent to a break
    with null type and clear attributes, so we handle it as
    a <w:br/>, instead of endOfParagraph, fixing
    losing table paragraphs and tables containing <w:cr/>.
    
    Note: It seems, MSO cannot handle carriage return characters
    in table cells correctly. It shows squares (unknown
    characters) without line break there. Copying this text to
    a non-table paragraph in MSO, we get the correct layout with
    line breaks. Copying this text with carriage return characters
    back to a table cell, we get squares again. With this LO fix,
    it will be possible to fix the bad tables edited by MS Word
    by using LO, because LibreOffice import/export converts all
    <w:cr>s to <w:br>s (as before, but now without destroying
    the structure of the tables).
    
    Change-Id: Iee42f71e9a00531353582e7127c2c212ea0890d0
    Reviewed-on: https://gerrit.libreoffice.org/60585
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit f63a60f56156e4ac17887e6c96d15fb865a2a8eb)
    Reviewed-on: https://gerrit.libreoffice.org/60655
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf118691.docx b/sw/qa/extras/ooxmlexport/data/tdf118691.docx
new file mode 100644
index 000000000000..ce6c6c5cf76d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118691.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index df780afde73e..f32d14ee62a0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -443,6 +443,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf104797, "tdf104797.docx")
     CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(2), 5), "IsStart"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf118691, "tdf118691.docx")
+{
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
+                                                    uno::UNO_QUERY);
+    // Text "Before" stays in the first cell, not removed before the table because of
+    // bad handling of <w:cr>
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("Before\nAfter"), xCell->getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 25f8a267bb8a..7146ccbe848d 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17927,8 +17927,8 @@
     <resource name="CT_PgNum" resource="Stream">
       <action name="end" action="pgNum"/>
     </resource>
-    <resource name="CT_Cr" resource="Stream">
-      <action name="end" action="endOfParagraph"/>
+    <resource name="CT_Cr" resource="Properties">
+      <action name="end" action="handleBreak"/>
     </resource>
     <resource name="CT_Tab" resource="Stream">
       <action name="end" action="tab"/>


More information about the Libreoffice-commits mailing list