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

Michael Stahl mstahl at redhat.com
Wed Feb 6 00:54:30 PST 2013


 sw/qa/extras/rtfimport/data/fdo58646line.rtf   |    1 +
 sw/qa/extras/rtfimport/rtfimport.cxx           |    8 ++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    8 ++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 6769538b2e3ff454c4462e64372c50ff9d70df3e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Feb 5 20:46:19 2013 +0100

    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
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

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 d2a5c31..3e15f55 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -137,6 +137,7 @@ public:
     void testFdo54612();
     void testFdo58933();
     void testFdo44053();
+    void testFdo58646line();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -224,6 +225,7 @@ void Test::run()
         {"fdo54612.rtf", &Test::testFdo54612},
         {"fdo58933.rtf", &Test::testFdo58933},
         {"fdo44053.rtf", &Test::testFdo44053},
+        {"fdo58646line.rtf", &Test::testFdo58646line},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1065,6 +1067,12 @@ void Test::testFdo44053()
             getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
 }
 
+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 cdea1b1..a58e139 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1604,12 +1604,16 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
         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;


More information about the Libreoffice-commits mailing list