sw/qa/extras/rtftok/data/fdo50539.rtf | 4 ++++ sw/qa/extras/rtftok/rtftok.cxx | 18 ++++++++++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1 + 3 files changed, 23 insertions(+)
New commits: commit 9bbb849dd892fc79df4b2a06253c8cf02cbbcbdf Author: Miklos Vajna <[email protected]> Date: Fri Jun 1 16:30:06 2012 +0200 fdo#50539 fix RTF import of automatic character background color Change-Id: I7efb3bce9a3a6f6c029d99de2264e00bb1bc7c93 diff --git a/sw/qa/extras/rtftok/data/fdo50539.rtf b/sw/qa/extras/rtftok/data/fdo50539.rtf new file mode 100644 index 0000000..c8a1301 --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo50539.rtf @@ -0,0 +1,4 @@ +{\rtf1 +\chcbpat0\cf0 +bug +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index 29ea9be..a37d02e 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -93,6 +93,7 @@ public: void testFdo49271(); void testFdo49692(); void testFdo45190(); + void testFdo50539(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -129,6 +130,7 @@ public: CPPUNIT_TEST(testFdo49271); CPPUNIT_TEST(testFdo49692); CPPUNIT_TEST(testFdo45190); + CPPUNIT_TEST(testFdo50539); #endif CPPUNIT_TEST_SUITE_END(); @@ -743,6 +745,22 @@ void Test::testFdo45190() CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-100)), nValue); } +void Test::testFdo50539() +{ + load("fdo50539.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(); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); + uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY); + sal_Int32 nValue = 0; + // \chcbpat with zero argument should mean the auto (-1) color, not a default color (black) + xPropertySet->getPropertyValue("CharBackColor") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), nValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 9f2e0f6..51e95fd 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2370,6 +2370,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aDefaultState.aCharacterSprms.set(NS_sprm::LN_CLidBi, pIntValue); break; case RTF_CHCBPAT: + if (nParam) { RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_sprm::LN_CShd, NS_ooxml::LN_CT_Shd_fill, pValue); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
