[gnumeric] OO: we no longer need OO-specific optimization of colrow.



commit 77b06c642b05e80f40730a8e2b19d46174371cb8
Author: Morten Welinder <terra gnome org>
Date:   Mon May 9 21:50:17 2011 -0400

    OO: we no longer need OO-specific optimization of colrow.
    
    Because we do it for all formats now.

 plugins/openoffice/openoffice-read.c |   49 --------------------------------
 src/colrow.c                         |   52 ----------------------------------
 src/colrow.h                         |    1 -
 3 files changed, 0 insertions(+), 102 deletions(-)
---
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 3cddad2..399c3bf 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -1588,52 +1588,6 @@ odf_validation (GsfXMLIn *xin, xmlChar const **attrs)
 }
 
 static void
-cb_find_default_colrow_style (gpointer *key, OOColRowStyle *val,
-			   OOColRowStyle **cri)
-{
-	if (*cri == NULL || ((*cri)->count < val->count))
-		*cri = val;
-}
-
-/* ODF defines default styles for cols/rows but many applications do not set it
- * and frequently ending up specifying a row style for real_extent..MAX
- * in order to make the styles work as above.  To avoid the miserable
- * performance of pretending to have 64k rows, we now need to go back and reset
- * the 'default'ness of any othewise empty rows, and assign the most common row
- * format as the default unless a default style is already set. */
-static void
-oo_col_reset_defaults (OOParseState *state)
-{
-	OOColRowStyle *cri = NULL;
-
-	if (state->default_style.columns == NULL) {
-		g_hash_table_foreach (state->styles.col,
-				      (GHFunc)cb_find_default_colrow_style, &cri);
-		if (NULL != cri && cri->size_pts > 0.)
-			sheet_col_set_default_size_pts (state->pos.sheet,
-							cri->size_pts);
-	}
-	colrow_reset_defaults (state->pos.sheet, TRUE,
-			       state->extent_data.col);
-}
-
-static void
-oo_row_reset_defaults (OOParseState *state)
-{
-	OOColRowStyle *cri = NULL;
-
-	if (state->default_style.rows == NULL) {
-		g_hash_table_foreach (state->styles.row,
-				      (GHFunc)cb_find_default_colrow_style, &cri);
-		if (NULL != cri && cri->size_pts > 0.)
-			sheet_row_set_default_size_pts (state->pos.sheet,
-							cri->size_pts);
-	}
-	colrow_reset_defaults (state->pos.sheet, FALSE,
-			       state->extent_data.row);
-}
-
-static void
 oo_table_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 {
 	OOParseState *state = (OOParseState *)xin->user_state;
@@ -1681,9 +1635,6 @@ oo_table_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 				       sheet_style_default (state->pos.sheet));
 	}
 
-	oo_col_reset_defaults (state);
-	oo_row_reset_defaults (state);
-
 	state->pos.eval.col = state->pos.eval.row = 0;
 	state->pos.sheet = NULL;
 }
diff --git a/src/colrow.c b/src/colrow.c
index 6930281..5f5e073 100644
--- a/src/colrow.c
+++ b/src/colrow.c
@@ -1235,58 +1235,6 @@ colrow_get_global_outline (Sheet const *sheet, gboolean is_cols, int depth,
 	*hide = g_slist_reverse (*hide);
 }
 
-/**
- * colrow_reset_defaults :
- * @sheet : #Sheet
- * @is_cols :
- * @maxima : The maximum col/row with cell content (this argument can go away
- *		 once we stop using col/row data to limit iteration)
- *
- * Find empty cols/rows that are equivalent to the default
- * and replace them with the default.
- **/
-void
-colrow_reset_defaults (Sheet *sheet, gboolean is_cols, int maxima)
-{
-	ColRowCollection *infos = is_cols ? &sheet->cols : &sheet->rows;
-	ColRowInfo const *default_cri = &infos->default_style;
-	ColRowSegment *segment;
-	ColRowInfo *cri;
-	int const end = colrow_max (is_cols, sheet);
-	int inner, inner_start, inner_last, i;
-
-	if (maxima >= end) {
-		g_warning ("In colrow_reset_defaults, someone set maxima to %d >= %d", maxima, end);
-		maxima = end - 1;
-	}
-
-	/* From here on, maxima is the first unused.  */
-	maxima++;
-
-	i = COLROW_SEGMENT_START(maxima);
-	inner_start = maxima - i;
-	for ( ; i < end ; i += COLROW_SEGMENT_SIZE) {
-		segment = COLROW_GET_SEGMENT (infos, i);
-		if (segment == NULL)
-			continue;
-		inner_last = COLROW_SEGMENT_SIZE;
-		for (inner = inner_start ; inner < inner_last; inner++) {
-			cri = segment->info[inner];
-			if (colrow_equal (cri, default_cri)) {
-				segment->info[inner] = NULL;
-				colrow_free (cri);
-			} else
-				maxima = inner + i;
-		}
-		if (maxima <= i) {
-			g_free (segment);
-			COLROW_GET_SEGMENT (infos, i) = NULL;
-		}
-		inner_start = 0;
-	}
-	infos->max_used = maxima - 1;
-}
-
 void
 colrow_resize (ColRowCollection *infos, int size)
 {
diff --git a/src/colrow.h b/src/colrow.h
index b9f6f01..b0e9de4 100644
--- a/src/colrow.h
+++ b/src/colrow.h
@@ -141,7 +141,6 @@ void		 colrow_set_visibility_list	(Sheet *sheet, gboolean is_cols,
 
 /* Misc */
 #define		 colrow_max(is_cols,sheet)	((is_cols) ? gnm_sheet_get_max_cols (sheet) : gnm_sheet_get_max_rows (sheet))
-void             colrow_reset_defaults		(Sheet *sheet, gboolean is_cols, int maxima);
 int              colrow_find_adjacent_visible   (Sheet *sheet, gboolean is_cols,
 						 int index, gboolean forward);
 



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