diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-06-01 16:30:06 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-06-01 16:40:11 +0200 |
commit | 9bbb849dd892fc79df4b2a06253c8cf02cbbcbdf (patch) | |
tree | 275b5a6b9f9285d15729c1560491b98dc665559e | |
parent | c9337a8bfcd904d723c76525e2473578d5af4e77 (diff) |
fdo#50539 fix RTF import of automatic character background color
Change-Id: I7efb3bce9a3a6f6c029d99de2264e00bb1bc7c93
-rw-r--r-- | sw/qa/extras/rtftok/data/fdo50539.rtf | 4 | ||||
-rw-r--r-- | sw/qa/extras/rtftok/rtftok.cxx | 18 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo50539.rtf b/sw/qa/extras/rtftok/data/fdo50539.rtf new file mode 100644 index 000000000000..c8a13012f0b0 --- /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 29ea9be10ed4..a37d02e8244b 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 9f2e0f6263e5..51e95fda85cd 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); |