[gnumeric] Fix style handling in ODF export for empty cells with objects. [#687693]



commit a1e0f740964dcd6eeb48d1360f8db77c7ce58399
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Nov 5 19:32:40 2012 -0700

    Fix style handling in ODF export for empty cells with objects. [#687693]
    
    2012-11-04  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_write_cell): add argument, change caller
    	and use style even for NULL cells.

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    5 ++++
 plugins/openoffice/openoffice-write.c |   34 +++++++++++++++-----------------
 3 files changed, 22 insertions(+), 18 deletions(-)
---
diff --git a/NEWS b/NEWS
index d0eff7f..db5e632 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Andreas:
 	* Fix ODF export of conditional styles including data styles. [#683739]
 	* Fix encounter with macro sheets on xls import. [#684646]
 	* Make ODF import handling of strike-through match LO. [#686789]
+	* Fix style handling in ODF export for empty cells with objects. [#687693] 
 
 Jean:
 	* Fixed indentation in cell format dialog. [#683576]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 99e0aa9..c006feb 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2012-11-04  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-write.c (odf_write_cell): add argument, change caller
+	and use style even for NULL cells.
+
+2012-11-04  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-write.c (odf_write_content_rows): remove unused arguments
 	and change all callers
 	(odf_write_sheet): don't worry about the extent here.
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index ab232d0..6ddc25c 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3146,7 +3146,7 @@ odf_write_covered_cell (GnmOOExport *state, int *num)
 
 static void
 odf_write_cell (GnmOOExport *state, GnmCell *cell, GnmRange const *merge_range,
-		GSList *objects)
+		GnmStyle const *style, GSList *objects)
 {
 	int rows_spanned = 0, cols_spanned = 0;
 	gboolean pp = TRUE;
@@ -3167,24 +3167,22 @@ odf_write_cell (GnmOOExport *state, GnmCell *cell, GnmRange const *merge_range,
 	if (rows_spanned > 1)
 		gsf_xml_out_add_int (state->xml,
 				     TABLE "number-rows-spanned", rows_spanned);
-	if (cell != NULL) {
-		GnmStyle const *style = gnm_cell_get_style (cell);
-
-		if (style) {
-			char const * name = odf_find_style (state, style);
-			GnmValidation const *val = gnm_style_get_validation (style);
-			if (name != NULL)
-				gsf_xml_out_add_cstr (state->xml,
-						      TABLE "style-name", name);
-			if (val != NULL) {
-				char *vname = g_strdup_printf ("VAL-%p", val);
-				gsf_xml_out_add_cstr (state->xml,
-						      TABLE "content-validation-name", vname);
-				g_free (vname);
-			}
-			link = gnm_style_get_hlink (style);
+	if (style) {
+		char const * name = odf_find_style (state, style);
+		GnmValidation const *val = gnm_style_get_validation (style);
+		if (name != NULL)
+			gsf_xml_out_add_cstr (state->xml,
+					      TABLE "style-name", name);
+		if (val != NULL) {
+			char *vname = g_strdup_printf ("VAL-%p", val);
+			gsf_xml_out_add_cstr (state->xml,
+					      TABLE "content-validation-name", vname);
+			g_free (vname);
 		}
+		link = gnm_style_get_hlink (style);
+	}
 
+	if (cell != NULL) {
 		if ((NULL != cell->base.texpr) &&
 		    !gnm_expr_top_is_array_elem (cell->base.texpr, NULL, NULL)) {
 			char *formula, *eq_formula;
@@ -3622,7 +3620,7 @@ odf_write_content_rows (GnmOOExport *state, Sheet const *sheet, int from, int to
 				null_cell = 0;
 				if (covered_cell > 0)
 					odf_write_covered_cell (state, &covered_cell);
-				odf_write_cell (state, current_cell, merge_range, objects);
+				odf_write_cell (state, current_cell, merge_range, this_style, objects);
 
 				g_slist_free (objects);
 



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