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

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed May 9 07:50:59 PDT 2012


 sw/qa/extras/rtftok/data/fdo49271.rtf          |    3 +++
 sw/qa/extras/rtftok/rtftok.cxx                 |   17 +++++++++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   16 ++++++++++++++++
 3 files changed, 36 insertions(+)

New commits:
commit 6092b332b99541bfdb9fd4bb14d0baa7dcf63e6a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed May 9 16:07:12 2012 +0200

    fdo#49271 rtftok: make sure we send char props if there are no runs
    
    Change-Id: Id900b06fc1aad1d0f50ff92e3c12616dfbc1a81e

diff --git a/sw/qa/extras/rtftok/data/fdo49271.rtf b/sw/qa/extras/rtftok/data/fdo49271.rtf
new file mode 100644
index 0000000..4f3a48c
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo49271.rtf
@@ -0,0 +1,3 @@
+{\rtf1
+\fs50 one \par \par two \par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index e7c51fa..92f722c 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -90,6 +90,7 @@ public:
     void testFdo38786();
     void testN757651();
     void testFdo49501();
+    void testFdo49271();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -123,6 +124,7 @@ public:
     CPPUNIT_TEST(testFdo38786);
     CPPUNIT_TEST(testN757651);
     CPPUNIT_TEST(testFdo49501);
+    CPPUNIT_TEST(testFdo49271);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -679,6 +681,21 @@ void Test::testFdo49501()
     CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
 }
 
+void Test::testFdo49271()
+{
+    load("fdo49271.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();
+    xParaEnum->nextElement();
+    uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
+    float fValue = 0;
+    xPropertySet->getPropertyValue("CharHeight") >>= fValue;
+
+    CPPUNIT_ASSERT_EQUAL(25.f, fValue);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 93b2812..1fd3d4d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1416,7 +1416,23 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
         case RTF_PAR:
             {
                 checkFirstRun();
+                bool bNeedPap = m_bNeedPap;
                 checkNeedPap();
+                if (bNeedPap)
+                {
+                    if (!m_pCurrentBuffer)
+                    {
+                        writerfilter::Reference<Properties>::Pointer_t const pProperties(
+                                new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)
+                                );
+                        Mapper().props(pProperties);
+                    }
+                    else
+                    {
+                        RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
+                        m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
+                    }
+                }
                 if (!m_pCurrentBuffer)
                     parBreak();
                 else if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)


More information about the Libreoffice-commits mailing list