[gnumeric] Write const trendline names to loext extension



commit c2700ee93a19ccd22b95013e6aebefd3dcdaa89e
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun Jan 25 14:35:30 2015 -0700

    Write const trendline names to loext extension
    
    2015-01-25  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (odf_write_data_attribute): add argument, change all callers
        and write loext extendion if appropriate
        (odf_write_reg_name): pass loext extension name to odf_write_data_attribute

 plugins/openoffice/ChangeLog          |    8 +++++++-
 plugins/openoffice/openoffice-write.c |   19 +++++++++++++++----
 2 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 7aaf706..61eeb4f 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,4 +1,10 @@
-2015-01-24  Andreas J. Guelzow <aguelzow pyrshep ca>
+2015-01-25  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-write.c (odf_write_data_attribute): add argument, change all callers
+       and write loext extendion if appropriate
+       (odf_write_reg_name): pass loext extension name to odf_write_data_attribute
+
+2015-01-25  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (od_style_prop_chart): store regression name constant
        from loext: name space
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index a23ed43..750225e 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -105,6 +105,8 @@
 #define TABLEOOO "tableooo:"
 #define XML      "xml:"
 #define CSS      "css3t:"
+#define LOEXT    "loext:"
+#define CALCEXT  "calcext:"
 #define GNMSTYLE "gnm:"  /* We use this for attributes and elements not supported by ODF */
 
 typedef struct {
@@ -200,6 +202,8 @@ static struct {
        { "xmlns:xsi",          "http://www.w3.org/2001/XMLSchema-instance"; },
        { "xmlns:gnm",          "http://www.gnumeric.org/odf-extension/1.0"},
        { "xmlns:css3t",        "http://www.w3.org/TR/css3-text/"},
+       { "xmlns:loext",        "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"},
+       { "xmlns:calcext",      "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"},
 };
 
 /*****************************************************************************/
@@ -6260,7 +6264,7 @@ odf_write_data_element (GnmOOExport *state, GOData const *data, GnmParsePos *pp,
 
 static void
 odf_write_data_attribute (GnmOOExport *state, GOData const *data, GnmParsePos *pp,
-                         char const *attribute)
+                         char const *attribute, char const *c_attribute)
 {
        GnmExprTop const *texpr = gnm_go_data_get_expr (data);
 
@@ -6269,6 +6273,12 @@ odf_write_data_attribute (GnmOOExport *state, GOData const *data, GnmParsePos *p
                gsf_xml_out_add_cstr (state->xml, attribute,
                                      odf_strip_brackets (str));
                g_free (str);
+               if (NULL != c_attribute) {
+                       GnmValue const *v = gnm_expr_top_get_constant (texpr);
+                       if (NULL != v && VALUE_IS_STRING (v))
+                               gsf_xml_out_add_cstr (state->xml, c_attribute, 
+                                                     value_peek_string (v));
+               }
        }
 }
 
@@ -6315,11 +6325,11 @@ odf_write_regression_curve (GnmOOExport *state, GogObjectRole const *role, GogOb
                        bd = gog_dataset_get_dim (GOG_DATASET (regression), 0);
                        if (bd != NULL)
                                odf_write_data_attribute
-                                       (state, bd, pp, GNMSTYLE "lower-bound");
+                                       (state, bd, pp, GNMSTYLE "lower-bound", NULL);
                        bd = gog_dataset_get_dim (GOG_DATASET (regression), 1);
                        if (bd != NULL)
                                odf_write_data_attribute
-                                       (state, bd, pp, GNMSTYLE "upper-bound");
+                                       (state, bd, pp, GNMSTYLE "upper-bound", NULL);
                }
                if (equation != NULL) {
                        char const *eq_element, *eq_automatic, *eq_display, *eq_r;
@@ -8104,7 +8114,8 @@ odf_write_reg_name (GnmOOExport *state, GogObject const *obj)
                bd = gog_dataset_get_dim (GOG_DATASET (obj), -1);
                if (bd != NULL)
                        odf_write_data_attribute
-                               (state, bd, &pp, GNMSTYLE "regression-name");
+                               (state, bd, &pp, GNMSTYLE "regression-name",
+                                LOEXT "regression-name");
        }
 }
 


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