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

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Apr 20 03:57:30 PDT 2012


 sw/qa/extras/rtftok/data/fdo48356.rtf          |    3 +++
 sw/qa/extras/rtftok/rtftok.cxx                 |   20 ++++++++++++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    2 +-
 3 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 69259c6509809c1064eb05690dcd9c19c840bae1
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Apr 20 12:42:23 2012 +0200

    fdo#48356 fix RTF import of special unicode characters
    
    The \'0d string should not be an exception when ignoring characters
    after the \u control word.

diff --git a/sw/qa/extras/rtftok/data/fdo48356.rtf b/sw/qa/extras/rtftok/data/fdo48356.rtf
new file mode 100644
index 0000000..59d6cb0
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo48356.rtf
@@ -0,0 +1,3 @@
+{\rtf1
+Ma\u269\'0dek
+\par }
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index fad769c..fa1321f 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -81,6 +81,7 @@ public:
     void testFdo45182();
     void testFdo44176();
     void testFdo39053();
+    void testFdo48356();
 
     CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX) && !defined(WNT)
@@ -104,6 +105,7 @@ public:
     CPPUNIT_TEST(testFdo45182);
     CPPUNIT_TEST(testFdo44176);
     CPPUNIT_TEST(testFdo39053);
+    CPPUNIT_TEST(testFdo48356);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -554,6 +556,24 @@ void RtfModelTest::testFdo39053()
     CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
 }
 
+void RtfModelTest::testFdo48356()
+{
+    load("fdo48356.rtf");
+
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+    uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+    OUStringBuffer aBuf;
+    int i = 0;
+    while (xParaEnum->hasMoreElements())
+    {
+        xParaEnum->nextElement();
+        i++;
+    }
+    // The document used to be imported as two paragraphs.
+    CPPUNIT_ASSERT_EQUAL(1, i);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e2fa851..4a0eb27 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -765,7 +765,7 @@ int RTFDocumentImpl::resolveChars(char ch)
     bool bSkipped = false;
     while(!Strm().IsEof() && ch != '{' && ch != '}' && ch != '\\')
     {
-        if (ch != 0x0d && ch != 0x0a)
+        if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d && ch != 0x0a))
         {
             if (m_aStates.top().nCharsToSkip == 0)
             {


More information about the Libreoffice-commits mailing list