[gnumeric] ODF: unify some code



commit b33d03b590a16412d28451b1fb0117396eacf008
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Aug 30 02:15:36 2010 -0600

    ODF: unify some code
    
    2010-08-30  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_match_dash_type): move
    	(odf_apply_style_props): more attirbutes
    	(oo_prop_list_to_series): rename to oo_chart_style_to_series and
    	  move code to odf_apply_style_props
    	(od_style_prop_chart) : new attributes
    	(oo_chart_style_free): drop series_props
    	* openoffice-write.c (odf_write_standard_series): use gog_styles
    	(odf_write_box_series): ditto
    	(odf_write_gantt_series): ditto
    	(odf_write_bubble_series): ditto
    	(odf_write_min_max_series): ditto
    	(odf_write_interpolation_attribute): add argument and change all callers
    	(odf_write_scatter_series_style): deleted
    	(odf_write_scatter_series_style_graphic): deleted
    	(odf_write_gog_style_graphic): new atributes
    	(odf_write_gog_style_chart): new atributes
    	(odf_write_plot): use gog_styles instead of series named styles

 plugins/openoffice/ChangeLog          |   20 +++
 plugins/openoffice/openoffice-read.c  |  155 ++++++++++------------
 plugins/openoffice/openoffice-write.c |  234 ++++++++++++---------------------
 3 files changed, 175 insertions(+), 234 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 9fc37fb..28c012d 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,25 @@
 2010-08-30  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (odf_match_dash_type): move
+	(odf_apply_style_props): more attirbutes
+	(oo_prop_list_to_series): rename to oo_chart_style_to_series and
+	  move code to odf_apply_style_props
+	(od_style_prop_chart) : new attributes
+	(oo_chart_style_free): drop series_props
+	* openoffice-write.c (odf_write_standard_series): use gog_styles
+	(odf_write_box_series): ditto
+	(odf_write_gantt_series): ditto
+	(odf_write_bubble_series): ditto
+	(odf_write_min_max_series): ditto
+	(odf_write_interpolation_attribute): add argument and change all callers
+	(odf_write_scatter_series_style): deleted
+	(odf_write_scatter_series_style_graphic): deleted
+	(odf_write_gog_style_graphic): new atributes
+	(odf_write_gog_style_chart): new atributes
+	(odf_write_plot): use gog_styles instead of series named styles
+
+2010-08-30  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (odf_apply_style_props): add xin
 	  argument and change all callers; handle hatches
 	(od_style_prop_chart): add attributes
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 88ff9de..4f6ae4b 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -163,7 +163,6 @@ typedef struct {
 	gboolean src_in_rows;	/* orientation of graph data: rows or columns */
 	GSList	*axis_props;	/* axis properties */
 	GSList	*plot_props;	/* plot properties */
-	GSList	*series_props;	/* any other properties */
 	GSList	*style_props;	/* any other properties */
 	GSList	*other_props;	/* any other properties */
 } OOChartStyle;
@@ -532,15 +531,27 @@ oo_attr_color (GsfXMLIn *xin, xmlChar const * const *attrs,
 	return oo_parse_color (xin, attrs[1], name);
 }
 
+static GOLineDashType
+odf_match_dash_type (OOParseState *state, gchar const *dash_style)
+{
+	GOLineDashType t = go_line_dash_from_str (dash_style);
+	return ((t == GO_LINE_NONE)? GO_LINE_DOT : t );
+}
+
 static void
 odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
 {
+	OOParseState *state = (OOParseState *)xin->user_state;
 	PangoFontDescription *desc;
 	GSList *l;
 	gboolean desc_changed = FALSE;
 	char const *hatch_name;
 	gboolean has_hatch = FALSE;
 	unsigned int gnm_hatch = 0;
+	int symbol_type = -1, symbol_name = GO_MARKER_DIAMOND;
+	GOMarker *m;
+	gboolean line_is_not_dash = FALSE;
+
 	desc = pango_font_description_copy (style->font.font->desc);
 	for (l = props; l != NULL; l = l->next) {
 		OOProp *prop = l->data;
@@ -602,7 +613,28 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
 			pango_font_description_set_family
 				(desc, g_value_get_string (&prop->value));
 			desc_changed = TRUE;
-		}
+		} else if (0 == strcmp (prop->name, "lines")) {
+			style->line.auto_color = g_value_get_boolean (&prop->value);
+		} else if (0 == strcmp (prop->name, "stroke")) {
+			if (0 == strcmp (g_value_get_string (&prop->value), "solid")) {
+				style->line.dash_type = GO_LINE_SOLID;
+				style->line.auto_dash = FALSE;
+				line_is_not_dash = TRUE;
+			} else if (0 == strcmp (g_value_get_string (&prop->value), "dash")) {
+				style->line.auto_dash = FALSE;
+				line_is_not_dash = FALSE;
+			} else {
+				style->line.dash_type = GO_LINE_NONE;
+				style->line.auto_dash = FALSE;
+				line_is_not_dash = TRUE;
+			}
+		} else if (0 == strcmp (prop->name, "stroke-dash") && !line_is_not_dash) {
+			style->line.dash_type = odf_match_dash_type 
+				(state, g_value_get_string (&prop->value));
+		} else if (0 == strcmp (prop->name, "symbol-type"))
+			symbol_type = g_value_get_int (&prop->value);
+		else if (0 == strcmp (prop->name, "symbol-name"))
+			symbol_name = g_value_get_int (&prop->value);
 	}
 	if (desc_changed)
 		go_style_set_font_desc	(style, desc);
