diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-05-02 17:50:55 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-05-02 18:10:58 +0200 |
commit | e8706d7a110547c04e6db9ed75b2e7f74bd6d0bd (patch) | |
tree | 8dc7ce2737d154f40aeb8ec10788dfaa04cdabc0 | |
parent | 042da092165eea856596db5ba5f18ea1273b88eb (diff) |
fdo#47764 fix RTF import of automatic paragraph background color
Change-Id: I4b3a4bd6ce45cffc5b2c23052c49ff98579c5564
-rw-r--r-- | sw/qa/extras/rtftok/data/fdo47764.rtf | 4 | ||||
-rw-r--r-- | sw/qa/extras/rtftok/rtftok.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/rtftok/data/fdo47764.rtf b/sw/qa/extras/rtftok/data/fdo47764.rtf new file mode 100644 index 000000000000..2a9d367b5aff --- /dev/null +++ b/sw/qa/extras/rtftok/data/fdo47764.rtf @@ -0,0 +1,4 @@ +{\rtf1 +\cbpat0\cf0 +bug +} diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx index eba7bea919aa..137062a43670 100644 --- a/sw/qa/extras/rtftok/rtftok.cxx +++ b/sw/qa/extras/rtftok/rtftok.cxx @@ -91,6 +91,7 @@ public: void testFdo48193(); void testFdo44211(); void testFdo48037(); + void testFdo47764(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -120,6 +121,7 @@ public: CPPUNIT_TEST(testFdo48193); CPPUNIT_TEST(testFdo44211); CPPUNIT_TEST(testFdo48037); + CPPUNIT_TEST(testFdo47764); #endif CPPUNIT_TEST_SUITE_END(); @@ -660,6 +662,20 @@ void Test::testFdo48037() CPPUNIT_ASSERT_EQUAL(nExpected, nActual); } +void Test::testFdo47764() +{ + load("fdo47764.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<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY); + sal_Int32 nValue = 0; + // \cbpat with zero argument should mean the auto (-1) color, not a default color (black) + xPropertySet->getPropertyValue("ParaBackColor") >>= 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 0e1a53faef3e..9bbbcb0c151d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2331,6 +2331,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) } break; case RTF_CBPAT: + if (nParam) { RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_sprm::LN_PShd, NS_ooxml::LN_CT_Shd_fill, pValue); |