[gnumeric] ODF import/export trendline affinity & dimensions.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ODF import/export trendline affinity & dimensions.
- Date: Mon, 26 Jan 2015 16:51:59 +0000 (UTC)
commit 44c766cf7d32d5b97db8468200e24ff7970ba222
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Mon Jan 26 09:48:10 2015 -0700
ODF import/export trendline affinity & dimensions.
2015-01-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_lin_reg): write
loext:regression-max-degree
(odf_write_polynom_reg): ditto
* openoffice-read.c (od_style_prop_chart): read
loext:regression-max-degree
(od_series_regression): apply loext:regression-max-degree
NEWS | 1 +
plugins/openoffice/ChangeLog | 9 +++++++++
plugins/openoffice/openoffice-read.c | 19 +++++++++++++++++--
plugins/openoffice/openoffice-write.c | 6 +++++-
4 files changed, 32 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index 87c2641..674ed79 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.12.20
Andreas:
* ODF import/export trendline names. [#743448]
+ * ODF import/export trendline affinity & dimensions.
Morten:
* xlsx chart import: fix font family name.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 23c8239..b6c7ad8 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,12 @@
+2015-01-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-write.c (odf_write_lin_reg): write
+ loext:regression-max-degree
+ (odf_write_polynom_reg): ditto
+ * openoffice-read.c (od_style_prop_chart): read
+ loext:regression-max-degree
+ (od_series_regression): apply loext:regression-max-degree
+
2015-01-25 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_plot_style_affine): new
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 5c0a4d4..5008e16 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -7213,6 +7213,14 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
style->other_props = g_slist_prepend
(style->other_props,
oo_prop_new_int ("dims", tmp));
+#if HAVE_OO_NS_LOCALC_EXT
+ else if (oo_attr_int_range (xin, attrs, OO_NS_LOCALC_EXT,
+ "regression-max-degree", &tmp,
+ 1, 100))
+ style->other_props = g_slist_prepend
+ (style->other_props,
+ oo_prop_new_int ("lo-dims", tmp));
+#endif
else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "regression-affine",
&btmp))
style->other_props = g_slist_prepend (style->other_props,
@@ -9192,6 +9200,8 @@ od_series_regression (GsfXMLIn *xin, xmlChar const **attrs)
gchar const *type_name = "GogLinRegCurve";
gchar const *regression_name = NULL;
gchar const *regression_name_c = NULL;
+ gboolean write_lo_dims = FALSE;
+ GValue *lo_dim = NULL;
for (l = chart_style->other_props; l != NULL; l = l->next) {
OOProp *prop = l->data;
if (0 == strcmp ("regression-type", prop->name)) {
@@ -9211,15 +9221,18 @@ od_series_regression (GsfXMLIn *xin, xmlChar const **attrs)
(reg_type, "gnm:logfit"))
type_name = "GogLogFitCurve";
else if (0 == strcmp
- (reg_type, "gnm:polynomial"))
+ (reg_type, "gnm:polynomial")) {
type_name = "GogPolynomRegCurve";
- else if (0 == strcmp
+ write_lo_dims = TRUE;
+ } else if (0 == strcmp
(reg_type, "gnm:moving-average"))
type_name = "GogMovingAvg";
} else if (0 == strcmp ("regression-name-expression", prop->name)) {
regression_name = g_value_get_string (&prop->value);
} else if (0 == strcmp ("regression-name-constant", prop->name)) {
regression_name_c = g_value_get_string (&prop->value);
+ } else if (0 == strcmp ("lo-dims", prop->name)) {
+ lo_dim = &prop->value;
}
}
@@ -9227,6 +9240,8 @@ od_series_regression (GsfXMLIn *xin, xmlChar const **attrs)
GOG_OBJECT (gog_trend_line_new_by_name (type_name));
regression = gog_object_add_by_name (GOG_OBJECT (state->chart.series),
"Trend line", regression);
+ if (write_lo_dims && lo_dim != NULL)
+ g_object_set_property ( G_OBJECT (regression), "dims", lo_dim);
oo_prop_list_apply (chart_style->other_props, G_OBJECT (regression));
g_object_get (G_OBJECT (regression), "style", &style, NULL);
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index cd04424..ee010ac 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -8138,7 +8138,9 @@ odf_write_lin_reg (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
gsf_xml_out_add_cstr (state->xml, CHART "regression-type", "linear");
if (state->with_extension) {
odf_write_plot_style_uint (state->xml, obj,
- "dims", GNMSTYLE "regression-polynomial-dims");
+ "dims", GNMSTYLE "regression-polynomial-dims");
+ odf_write_plot_style_uint (state->xml, obj,
+ "dims", LOEXT "regression-max-degree");
odf_write_plot_style_affine (state->xml, obj, 0.);
}
odf_write_reg_name (state, obj);
@@ -8153,6 +8155,8 @@ odf_write_polynom_reg (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
GNMSTYLE "polynomial");
odf_write_plot_style_uint (state->xml, obj,
"dims", GNMSTYLE "regression-polynomial-dims");
+ odf_write_plot_style_uint (state->xml, obj,
+ "dims", LOEXT "regression-max-degree");
odf_write_plot_style_affine (state->xml, obj, 0.);
}
odf_write_reg_name (state, obj);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]