diff options
-rw-r--r-- | sw/qa/extras/rtftok/data/fdo48876.rtf | 5 | ||||
-rw-r--r-- | sw/qa/extras/rtftok/rtftok.cxx | 17 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 |
3 files changed, 30 insertions, 2 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo48876.rtf b/sw/qa/extras/rtftok/data/fdo48876.rtf new file mode 100644 index 000000000000..49a6eb0bf6a9 --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo48876.rtf @@ -0,0 +1,5 @@ +{\rtf +\sl54 +C +\par +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 6870f0202e86..0bb45e47d0d7 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -29,6 +29,8 @@ #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/style/CaseMap.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/BorderLineStyle.hpp> @@ -83,6 +85,7 @@ public: void testFdo39053(); void testFdo48356(); void testFdo48023(); + void testFdo48876(); CPPUNIT_TEST_SUITE(RtfModelTest); #if !defined(MACOSX) && !defined(WNT) @@ -108,6 +111,7 @@ public: CPPUNIT_TEST(testFdo39053); CPPUNIT_TEST(testFdo48356); CPPUNIT_TEST(testFdo48023); + CPPUNIT_TEST(testFdo48876); #endif CPPUNIT_TEST_SUITE_END(); @@ -599,6 +603,19 @@ void RtfModelTest::testFdo48023() CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); } +void RtfModelTest::testFdo48876() +{ + load("fdo48876.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(); + CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); + uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY); + style::LineSpacing aSpacing; + xPropertySet->getPropertyValue("ParaLineSpacing") >>= aSpacing; + CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, aSpacing.Mode); +} + CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index e50cc1fea177..750e473d17c9 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2379,9 +2379,15 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_SL: - if (nParam > 0) { - // NS_sprm::LN_PDyaLine could be used, but that won't work with slmult + // This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'. + RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast)); + if (nParam < 0) + { + pValue.reset(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact)); + pIntValue.reset(new RTFValue(-nParam)); + } + m_aStates.top().aParagraphAttributes->push_back(make_pair(NS_ooxml::LN_CT_Spacing_lineRule, pValue)); m_aStates.top().aParagraphAttributes->push_back(make_pair(NS_ooxml::LN_CT_Spacing_line, pIntValue)); } break; |