[gnumeric] Don't get carried away with deleting unneeded styles



commit 5da1d835d694625a9945ff3c7dee7be02da8cc30
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue Jun 23 21:14:30 2009 -0600

    Don't get carried away with deleting unneeded styles
    
    2009-06-23 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (oo_table_end): keep the styles for also
    	  for the whole data extent.

 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |   17 +++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 8e18f99..86d7fb2 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2009-06-23 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (oo_table_end): keep the styles for also
+	  for the whole data extent.
+
+2009-06-23 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (odf_map): simplify slightly
 	(oo_style_map): implement
 
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index fb85996..72e296a 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -782,6 +782,7 @@ oo_table_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 {
 	OOParseState *state = (OOParseState *)xin->user_state;
 	GnmRange r;
+	int rows, cols;
 	int max_cols, max_rows;
 
 	maybe_update_progress (xin);
@@ -803,14 +804,22 @@ oo_table_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 	/* default cell styles are applied only to cells that are specified
 	 * which is a performance nightmare.  Instead we apply the styles to
 	 * the entire column or row and clear the area beyond the extent here. */
-	if (state->extent_style.col + 1 < max_cols) {
-		range_init (&r, state->extent_style.col + 1, 0,
+
+	rows = state->extent_style.row;
+	if (state->extent_data.row > rows)
+		rows = state->extent_data.row;
+	cols = state->extent_style.col;
+	if (state->extent_data.col > cols)
+		cols = state->extent_data.col;
+	cols++; rows++;
+	if (cols < max_cols) {
+		range_init (&r, cols, 0,
 			    max_cols - 1, max_rows - 1);
 		sheet_style_set_range (state->pos.sheet, &r,
 				       sheet_style_default (state->pos.sheet));
 	}
-	if (state->extent_style.row + 1 < max_rows) {
-		range_init (&r, 0, state->extent_style.row+1,
+	if (rows < max_rows) {
+		range_init (&r, 0, rows,
 			    max_cols - 1, max_rows - 1);
 		sheet_style_set_range (state->pos.sheet, &r,
 				       sheet_style_default (state->pos.sheet));



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