diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-02-03 08:01:55 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-02-08 07:52:27 +0100 |
commit | b99f310d3b24dc45e3d84751e810c0bbff1d991b (patch) | |
tree | 6780680407253b0b9f7599843313730309b84368 /xmloff/source/chart | |
parent | 48a8901a205000e9878c7ee5b4fb26e07ea0a607 (diff) |
tdf#94235 Add support for series name in data series labels
including ODF/OOXML import/export (and test)
Change-Id: Id5a5194630a67476f7c5390294400a00ea3ad42d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110338
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'xmloff/source/chart')
-rw-r--r-- | xmloff/source/chart/PropertyMap.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/chart/PropertyMaps.cxx | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx index d98fa98e8912..00a6ed7ea6f3 100644 --- a/xmloff/source/chart/PropertyMap.hxx +++ b/xmloff/source/chart/PropertyMap.hxx @@ -83,6 +83,7 @@ #define XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR ( XML_SCH_CTF_START + 24 ) #define XML_SCH_CONTEXT_SPECIAL_ERRORBAR_RANGE ( XML_SCH_CTF_START + 25 ) #define XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE ( XML_SCH_CTF_START + 26 ) +#define XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SERIES ( XML_SCH_CTF_START + 27 ) #define MAP_FULL( ApiName, NameSpace, XMLTokenName, XMLType, ContextId, EarliestODFVersionForExport ) { ApiName, sizeof(ApiName)-1, XML_NAMESPACE_##NameSpace, xmloff::token::XMLTokenName, XMLType|XML_TYPE_PROP_CHART, ContextId, EarliestODFVersionForExport, false } #define MAP_ENTRY( a, ns, nm, t ) { a, sizeof(a)-1, XML_NAMESPACE_##ns, xmloff::token::nm, t|XML_TYPE_PROP_CHART, 0, SvtSaveOptions::ODFSVER_010, false } @@ -248,6 +249,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] = MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_NUMBER, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_NUMBER ), // convert one constant MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_TEXT, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_TEXT ), // to 'tristate' and two bools MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_SYMBOL, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SYMBOL ), + MAP_SPECIAL( "DataCaption", CHART, XML_DATA_LABEL_SERIES, XML_TYPE_NUMBER | MID_FLAG_MERGE_PROPERTY, XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SERIES ), MAP_SPECIAL_ODF12( "LabelSeparator", CHART, XML_LABEL_SEPARATOR, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR ), MAP_ENTRY_ODF12( "LabelPlacement", CHART, XML_LABEL_POSITION, XML_SCH_TYPE_LABEL_PLACEMENT_TYPE ), MAP_ENTRY( "SegmentOffset", CHART, XML_PIE_OFFSET, XML_TYPE_NUMBER ), diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 6ce23fb54c68..f93747b93794 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -461,6 +461,11 @@ void XMLChartExportPropertyMapper::handleSpecialItem( bValue = (( nValue & chart::ChartDataCaption::SYMBOL ) == chart::ChartDataCaption::SYMBOL ); ::sax::Converter::convertBool( sValueBuffer, bValue ); break; + case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SERIES: + rProperty.maValue >>= nValue; + bValue = (( nValue & chart::ChartDataCaption::DATA_SERIES ) == chart::ChartDataCaption::DATA_SERIES ); + ::sax::Converter::convertBool( sValueBuffer, bValue ); + break; case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH: case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT: { @@ -642,6 +647,15 @@ bool XMLChartImportPropertyMapper::handleSpecialItem( SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::SYMBOL ); rProperty.maValue <<= nValue; break; + case XML_SCH_CONTEXT_SPECIAL_DATA_LABEL_SERIES: + rProperty.maValue >>= nValue; + (void)::sax::Converter::convertBool( bValue, rValue ); + if( bValue ) + SCH_XML_SETFLAG( nValue, chart::ChartDataCaption::DATA_SERIES ); + else + SCH_XML_UNSETFLAG( nValue, chart::ChartDataCaption::DATA_SERIES ); + rProperty.maValue <<= nValue; + break; case XML_SCH_CONTEXT_SPECIAL_SYMBOL_WIDTH: case XML_SCH_CONTEXT_SPECIAL_SYMBOL_HEIGHT: { |