diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-07-15 09:36:23 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-07-22 12:14:28 +0200 |
commit | b894890cfdddc7dd38f483c9a9b2592a24dd1697 (patch) | |
tree | b320d648aa19e31ca419e00182df220b99edf558 /xmloff | |
parent | 9f1d98a6a8a0e61ee4e021ac35d588e4bb025407 (diff) |
tdf#131175 oox chart import: fix char color of <dLbl>, inherited from <dLbls>
There were two problems here:
1) Our chart model expects the char formatting of a data label as direct
formatting, so in case <c:dLbl> has no such formatting, but <c:dLbls>
has, oox has to explicitly inherit.
2) The data label char formatting is represented using
chart::FormattedString, but the char format of it is not (yet) exported
to ODF. Given that the char format of the series and the individual data
labels is the same, restore the same formatting on import to please
rendering.
With these, finally the chart labels in the bugdoc are white, not black
(and have a dark background, so they are readable).
(cherry picked from commit 8a43bfeffab9009c9f373e883fef87af1a7b3843)
Change-Id: Iebac5ce0be31a59bafb0f9fe7636330585e33822
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99026
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLSeries2Context.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index 378c1195633a..eb743022fd3e 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -1121,6 +1121,26 @@ void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeri xLabels[j] = xCustomLabel; xCustomLabel->setString(seriesStyle.mCustomLabels[j]); xCustomLabel->setFieldType(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_TEXT); + + // Restore character properties on the text span manually, till + // SchXMLExportHelper_Impl::exportCustomLabel() does not write the style. + uno::Reference<beans::XPropertySetInfo> xPointPropInfo + = xPointProp->getPropertySetInfo(); + if (xPointPropInfo.is()) + { + uno::Sequence<beans::Property> aProperties = xPointPropInfo->getProperties(); + for (const auto& rProperty : std::as_const(aProperties)) + { + if (!rProperty.Name.startsWith("Char") + || rProperty.Name.startsWith("Chart")) + { + continue; + } + + xCustomLabel->setPropertyValue( + rProperty.Name, xPointProp->getPropertyValue(rProperty.Name)); + } + } } xPointProp->setPropertyValue("CustomLabelFields", uno::Any(xLabels)); } |