oox/source/shape/WpsContext.cxx | 5 ++++- sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-)
New commits: commit d3459346a6f4cf7650a03685bcc89c83716d98b1 Author: Tünde Tóth <toth.tu...@nisz.hu> AuthorDate: Thu Dec 1 16:15:42 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Dec 16 08:00:22 2022 +0000 tdf#152310 DOCX shape import: fix lost text color regression Don't apply COL_AUTO as color of the run. Regression from commit 49a40e3ed200e7c6d728f36d0b4be22dd85c51be "tdf#135923 DOCX shape import: set text color". Change-Id: I9c2088b4c531f09c80715bffdae225ac0987be79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143533 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit fd831c28bfc29d9d5fe2b3074324d4cbc4a70689) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144179 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 9a7458ac6a85..99656195075b 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -220,7 +220,10 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken { uno::Reference<beans::XPropertySet> xRunPropSet( xRun, uno::UNO_QUERY); - xRunPropSet->setPropertyValue("CharColor", xCharColor); + Color aRunColor = COL_AUTO; + xRunPropSet->getPropertyValue("CharColor") >>= aRunColor; + if (aRunColor == COL_AUTO) + xRunPropSet->setPropertyValue("CharColor", xCharColor); } } } diff --git a/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx b/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx new file mode 100644 index 000000000000..f1c8e527df96 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/ColorOverwritten.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 0f0af36ec7c7..4feae4b5d864 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -862,6 +862,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104348_contextMargin, "tdf104348_contextMargin.d CPPUNIT_ASSERT_EQUAL(nMargin, getProperty<sal_Int32>(getParagraph(2), "ParaBottomMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf152310, "ColorOverwritten.docx") +{ + uno::Reference<text::XText> xShape(getShape(1), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), + getProperty<Color>(getParagraphOfText(1, xShape), "CharColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x00b050), + getProperty<Color>(getParagraphOfText(2, xShape), "CharColor")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */