diff options
-rw-r--r-- | sw/qa/extras/rtfimport/data/fdo52475.rtf | 5 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo52475.rtf b/sw/qa/extras/rtfimport/data/fdo52475.rtf new file mode 100644 index 000000000000..fe4a557d77ca --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo52475.rtf @@ -0,0 +1,5 @@ +{\rtf1 +{\colortbl;\red228\green228\blue228;} +before \chcbpat1 highlighted\chcbpat0 after +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 61813f1c5555..997e33db4c0e 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -108,6 +108,7 @@ public: void testInk(); void testFdo52389(); void testFdo49655(); + void testFdo52475(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -159,6 +160,7 @@ public: CPPUNIT_TEST(testInk); CPPUNIT_TEST(testFdo52389); CPPUNIT_TEST(testFdo49655); + CPPUNIT_TEST(testFdo52475); #endif CPPUNIT_TEST_SUITE_END(); @@ -843,6 +845,13 @@ void Test::testFdo49655() CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } +void Test::testFdo52475() +{ + // The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO. + load("fdo52475.rtf"); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 5e3365431b5b..d56307fbe803 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2566,9 +2566,8 @@ 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))); + RTFValue::Pointer_t pValue(new RTFValue(nParam ? getColorTable(nParam) : COL_AUTO)); lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_sprm::LN_CShd, NS_ooxml::LN_CT_Shd_fill, pValue); } break; |