@@ -615,6 +647,25 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
 			style->fill.pattern.pattern = GO_PATTERN_SOLID;
 		} else oo_warning (xin, _("Hatch fill without hatch name encountered!"));
 	}
+	switch (symbol_type) {
+	case OO_SYMBOL_TYPE_AUTO:
+		style->marker.auto_shape = TRUE;
+		break;
+	case OO_SYMBOL_TYPE_NONE:
+		style->marker.auto_shape = FALSE;
+		m = go_marker_new ();
+		go_marker_set_shape (m, GO_MARKER_NONE); 
+		go_style_set_marker (style, m);
+		break;
+	case OO_SYMBOL_TYPE_NAMED:
+		style->marker.auto_shape = FALSE;
+		m = go_marker_new ();
+		go_marker_set_shape (m, symbol_name); 
+		go_style_set_marker (style, m);	
+		break;
+	default:
+		break;
+	}
 }
 
 
@@ -1875,7 +1926,6 @@ oo_style (GsfXMLIn *xin, xmlChar const **attrs)
 			cur_style = g_new0(OOChartStyle, 1);
 			cur_style->axis_props = NULL;
 			cur_style->plot_props = NULL;
-			cur_style->series_props = NULL;
 			cur_style->style_props = NULL;
 			cur_style->other_props = NULL;
 			state->chart.cur_graph_style = cur_style;
@@ -3336,77 +3386,18 @@ oo_prop_list_apply_to_axis (GSList *props, GObject *obj)
 	gog_axis_set_bounds (GOG_AXIS (obj), minimum, maximum);
 }
 
-static GOLineDashType
-odf_match_dash_type (OOParseState *state, gchar const *dash_style)
-{
-	GOLineDashType t = go_line_dash_from_str (dash_style);
-	return ((t == GO_LINE_NONE)? GO_LINE_DOT : t );
-}
-
 static void
