[gnumeric] replace gnm:style with gnm:am-prefix and gnm:pm-prefix



commit 9dab56d4d8bf8e96863a62bea4d3e540ca9dff2b
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Fri Jan 1 19:52:23 2016 -0700

    replace gnm:style with gnm:am-prefix and gnm:pm-prefix
    
    2015-04-12  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * ods-ext-schema.patch: replace gnm:style with gnm:am-suffix and gnm:pm-suffix
    
    2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (oo_date_am_pm): read new foreign attributes
        gnm:am-suffix and gnm:pm-suffix
    
    2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * odf-foreign.txt: replace gnm:style attribute with
        gnm:am-suffix and gnm:pm-suffix

 doc/ChangeLog                        |    5 +++
 doc/developer/odf-foreign.txt        |    4 +-
 plugins/openoffice/ChangeLog         |    5 +++
 plugins/openoffice/openoffice-read.c |   30 +++++++++++++++-----
 test/ChangeLog                       |    4 +++
 test/ods-ext-schema.patch            |   49 ++++++++++++++++++---------------
 6 files changed, 65 insertions(+), 32 deletions(-)
---
diff --git a/doc/ChangeLog b/doc/ChangeLog
index e2eaff5..2a41c70 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,10 @@
 2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * odf-foreign.txt: replace gnm:style attribute with
+       gnm:am-suffix and gnm:pm-suffix
+
+2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * odf-foreign.txt: add gnm:style attribute
 
 2015-12-28  Morten Welinder <terra gnome org>
diff --git a/doc/developer/odf-foreign.txt b/doc/developer/odf-foreign.txt
index 4025398..8670379 100644
--- a/doc/developer/odf-foreign.txt
+++ b/doc/developer/odf-foreign.txt
@@ -10,8 +10,8 @@ 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.)
+gnm:am-suffix gnm:pm-suffix
+Attributes to <number:am-pm> determining the suffixes to be used.)
 
 2) Attributes added by Gnumeric:
 
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 84ecb5d..07c4f62 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (oo_date_am_pm): read new foreign attributes
+       gnm:am-suffix and gnm:pm-suffix
+
+2016-01-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (oo_date_am_pm): read new foreign attribute
        gnm:style
 
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 21f729f..00564d2 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -5021,15 +5021,29 @@ static void
 oo_date_am_pm (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 {
        OOParseState *state = (OOParseState *)xin->user_state;
-       gboolean is_short = FALSE;
-
+       gchar const *am_suffix = "AM";
+       gchar const *pm_suffix = "PM";
+       
        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, is_short ? "a/p" : "AM/PM");
-
+               if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_GNUM_NS_EXT, "am-suffix"))
+                       am_suffix = CXML2C (attrs[1]);
+               else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_GNUM_NS_EXT, "pm-suffix"))
+                       pm_suffix = CXML2C (attrs[1]);
+
+       if (strlen (am_suffix) > 2 || (*am_suffix != 'a' && *am_suffix != 'A') ||
+           (*(am_suffix + 1) != 'm' && *(am_suffix + 1) != 'M' && *(am_suffix + 1) != 0))
+               am_suffix = "AM";
+       if (strlen (pm_suffix) > 2 || (*pm_suffix != 'p' && *pm_suffix != 'P') ||
+           (*(pm_suffix + 1) != 'm' && *(pm_suffix + 1) != 'M' && *(pm_suffix + 1) != 0))
+               pm_suffix = "PM";
+       if (strlen (am_suffix) != strlen (pm_suffix))
+               pm_suffix = am_suffix = "AM";
+       
+       if (state->cur_format.accum != NULL) {
+               g_string_append (state->cur_format.accum, am_suffix);
+               g_string_append_c (state->cur_format.accum, '/');
+               g_string_append (state->cur_format.accum, pm_suffix);
+       }
 }
 
 static void
diff --git a/test/ChangeLog b/test/ChangeLog
index b99af1a..77dd6e1 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-12  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * ods-ext-schema.patch: replace gnm:style with gnm:am-suffix and gnm:pm-suffix
+
 2015-12-28  Morten Welinder <terra gnome org>
 
        * Release 1.12.26
diff --git a/test/ods-ext-schema.patch b/test/ods-ext-schema.patch
index b95b8e9..c1cbf62 100644
--- a/test/ods-ext-schema.patch
+++ b/test/ods-ext-schema.patch
@@ -1,5 +1,5 @@
---- ods-schema/OpenDocument-v1.2-os-schema.rng 2015-01-28 18:46:19.155715877 -0500
-+++ ods-schema/OpenDocument-v1.2-os-ext-schema.rng     2016-01-01 19:44:25.464059435 -0500
+--- ods-schema/OpenDocument-v1.2-os-schema.rng 2015-04-08 21:49:54.000000000 -0600
++++ ods-schema/OpenDocument-v1.2-os-ext-schema.rng     2016-01-01 19:47:48.204868483 -0700
 @@ -62,6 +62,12 @@
        xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
        xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
@@ -253,20 +253,25 @@
                        <optional>
                                <attribute name="number:style">
                                        <choice>
-@@ -13047,7 +13137,11 @@
+@@ -13047,7 +13137,16 @@
        </define>
        <define name="number-am-pm">
                <element name="number:am-pm">
 -                      <empty/>
 +                      <optional>
