From 5bab5aae165158621dcf740be9bee9fca808aa9d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 1 Oct 2014 12:53:27 +0200 Subject: DOCX drawingML import: handle char color from theme for shape text When we import table styles, we apply that as direct formatting, in case there is no real direct formatting, see lcl_ApplyCellProperties() in the sw UNO implementation. We can do the same here: in case there is no other formatting, then apply the char color from the WPS theme, that will give us the expected result. Change-Id: Ic8e6afc09167f7924a11ab0b445351075f16738e --- oox/source/shape/WpsContext.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'oox/source/shape') diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 4d5863873fd5..9e3218e5bfbc 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -111,6 +111,19 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken drawing::TextVerticalAdjust eAdjust = drawingml::GetTextVerticalAdjust(rAttribs.getToken(XML_anchor, XML_t)); xPropertySet->setPropertyValue("TextVerticalAdjust", uno::makeAny(eAdjust)); } + + // Apply character color of the shape to the shape's textbox. + uno::Reference xText(mxShape, uno::UNO_QUERY); + uno::Reference xTextCursor = xText->createTextCursor(); + xTextCursor->gotoStart(false); + xTextCursor->gotoEnd(true); + const uno::Reference xPropertyState(xTextCursor, uno::UNO_QUERY); + const beans::PropertyState ePropertyState = xPropertyState->getPropertyState("CharColor"); + if (ePropertyState == beans::PropertyState_DEFAULT_VALUE) + { + uno::Reference xTextBoxPropertySet(xTextCursor, uno::UNO_QUERY); + xTextBoxPropertySet->setPropertyValue("CharColor", xPropertySet->getPropertyValue("CharColor")); + } return this; } break; -- cgit