-oo_prop_list_to_series (OOParseState *state, GSList *props, GObject *obj)
+oo_chart_style_to_series (GsfXMLIn *xin, OOChartStyle *oostyle, GObject *obj)
 {
 	GOStyle *style = NULL;
-	GSList *l;
-	int symbol_type = -1, symbol_name = GO_MARKER_DIAMOND;
-	GOMarker *m;
-	gboolean line_is_not_dash = FALSE;
-
-	oo_prop_list_apply (props, obj);
 
-	/* There are properties that apply to subitems: */
+	oo_prop_list_apply (oostyle->plot_props, obj);
 
 	g_object_get (obj, "style", &style, NULL);
-
-	if (style != NULL)
-		for (l = props; l != NULL; l = l->next) {
-			OOProp *prop = l->data;
-			if (0 == strcmp (prop->name, "lines")) {
-				style->line.auto_color = g_value_get_boolean (&prop->value);
-			} else if (0 == strcmp (prop->name, "stroke")) {
-				if (0 == strcmp (g_value_get_string (&prop->value), "solid")) {
-					style->line.dash_type = GO_LINE_SOLID;
-					style->line.auto_dash = FALSE;
-					line_is_not_dash = TRUE;
-				} else if (0 == strcmp (g_value_get_string (&prop->value), "dash")) {
-					style->line.auto_dash = FALSE;
-					line_is_not_dash = FALSE;
-				} else {
-					style->line.dash_type = GO_LINE_NONE;
-					style->line.auto_dash = FALSE;
-					line_is_not_dash = TRUE;
-				}
-			} else if (0 == strcmp (prop->name, "stroke-dash") && !line_is_not_dash) {
-				style->line.dash_type = odf_match_dash_type 
-					(state, g_value_get_string (&prop->value));
-			} else if (0 == strcmp (prop->name, "symbol-type"))
-				symbol_type = g_value_get_int (&prop->value);
-			else if (0 == strcmp (prop->name, "symbol-name"))
-				symbol_name = g_value_get_int (&prop->value);
-		}
-	
-	switch (symbol_type) {
-	case OO_SYMBOL_TYPE_AUTO:
-		style->marker.auto_shape = TRUE;
-		break;
-	case OO_SYMBOL_TYPE_NONE:
-		style->marker.auto_shape = FALSE;
-		m = go_marker_new ();
-		go_marker_set_shape (m, GO_MARKER_NONE); 
-		go_style_set_marker (style, m);
-		break;
-	case OO_SYMBOL_TYPE_NAMED:
-		style->marker.auto_shape = FALSE;
-		m = go_marker_new ();
-		go_marker_set_shape (m, symbol_name); 
-		go_style_set_marker (style, m);	
-		break;
-	default:
-		break;
+	if (style != NULL) {
+		odf_apply_style_props (xin, oostyle->style_props, style);
+		g_object_unref (G_OBJECT (style));
 	}
-
-	g_object_set (obj, "style", style, NULL);
-	g_object_unref (G_OBJECT (style));
 }
 
 static void
@@ -3594,14 +3585,14 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 				(style->plot_props,
 				 oo_prop_new_bool ("default-style-has-markers",
 						   tmp != OO_SYMBOL_TYPE_NONE));
-			style->series_props = g_slist_prepend
-				(style->series_props,
+			style->style_props = g_slist_prepend
+				(style->style_props,
 				 oo_prop_new_int ("symbol-type", tmp));
 		} else if (oo_attr_enum (xin, attrs, OO_NS_CHART, 
 					 "symbol-name", 
 					 named_symbols, &tmp)) {
-			style->series_props = g_slist_prepend
-				(style->series_props,
+			style->style_props = g_slist_prepend
+				(style->style_props,
 				 oo_prop_new_int ("symbol-name", tmp));
 		} else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), 
 					       OO_NS_CHART, "interpolation")) {
@@ -3619,33 +3610,28 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 				     (xin, _("Unknown interpolation type "
 					     "encountered: %s"), 
 				      CXML2C(attrs[1]));
-			if (interpolation != NULL) {
-				style->series_props = g_slist_prepend
-					(style->series_props,
-					 oo_prop_new_string 
-					 ("interpolation", interpolation));
+			if (interpolation != NULL)
 				style->plot_props = g_slist_prepend
 					(style->plot_props,
 					 oo_prop_new_string 
 					 ("interpolation", interpolation));
-			}
 		} else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), 
 					       OO_NS_DRAW, "stroke")) {
 			draw_stroke = !attr_eq (attrs[1], "none");
 			draw_stroke_set = TRUE;
-			style->series_props = g_slist_prepend
-				(style->series_props,
+			style->style_props = g_slist_prepend
+				(style->style_props,
 				 oo_prop_new_string ("stroke",
 						     CXML2C(attrs[1])));
 		} else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), 
 					       OO_NS_DRAW, "stroke-dash")) {
-			style->series_props = g_slist_prepend
-				(style->series_props,
+			style->style_props = g_slist_prepend
+				(style->style_props,
 				 oo_prop_new_string ("stroke-dash",
 						     CXML2C(attrs[1])));
 		} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "lines", &btmp)) {
-			style->series_props = g_slist_prepend
-				(style->series_props,
+			style->style_props = g_slist_prepend
+				(style->style_props,
 				 oo_prop_new_bool ("lines", btmp));
 			style->plot_props = g_slist_prepend
 				(style->plot_props,
@@ -4823,7 +4809,7 @@ oo_plot_series (GsfXMLIn *xin, xmlChar const **attrs)
 			OOChartStyle *style = NULL;
 			style = g_hash_table_lookup
 				(state->chart.graph_styles, CXML2C (attrs[1]));
-			oo_prop_list_to_series (state, style->series_props, G_OBJECT (state->chart.series));
+			oo_chart_style_to_series (xin, style, G_OBJECT (state->chart.series));
 		}
 	}
 }
