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

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri May 11 06:08:22 PDT 2012


 sw/qa/extras/rtftok/data/fdo45190.rtf          |   10 ++++++++++
 sw/qa/extras/rtftok/rtftok.cxx                 |   22 ++++++++++++++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    8 +++++++-
 3 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit bf123eeffc05907dfcb0d355ab17359353b0ede5
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri May 11 14:45:59 2012 +0200

    fdo#45190 import of RTF_LI should reset inherited RTF_FI
    
    Change-Id: I17c287fa4daa399876b34182c02d9cf928fe1b6f

diff --git a/sw/qa/extras/rtftok/data/fdo45190.rtf b/sw/qa/extras/rtftok/data/fdo45190.rtf
new file mode 100644
index 0000000..613a283
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/fdo45190.rtf
@@ -0,0 +1,10 @@
+{\rtf1
+{\stylesheet
+{\s1 \fi-100 style;}
+}
+\s1\li0 first
+\par
+\pard
+\s1\fi-100\li0 second
+\par
+}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index bff076a..29ea9be 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -92,6 +92,7 @@ public:
     void testFdo49501();
     void testFdo49271();
     void testFdo49692();
+    void testFdo45190();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -127,6 +128,7 @@ public:
     CPPUNIT_TEST(testFdo49501);
     CPPUNIT_TEST(testFdo49271);
     CPPUNIT_TEST(testFdo49692);
+    CPPUNIT_TEST(testFdo45190);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -721,6 +723,26 @@ void Test::testFdo49692()
     }
 }
 
+void Test::testFdo45190()
+{
+    load("fdo45190.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();
+
+    // inherited \fi should be reset
+    uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
+    sal_Int32 nValue = 0;
+    xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nValue;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nValue);
+
+    // but direct one not
+    xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+    xPropertySet->getPropertyValue("ParaFirstLineIndent") >>= nValue;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-100)), nValue);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a1f27be..83ea09c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2233,7 +2233,6 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     switch (nKeyword)
     {
         case RTF_FI: nSprm = NS_sprm::LN_PDxaLeft1; break;
-        case RTF_LI: nSprm = NS_sprm::LN_PDxaLeft; break;
         case RTF_LIN: nSprm = 0x845e; break;
         case RTF_RI: nSprm = NS_sprm::LN_PDxaRight; break;
         case RTF_RIN: nSprm = 0x845d; break;
@@ -2868,6 +2867,13 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         case RTF_DPFILLBGCB:
             m_aStates.top().aDrawingObject.nFillColorB = nParam; m_aStates.top().aDrawingObject.bHasFillColor = true;
             break;
+        case RTF_LI:
+            m_aStates.top().aParagraphSprms->push_back(make_pair(NS_sprm::LN_PDxaLeft, pIntValue));
+            // It turns out \li should reset the \fi inherited from the stylesheet.
+            // So set the direct formatting to zero, if we don't have such direct formatting yet.
+            if (!m_aStates.top().aParagraphSprms.find(NS_sprm::LN_PDxaLeft1).get())
+                m_aStates.top().aParagraphSprms->push_back(make_pair(NS_sprm::LN_PDxaLeft1, RTFValue::Pointer_t(new RTFValue(0))));
+            break;
         default:
             SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
             aSkip.setParsed(false);


More information about the Libreoffice-commits mailing list