summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-02-11 07:53:15 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-02-22 07:36:21 +0100
commit4141533a3fb984fbaefe87b15fceeda7f2082061 (patch)
tree46b7dc9e659033666cdef2275ec283dd2de8fd96 /xmloff/source
parentc40ce0c542b46d45a00561a926953df2fe9a9762 (diff)
[API CHANGE] tdf#133423 Implement chart:regression-moving-type
Change-Id: Icb967367fbf12e5a1566b7f18ebe5e3d8a3534f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110748 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/chart/PropertyMap.hxx5
-rw-r--r--xmloff/source/chart/PropertyMaps.cxx29
-rw-r--r--xmloff/source/core/xmltoken.cxx3
-rw-r--r--xmloff/source/token/tokens.txt3
4 files changed, 38 insertions, 2 deletions
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index 08c05923e861..c35e34b83dbe 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -84,6 +84,7 @@
#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 XML_SCH_CONTEXT_SPECIAL_MOVING_AVERAGE_TYPE ( XML_SCH_CTF_START + 28 )
#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 }
@@ -214,6 +215,8 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
// regression curve properties
MAP_SPECIAL( "RegressionType", CHART, XML_REGRESSION_TYPE, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_REGRESSION_TYPE ),
+ MAP_SPECIAL_ODF13( "MovingAverageType", LO_EXT, XML_REGRESSION_MOVING_TYPE, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_MOVING_AVERAGE_TYPE ),
+ MAP_SPECIAL_ODF13( "MovingAverageType", CHART, XML_REGRESSION_MOVING_TYPE, XML_TYPE_STRING, XML_SCH_CONTEXT_SPECIAL_MOVING_AVERAGE_TYPE ),
// ODF 1.3 OFFICE-3958
MAP_ENTRY_ODF13( "CurveName", XML_NAMESPACE_LO_EXT, XML_REGRESSION_CURVE_NAME, XML_TYPE_STRING ),
@@ -228,8 +231,6 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
// ODF 1.3 OFFICE-3959
MAP_ENTRY_ODF13( "MovingAveragePeriod", XML_NAMESPACE_LO_EXT, XML_REGRESSION_PERIOD, XML_TYPE_NUMBER ),
MAP_ENTRY_ODF13( "MovingAveragePeriod", XML_NAMESPACE_CHART, XML_REGRESSION_PERIOD, XML_TYPE_NUMBER ),
- MAP_ENTRY_ODF13( "MovingAverageType", XML_NAMESPACE_LO_EXT, XML_REGRESSION_MOVING_TYPE, XML_TYPE_STRING ),
- MAP_ENTRY_ODF13( "MovingAverageType", XML_NAMESPACE_CHART, XML_REGRESSION_MOVING_TYPE, XML_TYPE_STRING ),
MAP_ENTRY_ODF_EXT( "ExtrapolateForward", LO_EXT, XML_REGRESSION_EXTRAPOLATE_FORWARD, XML_TYPE_DOUBLE ),
MAP_ENTRY_ODF_EXT( "ExtrapolateBackward", LO_EXT, XML_REGRESSION_EXTRAPOLATE_BACKWARD, XML_TYPE_DOUBLE ),
diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx
index f93747b93794..f63d04c45fd4 100644
--- a/xmloff/source/chart/PropertyMaps.cxx
+++ b/xmloff/source/chart/PropertyMaps.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/chart/ChartAxisMarks.hpp>
#include <com/sun/star/chart/ChartDataCaption.hpp>
+#include <com/sun/star/chart2/MovingAverageType.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
@@ -61,6 +62,7 @@
using namespace com::sun::star;
using namespace ::xmloff::token;
+using namespace css::chart2;
namespace {
@@ -516,6 +518,20 @@ void XMLChartExportPropertyMapper::handleSpecialItem(
}
break;
+ case XML_SCH_CONTEXT_SPECIAL_MOVING_AVERAGE_TYPE:
+ {
+ rProperty.maValue >>= nValue;
+ if (nValue == MovingAverageType::Prior)
+ sValueBuffer.append( GetXMLToken( XML_PRIOR ));
+ else if (nValue == MovingAverageType::Central)
+ sValueBuffer.append( GetXMLToken( XML_CENTRAL ));
+ else if (nValue == MovingAverageType::AveragedAbscissa)
+ sValueBuffer.append( GetXMLToken( XML_AVERAGED_ABSCISSA ));
+ else // default
+ sValueBuffer.append( GetXMLToken( XML_PRIOR ));
+ }
+ break;
+
default:
bHandled = false;
break;
@@ -698,6 +714,19 @@ bool XMLChartImportPropertyMapper::handleSpecialItem(
}
break;
+ case XML_SCH_CONTEXT_SPECIAL_MOVING_AVERAGE_TYPE:
+ {
+ if (IsXMLToken( rValue, XML_PRIOR ))
+ rProperty.maValue <<= MovingAverageType::Prior;
+ else if (IsXMLToken( rValue, XML_CENTRAL))
+ rProperty.maValue <<= MovingAverageType::Central;
+ else if (IsXMLToken( rValue, XML_AVERAGED_ABSCISSA))
+ rProperty.maValue <<= MovingAverageType::AveragedAbscissa;
+ else // default
+ rProperty.maValue <<= MovingAverageType::Prior;
+ }
+ break;
+
default:
bRet = false;
break;
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index d46ec76fb7fa..6264eda43b31 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -295,6 +295,7 @@ namespace xmloff::token {
TOKEN( "automatic-update", XML_AUTOMATIC_UPDATE ),
TOKEN( "autosize", XML_AUTOSIZE ),
TOKEN( "average", XML_AVERAGE ),
+ TOKEN( "averaged-abscissa", XML_AVERAGED_ABSCISSA ),
TOKEN( "axis", XML_AXIS ),
TOKEN( "axis-color", XML_AXIS_COLOR ),
TOKEN( "back-scale", XML_BACK_SCALE ),
@@ -402,6 +403,7 @@ namespace xmloff::token {
TOKEN( "cell-range-address-list", XML_CELL_RANGE_ADDRESS_LIST ),
TOKEN( "cell-range-source", XML_CELL_RANGE_SOURCE ),
TOKEN( "center", XML_CENTER ),
+ TOKEN( "central", XML_CENTRAL ),
TOKEN( "chain-next-name", XML_CHAIN_NEXT_NAME ),
TOKEN( "change", XML_CHANGE ),
TOKEN( "change-deletion", XML_CHANGE_DELETION ),
@@ -1520,6 +1522,7 @@ namespace xmloff::token {
TOKEN( "print-time", XML_PRINT_TIME ),
TOKEN( "printable", XML_PRINTABLE ),
TOKEN( "printed-by", XML_PRINTED_BY ),
+ TOKEN( "prior", XML_PRIOR ),
TOKEN( "proceedings", XML_PROCEEDINGS ),
TOKEN( "product", XML_PRODUCT ),
TOKEN( "projection", XML_PROJECTION ),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index dcf905ba40e6..503fadc0cca9 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -210,6 +210,7 @@ automatic-styles
automatic-update
autosize
average
+averaged-abscissa
axis
axis-color
back-scale
@@ -317,6 +318,7 @@ cell-range-address
cell-range-address-list
cell-range-source
center
+central
chain-next-name
change
change-deletion
@@ -1430,6 +1432,7 @@ print-ranges
print-time
printable
printed-by
+prior
proceedings
product
projection