[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at suse.cz
Sun Feb 3 05:50:40 PST 2013


 sw/qa/extras/rtfimport/data/fdo59419.rtf       |    5 +++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   10 ++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    8 ++++++++
 3 files changed, 23 insertions(+)

New commits:
commit f593a2e4179b05ae1019372cde612cb242d1d27f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sun Feb 3 14:37:38 2013 +0100

    fdo#59419 fix RTF import of hex form of \r and \n
    
    Change-Id: Ic700cdc67f756cafc454c326b73f680a8a47a6e8

diff --git a/sw/qa/extras/rtfimport/data/fdo59419.rtf b/sw/qa/extras/rtfimport/data/fdo59419.rtf
new file mode 100644
index 0000000..ec52508
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo59419.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+\trowd\cellx3000\pard\plain\intbl the next cell will be empty\cell\row
+\pard\trowd\cellx3000\pard\plain\intbl\'0d\cell\row
+\pard\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index ab8ac50..c321ba6 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -139,6 +139,7 @@ public:
     void testFdo44053();
     void testFdo48440();
     void testFdo58646();
+    void testFdo59419();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -249,6 +250,7 @@ void Test::run()
         {"fdo44053.rtf", &Test::testFdo44053},
         {"fdo48440.rtf", &Test::testFdo48440},
         {"fdo58646.rtf", &Test::testFdo58646},
+        {"fdo59419.rtf", &Test::testFdo59419},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1078,6 +1080,14 @@ void Test::testFdo58646()
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+void Test::testFdo59419()
+{
+    // Junk to be ignored broke import of the table.
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3aed3b4..bc15702 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -945,6 +945,14 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
 
 void RTFDocumentImpl::text(OUString& rString)
 {
+    if (rString.getLength() == 1)
+    {
+        // No cheating! Tokenizer ignores bare \r and \n, their hex \'0d / \'0a form doesn't count, either.
+        char ch = rString.getStr()[0];
+        if (ch == 0x0d || ch == 0x0a)
+            return;
+    }
+
     bool bRet = true;
     switch (m_aStates.top().nDestinationState)
     {


More information about the Libreoffice-commits mailing list