[gnumeric] Export and import more sheet properties to/from ODF. [#725258]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Export and import more sheet properties to/from ODF. [#725258]
- Date: Fri, 28 Feb 2014 07:36:55 +0000 (UTC)
commit 6e265dbe7d4523e119729d8dfae9cc9b526bb52f
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Fri Feb 28 00:36:09 2014 -0700
Export and import more sheet properties to/from ODF. [#725258]
2014-02-28 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_table_start): handle new style fields
(oo_style_prop_table): read more style info
(odf_apply_ooo_table_config): read table properties
* openoffice-write.c (odf_write_table_style): write more style info
(odf_write_ooo_settings): write more table properties
NEWS | 1 +
plugins/openoffice/ChangeLog | 8 ++++++
plugins/openoffice/openoffice-read.c | 32 +++++++++++++++++++++++-
plugins/openoffice/openoffice-write.c | 42 +++++++++++++++++++++++---------
4 files changed, 69 insertions(+), 14 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9c3c652..e7db0f8 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Andreas:
* Fix ODF pattern roundtrip issue. [#724898]
* Export row and column visibility to ODF. [#725115]
* Export frozen panes info to and import from ODF. [#725228]
+ * Export and import more sheet properties to/from ODF. [#725258]
Jean:
* Fix persistence of hyperlinks tips. [see #724108]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 3e74a38..72865c3 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (oo_table_start): handle new style fields
+ (oo_style_prop_table): read more style info
+ (odf_apply_ooo_table_config): read table properties
+ * openoffice-write.c (odf_write_table_style): write more style info
+ (odf_write_ooo_settings): write more table properties
+
2014-02-27 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_config_item): read shorts
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index de0b931..40f4215 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -322,6 +322,9 @@ typedef struct {
GOColor tab_color;
gboolean tab_text_color_set;
GOColor tab_text_color;
+ gboolean display_formulas;
+ gboolean hide_col_header;
+ gboolean hide_row_header;
char *master_page_name;
} OOSheetStyle;
@@ -2235,6 +2238,9 @@ oo_table_start (GsfXMLIn *xin, xmlChar const **attrs)
g_object_set (state->pos.sheet,
"visibility", style->visibility,
"text-is-rtl", style->is_rtl,
+ "display-formulas", style->display_formulas,
+ "display-column-header", !style->hide_col_header,
+ "display-row-header", !style->hide_row_header,
NULL);
if (style->tab_color_set) {
GnmColor *color
@@ -6352,8 +6358,8 @@ oo_style_prop_table (GsfXMLIn *xin, xmlChar const **attrs)
};
OOParseState *state = (OOParseState *)xin->user_state;
OOSheetStyle *style = state->cur_style.sheets;
- gboolean tmp_i;
- int tmp_b;
+ int tmp_i;
+ gboolean tmp_b;
g_return_if_fail (style != NULL);
@@ -6364,6 +6370,14 @@ oo_style_prop_table (GsfXMLIn *xin, xmlChar const **attrs)
if (oo_attr_bool (xin, attrs, OO_NS_TABLE, "display", &tmp_b)) {
if (!tmp_b)
style->visibility = GNM_SHEET_VISIBILITY_HIDDEN;
+ } else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "display-formulas",
+ &style->display_formulas)) {
+ } else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "display-col-header",
+ &tmp_b)) {
+ style->hide_col_header = !tmp_b;
+ } else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "display-row-header",
+ &tmp_b)) {
+ style->hide_row_header = !tmp_b;
} else if (oo_attr_enum (xin, attrs, OO_NS_STYLE, "writing-mode", modes, &tmp_i))
style->is_rtl = tmp_i;
else if ((!style->tab_color_set &&
@@ -10442,8 +10456,22 @@ odf_apply_ooo_table_config (char const *key, GValue *val, OOParseState *state)
&pos);
}
}
+ item = g_hash_table_lookup (hash, "HasColumnRowHeaders");
+ if (item != NULL && G_VALUE_HOLDS(item, G_TYPE_BOOLEAN)) {
+ gboolean val = g_value_get_boolean (item);
+ g_object_set (sheet, "display-row-header", val, NULL);
+ g_object_set (sheet, "display-column-header", val, NULL);
+ }
}
+ item = g_hash_table_lookup (hash, "ShowGrid");
+ if (item != NULL && G_VALUE_HOLDS(item, G_TYPE_BOOLEAN))
+ g_object_set (sheet, "display-grid", g_value_get_boolean (item), NULL);
+
+ item = g_hash_table_lookup (hash, "ShowZeroValues");
+ if (item != NULL && G_VALUE_HOLDS(item, G_TYPE_BOOLEAN))
+ g_object_set (sheet, "display-zeros", g_value_get_boolean (item), NULL);
+
item = g_hash_table_lookup (hash, "HorizontalSplitMode");
if (item != NULL && G_VALUE_HOLDS(item, G_TYPE_INT))
vsm = g_value_get_int (item);
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index c37d047..7ac6a2c 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -713,18 +713,23 @@ odf_write_table_style (GnmOOExport *state, Sheet const *sheet)
sheet->visibility == GNM_SHEET_VISIBILITY_VISIBLE);
gsf_xml_out_add_cstr_unchecked (state->xml, STYLE "writing-mode",
sheet->text_is_rtl ? "rl-tb" : "lr-tb");
- if (state->with_extension && state->odf_version < 103) {
- if (sheet->tab_color && !sheet->tab_color->is_auto) {
- gnm_xml_out_add_hex_color (state->xml, GNMSTYLE "tab-color",
- sheet->tab_color, 1);
- gnm_xml_out_add_hex_color (state->xml, TABLEOOO "tab-color",
- sheet->tab_color, 1);
- }
- if (sheet->tab_text_color && !sheet->tab_text_color->is_auto) {
- gnm_xml_out_add_hex_color (state->xml,
- GNMSTYLE "tab-text-color",
- sheet->tab_text_color, 1);
+ if (state->with_extension) {
+ if (state->odf_version < 103) {
+ if (sheet->tab_color && !sheet->tab_color->is_auto) {
+ gnm_xml_out_add_hex_color (state->xml, GNMSTYLE "tab-color",
+ sheet->tab_color, 1);
+ gnm_xml_out_add_hex_color (state->xml, TABLEOOO "tab-color",
+ sheet->tab_color, 1);
+ }
+ if (sheet->tab_text_color && !sheet->tab_text_color->is_auto) {
+ gnm_xml_out_add_hex_color (state->xml,
+ GNMSTYLE "tab-text-color",
+ sheet->tab_text_color, 1);
+ }
}
+ odf_add_bool (state->xml, GNMSTYLE "display-formulas", sheet->display_formulas);
+ odf_add_bool (state->xml, GNMSTYLE "display-col-header", !sheet->hide_col_header);
+ odf_add_bool (state->xml, GNMSTYLE "display-row-header", !sheet->hide_row_header);
}
if (state->odf_version >= 103)
gnm_xml_out_add_hex_color (state->xml, TABLE "tab-color",
@@ -5923,7 +5928,20 @@ odf_write_ooo_settings (GnmOOExport *state)
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");
+ odf_add_bool (state->xml, NULL, !sheet->hide_grid);
+ 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", "HasColumnRowHeaders");
+ gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "boolean");
+ odf_add_bool (state->xml, NULL,
+ (!sheet->hide_col_header) || !sheet->hide_row_header);
+ 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", "ShowZeroValues");
+ gsf_xml_out_add_cstr_unchecked (state->xml, CONFIG "type", "boolean");
+ odf_add_bool (state->xml, NULL, !sheet->hide_zero);
gsf_xml_out_end_element (state->xml); /* </config:config-item> */
if (sv_is_frozen (sv)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]