[gnumeric] Import the legend from guppi graph



commit 86a74955e6120d14919f9e5ef788060e679dff3d
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Jul 31 20:51:07 2010 +0200

    Import the legend from guppi graph

 ChangeLog                |    5 +++++
 src/sheet-object-graph.c |   27 +++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fbb569e..942b17a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-07-31  Jean Brefort  <jean brefort normalesup org>
 
+	* src/sheet-object-graph.c (legend_start), (position_end),
+	(gnm_sogg_prep_sax_parser): import the legend from guppi graph.
+
+2010-07-31  Jean Brefort  <jean brefort normalesup org>
+
 	* src/sheet-object-graph.c (dim_start): survive malformed guppi graphs.
 	[#625726]
 
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index ceb3641..a757f03 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -841,6 +841,29 @@ plot_type_start (GsfXMLIn *xin, xmlChar const **attrs)
 }
 
 static void
+legend_start (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
+{
+	GuppiReadState *state = (GuppiReadState *) xin->user_state;
+	state->cur = gog_object_add_by_name (state->chart, "Legend", NULL);
+}
+	
+static void
+position_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
+{
+	GuppiReadState *state = (GuppiReadState *)xin->user_state;
+	if (!xin->content->str)
+		return;
+	if (0 == strcmp (xin->content->str, "east"))
+		g_object_set (G_OBJECT (state->cur), "compass", "right", NULL);
+	if (0 == strcmp (xin->content->str, "west"))
+		g_object_set (G_OBJECT (state->cur), "compass", "left", NULL);
+	if (0 == strcmp (xin->content->str, "north"))
+		g_object_set (G_OBJECT (state->cur), "compass", "top", NULL);
+	if (0 == strcmp (xin->content->str, "south"))
+		g_object_set (G_OBJECT (state->cur), "compass", "bottom", NULL);
+}
+	
+static void
 series_start (GsfXMLIn *xin, xmlChar const **attrs)
 {
 	GuppiReadState *state = (GuppiReadState *) xin->user_state;
@@ -995,8 +1018,8 @@ gnm_sogg_prep_sax_parser (SheetObject *so, GsfXMLIn *xin, xmlChar const **attrs,
 	    GSF_XML_IN_NODE (GRAPH, GUPPI_VECTORS, -1, "gmr:Vectors", GSF_XML_NO_CONTENT, NULL, NULL),
 	      GSF_XML_IN_NODE (GUPPI_VECTORS, GUPPI_VECTOR, -1, "gmr:Vector", GSF_XML_CONTENT, vector_start, vector_end),
 	    GSF_XML_IN_NODE (GRAPH, GUPPI_GRAPH, -1, "graph:Graph", GSF_XML_NO_CONTENT, NULL, NULL),
-	      GSF_XML_IN_NODE (GUPPI_GRAPH, GUPPI_LEGEND, -1, "graph:Legend", GSF_XML_NO_CONTENT, NULL, NULL),
-	        GSF_XML_IN_NODE (GUPPI_LEGEND, GUPPI_LEGEND_POS, -1, "graph:Position", GSF_XML_NO_CONTENT, NULL, NULL),
+	      GSF_XML_IN_NODE (GUPPI_GRAPH, GUPPI_LEGEND, -1, "graph:Legend", GSF_XML_NO_CONTENT, legend_start, NULL),
+	        GSF_XML_IN_NODE (GUPPI_LEGEND, GUPPI_LEGEND_POS, -1, "graph:Position", GSF_XML_CONTENT, NULL, position_end),
 	      GSF_XML_IN_NODE (GUPPI_GRAPH, GUPPI_PLOTS, -1, "graph:Plots", GSF_XML_NO_CONTENT, NULL, NULL),
 	        GSF_XML_IN_NODE (GUPPI_PLOTS, GUPPI_PLOT, -1, "graph:Plot", GSF_XML_NO_CONTENT, NULL, NULL),
 	          GSF_XML_IN_NODE (GUPPI_PLOT, GUPPI_PLOT_TYPE, -1, "Type", GSF_XML_NO_CONTENT, plot_type_start, NULL),



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