[gnumeric] Fix ODF roundtrip of preferred window size. [part of #724487]



commit 37792bcd17f9e85bf0da14f184f981db7646ac4c
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun Feb 16 19:27:09 2014 -0700

    Fix ODF roundtrip of preferred window size. [part of #724487]
    
    2014-02-16  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (odf_apply_gnm_config): handle geometry
        * openoffice-write.c (odf_write_gnm_settings): handle geometry

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-read.c  |   11 +++++++++++
 plugins/openoffice/openoffice-write.c |   14 ++++++++++++++
 4 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0745679..d37e7b2 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.12.12
 
 Andreas:
        * Fix ODF roundtrip of some header/footer markers. [part of #724487]
+       * Fix ODF roundtrip of preferred window size. [part of #724487]
 
 Jean:
        * Fix persistence of hyperlinks tips. [see #724108]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 76fcc16..a4ea602 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2014-02-16  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (odf_apply_gnm_config): handle geometry
+       * openoffice-write.c (odf_write_gnm_settings): handle geometry
+
+2014-02-16  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (odf_hf_sheet_name): fix capitalization
        (odf_hf_date): ditto
        (odf_hf_time): ditto
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index b255f5a..4873d75 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -10322,6 +10322,7 @@ odf_apply_gnm_config (OOParseState *state)
        if ((state->settings.settings != NULL) &&
            NULL != (val = g_hash_table_lookup (state->settings.settings, "gnm:settings")) &&
            G_VALUE_HOLDS(val,G_TYPE_HASH_TABLE)) {
+               int width = 0, height = 0;
                GHashTable *hash =  g_value_get_boxed (val);
                val = g_hash_table_lookup (hash, "gnm:active-sheet");
                if (val != NULL && G_VALUE_HOLDS(val, G_TYPE_STRING)) {
@@ -10330,6 +10331,16 @@ odf_apply_gnm_config (OOParseState *state)
                        if (sheet != NULL)
                                wb_view_sheet_focus (state->wb_view, sheet);
                }
+               val = g_hash_table_lookup (hash, "gnm:geometry-width");
+               if (val != NULL && G_VALUE_HOLDS(val, G_TYPE_INT)) {
+                               width = g_value_get_int (val);
+               }
+               val = g_hash_table_lookup (hash, "gnm:geometry-height");
+               if (val != NULL && G_VALUE_HOLDS(val, G_TYPE_INT)) {
+                               height = g_value_get_int (val);
+               }
+               if (width > 0 && height > 0)
+                       wb_view_preferred_size (state->wb_view, width, height);
        }
 }
 
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 565aa6d..326e2ac 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -5838,6 +5838,20 @@ odf_write_gnm_settings (GnmOOExport *state)
                              (wb_view_cur_sheet (state->wbv))->name_unquoted);
        gsf_xml_out_end_element (state->xml); /* </config:config-item> */
 
+       gsf_xml_out_start_element (state->xml, CONFIG "config-item");
+       gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "name", GNMSTYLE "geometry-width");
+       gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "int");
+       gsf_xml_out_add_int (state->xml, NULL,
+                            state->wbv->preferred_width);
+       gsf_xml_out_end_element (state->xml); /* </config:config-item> */
+
+       gsf_xml_out_start_element (state->xml, CONFIG "config-item");
+       gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "name", GNMSTYLE "geometry-height");
+       gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "int");
+       gsf_xml_out_add_int (state->xml, NULL,
+                            state->wbv->preferred_height);
+       gsf_xml_out_end_element (state->xml); /* </config:config-item> */
+
        gsf_xml_out_end_element (state->xml); /* </config:config-item-set> */
 }
 


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