@@ -5262,7 +5248,6 @@ static void
 oo_chart_style_free (OOChartStyle *cstyle)
 {
 	oo_prop_list_free (cstyle->axis_props);
-	oo_prop_list_free (cstyle->series_props);
 	oo_prop_list_free (cstyle->style_props);
 	oo_prop_list_free (cstyle->plot_props);
 	oo_prop_list_free (cstyle->other_props);
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 6742a05..ad9f3cd 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3804,7 +3804,7 @@ odf_write_standard_series (GnmOOExport *state, GSList const *series)
 			GSList *points;
 			GOData const *cat = gog_dataset_get_dim (GOG_DATASET (series->data), 
 								 GOG_MS_DIM_LABELS);
-			char *str = g_strdup_printf ("series%i", i);
+			char *str = odf_get_gog_style_name_from_obj (series->data);
 			gsf_xml_out_add_cstr (state->xml, CHART "style-name", str);
 			g_free (str);
 			
@@ -3939,7 +3939,7 @@ odf_write_box_series (GnmOOExport *state, GSList const *series)
 				gsf_xml_out_add_cstr (state->xml, CHART "values-cell-range-address",
 						      odf_strip_brackets (str));
 				g_free (str);
-				str = g_strdup_printf ("series%i", i);
+				str = odf_get_gog_style_name_from_obj (series->data);
 				gsf_xml_out_add_cstr (state->xml, CHART "style-name", str);
 				g_free (str);
 				odf_write_label_cell_address 
@@ -3968,7 +3968,7 @@ odf_write_gantt_series (GnmOOExport *state, GSList const *series)
 				gsf_xml_out_add_cstr (state->xml, CHART "values-cell-range-address",
 						      odf_strip_brackets (str));
 				g_free (str);
-				str = g_strdup_printf ("series%i", i);
+				str = odf_get_gog_style_name_from_obj (series->data);
 				gsf_xml_out_add_cstr (state->xml, CHART "style-name", str);
 				g_free (str);
 				if (NULL != cat) {
@@ -3994,7 +3994,7 @@ odf_write_gantt_series (GnmOOExport *state, GSList const *series)
 				gsf_xml_out_add_cstr (state->xml, CHART "values-cell-range-address",
 						      odf_strip_brackets (str));
 				g_free (str);
-				str = g_strdup_printf ("series%i", i);
+				str = odf_get_gog_style_name_from_obj (series->data);
 				gsf_xml_out_add_cstr (state->xml, CHART "style-name", str);
 				g_free (str);
 				gsf_xml_out_end_element (state->xml); /* </chart:series> */
@@ -4022,7 +4022,7 @@ odf_write_bubble_series (GnmOOExport *state, GSList const *orig_series)
 				gsf_xml_out_add_cstr (state->xml, CHART "values-cell-range-address",
 						      odf_strip_brackets (str));
 				g_free (str);
-				str = g_strdup_printf ("series%i", i);
+				str = odf_get_gog_style_name_from_obj (series->data);
 				gsf_xml_out_add_cstr (state->xml, CHART "style-name", str);
 				g_free (str);
 				for (j = 1; j >= 0; j--) {
@@ -4065,7 +4065,7 @@ odf_write_min_max_series (GnmOOExport *state, GSList const *orig_series)
 					gsf_xml_out_add_cstr (state->xml, CHART "values-cell-range-address",
 							      odf_strip_brackets (str));
 					g_free (str);
-					str = g_strdup_printf ("series%i", i);
+					str = odf_get_gog_style_name_from_obj (series->data);
 					gsf_xml_out_add_cstr (state->xml, CHART "style-name", str);
 					g_free (str);
 					break;
@@ -4078,7 +4078,7 @@ odf_write_min_max_series (GnmOOExport *state, GSList const *orig_series)
 
 
 static void
-odf_write_interpolation_attribute (GnmOOExport *state, GogObject const *series) 
+odf_write_interpolation_attribute (GnmOOExport *state, GOStyle const *style, GogObject const *series) 
 {
 	gchar *interpolation = NULL;
 
@@ -4174,7 +4174,7 @@ odf_write_plot_style (GnmOOExport *state, GogObject const *plot)
 	if (NULL != (spec = g_object_class_find_property (klass, "interpolation"))   
 	    && spec->value_type == G_TYPE_STRING
 	    && (G_PARAM_READABLE & spec->flags))
-		odf_write_interpolation_attribute (state, plot);
+		odf_write_interpolation_attribute (state, NULL, plot);
 
 	if (0 == strcmp ( "GogXYZSurfacePlot", plot_type) || 
 	    0 == strcmp ( "GogSurfacePlot", plot_type) || 
@@ -4239,78 +4239,6 @@ odf_get_marker (GOMarkerShape m)
 }
 
 static void
-odf_write_scatter_series_style (GnmOOExport *state, GogObject const *plot, GogObject const *series)
-{
-	GOStyle *style = NULL;
-
-	odf_write_interpolation_attribute (state, series);
-
-	g_object_get (G_OBJECT (series), "style", &style, NULL);
-
-	if (go_style_is_line_visible (style)) {
-		odf_add_bool (state->xml, CHART "lines", TRUE);
-	} else {
-		odf_add_bool (state->xml, CHART "lines", FALSE);
-	}
-
-	if (style->marker.auto_shape) {
-		gboolean has_marker = TRUE;
-		g_object_get (G_OBJECT (plot), "default-style-has-markers", 
-			      &has_marker, NULL);
-		if (has_marker)
-			gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
-					      "automatic");
-		else
-			gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
-					      "none");			
-	} else {
-		GOMarkerShape m	
-			= go_marker_get_shape (go_style_get_marker (style));
-		if (m == GO_MARKER_NONE)
-			gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
-					      "none");
-		else {
-			gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
-					      "named-symbol");
-			gsf_xml_out_add_cstr 
-				(state->xml, CHART "symbol-name", odf_get_marker (m));
-		}
-	}
-
-	g_object_unref (G_OBJECT (style));
-}
-
-static void
-odf_write_scatter_series_style_graphic (GnmOOExport *state, GogObject const *plot, GogObject const *series)
-{
-	GOStyle *style = NULL;
-
-	g_object_get (G_OBJECT (series), "style", &style, NULL);
-
-	if (go_style_is_line_visible (style)) {
-		GOLineDashType dash_type = style->line.dash_type;
-		
-		if (dash_type == GO_LINE_SOLID)
-			gsf_xml_out_add_cstr (state->xml, 
-					      DRAW "stroke", "solid");
-		else {
-			char const *dash = go_line_dash_as_str (dash_type);
-			gsf_xml_out_add_cstr (state->xml, 
-					      DRAW "stroke", "dash");
-			gsf_xml_out_add_cstr 
-				(state->xml, 
-				 DRAW "stroke-dash", dash);
-			g_hash_table_insert (state->graph_dashes, g_strdup (dash), 
-					     GINT_TO_POINTER (dash_type));
-		}
-	} else {
-		gsf_xml_out_add_cstr (state->xml, DRAW "stroke", "none");
-	}
-
-	g_object_unref (G_OBJECT (style));
-}
-
-static void
 odf_write_axis_style (GnmOOExport *state, GOStyle const *style, GogObject const *axis)
 {
 	char const *type = NULL;
@@ -4593,6 +4521,25 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style)
 /* 			gsf_xml_out_add_cstr (state->xml, DRAW "fill", "bitmap"); */
 			break;
 		}
