[gnumeric] ODF: new axes attributes



commit f546db2e58765a91446eaf365290471f4fb254d2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Aug 25 18:05:41 2010 -0600

    ODF: new axes attributes
    
    2010-08-25  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (oo_prop_list_apply_to_axis): new
    	(od_style_prop_chart): new attributes
    	(oo_chart_axis): call oo_prop_list_apply_to_axis instead of
    	  (oo_prop_list_apply
    	* openoffice-write.c (odf_write_standard_axes_styles): don't switch
    	  axes (otherwise we switch them twice: when we write teh style and
    	  when we write the axes proper).

 plugins/openoffice/ChangeLog          |   10 ++++++++++
 plugins/openoffice/openoffice-read.c  |   32 +++++++++++++++++++++++++++++++-
 plugins/openoffice/openoffice-write.c |    7 ++-----
 3 files changed, 43 insertions(+), 6 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index c120db4..2ccdb75 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,15 @@
 2010-08-25  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (oo_prop_list_apply_to_axis): new
+	(od_style_prop_chart): new attributes
+	(oo_chart_axis): call oo_prop_list_apply_to_axis instead of
+	  (oo_prop_list_apply
+	* openoffice-write.c (odf_write_standard_axes_styles): don't switch
+	  axes (otherwise we switch them twice: when we write teh style and 
+	  when we write the axes proper).
+
+2010-08-25  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (od_style_prop_chart): new attributes
 	* openoffice-write.c (odf_write_axis_style): new attributes
 
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index bed6952..fc3c9b5 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3300,6 +3300,27 @@ oo_prop_list_apply (GSList *props, GObject *obj)
 	}
 }
 
+static void
+oo_prop_list_apply_to_axis (GSList *props, GObject *obj)
+{
+	GSList *ptr;
+	OOProp *prop;
+
+	double minimum = go_ninf, maximum = go_pinf;
+
+	oo_prop_list_apply (props, obj);
+
+	for (ptr = props; ptr; ptr = ptr->next) {
+		prop = ptr->data;
+		if (0 == strcmp ("minimum", prop->name))
+			minimum = g_value_get_double (&prop->value);
+		else if (0 == strcmp ("maximum", prop->name))
+			maximum = g_value_get_double (&prop->value);
+	}
+
+	gog_axis_set_bounds (GOG_AXIS (obj), minimum, maximum);
+}
+
 static GOLineDashType
 odf_match_dash_type (OOParseState *state, gchar const *dash_style)
 {
@@ -3496,6 +3517,14 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 					 "show-negatives", &btmp)) {
 			style->plot_props = g_slist_prepend (style->plot_props,
 				oo_prop_new_bool ("show-negatives", btmp));
+		} else if (oo_attr_float (xin, attrs, OO_NS_CHART, 
+					  "minimum", &ftmp)) {
+			style->axis_props = g_slist_prepend (style->axis_props,
+				oo_prop_new_float ("minimum", ftmp));
+		} else if (oo_attr_float (xin, attrs, OO_NS_CHART, 
+					  "maximum", &ftmp)) {
+			style->axis_props = g_slist_prepend (style->axis_props,
+				oo_prop_new_float ("maximum", ftmp));
 		} else if (oo_attr_float (xin, attrs, OO_GNUM_NS_EXT, 
 					  "radius-ratio", &ftmp)) {
 			style->plot_props = g_slist_prepend (style->plot_props,
@@ -4250,7 +4279,8 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
 	if (NULL != style_name &&
 	    NULL != (style = g_hash_table_lookup (state->chart.graph_styles, style_name))) {
 		if (NULL != state->chart.axis)
-			oo_prop_list_apply (style->axis_props, G_OBJECT (state->chart.axis));
+			oo_prop_list_apply_to_axis (style->axis_props, G_OBJECT (state->chart.axis));
+
 
 		/* AAARRRGGGHH : why would they do this.  The axis style impact
 		 * the plot ?? */
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 34e317c..245d853 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -4153,15 +4153,12 @@ odf_write_standard_axes_styles (GnmOOExport *state, GogObject const *chart,
 {
 	GogObject const *axis;
 	GObjectClass *klass = G_OBJECT_GET_CLASS (G_OBJECT (plot));
-	gboolean horizontal = FALSE;
-	if (NULL != g_object_class_find_property (klass,  "horizontal"))
-		g_object_get (G_OBJECT (plot), "horizontal", &horizontal, NULL);
 
-	axis = gog_object_get_child_by_name (chart, horizontal ? "Y-Axis" : "X-Axis");
+	axis = gog_object_get_child_by_name (chart, "X-Axis");
 	if (axis != NULL)
 		*x_style = odf_get_gog_style_name_from_obj (axis);
 
-	axis = gog_object_get_child_by_name (chart, horizontal ? "X-Axis" : "Y-Axis");
+	axis = gog_object_get_child_by_name (chart, "Y-Axis");
 	if (axis != NULL)
 		*y_style = odf_get_gog_style_name_from_obj (axis);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]