[gnumeric] Write edit position and active sheet to LibreOffice confs in ODF files.



commit fd1fa96b79ff4e4b328c727e48db50b1ecc99e73
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Aug 29 16:13:05 2011 -0600

    Write edit position and active sheet to LibreOffice confs in ODF files.
    
    2011-08-29  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_write_ooo_settings): write edit positions and
    	active sheet

 NEWS                                  |    2 +-
 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |   19 +++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 982a032..199f8a7 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,7 @@ Andreas:
 	* Fix saving of newlines to xls. [#356711]
 	* Enable markup selection in scientific format selector.
 	* Be compatible wihthe changed LibreOffice ODF documents with tab colours.
-	* Read edit position and active sheet from LibreOffice generated ODF files.
+	* Read/write edit position and active sheet from/to LibreOffice confs in ODF files.
 
 Jean:
 	* Make things build against gtk+-3.0.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index dbb9883..f3650e9 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2011-08-29  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-write.c (odf_write_ooo_settings): write edit positions and
+	active sheet
+
+2011-08-29  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (odf_config_item_end): handle G_TYPE_STRING
 	(odf_config_item): handle string type
 	(odf_apply_ooo_table_config): set edit position
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index e72a596..6fa9478 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -5422,6 +5422,7 @@ odf_write_ooo_settings (GnmOOExport *state)
 	sheets = workbook_sheets (state->wb);
 	for (l = sheets; l != NULL; l = l->next) {
 		Sheet *sheet = l->data;
+		SheetView *sv = sheet_get_view (sheet, state->wbv);
 		gsf_xml_out_start_element (state->xml, CONFIG "config-item-map-entry");
 		gsf_xml_out_add_cstr (state->xml, CONFIG "name", sheet->name_unquoted);
 		if (get_gsf_odf_version () < 103  && sheet->tab_color != NULL 
@@ -5434,6 +5435,17 @@ odf_write_ooo_settings (GnmOOExport *state)
 			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", "CursorPositionX");
+		gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "int");
+		gsf_xml_out_add_int (state->xml, NULL, sv->edit_pos.col);
+		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", "CursorPositionY");
+		gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "int");
+		gsf_xml_out_add_int (state->xml, NULL, sv->edit_pos.row);
+		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", "ShowGrid");
 		gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "boolean");
 		gsf_xml_out_add_cstr_unchecked (state->xml, NULL, "true");
@@ -5444,6 +5456,13 @@ odf_write_ooo_settings (GnmOOExport *state)
 	g_slist_free (sheets);
 
 	gsf_xml_out_end_element (state->xml); /* </config:config-item-map-named> */
+
+		gsf_xml_out_start_element (state->xml, CONFIG "config-item");
+		gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "name", "ActiveTable");
+		gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "string");
+		gsf_xml_out_add_cstr_unchecked (state->xml, NULL, "Sheet2");
+		gsf_xml_out_end_element (state->xml); /* </config:config-item> */
+
 	gsf_xml_out_end_element (state->xml); /* </config:config-item-map-entry> */
 	gsf_xml_out_end_element (state->xml); /* </config:config-item-map-indexed> */
 	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]