+		if (go_style_is_line_visible (style)) {
+			GOLineDashType dash_type = style->line.dash_type;
+			
+			if (dash_type == GO_LINE_SOLID)
+				gsf_xml_out_add_cstr (state->xml, 
+						      DRAW "stroke", "solid");
+			else {
+				char const *dash = go_line_dash_as_str (dash_type);
+				gsf_xml_out_add_cstr (state->xml, 
+						      DRAW "stroke", "dash");
+				gsf_xml_out_add_cstr 
+					(state->xml, 
+					 DRAW "stroke-dash", dash);
+				g_hash_table_insert (state->graph_dashes, g_strdup (dash), 
+						     GINT_TO_POINTER (dash_type));
+			}
+		} else {
+			gsf_xml_out_add_cstr (state->xml, DRAW "stroke", "none");
+		}
 	}
 }
 
@@ -4673,8 +4620,9 @@ static void
 odf_write_gog_style_chart (GnmOOExport *state, GOStyle const *style, GogObject const *obj)
 {
 	gchar const *type = G_OBJECT_TYPE_NAME (G_OBJECT (obj));
+	GObjectClass *klass = G_OBJECT_GET_CLASS (G_OBJECT (obj));
 	void (*func) (GnmOOExport *state, GOStyle const *style, GogObject const *obj);
-
+	GParamSpec *spec;
 
 	if (GOG_IS_PLOT (obj))
 		odf_write_plot_style (state, obj);
@@ -4682,6 +4630,42 @@ odf_write_gog_style_chart (GnmOOExport *state, GOStyle const *style, GogObject c
 	func = g_hash_table_lookup (state->chart_props_hash, type);
 	if (func != NULL)
 		func (state, style, obj);
+
+	if (style != NULL) {
+		if (go_style_is_line_visible (style)) {
+			odf_add_bool (state->xml, CHART "lines", TRUE);
+		} else {
+			odf_add_bool (state->xml, CHART "lines", FALSE);
+		}
+
+		if (style->marker.auto_shape) {
+			if (NULL != (spec = g_object_class_find_property (klass, "type"))  
+			    && spec->value_type == G_TYPE_BOOLEAN 
+			    && (G_PARAM_READABLE & spec->flags)) {
+				gboolean has_marker = TRUE;
+				g_object_get (G_OBJECT (obj), "default-style-has-markers", 
+					      &has_marker, NULL);
+				if (has_marker)
+					gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
+						      "automatic");
+				else
+					gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
+							      "none");	
+			}		
+		} else {
+			GOMarkerShape m	
+				= go_marker_get_shape (go_style_get_marker ((GOStyle *)style));
+			if (m == GO_MARKER_NONE)
+				gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
+						      "none");
+			else {
+				gsf_xml_out_add_cstr (state->xml, CHART "symbol-type", 
+						      "named-symbol");
+				gsf_xml_out_add_cstr 
+					(state->xml, CHART "symbol-name", odf_get_marker (m));
+			}
+		}
+	}
 }
 
 static void
