[gnumeric] Set a default separator for data labels imported from xlsx.



commit bddbdf68b7c4dd0942374530ac7dc5d865e2bb6a
Author: Jean Brefort <jean brefort normalesup org>
Date:   Mon Aug 29 18:16:41 2011 +0200

    Set a default separator for data labels imported from xlsx.

 ChangeLog                         |    5 +++++
 plugins/excel/ChangeLog           |    7 +++++++
 plugins/excel/xlsx-read-drawing.c |   12 ++++++++----
 src/graph.c                       |    3 ++-
 src/wbc-gtk.c                     |    2 ++
 5 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 415f996..5f95a1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-29  Jean Brefort  <jean brefort normalesup org>
+
+	* src/graph.c (gnm_go_data_scalar_get_str): fix a critical.
+	* src/wbc-gtk.c (wbc_gtk_set_toggle_action_state): one more.
+
 2011-08-28  Jean Brefort  <jean brefort normalesup org>
 
 	* src/graph.c (gnm_go_data_scalar_get_str): format the string.
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index f9b8817..bdfc812 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-29  Jean Brefort  <jean brefort normalesup org>
+
+	* xlsx-read-drawing.c (xlsx_ser_labels_show_val),
+	(xlsx_ser_labels_show_cat), (xlsx_ser_labels_start),
+	(xlsx_data_label_show_val), (xlsx_data_label_show_cat),
+	(xlsx_data_label_start): set a default separator.
+
 2011-08-28  Jean Brefort  <jean brefort normalesup org>
 
 	* ms-chart.c (end), (xl_chart_import_error_bar),
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 73d6175..e61f946 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -822,7 +822,7 @@ xlsx_ser_labels_show_val (GsfXMLIn *xin, xmlChar const **attrs)
 			if (desc->series.dim[i].ms_type == GOG_MS_DIM_VALUES)
 				break;
 		if (i != desc->series.num_dim) {
-			new_f = (f && *f)? g_strdup_printf ("%s %%%d", f, i): g_strdup_printf ("%%%d", i); 
+			new_f = (f && *f)? g_strdup_printf ("%s%%s%%%d", f, i): g_strdup_printf ("%%%d", i); 
 			g_object_set (state->cur_obj, "format", new_f, NULL);
 			g_free (new_f);
 		}
@@ -849,7 +849,7 @@ xlsx_ser_labels_show_cat (GsfXMLIn *xin, xmlChar const **attrs)
 			if (desc->series.dim[i].ms_type == GOG_MS_DIM_CATEGORIES)
 				break;
 		if (i != desc->series.num_dim) {
-			new_f = (f && *f)? g_strdup_printf ("%s %%%d", f, i): g_strdup_printf ("%%%d", i); 
+			new_f = (f && *f)? g_strdup_printf ("%s%%s%%%d", f, i): g_strdup_printf ("%%%d", i); 
 			g_object_set (state->cur_obj, "format", new_f, NULL);
 			g_free (new_f);
 		}
@@ -884,6 +884,8 @@ xlsx_ser_labels_start (GsfXMLIn *xin, xmlChar const **attrs)
 	XLSXReadState	*state = (XLSXReadState *)xin->user_state;
 	if (NULL != state->series) {
 		GogObject *data = gog_object_add_by_name (GOG_OBJECT (state->series), "Data labels", NULL);
+		GOData *sep = go_data_scalar_str_new (",", FALSE); /* FIXME, should be "\n" for pies */
+		gog_dataset_set_dim (GOG_DATASET (data), 1, sep, NULL);
 		g_object_set (data, "format", "", "offset", 3, NULL);
 		xlsx_chart_push_obj (state, data);
 	}
@@ -954,7 +956,7 @@ xlsx_data_label_show_val (GsfXMLIn *xin, xmlChar const **attrs)
 			if (desc->series.dim[i].ms_type == GOG_MS_DIM_VALUES)
 				break;
 		if (i != desc->series.num_dim) {
-			new_f = (f && *f)? g_strdup_printf ("%s %%%d", f, i): g_strdup_printf ("%%%d", i);
+			new_f = (f && *f)? g_strdup_printf ("%s%%s%%%d", f, i): g_strdup_printf ("%%%d", i);
 			g_object_set (state->cur_obj, "format", new_f, NULL);
 			g_free (new_f);
 		}
@@ -981,7 +983,7 @@ xlsx_data_label_show_cat (GsfXMLIn *xin, xmlChar const **attrs)
 			if (desc->series.dim[i].ms_type == GOG_MS_DIM_CATEGORIES)
 				break;
 		if (i != desc->series.num_dim) {
-			new_f = (f && *f)? g_strdup_printf ("%s %%%d", f, i): g_strdup_printf ("%%%d", i); 
+			new_f = (f && *f)? g_strdup_printf ("%s%%s%%%d", f, i): g_strdup_printf ("%%%d", i); 
 			g_object_set (state->cur_obj, "format", new_f, NULL);
 			g_free (new_f);
 		}
@@ -994,6 +996,8 @@ xlsx_data_label_start (GsfXMLIn *xin, xmlChar const **attrs)
 {
 	XLSXReadState	*state = (XLSXReadState *)xin->user_state;
 	GogObject *data = gog_object_add_by_name (state->cur_obj, "Point", NULL);
+	GOData *sep = go_data_scalar_str_new (",", FALSE); /* FIXME, should be "\n" for pies */
+	gog_dataset_set_dim (GOG_DATASET (data), 1, sep, NULL);
 	g_object_set (data, "format", "", "offset", 3, NULL);
 	xlsx_chart_push_obj (state, data);
 }
diff --git a/src/graph.c b/src/graph.c
index 1a3288b..2d3f71a 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -382,7 +382,8 @@ gnm_go_data_scalar_get_str (GODataScalar *dat)
 		GnmEvalPos ep;
 
 		eval_pos_init_dep (&ep, &scalar->dep);
-		fmt = auto_style_format_suggest (scalar->dep.texpr, &ep);
+		if (scalar->dep.texpr)
+			fmt = auto_style_format_suggest (scalar->dep.texpr, &ep);
 		scalar->val_str =
 			render_val (scalar_get_val (scalar), 0, 0, fmt, &ep);
 	}
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 04e2f99..30ada44 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -194,6 +194,8 @@ wbc_gtk_set_toggle_action_state (WBCGtk const *wbcg,
 		a = gtk_action_group_get_action (wbcg->font_actions, action);
 	if (a == NULL)
 		a = gtk_action_group_get_action (wbcg->toolbar.actions, action);
+	if (a == NULL)
+		a = gtk_action_group_get_action (wbcg->semi_permanent_actions, action);
 	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (a), state);
 }
 



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