[goffice] Write invisible characters in ODF number style export. [#725852]



commit fbba9de83c0786252247107f49a230c5022924e2
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Thu Mar 6 22:56:22 2014 -0700

    Write invisible characters in ODF number style export. [#725852]
    
    2014-03-06 Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * goffice/utils/go-format.c (go_format_output_number_to_odf): write
        invisible characters; add argument
        (go_format_output_to_odf): adjust call to go_format_output_number_to_odf

 ChangeLog                 |    6 ++++++
 NEWS                      |    3 +++
 goffice/utils/go-format.c |   20 +++++++++++++++++---
 3 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3ff3350..47e0e5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-06 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * goffice/utils/go-format.c (go_format_output_number_to_odf): write
+       invisible characters; add argument
+       (go_format_output_to_odf): adjust call to go_format_output_number_to_odf
+
 2014-03-06  Jean Brefort  <jean brefort normalesup org>
 
        * goffice/utils/go-file.c (go_file_open): use GsfInputHTTP for URLs
diff --git a/NEWS b/NEWS
index cb6a02f..cc14ec0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 goffice 0.10.13:
 
+Andreas:
+       * Write invisible characters in ODF number style export. [#725852]
+
 Jean:
        * Ensure that the lasem plugin builds with lasem-0.4.1. [#725693]
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index cba3b7a..20f1280 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -8076,7 +8076,7 @@ go_format_output_number_element_to_odf (GsfXMLOut *xout,
 static void
 go_format_output_number_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                                GOFormatFamily family,
-                               char const *name, int cond_part)
+                               char const *name, int cond_part, gboolean with_extension)
 {
        char const *xl = go_format_as_XL (fmt);
        GString *accum = g_string_new (NULL);
@@ -8196,13 +8196,27 @@ go_format_output_number_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                case TOK_ELAPSED_M:
                case TOK_ELAPSED_S:
                case TOK_GENERAL:
-               case TOK_INVISIBLE_CHAR:
                case TOK_REPEATED_CHAR:
                case TOK_CONDITION:
                case TOK_ERROR:
                        ODF_WRITE_NUMBER;
                        break;
 
+               case TOK_INVISIBLE_CHAR: 
+                       if (with_extension) {
+                               size_t len = g_utf8_next_char(token + 1) - (token + 1);
+                               if (len > 0) {
+                                       gchar *text = g_strndup (token + 1, len);
+                                       ODF_WRITE_NUMBER;
+                                       gsf_xml_out_start_element (xout, GNMSTYLE "invisible");
+                                       gsf_xml_out_add_cstr (xout, GNMSTYLE  "char", text);
+                                       gsf_xml_out_end_element (xout); /* </gnm:invisible> */
+                                       g_free (text);
+                               }
+                       }
+                       break;
+          
+
                case TOK_STRING: {
                        size_t len = strchr (token + 1, '"') - (token + 1);
                        if (len > 0) {
@@ -8703,7 +8717,7 @@ go_format_output_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
        case GO_FORMAT_CURRENCY:
        case GO_FORMAT_PERCENTAGE:
        case GO_FORMAT_NUMBER:
-               go_format_output_number_to_odf (xout, act_fmt, family, name, cond_part);
+               go_format_output_number_to_odf (xout, act_fmt, family, name, cond_part, with_extension);
                break;
        default: {
                /* We need to output something and we don't need any details for this */


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