From 6092b332b99541bfdb9fd4bb14d0baa7dcf63e6a Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 9 May 2012 16:07:12 +0200 Subject: fdo#49271 rtftok: make sure we send char props if there are no runs Change-Id: Id900b06fc1aad1d0f50ff92e3c12616dfbc1a81e --- 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(+) create mode 100644 sw/qa/extras/rtftok/data/fdo49271.rtf diff --git a/sw/qa/extras/rtftok/data/fdo49271.rtf b/sw/qa/extras/rtftok/data/fdo49271.rtf new file mode 100644 index 000000000000..4f3a48c6e9e8 --- /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 e7c51fa6bba4..92f722c3a533 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 xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); + xParaEnum->nextElement(); + uno::Reference 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 93b2812bfdc6..1fd3d4dce577 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::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) -- cgit v1.2.3