[PATCH libreoffice-4-0] RTF import: fix import of \line symbol

Michael Stahl (via Code Review) gerrit at gerrit.libreoffice.org
Tue Feb 5 12:19:13 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2006

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/06/2006/1

RTF import: fix import of \line symbol

"Required line break" was eaten by the newly added code in text() to
ignore \'0a.  (regression from f593a2e4179b05ae1019372cde612cb242d1d27f)

(cherry picked from commit c4696e7c0456df8d9466acbae3ea1fa9dcfa73f0)

Conflicts:
	sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: Id32687c40a17ddb99196635cedfc850182705799
---
A sw/qa/extras/rtfimport/data/fdo58646line.rtf
M sw/qa/extras/rtfimport/rtfimport.cxx
M writerfilter/source/rtftok/rtfdocumentimpl.cxx
3 files changed, 15 insertions(+), 2 deletions(-)



diff --git a/sw/qa/extras/rtfimport/data/fdo58646line.rtf b/sw/qa/extras/rtfimport/data/fdo58646line.rtf
new file mode 100644
index 0000000..63cf71d
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo58646line.rtf
@@ -0,0 +1 @@
+{\rtf1 foo\line bar}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 3dc2f1b..5c82657 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -136,6 +136,7 @@
     void testFdo45183();
     void testFdo54612();
     void testFdo58933();
+    void testFdo58646line();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -222,6 +223,7 @@
         {"fdo45183.rtf", &Test::testFdo45183},
         {"fdo54612.rtf", &Test::testFdo54612},
         {"fdo58933.rtf", &Test::testFdo58933},
+        {"fdo58646line.rtf", &Test::testFdo58646line},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1052,6 +1054,12 @@
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength());
 }
 
+void Test::testFdo58646line()
+{
+    // \line symbol was ignored
+    getParagraph(1, "foo\nbar");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 37d0376..a3964b4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1589,12 +1589,16 @@
         checkUnicode();
     setNeedSect();
     RTFSkipDestination aSkip(*this);
-    sal_uInt8 cCh = 0;
 
+    if (RTF_LINE == nKeyword)
+    {   // very special handling since text() will eat lone '\n'
+        singleChar('\n');
+        return 0;
+    }
     // Trivial symbols
+    sal_uInt8 cCh = 0;
     switch (nKeyword)
     {
-        case RTF_LINE: cCh = '\n'; break;
         case RTF_TAB: cCh = '\t'; break;
         case RTF_BACKSLASH: cCh = '\\'; break;
         case RTF_LBRACE: cCh = '{'; break;

-- 
To view, visit https://gerrit.libreoffice.org/2006
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id32687c40a17ddb99196635cedfc850182705799
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Michael Stahl <mstahl at redhat.com>


More information about the LibreOffice mailing list