[gnumeric] ods: import gnm:repeated inside number formats.



commit c3f0a11606a7223886a5ed112e82a9bb942c4d5e
Author: Morten Welinder <terra gnome org>
Date:   Tue Apr 22 07:58:54 2014 -0400

    ods: import gnm:repeated inside number formats.

 NEWS                                 |    1 +
 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |   22 +++++++++++++++++-----
 3 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index b0fea25..0829658 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Morten:
        * xlsx graph import improvements.
        * Attempt a fix for tabs appearance with gtk+ 3.12.  [#728465]
        * Make it possible to have all callables as python functions. [#728611]
+       * Improve format roundtrip through ODF.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.14
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 8ae2d7c..ee8b28f 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-22  Morten Welinder  <terra gnome org>
+
+       * openoffice-read.c (odf_format_repeated_text_end): Imported "*x"
+       type format.
+
 2014-04-20  Morten Welinder  <terra gnome org>
 
        * openoffice-read.c: Read gnm:invisible for text formats too.
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 0dd8576..7742f12 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -5315,7 +5315,7 @@ attr_eq_ncase (xmlChar const *a, char const *s, int n)
 
 
 static void
-odf_number_invisible_text (GsfXMLIn *xin, xmlChar const **attrs)
+odf_format_invisible_text (GsfXMLIn *xin, xmlChar const **attrs)
 {
        /* This can only be called inside a fixed text string */
        OOParseState *state = (OOParseState *)xin->user_state;
@@ -5346,6 +5346,16 @@ odf_number_invisible_text (GsfXMLIn *xin, xmlChar const **attrs)
 }
 
 static void
+odf_format_repeated_text_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
+{
+       OOParseState *state = (OOParseState *)xin->user_state;
+
+       /* This really only works for a single character. */
+       g_string_append_c (state->cur_format.accum, '*');
+       g_string_append (state->cur_format.accum, xin->content->str);
+}
+
+static void
 odf_number_color (GsfXMLIn *xin, xmlChar const **attrs)
 {
        OOParseState *state = (OOParseState *)xin->user_state;
@@ -10985,13 +10995,14 @@ GSF_XML_IN_NODE (OFFICE_DOC_STYLES, OFFICE_STYLES, OO_NS_OFFICE, "styles", GSF_X
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_NUMBER, OO_NS_NUMBER,  "number", GSF_XML_NO_CONTENT, 
&odf_number, NULL),
 GSF_XML_IN_NODE (NUMBER_STYLE_NUMBER, NUMBER_EMBEDDED_TEXT, OO_NS_NUMBER, "embedded-text", GSF_XML_CONTENT, 
&odf_embedded_text_start, &odf_embedded_text_end),
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_TEXT, OO_NS_NUMBER,    "text", GSF_XML_CONTENT, 
&odf_date_text_start, &oo_date_text_end),
-       GSF_XML_IN_NODE (NUMBER_STYLE_TEXT, NUMBER_TEXT_INVISBLE, OO_GNUM_NS_EXT, "invisible", 
GSF_XML_NO_CONTENT, &odf_number_invisible_text, NULL),
+       GSF_XML_IN_NODE (NUMBER_STYLE_TEXT, FORMAT_TEXT_INVISIBLE, OO_GNUM_NS_EXT, "invisible", 
GSF_XML_NO_CONTENT, &odf_format_invisible_text, NULL),
+       GSF_XML_IN_NODE (NUMBER_STYLE_TEXT, FORMAT_TEXT_REPEATED, OO_GNUM_NS_EXT, "repeated", 
GSF_XML_NO_CONTENT, NULL, &odf_format_repeated_text_end),
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_FRACTION, OO_NS_NUMBER, "fraction", GSF_XML_NO_CONTENT, 
&odf_fraction, NULL),
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_SCI_STYLE_PROP, OO_NS_NUMBER, "scientific-number", 
GSF_XML_NO_CONTENT, &odf_scientific, NULL),
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_PROP, OO_NS_STYLE,     "properties", GSF_XML_NO_CONTENT, 
NULL, NULL),
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_MAP, OO_NS_STYLE,            "map", GSF_XML_NO_CONTENT, &odf_map, 
NULL),
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_TEXT_PROP, OO_NS_STYLE,      "text-properties", 
GSF_XML_NO_CONTENT, &odf_number_color, NULL),
-    GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_TEXT_INVISBLE, OO_GNUM_NS_EXT, "invisible", GSF_XML_NO_CONTENT, 
NULL, NULL), /* 2nd */
+    GSF_XML_IN_NODE (NUMBER_STYLE, FORMAT_TEXT_INVISIBLE, OO_GNUM_NS_EXT, "invisible", GSF_XML_NO_CONTENT, 
NULL, NULL), /* 2nd */
     GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_FILL_CHARACTER, OO_NS_NUMBER,        "fill-character", 
