[gnumeric] Improve import of header/footer info from ODF.



commit 18377de44918fa2601f57a2000cf049b05018302
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Apr 21 22:01:40 2013 -0600

    Improve import of header/footer info from ODF.
    
    2013-04-21  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (df_hf_item_start): new
        (odf_hf_sheet_name): call df_hf_item_start
        (odf_hf_date): ditto
        (odf_hf_item_w_data_style): ditto
        (odf_hf_time): ditto
        (odf_hf_page_number): ditto
        (odf_hf_page_count): ditto
        (odf_hf_file): ditto
        (odf_hf_expression): ditto
        (odf_hf_title): ditto

 NEWS                                 |  1 +
 plugins/openoffice/ChangeLog         | 13 +++++++++++++
 plugins/openoffice/openoffice-read.c | 21 +++++++++++++++++++++
 3 files changed, 35 insertions(+)
---
diff --git a/NEWS b/NEWS
index 1d8b8ff..25a6748 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Andreas:
        * Update documentation.
        * Fix angle import of ODF graphs. [#698389]
        * Don't insert ODF local tables as sheets. [#698388]
+       * Improve import of header/footer info from ODF.
 
 Dominique Leuenberger:
        * Fix locale directory.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 018d035..45d501a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,18 @@
 2013-04-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (df_hf_item_start): new
+       (odf_hf_sheet_name): call df_hf_item_start
+       (odf_hf_date): ditto
+       (odf_hf_item_w_data_style): ditto
+       (odf_hf_time): ditto
+       (odf_hf_page_number): ditto
+       (odf_hf_page_count): ditto
+       (odf_hf_file): ditto
+       (odf_hf_expression): ditto
+       (odf_hf_title): ditto
+
+2013-04-21  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (odf_header_footer_end): fix leak
        (odf_hf_file): don't try to circumvent the GString handling
 
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index cab6d80..7be6eba 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -5785,6 +5785,18 @@ odf_hf_region (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 }
 
 static void
+odf_hf_item_start (GsfXMLIn *xin)
+{
+       OOParseState *state = (OOParseState *)xin->user_state;
+
+       if (xin->content->str != NULL && *xin->content->str != 0) {
+              oo_text_p_t *ptr = state->text_p_stack->data;
+              odf_text_p_add_text (state, xin->content->str + ptr->offset);
+              ptr->offset = strlen (xin->content->str);
+       }       
+}
+
+static void
 odf_hf_item (GsfXMLIn *xin, char const *item)
 {
        OOParseState *state = (OOParseState *)xin->user_state;
@@ -5797,6 +5809,7 @@ odf_hf_item (GsfXMLIn *xin, char const *item)
 static void
 odf_hf_sheet_name (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 {
+       odf_hf_item_start (xin);
        odf_hf_item (xin, _("tab"));
 }
 
@@ -5810,6 +5823,7 @@ odf_hf_item_w_data_style (GsfXMLIn *xin, xmlChar const **attrs, char const *item
                if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_STYLE, "data-style-name"))
                        data_style_name = CXML2C (attrs[1]);
 
+       odf_hf_item_start (xin);
        if (data_style_name == NULL)
                odf_hf_item (xin, item);
        else {
@@ -5827,24 +5841,28 @@ odf_hf_item_w_data_style (GsfXMLIn *xin, xmlChar const **attrs, char const *item
 static void
 odf_hf_date (GsfXMLIn *xin, xmlChar const **attrs)
 {
+       odf_hf_item_start (xin);
        odf_hf_item_w_data_style (xin, attrs, _("date"));
 }
 
 static void
 odf_hf_time (GsfXMLIn *xin, xmlChar const **attrs)
 {
+       odf_hf_item_start (xin);
        odf_hf_item_w_data_style (xin, attrs, _("time"));
 }
 
 static void
 odf_hf_page_number (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 {
+       odf_hf_item_start (xin);
        odf_hf_item (xin, _("page"));
 }
 
 static void
 odf_hf_page_count (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 {
+       odf_hf_item_start (xin);
        odf_hf_item (xin, _("pages"));
 }
 
@@ -5867,6 +5885,7 @@ odf_hf_file (GsfXMLIn *xin, xmlChar const **attrs)
        for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
                if (oo_attr_enum (xin, attrs, OO_NS_TEXT, "display", display_types, &tmp)) ;
 
+       odf_hf_item_start (xin);
        switch (tmp) {
        case 0:
                odf_hf_item (xin, _("path"));
@@ -5912,6 +5931,7 @@ odf_hf_expression (GsfXMLIn *xin, xmlChar const **attrs)
                gchar const *str = odf_string_id (state, formula);
                char *new;
                new = g_strconcat ((tmp == 1) ? "cellt" : "cell", ":", str, NULL);
+               odf_hf_item_start (xin);
                odf_hf_item (xin, new);
                g_free (new);
        }
@@ -5920,6 +5940,7 @@ odf_hf_expression (GsfXMLIn *xin, xmlChar const **attrs)
 static void
 odf_hf_title (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 {
+               odf_hf_item_start (xin);
        odf_hf_item (xin, _("title"));
 }
 


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