@@ -4805,7 +4789,6 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 	SheetObjectAnchor const *anchor = sheet_object_get_anchor (so);
 	double res_pts[4] = {0.,0.,0.,0.};
 	GSList const *series, *l;
-	int i;
 	GogObject const *wall = gog_object_get_child_by_name (chart, "Backplane");
 	GogObject const *legend = gog_object_get_child_by_name (chart, "Legend");
 	GSList *titles = gog_object_get_children (chart, gog_object_find_role_by_name (chart, "Title"));
@@ -4830,12 +4813,6 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 						gchar **z_style);
 		void (*odf_write_series)       (GnmOOExport *state, 
 						GSList const *series);
-		void (*odf_write_series_style) (GnmOOExport *state, 
-						GogObject const * plot, 
-						GogObject const *series);
-		void (*odf_write_series_style_graphic) (GnmOOExport *state, 
-							GogObject const * plot, 
-							GogObject const *series);		
 		void (*odf_write_x_axis) (GnmOOExport *state, 
 					  GogObject const *chart, 
 					  char const *axis_role, 
@@ -4860,106 +4837,85 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 	} *this_plot, plots[] = {
 		{ "GogBarColPlot", CHART "bar", ODF_BARCOL,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series, 
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogLinePlot", CHART "line", ODF_LINE,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series, 
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogPolarPlot", GNMSTYLE "polar", ODF_POLAR,
 		  20., "Circular-Axis", "Radial-Axis", NULL, 
 		  odf_write_radar_axes_styles,
-		  odf_write_standard_series, odf_write_scatter_series_style, 
-		  odf_write_scatter_series_style_graphic,
+		  odf_write_standard_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogAreaPlot", CHART "area", ODF_AREA,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series, 
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogDropBarPlot", CHART "gantt", ODF_DROPBAR,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_gantt_series, NULL,
-		  NULL,
+		  odf_write_gantt_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogMinMaxPlot", CHART "stock", ODF_MINMAX,
 		  10., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_min_max_series, NULL,
-		  NULL,
+		  odf_write_min_max_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogPiePlot", CHART "circle", ODF_CIRCLE,
 		  5., "X-Axis", "Y-Axis", NULL, odf_write_circle_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogRadarPlot", CHART "radar", ODF_RADAR,
 		  10., "Circular-Axis", "Radial-Axis", NULL, 
 		  odf_write_radar_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogRadarAreaPlot", CHART "filled-radar", ODF_RADARAREA,
 		  10., "X-Axis", "Y-Axis", NULL, odf_write_radar_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogRingPlot", CHART "ring", ODF_RING,
 		  10., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series,
 		  odf_write_axis_ring, odf_write_generic_axis, NULL},
 		{ "GogXYPlot", CHART "scatter", ODF_SCATTER,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
 		  odf_write_standard_series, 
-		  odf_write_scatter_series_style,
-		  odf_write_scatter_series_style_graphic,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogContourPlot", CHART "surface", ODF_SURF,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_bubble_series, NULL,
-		  NULL,
+		  odf_write_bubble_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogXYZContourPlot", GNMSTYLE "xyz-surface", ODF_XYZ_SURF,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_bubble_series, NULL,
-		  NULL,
+		  odf_write_bubble_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogXYZSurfacePlot", GNMSTYLE "xyz-surface", ODF_XYZ_GNM_SURF,
 		  20., "X-Axis", "Y-Axis", "Z-Axis", odf_write_surface_axes_styles,
-		  odf_write_bubble_series, NULL,
-		  NULL,
+		  odf_write_bubble_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogSurfacePlot", CHART "surface", ODF_GNM_SURF,
 		  20., "X-Axis", "Y-Axis", "Z-Axis", odf_write_surface_axes_styles,
-		  odf_write_bubble_series, NULL,
-		  NULL,
+		  odf_write_bubble_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogBubblePlot", CHART "bubble", ODF_BUBBLE,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_bubble_series, NULL,
-		  NULL,
+		  odf_write_bubble_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogXYColorPlot", GNMSTYLE "scatter-color", ODF_SCATTER_COLOUR,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_bubble_series, NULL,
-		  NULL,
+		  odf_write_bubble_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "XLSurfacePlot", CHART "surface", ODF_GNM_SURF,
 		  20., "X-Axis", "Y-Axis", "Z-Axis", odf_write_surface_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ "GogBoxPlot", GNMSTYLE "box", ODF_GNM_BOX,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_box_series, NULL,
-		  NULL,
+		  odf_write_box_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis},
 		{ NULL, NULL, 0,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
-		  odf_write_standard_series, NULL,
-		  NULL,
+		  odf_write_standard_series,
 		  odf_write_axis, odf_write_axis, odf_write_axis}
 	};
 
