[gnumeric] Fix ODF export of conditional styles including data styles. [#683739]



commit 257e57cfb389b4e58aac55bb225d1299ce7a2571
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Sep 11 08:33:08 2012 -0600

    Fix ODF export of conditional styles including data styles. [#683739]
    
    2012-09-11  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_store_data_style_for_style_with_name): new
    	(odf_write_office_styles): call odf_store_data_style_for_style_with_name
    	to ensure data files for named styles are collected (and later written)

 NEWS                                  |    2 ++
 plugins/openoffice/ChangeLog          |    6 ++++++
 plugins/openoffice/openoffice-write.c |   19 +++++++++++++++++++
 3 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index ac669e3..5134bd5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 Gnumeric 1.11.7
 
+Andreas:
+	* Fix ODF export of conditional styles including data styles. [#683739]
 Jean:
 	* Fixed indentation in cell format dialog. [#683576]
 
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 9b68f6c..aca3c5a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-11  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-write.c (odf_store_data_style_for_style_with_name): new
+	(odf_write_office_styles): call odf_store_data_style_for_style_with_name
+	to ensure data files for named styles are collected (and later written)
+
 2012-09-08  Jean Brefort  <jean brefort normalesup org>
 
 	* openoffice-read.c (odf_custom_shape_end): use the "paths" property for
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 89ac6b8..cac731d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -5143,10 +5143,29 @@ odf_write_hf (GnmOOExport *state, PrintInformation *pi, char const *id, gboolean
 }
 
 static void
+odf_store_data_style_for_style_with_name (GnmStyleRegion *sr, G_GNUC_UNUSED char const *name, GnmOOExport *state)
+{
+	GnmStyle const *style = sr->style;
+
+	if (gnm_style_is_element_set (style, MSTYLE_FORMAT)) {
+		GOFormat const *format = gnm_style_get_format(style);
+		if (format != NULL && !go_format_is_markup (format) && !go_format_is_general (format)) {
+			if (go_format_is_simple (format))
+				xl_find_format (state, format, 0);
+			else
+				xl_find_conditional_format (state, format);
+		}
+	}
+}
+
+static void
 odf_write_office_styles (GnmOOExport *state)
 {
 	gsf_xml_out_start_element (state->xml, OFFICE "styles");
 
+	/* We need to make sure all teh data styles for the named styles are included */
+	g_hash_table_foreach (state->named_cell_style_regions, (GHFunc) odf_store_data_style_for_style_with_name, state);
+
 	g_hash_table_foreach (state->xl_styles, (GHFunc) odf_write_this_xl_style, state);
 	g_hash_table_foreach (state->xl_styles_neg, (GHFunc) odf_write_this_xl_style_neg, state);
 	g_hash_table_foreach (state->xl_styles_zero, (GHFunc) odf_write_this_xl_style_zero, state);



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