GSF_XML_NO_CONTENT, NULL, NULL),
  
   GSF_XML_IN_NODE (OFFICE_STYLES, DATE_STYLE, OO_NS_NUMBER, "date-style", GSF_XML_NO_CONTENT, 
&oo_date_style, &oo_date_style_end),
@@ -11030,7 +11041,8 @@ GSF_XML_IN_NODE (NUMBER_STYLE_NUMBER, NUMBER_EMBEDDED_TEXT, OO_NS_NUMBER, "embed
     GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_MAP, OO_NS_STYLE,                "map", GSF_XML_NO_CONTENT, 
&odf_map, NULL),
     GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_SYMBOL, OO_NS_NUMBER,    "currency-symbol", GSF_XML_CONTENT, 
NULL, &odf_currency_symbol_end),
     GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_TEXT, OO_NS_NUMBER,      "text", GSF_XML_CONTENT, 
&odf_date_text_start, &oo_date_text_end),
-      GSF_XML_IN_NODE (CURRENCY_TEXT, CURRENCY_TEXT_INVISBLE, OO_GNUM_NS_EXT, "invisible", 
GSF_XML_NO_CONTENT, &odf_number_invisible_text, NULL),
+      GSF_XML_IN_NODE (CURRENCY_TEXT, FORMAT_TEXT_INVISIBLE, OO_GNUM_NS_EXT, "invisible", 
GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd */
+      GSF_XML_IN_NODE (CURRENCY_TEXT, FORMAT_TEXT_REPEATED, OO_GNUM_NS_EXT, "repeated", GSF_XML_NO_CONTENT, 
NULL, NULL), /* 2nd */
     GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_TEXT_PROP, OO_NS_STYLE,  "text-properties", 
GSF_XML_NO_CONTENT, &odf_number_color, NULL),
     GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_FILL_CHARACTER, OO_NS_NUMBER,    "fill-character", 
GSF_XML_NO_CONTENT, NULL, NULL),
 
@@ -11044,7 +11056,7 @@ GSF_XML_IN_NODE (NUMBER_STYLE_NUMBER, NUMBER_EMBEDDED_TEXT, OO_NS_NUMBER, "embed
   GSF_XML_IN_NODE (OFFICE_STYLES, STYLE_TEXT, OO_NS_NUMBER, "text-style", GSF_XML_NO_CONTENT, 
&odf_number_style, &odf_number_style_end),
     GSF_XML_IN_NODE (STYLE_TEXT, STYLE_TEXT_CONTENT, OO_NS_NUMBER,     "text-content", GSF_XML_NO_CONTENT,  
&odf_text_content, NULL),
     GSF_XML_IN_NODE (STYLE_TEXT, STYLE_TEXT_PROP, OO_NS_NUMBER,                "text", GSF_XML_CONTENT, 
&odf_date_text_start, &oo_date_text_end),
-       GSF_XML_IN_NODE (STYLE_TEXT_PROP, TEXT_TEXT_INVISBLE, OO_GNUM_NS_EXT, "invisible", 
GSF_XML_NO_CONTENT, &odf_number_invisible_text, NULL),
+      GSF_XML_IN_NODE (CURRENCY_TEXT, FORMAT_TEXT_INVISIBLE, OO_GNUM_NS_EXT, "invisible", 
GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd */
     GSF_XML_IN_NODE (STYLE_TEXT, STYLE_TEXT_MAP, OO_NS_STYLE,          "map", GSF_XML_NO_CONTENT, &odf_map, 
NULL),
     GSF_XML_IN_NODE (STYLE_TEXT, STYLE_TEXT_TEXT_PROP, OO_NS_STYLE,    "text-properties", 
GSF_XML_NO_CONTENT, &odf_number_color, NULL),
 


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