[gnumeric] ODF: handle inverted axis



commit 1ef723d2ae19577843707c1ca93211dce0002ece
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Aug 25 07:36:11 2010 -0600

    ODF: handle inverted axis
    
    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

 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-read.c  |    6 ++++++
 plugins/openoffice/openoffice-write.c |   21 +++++++++++++++++----
 3 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 6f8dd85..c120db4 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 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
+
+2010-08-25  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-write.c (odf_write_axis_style): split into
 	  odf_write_axis_style and df_write_generic_axis_style
 	(odf_write_dropbar_axes_styles): delete
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 48eff17..bed6952 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3482,6 +3482,12 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 		} else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "outliers", &btmp)) {
 			style->plot_props = g_slist_prepend (style->plot_props,
 				oo_prop_new_bool ("outliers", btmp));
+		} else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "reverse-direction", &btmp)) {
+			style->axis_props = g_slist_prepend (style->axis_props,
+				oo_prop_new_bool ("invert-axis", btmp));
+		} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "reverse-direction", &btmp)) {
+			style->axis_props = g_slist_prepend (style->axis_props,
+				oo_prop_new_bool ("invert-axis", btmp));
 		} else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, 
 					 "vary-style-by-element", &btmp)) {
 			style->plot_props = g_slist_prepend (style->plot_props,
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index e548c02..34e317c 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -4069,19 +4069,32 @@ odf_write_axis_style (GnmOOExport *state, GOStyle const *style, GogObject const
 {
 	char const *type = NULL;
 	double minima = 0., maxima = 0.;
+	GObjectClass *klass = G_OBJECT_GET_CLASS (axis);
+	GParamSpec *spec;
 
 	gsf_xml_out_add_cstr (state->xml, CHART "axis-position", "start");
 	odf_add_bool (state->xml, CHART "display-label", TRUE);
 
-	g_object_get (G_OBJECT (axis), "map-name", &type, NULL);
-	odf_add_bool (state->xml, CHART "logarithmic", 0 != strcmp (type, "Linear"));
+	if (NULL != (spec = g_object_class_find_property (klass, "map-name"))
+	    && spec->value_type == G_TYPE_STRING 
+	    && (G_PARAM_READABLE & spec->flags)) {
+		g_object_get (G_OBJECT (axis), "map-name", &type, NULL);
+		odf_add_bool (state->xml, CHART "logarithmic", 
+			      0 != strcmp (type, "Linear"));
+	}
 	if (gog_axis_get_bounds (GOG_AXIS (axis), &minima, &maxima)) {
 		gsf_xml_out_add_float (state->xml, CHART "minimum", minima, -1);
 		gsf_xml_out_add_float (state->xml, CHART "maximum", maxima, -1);
 	}
 
-	/* 	if (get_gsf_odf_version () > 101) */
-	/* 		odf_add_bool (state->xml, CHART "reverse-direction", reverse); */
+	if (get_gsf_odf_version () > 101)
+		odf_write_plot_style_bool 
+			(state->xml, axis, klass,
+			 "invert-axis", CHART "reverse-direction");
+	else
+		odf_write_plot_style_bool 
+			(state->xml, axis, klass,
+			 "invert-axis", GNMSTYLE "reverse-direction");
 }
 
 static void



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