summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-05-09 16:07:12 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-05-09 16:50:59 +0200
commit6092b332b99541bfdb9fd4bb14d0baa7dcf63e6a (patch)
tree38dabe4e430ac17beec6d41bb8aa288a1595281b
parent9520dbf59f6bd6c86791954e082488556a610adc (diff)
fdo#49271 rtftok: make sure we send char props if there are no runs
Change-Id: Id900b06fc1aad1d0f50ff92e3c12616dfbc1a81e
-rw-r--r--sw/qa/extras/rtftok/data/fdo49271.rtf3
-rw-r--r--sw/qa/extras/rtftok/rtftok.cxx17
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx16
3 files changed, 36 insertions, 0 deletions
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<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 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<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)