[gnumeric] Read new attribute to am/pm element in ODF import. [#760043]



commit db28d0e7a1d0adb545dd99352b2f5f836edb97b3
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Fri Jan 1 17:15:32 2016 -0700

    Read new attribute to am/pm element in ODF import. [#760043]
    
    2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * odf-foreign.txt: add gnm:style attribute
    
    2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (oo_date_am_pm): read new foreign attribute
        gnm:style

 NEWS                                 |    1 +
 doc/ChangeLog                        |    4 ++++
 doc/developer/odf-foreign.txt        |    3 +++
 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |    8 +++++++-
 5 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 094084b..75f970d 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Gnumeric 1.12.27
 Andreas:
        * Read/write rich-text font-size from ODF files. [#759983]
        * Read/write zoom values to/from ODF files in LO compatible way. [#700013]
+       * Read new attribute to am/pm element in ODF import. [#760043]
 
 Morten:
        * Teach ssconvert to split sheets into separate .txt files [#694408]
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 2594975..e2eaff5 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * odf-foreign.txt: add gnm:style attribute
+
 2015-12-28  Morten Welinder <terra gnome org>
 
        * Release 1.12.26
diff --git a/doc/developer/odf-foreign.txt b/doc/developer/odf-foreign.txt
index e68dd3a..4025398 100644
--- a/doc/developer/odf-foreign.txt
+++ b/doc/developer/odf-foreign.txt
@@ -10,6 +10,9 @@ Part 1: In ODF 1.0 and 1.1 files only.
 gnm:no-integer-part
 An attribute to <number:fraction> determining whether an integer portion is shown or not. Defaults to 
"false" (i.e. an integer part is shown.)
 
+gnm:style
+An attribute to <number:am-pm> with possible values short and long determining whether the am/pm prefix is 
a/p or AM/PM.)
+
 2) Attributes added by Gnumeric:
 
 gnm:reverse-direction
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index d2bebe0..84ecb5d 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (oo_date_am_pm): read new foreign attribute
+       gnm:style
+
 2016-01-01  Morten Welinder  <terra gnome org>
 
        * openoffice-read.c (oo_date_text_append): Colons don't need
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 479069a..21f729f 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -5021,8 +5021,14 @@ static void
 oo_date_am_pm (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 {
        OOParseState *state = (OOParseState *)xin->user_state;
+       gboolean is_short = FALSE;
+
+       for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
+               if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_GNUM_NS_EXT, "style"))
+                       is_short = attr_eq (attrs[1], "short");
+
        if (state->cur_format.accum != NULL)
-               g_string_append (state->cur_format.accum, "AM/PM");
+               g_string_append (state->cur_format.accum, is_short ? "a/p" : "AM/PM");
 
 }
 


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