diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-07-15 09:36:23 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-07-15 10:53:17 +0200 |
commit | 8a43bfeffab9009c9f373e883fef87af1a7b3843 (patch) | |
tree | d1febd3f61307b21a91138a43175ffd8bdaa4d3f /xmloff | |
parent | 7a2b5236cc73993d71ccf46f62d69c6a9fa5a3d1 (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).
Change-Id: Iebac5ce0be31a59bafb0f9fe7636330585e33822
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98770
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
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)); } |