[gnumeric] ods: fully roundtrip accounting format.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ods: fully roundtrip accounting format.
- Date: Wed, 7 May 2014 15:41:04 +0000 (UTC)
commit ad2b21a3762803553a09df588f7358248d2590bd
Author: Morten Welinder <terra gnome org>
Date: Wed May 7 11:40:37 2014 -0400
ods: fully roundtrip accounting format.
plugins/openoffice/ChangeLog | 6 ++++++
plugins/openoffice/openoffice-read.c | 21 ++++++++++++++++++---
test/t6512-format.pl | 3 +--
3 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index c966af1..cafaf61 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,9 @@
+2014-05-07 Morten Welinder <terra gnome org>
+
+ * openoffice-read.c (odf_number): Remove escaped debug code.
+ (oo_canonical_format): New function.
+ (odf_number_style_end): Udr oo_canonical_format.
+
2014-04-30 Morten Welinder <terra gnome org>
* Release 1.12.15
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 49d46c0..be4da8f 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -4668,6 +4668,22 @@ oo_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
state->cur_style.requires_disposal = FALSE;
}
+static GOFormat *
+oo_canonical_format (const char *s)
+{
+ /*
+ * Quoting certain characters is options and has no functions effect
+ * for the meaning of the format. However, some formats are recognized
+ * as built-in and others are not. We therefore apply a simple mapping
+ * to whatever form we prefer.
+ */
+ if (g_str_equal (s, "_(* -??_)"))
+ s = "_(* \"-\"??_)";
+
+ return go_format_new_from_XL (s);
+}
+
+
static void
oo_date_day (GsfXMLIn *xin, xmlChar const **attrs)
{
@@ -5107,7 +5123,7 @@ oo_date_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
}
g_hash_table_insert (state->formats, state->cur_format.name,
- go_format_new_from_XL (state->cur_format.accum->str));
+ oo_canonical_format (state->cur_format.accum->str));
g_string_free (state->cur_format.accum, TRUE);
}
}
@@ -5234,7 +5250,6 @@ odf_number (GsfXMLIn *xin, xmlChar const **attrs)
*zero = '?';
min_i_chars--;
}
- g_print ("format: %s\n", state->cur_format.accum->str);
} else
go_format_generate_number_str (state->cur_format.accum, min_i_digits, decimal_places,
grouping, FALSE, FALSE, NULL, NULL);
@@ -5539,7 +5554,7 @@ odf_number_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
}
g_hash_table_insert (state->formats, state->cur_format.name,
- go_format_new_from_XL (state->cur_format.accum->str));
+ oo_canonical_format (state->cur_format.accum->str));
g_string_free (state->cur_format.accum, TRUE);
state->cur_format.accum = NULL;
state->cur_format.name = NULL;
diff --git a/test/t6512-format.pl b/test/t6512-format.pl
index b4d59a3..a8d17d9 100755
--- a/test/t6512-format.pl
+++ b/test/t6512-format.pl
@@ -19,8 +19,7 @@ my $file = "$samples/format-tests.gnumeric";
&test_roundtrip ($file,
'format' => 'Gnumeric_OpenCalc:odf',
'ext' => "ods",
- 'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'",
- 'ignore_failure' => 1);
+ 'filter2' => "$PERL -p -e '\$_ = \"\" if m{<meta:generator>}'");
my $xls_codepage_filter = "$PERL -p -e '\$_ = \"\" if m{<meta:user-defined meta:name=.msole:codepage.}'";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]