-+                              <attribute name="gnm:style">
++                              <attribute name="gnm:am-suffix">
++                                      <ref name="string"/>
++                              </attribute>
++                      </optional>
++                      <optional>
++                              <attribute name="gnm:pm-suffix">
 +                                      <ref name="string"/>
 +                              </attribute>
 +                      </optional>
                </element>
        </define>
        <define name="number-boolean-style">
-@@ -13097,7 +13191,15 @@
+@@ -13097,7 +13196,15 @@
        </define>
        <define name="number-text">
                <element name="number:text">
@@ -283,7 +288,7 @@
                </element>
        </define>
        <define name="number-text-content">
-@@ -13169,6 +13271,11 @@
+@@ -13169,6 +13276,11 @@
                                        </choice>
                                </attribute>
                        </optional>
@@ -295,7 +300,7 @@
                </interleave>
        </define>
        <define name="common-auto-reorder-attlist">
-@@ -13203,6 +13310,11 @@
+@@ -13203,6 +13315,11 @@
                                </attribute>
                        </optional>
                        <optional>
@@ -307,7 +312,7 @@
                                <attribute name="number:grouping">
                                        <ref name="boolean"/>
                                </attribute>
-@@ -14101,6 +14213,22 @@
+@@ -14101,6 +14218,22 @@
                                        <ref name="string"/>
                                </attribute>
                        </optional>
@@ -330,7 +335,7 @@
                </interleave>
        </define>
        <define name="draw-stroke-dash">
-@@ -14383,6 +14511,21 @@
+@@ -14383,6 +14516,21 @@
                                        <ref name="boolean"/>
                                </attribute>
                        </optional>
@@ -352,7 +357,7 @@
                </interleave>
        </define>
        <define name="style-page-layout-properties-elements">
-@@ -14874,11 +15017,33 @@
+@@ -14874,11 +15022,33 @@
                                </attribute>
                        </optional>
                        <optional>
@@ -386,7 +391,7 @@
                                <attribute name="style:text-line-through-mode">
                                        <ref name="lineMode"/>
                                </attribute>
-@@ -15090,6 +15255,18 @@
+@@ -15090,6 +15260,18 @@
        <define name="style-paragraph-properties-attlist">
                <interleave>
                        <optional>
@@ -405,7 +410,7 @@
                                <attribute name="fo:line-height">
                                        <choice>
                                                <value>normal</value>
-@@ -15461,14 +15638,21 @@
+@@ -15461,14 +15643,21 @@
                </optional>
        </define>
        <define name="common-background-color-attlist">
@@ -434,7 +439,7 @@
        </define>
        <define name="style-background-image">
                <optional>
-@@ -15564,6 +15748,36 @@
+@@ -15564,6 +15753,36 @@
                                <ref name="string"/>
                        </attribute>
                </optional>
@@ -471,7 +476,7 @@
        </define>
        <define name="common-border-line-width-attlist">
                <optional>
-@@ -15904,6 +16118,37 @@
+@@ -15904,6 +16123,37 @@
                                        <ref name="boolean"/>
                                </attribute>
                        </optional>
@@ -509,7 +514,7 @@
                </interleave>
        </define>
        <define name="style-table-properties-elements">
-@@ -16004,6 +16249,11 @@
+@@ -16004,6 +16254,11 @@
                                </attribute>
                        </optional>
                        <optional>
@@ -521,7 +526,7 @@
                                <attribute name="style:text-align-source">
                                        <choice>
                                                <value>fix</value>
-@@ -16028,6 +16278,16 @@
+@@ -16028,6 +16283,16 @@
                        <ref name="common-background-color-attlist"/>
                        <ref name="common-border-attlist"/>
                        <optional>
@@ -538,7 +543,7 @@
                                <attribute name="style:diagonal-tl-br">
                                        <ref name="string"/>
                                </attribute>
-@@ -16104,6 +16364,16 @@
+@@ -16104,6 +16369,16 @@
                                        <ref name="boolean"/>
                                </attribute>
                        </optional>
@@ -555,7 +560,7 @@
                </interleave>
        </define>
        <define name="common-style-direction-attlist">
-@@ -17060,6 +17330,46 @@
+@@ -17060,6 +17335,46 @@
                                        <ref name="nonNegativeInteger"/>
                                </attribute>
                        </optional>
@@ -602,7 +607,7 @@
                </interleave>
        </define>
        <define name="style-graphic-fill-properties-attlist">
-@@ -17388,6 +17698,10 @@
+@@ -17388,6 +17703,10 @@
                                                <value>none</value>
                                                <value>cubic-spline</value>
                                                <value>b-spline</value>
@@ -613,7 +618,7 @@
                                        </choice>
                                </attribute>
                        </optional>
-@@ -17661,6 +17975,10 @@
+@@ -17661,6 +17980,10 @@
                                                <value>logarithmic</value>
                                                <value>exponential</value>
                                                <value>power</value>
@@ -624,7 +629,7 @@
                                        </choice>
                                </attribute>
                        </optional>
-@@ -17697,6 +18015,62 @@
+@@ -17697,6 +18020,62 @@
                                        <ref name="boolean"/>
                                </attribute>
                        </optional>
@@ -687,7 +692,7 @@
                </interleave>
        </define>
        <define name="labelPositions">
-@@ -18124,4 +18498,85 @@
+@@ -18124,4 +18503,85 @@
                        </element>
                </zeroOrMore>
        </define>


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