[gnumeric] Support ODF's title tag in headers and footers.



commit a98d75c8c5d5096ed318d120e6974191d8c25153
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Apr 22 19:39:18 2013 -0600

    Support ODF's title tag in headers and footers.
    
    2013-04-22  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * src/print-info.c (render_title): new

 ChangeLog        |  4 ++++
 NEWS             |  1 +
 src/print-info.c | 17 +++++++++++++++++
 3 files changed, 22 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index d730ecd..95e0120 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,10 @@
 
 2013-04-22  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * src/print-info.c (render_title): new
+
+2013-04-22  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * src/sheet.c (sheet_range_set_expr_cb): don't try to empty empty
        cells.
        (sheet_range_set_text): ditto
diff --git a/NEWS b/NEWS
index 4de24c3..3402c9d 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Andreas:
        * Fix plot placement in ODF import.
        * Plug leaks.
        * Fix border handling in html4 export. [#635217]
+       * Support ODF's title tag in headers and footers.
 
 Dominique Leuenberger:
        * Fix locale directory.
diff --git a/src/print-info.c b/src/print-info.c
index a03ee7f..ad30f44 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -644,6 +644,22 @@ render_path (GString *target, HFRenderInfo *info, G_GNUC_UNUSED char const *args
                g_string_append (target, _("Path "));
 }
 
+static void
+render_title (GString *target, HFRenderInfo *info, G_GNUC_UNUSED char const *args)
+{
+       if (info->sheet != NULL && info->sheet->workbook != NULL) {
+               GsfDocProp *prop;
+               prop = gsf_doc_meta_data_lookup
+                       (go_doc_get_meta_data (GO_DOC (info->sheet->workbook)), GSF_META_NAME_TITLE);
+               if (prop != NULL) {
+                       GValue *prop_value = (GValue *) gsf_doc_prop_get_val (prop);
+                       if (prop_value != NULL)
+                               g_string_append (target, g_value_get_string (prop_value));
+               }
+       } else
+               g_string_append (target, _("Title"));
+}
+
 static struct {
        char const *name;
        void (*render)(GString *target, HFRenderInfo *info, char const *args);
@@ -657,6 +673,7 @@ static struct {
        { N_("file"),  render_file  , NULL},
        { N_("path"),  render_path  , NULL},
        { N_("cell"),  render_cell  , NULL},
+       { N_("title"), render_title  , NULL},
        { NULL , NULL, NULL},
 };
 /*


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