diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-04-15 13:39:03 +0200 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-04-18 18:07:57 +0200 |
commit | d7214aba95bbdcbd40e87ef50fc66f2e2ec4f5ff (patch) | |
tree | a4a7b62270149e841b8510cb3e810de43ae9b8c5 /oox | |
parent | 176406a07edc29f59a67464c7812358f46421f4d (diff) |
tdf#160517 - chart odf: import/export formatted chart titles
(main, sub, axis titles) texts properly to/from odf format.
Fix odf export of formatted chart titles. The exported data structure
will look like:
<chart:title svg:x="3.304cm" svg:y="0.285cm" chart:style-name="ch2">
<text:p>
<text:span text:style-name="T1">This</text:span>
<text:span text:style-name="T2"> is</text:span>
.
.
.
<text:span text:style-name="T3">3</text:span>
<text:span text:style-name="T2"> a </text:span>
</text:p>
</chart:title>
Fix import of formatted chart titles. Put the properties and related texts
into the chart2::XFormattedString2 uno objects.
Follow-up commit of:
55e9a27afd2d6a13cf76b39641bf121c3ec4b45c
Related: tdf#39052 - chart ooxml: export formatted chart titles
4f994cec388377cc5c2bddb804bd92eb4cd7dc8d
tdf#39052 - Chart: make characters formatable in editable chart textshapes
--
TODO: chart data point / dataseries labels are handled differently
since those are not editable objects, but that is a completily different
issue.
--
Change-Id: I1842f2c69c132bdf578bb2d354f451cc9d49c63c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166122
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/chartexport.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 75283815a831..e4d6ead64774 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1155,13 +1155,9 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC Reference< beans::XPropertySet > xPropSubTitle( xChartDoc->getSubTitle(), UNO_QUERY ); if( xPropSubTitle.is()) { - try - { + OUString aSubTitle; + if ((xPropSubTitle->getPropertyValue("String") >>= aSubTitle) && !aSubTitle.isEmpty()) xPropSubTitle->getPropertyValue("FormattedStrings") >>= xFormattedSubTitle; - } - catch( beans::UnknownPropertyException & ) - { - } } // chart element @@ -1452,7 +1448,9 @@ void ChartExport::exportTitle( const Reference< XShape >& xShape, Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); if( xPropSet.is()) { - xPropSet->getPropertyValue("FormattedStrings") >>= xFormattedTitle; + OUString aTitle; + if ((xPropSet->getPropertyValue("String") >>= aTitle) && !aTitle.isEmpty()) + xPropSet->getPropertyValue("FormattedStrings") >>= xFormattedTitle; } // tdf#101322: add subtitle to title |