@@ -4986,27 +4942,6 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 	gsf_xml_out_end_element (state->xml); /* </style:chart-properties> */
 	gsf_xml_out_end_element (state->xml); /* </style:style> */
 
-	for (l = series, i = 1; l != NULL; l = l->next) {
-		char *name = g_strdup_printf ("series%i", i++);
-		odf_start_style (state->xml, name, "chart");
-
-		gsf_xml_out_start_element (state->xml, STYLE "chart-properties");
-		odf_add_bool (state->xml, CHART "auto-size", TRUE);
-		if (this_plot->odf_write_series_style != NULL)
-			this_plot->odf_write_series_style (state, plot, l->data);
-		gsf_xml_out_end_element (state->xml); /* </style:chart-properties> */
-
-		if (this_plot->odf_write_series_style_graphic != NULL) {
-			gsf_xml_out_start_element (state->xml, 
-						   STYLE "graphic-properties");
-			this_plot->odf_write_series_style_graphic (state, plot, l->data);
-			gsf_xml_out_end_element (state->xml); /* </style:graphic-properties> */
-		}
-
-		gsf_xml_out_end_element (state->xml); /* </style:style> */
-		g_free (name);
-	}
-
 	odf_write_gog_styles (chart, state);
 
 	gsf_xml_out_end_element (state->xml); /* </office:automatic-styles> */
@@ -5351,6 +5286,7 @@ odf_fill_chart_props_hash (GnmOOExport *state)
 		{"GogMovingAvg", odf_write_movig_avg_reg},
 		{"GogExpSmooth", odf_write_exp_smooth_reg},
 		{"GogPieSeriesElement", odf_write_pie_point},
+		{"GogXYSeries", odf_write_interpolation_attribute},
 	};
 		
 	for (i = 0 ; i < (int)G_N_ELEMENTS (props) ; i++)



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