[gnumeric] Import the scatter plot default series style from xlsx.



commit 16651478b19a41b83fbf51c72f0b26e4bc26e30e
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Mar 5 12:18:51 2011 +0100

    Import the scatter plot default series style from xlsx.

 plugins/excel/ChangeLog   |    5 ++++
 plugins/excel/xlsx-read.c |   59 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 3 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 1b7654b..0f2ea0a 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,10 @@
 2011-03-05  Jean Brefort  <jean brefort normalesup org>
 
+	* xlsx-read.c (xlsx_chart_xy), (xlsx_scatter_style): import the scatter
+	plot default series style.
+
+2011-03-05  Jean Brefort  <jean brefort normalesup org>
+
 	* xlsx-read.c (xlsx_plot_axis_id), (xlsx_axis_crosses_at),
 	(cb_axis_set_position): import axis crossing position. [#642941]
 
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 2d03912..e63d3d2 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -1309,7 +1309,60 @@ xlsx_axis_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 
 static void xlsx_chart_area (GsfXMLIn *xin, xmlChar const **attrs) { xlsx_chart_add_plot (xin, "GogAreaPlot"); }
 static void xlsx_chart_line (GsfXMLIn *xin, xmlChar const **attrs) { xlsx_chart_add_plot (xin, "GogLinePlot"); }
-static void xlsx_chart_xy (GsfXMLIn *xin, xmlChar const **attrs) { xlsx_chart_add_plot (xin, "GogXYPlot"); }
+
+static void
+xlsx_chart_xy (GsfXMLIn *xin, xmlChar const **attrs)
+{
+	XLSXReadState *state = (XLSXReadState *)xin->user_state;
+	xlsx_chart_add_plot (xin, "GogXYPlot");
+	g_object_set (G_OBJECT (state->plot), "default-style-has-fill", FALSE, NULL);
+}
+
+static void
+xlsx_scatter_style (GsfXMLIn *xin, xmlChar const **attrs)
+{
+	static EnumVal styles[] = {
+		{"line",	0},
+		{"lineMarker",  1},
+		{"marker",      2},
+		{"none",	3},
+		{"smooth",      4},
+		{"smoothMarker", 5}
+	};
+	XLSXReadState *state = (XLSXReadState *)xin->user_state;
+	int style;
+
+	if (simple_enum (xin, attrs, styles, &style))
+		switch (style) {
+		case 0:
+			g_object_set (G_OBJECT (state->plot),
+			              "default-style-has-markers", FALSE,
+			              NULL);
+			break;
+		case 2:
+			g_object_set (G_OBJECT (state->plot),
+			              "default-style-has-lines", FALSE,
+			              NULL);
+			break;
+		case 3:
+			g_object_set (G_OBJECT (state->plot),
+			              "default-style-has-markers", FALSE,
+			              "default-style-has-lines", FALSE,
+			              NULL);
+			break;
+		case 4:
+			g_object_set (G_OBJECT (state->plot),
+			              "use-splines", TRUE,
+			              "default-style-has-markers", FALSE, NULL);
+			break;
+		case 5:
+			g_object_set (G_OBJECT (state->plot),
+			              "use-splines", TRUE,
+			              NULL);
+			break;
+		}
+}
+
 static void xlsx_chart_bubble (GsfXMLIn *xin, xmlChar const **attrs) { xlsx_chart_add_plot (xin, "GogBubblePlot"); }
 static void xlsx_chart_radar (GsfXMLIn *xin, xmlChar const **attrs) { xlsx_chart_add_plot (xin, "GogRadarPlot"); }
 #if 0
@@ -1926,8 +1979,8 @@ GSF_XML_IN_NODE_FULL (START, CHART_SPACE, XL_NS_CHART, "chartSpace", GSF_XML_NO_
           GSF_XML_IN_NODE (MAN_LAYOUT, MAN_LAYOUT_YMODE, XL_NS_CHART, "yMode", GSF_XML_NO_CONTENT, NULL, NULL),
 
       GSF_XML_IN_NODE (PLOTAREA, SCATTER, XL_NS_CHART,	"scatterChart", GSF_XML_NO_CONTENT, xlsx_chart_xy, &xlsx_plot_end),
-        GSF_XML_IN_NODE (SCATTER, SCATTER_STYLE, XL_NS_CHART,	"scatterStyle", GSF_XML_NO_CONTENT, NULL, NULL),
-        GSF_XML_IN_NODE (SCATTER, PLOT_AXIS_ID, XL_NS_CHART,		"axId", GSF_XML_NO_CONTENT, &xlsx_plot_axis_id, NULL),
+        GSF_XML_IN_NODE (SCATTER, SCATTER_STYLE, XL_NS_CHART,	"scatterStyle", GSF_XML_NO_CONTENT, &xlsx_scatter_style, NULL),
+        GSF_XML_IN_NODE (SCATTER, PLOT_AXIS_ID, XL_NS_CHART,           "axId", GSF_XML_NO_CONTENT, &xlsx_plot_axis_id, NULL),
 
         GSF_XML_IN_NODE (SCATTER, SERIES, XL_NS_CHART,	"ser", GSF_XML_NO_CONTENT, &xlsx_chart_ser_start, &xlsx_chart_ser_end),
           GSF_XML_IN_NODE (SERIES, SERIES_IDX, XL_NS_CHART,	"idx", GSF_XML_NO_CONTENT, NULL, NULL),



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