diff options
-rw-r--r-- | oox/source/shape/WpsContext.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf124754.docx | bin | 0 -> 20960 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 15 |
3 files changed, 22 insertions, 2 deletions
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 0f39a850b0ee..0692ea43777d 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -140,8 +140,13 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken { uno::Reference<beans::XPropertySet> xTextBoxPropertySet(xTextCursor, uno::UNO_QUERY); - xTextBoxPropertySet->setPropertyValue( - "CharColor", xPropertySet->getPropertyValue("CharColor")); + uno::Any xCharColor = xPropertySet->getPropertyValue("CharColor"); + Color aColor = COL_AUTO; + if (xCharColor >>= aColor) + { + if (aColor != COL_AUTO) + xTextBoxPropertySet->setPropertyValue("CharColor", xCharColor); + } } return this; } diff --git a/sw/qa/extras/ooxmlimport/data/tdf124754.docx b/sw/qa/extras/ooxmlimport/data/tdf124754.docx Binary files differnew file mode 100644 index 000000000000..2f7f4e14bda5 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf124754.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index fcd6d8d34d91..1c7282623b00 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -194,6 +194,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf117843, "tdf117843.docx") getProperty<sal_Int32>(getParagraphOfText(1, xHeaderText), "ParaTopMargin")); } +// related tdf#124754 DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx") { uno::Reference<text::XTextRange> xParagraph = getParagraph(1); @@ -204,6 +205,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx") getProperty<sal_Int32>(xText, "CharColor")); } +// related tdf#43017 +DECLARE_OOXMLIMPORT_TEST(testTdf124754, "tdf124754.docx") +{ + uno::Reference<text::XText> textbox(getShape(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(1, getParagraphs(textbox)); + + uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, textbox); + uno::Reference<text::XTextRange> xText = getRun(xParagraph, 2); + + // Ensure that hyperlink text color is not black + CPPUNIT_ASSERT_EQUAL_MESSAGE("Hyperlink color should be not black!", sal_Int32(353217), + getProperty<sal_Int32>(xText, "CharColor")); +} + DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx") { // the position of the flying text frame should be off page |