[gnumeric] read more ODF number formats



commit 417b8ee8b5e8116045fe18ee3d76727ea32ef299
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Mon Mar 31 01:38:27 2014 -0600

    read more ODF number formats
    
    2014-03-31  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (odf_embedded_text_end): remove print statement
        (oo_date_text_append): cover '"'

 plugins/openoffice/ChangeLog         |    5 ++++
 plugins/openoffice/openoffice-read.c |   40 ++++++++++-----------------------
 2 files changed, 17 insertions(+), 28 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index d9c1187..0fe4e3c 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-31  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (odf_embedded_text_end): remove print statement
+       (oo_date_text_append): cover '"'
+
 2014-03-30  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (odf_embedded_text_start): new
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 227d221..d8190ca 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -4859,8 +4859,6 @@ odf_embedded_text_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
        odf_insert_in_integer (state, xin->content->str);
 
        state->cur_format.offset = 0;
-
-       g_print ("odf_embedded_text_end: >>%s<<\n", state->cur_format.accum->str);
 }
 
 static void
@@ -4892,40 +4890,26 @@ oo_date_text_append_unquoted (OOParseState *state, char cnt)
 static void
 oo_date_text_append (OOParseState *state, char const *cnt, int cnt_len)
 {
-       if (cnt_len == 1) {
+       if (cnt_len > 0) {
                if (NULL != strchr (" /-(),",*cnt)) {
                        oo_date_text_append_unquoted (state, *cnt);
+                       oo_date_text_append (state, cnt + 1, cnt_len - 1);
                        return;
-               }
-               if (state->cur_format.percentage && *cnt == '%') {
+               } else if (state->cur_format.percentage && *cnt == '%') {
                        oo_date_text_append_unquoted  (state, '%');
                        state->cur_format.percent_sign_seen = TRUE;
+                       oo_date_text_append (state, cnt + 1, cnt_len - 1);
+                       return;
+               } else if (*cnt == '"') {
+                       oo_date_text_append_unquoted  (state, '\\');
+                       oo_date_text_append_unquoted  (state, '"');
+                       oo_date_text_append (state, cnt + 1, cnt_len - 1);
                        return;
+               } else {
+                       oo_date_text_append_quoted (state, cnt, 1);
+                       oo_date_text_append (state, cnt + 1, cnt_len - 1);
                }
        }
-
-       if (cnt_len > 0) {
-               if (state->cur_format.percentage) {
-                       int len = cnt_len;
-                       char const *text = cnt;
-                       char const *percent_sign;
-                       while ((percent_sign = strchr (text, '%')) != NULL) {
-                               if (percent_sign > text) {
-                                       oo_date_text_append_quoted 
-                                               (state, text,
-                                                percent_sign - text);
-                                       len -= (percent_sign - text);
-                               }
-                               text = percent_sign + 1;
-                               len--;
-                               oo_date_text_append_unquoted (state, '%');
-                               state->cur_format.percent_sign_seen = TRUE;
-                       }
-                       if (len > 0)
-                               oo_date_text_append_quoted (state, text, len);
-               } else
-                       oo_date_text_append_quoted (state, cnt, cnt_len);
-       }
 }
 
 /* date_text_end is also used for non-date formats */


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