[gnumeric] Map TRUE->TRUE() and FALSE->FALSE on ODF export
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Map TRUE->TRUE() and FALSE->FALSE on ODF export
- Date: Mon, 26 Mar 2012 15:27:02 +0000 (UTC)
commit 4cfb3013cfc2241eeeb9160f6e34900951433486
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Mon Mar 26 09:26:00 2012 -0600
Map TRUE->TRUE() and FALSE->FALSE on ODF export
2012-03-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/expr.c (do_expr_as_string): use new convs->output.boolean
* src/parse-util.h (_GnmConventions): add output.boolean
* src/parse-util.c (gnm_conventions_new_full): initialize output.boolean
2012-03-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_boolean_handler): new
(odf_expr_conventions_new): connect the above
ChangeLog | 6 ++++++
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-write.c | 7 +++++++
src/expr.c | 7 +++++++
src/parse-util.c | 1 +
src/parse-util.h | 2 ++
6 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d2a62b3..e2905b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/expr.c (do_expr_as_string): use new convs->output.boolean
+ * src/parse-util.h (_GnmConventions): add output.boolean
+ * src/parse-util.c (gnm_conventions_new_full): initialize output.boolean
+
2012-03-26 Jean Brefort <jean brefort normalesup org>
* src/sheet-object-image.c (sheet_object_image_set_image),
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 89d9981..2a16456 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
2012-03-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-write.c (odf_boolean_handler): new
+ (odf_expr_conventions_new): connect the above
+
+2012-03-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (odf_func_true_handler): new
(odf_func_false_handler): new
(oo_func_map_in): connect the above
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index a05a3fa..c3c17af 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -2547,6 +2547,12 @@ odf_string_handler (GnmConventionsOut *out, GOString const *str)
odf_print_string (out, str->str, '"');
}
+static void
+odf_boolean_handler (GnmConventionsOut *out, gboolean val)
+{
+ g_string_append (out->accum, val ? "TRUE()" : "FALSE()");
+}
+
static GnmConventions *
odf_expr_conventions_new (void)
@@ -2564,6 +2570,7 @@ odf_expr_conventions_new (void)
conv->output.cell_ref = odf_cellref_as_string;
conv->output.range_ref = odf_rangeref_as_string;
conv->output.func = odf_expr_func_handler;
+ conv->output.boolean = odf_boolean_handler;
return conv;
}
diff --git a/src/expr.c b/src/expr.c
index 7b02652..4ee900e 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1729,6 +1729,13 @@ do_expr_as_string (GnmExpr const *expr, int paren_level,
return;
}
+ if (v->type == VALUE_BOOLEAN &&
+ out->convs->output.boolean != NULL) {
+ out->convs->output.boolean (out, v->v_bool.val);
+ return;
+ }
+
+
value_get_as_gstring (v, target, out->convs);
/* If the number has a sign, pretend that it is the result of
diff --git a/src/parse-util.c b/src/parse-util.c
index cc83cfe..ed228ab 100644
--- a/src/parse-util.c
+++ b/src/parse-util.c
@@ -1406,6 +1406,7 @@ gnm_conventions_new_full (unsigned size)
convs->output.func = std_expr_func_handler;
convs->output.cell_ref = cellref_as_string;
convs->output.range_ref = rangeref_as_string;
+ convs->output.boolean = NULL;
convs->output.quote_sheet_name = std_sheet_name_quote;
return convs;
diff --git a/src/parse-util.h b/src/parse-util.h
index 318f196..bdeb23e 100644
--- a/src/parse-util.h
+++ b/src/parse-util.h
@@ -193,6 +193,8 @@ struct _GnmConventions {
gboolean no_sheetname);
void (*range_ref) (GnmConventionsOut *out,
GnmRangeRef const *range_ref);
+ void (*boolean) (GnmConventionsOut *out,
+ gboolean val);
GString * (*quote_sheet_name) (GnmConventions const *convs,
char const *name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]