[gnumeric] New xlsx chart import fixes.



commit c2da848575076bece71ccc25643f8d6922c8b12f
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed May 4 10:49:26 2011 +0200

    New xlsx chart import fixes.

 plugins/excel/ChangeLog           |    8 ++++++++
 plugins/excel/xlsx-read-drawing.c |   25 +++++++++++++++++++------
 2 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index e6a21ca..4060898 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-04  Jean Brefort  <jean brefort normalesup org>
+
+	* xlsx-read-drawing.c (xlsx_chart_pop_obj): don't set a style to a NULL object,
+	(xlsx_axis_mark): pass a true boolean to make gobject happy,
+	(xlsx_axis_end): don't exchange radar plots axes,
+	(xlsx_chart_legend_pos): add new enum values not in spec, but occuring,
+	(xlsx_chart_solid_fill): set line color to line, not fill.
+
 2011-05-03  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* ms-chart.c (chart_write_LEGEND): disable -Wswitch for this function
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index dcc1827..dc50d44 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -49,7 +49,8 @@ xlsx_chart_pop_obj (XLSXReadState *state)
 #endif
 
 	if (state->cur_style) {
-		g_object_set (G_OBJECT (state->cur_obj), "style", state->cur_style, NULL);
+		if (state->cur_obj)
+			g_object_set (G_OBJECT (state->cur_obj), "style", state->cur_style, NULL);
 		g_object_unref (state->cur_style);
 	}
 	state->cur_obj = obj_stack->data;
@@ -620,9 +621,9 @@ xlsx_axis_mark (GsfXMLIn *xin, xmlChar const **attrs)
 	int res;
 	simple_enum (xin, attrs, marks, &res);
 	if (xin->node->user_data.v_int == 0)
-		g_object_set (G_OBJECT (state->axis.obj), "major_tick_in", res & 1, "major_tick_out", res & 2, NULL);
+		g_object_set (G_OBJECT (state->axis.obj), "major-tick-in", res & 1, "major-tick-out", (res & 2) != 0, NULL);
 	else
-		g_object_set (G_OBJECT (state->axis.obj), "minor_tick_in", res & 1, "minor_tick_out", res & 2, NULL);
+		g_object_set (G_OBJECT (state->axis.obj), "minor-tick-in", res & 1, "minor-tick-out", (res & 2) != 0, NULL);
 }
 
 static void
@@ -648,7 +649,7 @@ xlsx_axis_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 		if (0 == strcmp (type, "GogRadarPlot") ||
 		    0 == strcmp (type, "GogRadarAreaPlot")) {
 			role = (state->axis.type == XLSX_AXIS_CAT
-				|| state->axis.type == XLSX_AXIS_DATE) ? "Radial-Axis" : "Circular-Axis";
+				|| state->axis.type == XLSX_AXIS_DATE) ? "Circular-Axis" : "Radial-Axis";
 		} else if (0 == strcmp (type, "GogBubblePlot") ||
 			   0 == strcmp (type, "GogXYPlot")) {
 			/* both are VAL, use the position to decide */
@@ -845,6 +846,14 @@ xlsx_chart_legend_pos (GsfXMLIn *xin, xmlChar const **attrs)
 		{ "l",	 GOG_POSITION_W },
 		{ "r",	 GOG_POSITION_E },
 		{ "rt",	 GOG_POSITION_N | GOG_POSITION_E },
+		/* adding extra values not in spec, but actually possible (found first one at least) */
+		{ "tr",	 GOG_POSITION_N | GOG_POSITION_E },
+		{ "lt",	 GOG_POSITION_N | GOG_POSITION_W },
+		{ "tl",	 GOG_POSITION_N | GOG_POSITION_W },
+		{ "rb",	 GOG_POSITION_S | GOG_POSITION_E },
+		{ "br",	 GOG_POSITION_S | GOG_POSITION_E },
+		{ "lb",	 GOG_POSITION_S | GOG_POSITION_W },
+		{ "bl",	 GOG_POSITION_S| GOG_POSITION_W },
 		{ NULL, 0 }
 	};
 	XLSXReadState *state = (XLSXReadState *)xin->user_state;
@@ -1023,8 +1032,12 @@ xlsx_chart_solid_fill (GsfXMLIn *xin, xmlChar const **attrs)
 		if (!(state->sp_type & GO_STYLE_LINE)) {
 			state->cur_style->fill.type = GO_STYLE_FILL_PATTERN;
 			state->cur_style->fill.auto_type = FALSE;
-			state->gocolor = &state->cur_style->fill.pattern.back;
-			state->auto_color = &state->cur_style->fill.auto_back;
+			state->gocolor = &state->cur_style->fill.pattern.fore;
+			state->auto_color = &state->cur_style->fill.auto_fore;
+		} else {
+			state->cur_style->line.dash_type = GO_LINE_SOLID;
+			state->gocolor = &state->cur_style->line.color;
+			state->auto_color = &state->cur_style->line.auto_color;
 		}
 	}
 }



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