summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/rtftok/data/fdo47764.rtf4
-rw-r--r--sw/qa/extras/rtftok/rtftok.cxx16
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx1
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);