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

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Mar 23 06:31:20 PDT 2012


 sw/qa/extras/rtftok/data/fdo47326.rtf          |    5 +++++
 sw/qa/extras/rtftok/rtftok.cxx                 |    9 +++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    8 ++++++++
 3 files changed, 22 insertions(+)

New commits:
commit f84e0e6b1b0ec5f52ee963a62ac420cd872a771e
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Mar 23 12:47:41 2012 +0100

    fdo#47326 fix RTF import of mixed super/nonsuper text
    
    In most cases \super has its own group, but it's valid to have mixed
    super and non-super text in a single group, as long as \super and
    \nosupersub keywords are used: handle this.

diff --git a/sw/qa/extras/rtftok/data/fdo47326.rtf b/sw/qa/extras/rtftok/data/fdo47326.rtf
new file mode 100644
index 0000000..264e719
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo47326.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+Windows\super\'ae\nosupersub XP:
+\pard
+ Cartes:\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index 7483634..f4a0c4d 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -68,6 +68,7 @@ public:
     void testFdo45563();
     void testFdo43965();
     void testN751020();
+    void testFdo47326();
 
     CPPUNIT_TEST_SUITE(RtfModelTest);
 #if !defined(MACOSX) && !defined(WNT)
@@ -82,6 +83,7 @@ public:
     CPPUNIT_TEST(testFdo45563);
     CPPUNIT_TEST(testFdo43965);
     CPPUNIT_TEST(testN751020);
+    CPPUNIT_TEST(testFdo47326);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -389,6 +391,13 @@ void RtfModelTest::testN751020()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), nValue);
 }
 
+void RtfModelTest::testFdo47326()
+{
+    load(OUString(RTL_CONSTASCII_USTRINGPARAM("fdo47326.rtf")));
+    // This was 15 only, as \super buffered text, then the contents of it got lost.
+    CPPUNIT_ASSERT_EQUAL(19, getLength());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 84267f3..d378694 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1932,6 +1932,14 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
                 m_aStates.top().aCharacterSprms->push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue));
             }
             break;
+        case RTF_NOSUPERSUB:
+            if (m_pCurrentBuffer == &m_aSuperBuffer)
+            {
+                replayBuffer(m_aSuperBuffer);
+                m_pCurrentBuffer = 0;
+            }
+            m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign);
+            break;
         case RTF_LINEPPAGE:
         case RTF_LINECONT:
             {


More information about the Libreoffice-commits mailing list