[gnumeric] ODF export axis positions.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ODF export axis positions.
- Date: Sat, 31 Jan 2015 05:36:11 +0000 (UTC)
commit da7eb2976d04dc487c86f826cab7d7ea58db33ea
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Fri Jan 30 22:33:11 2015 -0700
ODF export axis positions.
2015-01-30 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_data_attribute): alsoe handle constant
floats
(odf_write_axis_position): new
(odf_write_axis_style): call odf_write_axis_position from here
NEWS | 1 +
plugins/openoffice/ChangeLog | 7 +++++++
plugins/openoffice/openoffice-write.c | 33 ++++++++++++++++++++++++++++++---
3 files changed, 38 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index ea7f6cd..ac6351a 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Andreas:
* ODF import/export series fill types. [#743613]
* ODF import/export marker outline colour.
* ODF export all charts in a graph. (part 1)
+ * ODF export axis positions.
Morten:
* xlsx chart import: fix font family name.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index ec25423..8e69539 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-30 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-write.c (odf_write_data_attribute): alsoe handle constant
+ floats
+ (odf_write_axis_position): new
+ (odf_write_axis_style): call odf_write_axis_position from here
+
2015-01-29 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_n_charts): new
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 59e141a..c7d2f6d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -6308,6 +6308,9 @@ odf_write_data_attribute (GnmOOExport *state, GOData const *data, GnmParsePos *p
if (NULL != v && VALUE_IS_STRING (v))
gsf_xml_out_add_cstr (state->xml, c_attribute,
value_peek_string (v));
+ if (NULL != v && VALUE_IS_FLOAT (v))
+ gsf_xml_out_add_float (state->xml, c_attribute,
+ value_get_as_float (v), -1);
}
}
}
@@ -6832,10 +6835,34 @@ odf_add_expr (GnmOOExport *state, GogObject const *obj, gint dim,
if (bd != NULL)
odf_write_data_attribute
(state, bd, &pp, attribute, c_attribute);
-}
+}
+
+static void
+odf_write_axis_position (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
+ GogObject const *axis)
+{
+ char *pos_str = NULL;
+ if (gnm_object_has_readable_prop (axis, "pos-str",
+ G_TYPE_STRING, &pos_str)) {
+ if (0 == strcmp (pos_str, "low"))
+ gsf_xml_out_add_cstr (state->xml, CHART "axis-position", "start");
+ else if (0 == strcmp (pos_str, "high"))
+ gsf_xml_out_add_cstr (state->xml, CHART "axis-position", "end");
+ else if (0 == strcmp (pos_str, "cross")) {
+ GnmParsePos pp;
+ GOData const *bd;
+ parse_pos_init (&pp, WORKBOOK (state->wb), NULL, 0, 0);
+ bd = gog_dataset_get_dim (GOG_DATASET (axis), 4);
+ if (bd != NULL)
+ odf_write_data_attribute (state, bd, &pp,
+ GNMSTYLE "axis-position-expression",
+ CHART "axis-position");
+ }
+ }
+}
static void
-odf_write_axis_style (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
+odf_write_axis_style (GnmOOExport *state, GOStyle const *style,
GogObject const *axis)
{
double tmp;
@@ -6843,7 +6870,7 @@ odf_write_axis_style (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
gboolean user_defined;
char *map_name_str = NULL;
- gsf_xml_out_add_cstr (state->xml, CHART "axis-position", "start");
+ odf_write_axis_position (state, style, axis);
odf_add_bool (state->xml, CHART "display-label", TRUE);
if (gnm_object_has_readable_prop (axis, "map-name",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]