fdo#45190 import of RTF_LI should reset inherited RTF_FI

Change-Id: I17c287fa4daa399876b34182c02d9cf928fe1b6f
This commit is contained in:
Miklos Vajna
2012-05-11 14:45:59 +02:00
parent 46f38ec48c
commit bf123eeffc
3 changed files with 39 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
{\rtf1
{\stylesheet
{\s1 \fi-100 style;}
}
\s1\li0 first
\par
\pard
\s1\fi-100\li0 second
\par
}

View File

@@ -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();

View File

@@ -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);