gnumeric r16830 - in branches/gnumeric-1-8: . plugins/openoffice



Author: jody
Date: Sat Sep 27 03:26:28 2008
New Revision: 16830
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16830&view=rev

Log:
2008-09-26  Jody Goldberg <jody gnome org>

	* plugins/openoffice/openoffice-read.c (oo_table_end) : style_extent
	has the max col/row with a style set, clear _outside_ that. [#553506]
	(oo_update_style_extent) : new.
	(oo_col_start) : called here.
	(oo_row_start) : here.
	(oo_cell_start) : and here.


Modified:
   branches/gnumeric-1-8/NEWS
   branches/gnumeric-1-8/gnumeric.desktop.in
   branches/gnumeric-1-8/plugins/openoffice/ChangeLog
   branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c

Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS	(original)
+++ branches/gnumeric-1-8/NEWS	Sat Sep 27 03:26:28 2008
@@ -5,10 +5,11 @@
 	* Fix an attribute order issue while loading. [#547183]
 
 Jody:
-	* Fix ODS import failure on win32. [#536552]
+	* Fix OO.o import failure on win32. [#536552]
 	* Add mnemonics to the quit dialog. [#132131]
 	* Fix range highlighting while editing. [#542439]
 	* Fix highlighting of merged cells. [#127415]
+	* Fix OO.o style import. [#553506]
 
 Morten:
 	* Fix text export problem for times with fractional seconds.  [#534514]

Modified: branches/gnumeric-1-8/gnumeric.desktop.in
==============================================================================
--- branches/gnumeric-1-8/gnumeric.desktop.in	(original)
+++ branches/gnumeric-1-8/gnumeric.desktop.in	Sat Sep 27 03:26:28 2008
@@ -1,10 +1,9 @@
 [Desktop Entry]
-Encoding=UTF-8
 _Name=Gnumeric Spreadsheet
 _GenericName=Spreadsheet
 _Comment=Calculation, Analysis, and Visualization of Information
 Exec=gnumeric %F_OR_U
-Icon=gnome-gnumeric.png
+Icon=gnome-gnumeric
 Terminal=false
 Type=Application
 Categories=Application;Office;Spreadsheet;Science;Math;GNOME;GTK;
@@ -14,4 +13,4 @@
 X-GNOME-Bugzilla-Version=BUGZILLAVERSION
 X-GNOME-Bugzilla-Component=General
 DocPath=gnumeric
-MimeType=application/x-gnumeric;application/vnd.ms-excel;application/excel;application/msexcel;application/x-excel;application/x-ms-excel;application/x-msexcel;application/x-xls;application/xls;application/x-dos_ms_excel;zz-application/zz-winassoc-xls;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/csv;application/tab-separated-values;text/comma-separated-values;text/csv;text/spreadsheet;text/tab-separated-values;text/x-comma-separated-values;application/vnd.lotus-1-2-3;application/x-123;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/x-applix-spreadsheet;application/x-mps;application/x-oleo;application/x-planperfect;application/x-quattropro;application/x-sc;application/x-sylk;application/x-xbase;
+MimeType=application/x-gnumeric;application/vnd.ms-excel;application/excel;application/msexcel;application/x-excel;application/x-ms-excel;application/x-msexcel;application/x-xls;application/xls;application/x-dos_ms_excel;zz-application/zz-winassoc-xls;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/csv;application/tab-separated-values;text/comma-separated-values;text/csv;text/spreadsheet;text/tab-separated-values;text/x-comma-separated-values;application/vnd.lotus-1-2-3;application/x-123;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/x-applix-spreadsheet;application/x-mps;application/x-oleo;application/x-planperfect;application/x-quattropro;application/x-sc;application/x-sylk;application/x-dbase;application/x-dbf;application/x-xbase;

Modified: branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c
==============================================================================
--- branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c	(original)
+++ branches/gnumeric-1-8/plugins/openoffice/openoffice-read.c	Sat Sep 27 03:26:28 2008
@@ -594,14 +594,14 @@
 	/* 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 < gnm_sheet_get_max_cols (NULL)) {
-		range_init (&r, state->extent_style.col, 0,
+	if ((state->extent_style.col+1) < gnm_sheet_get_max_cols (NULL)) {
+		range_init (&r, state->extent_style.col+1, 0,
 			gnm_sheet_get_max_cols (NULL)-1, gnm_sheet_get_max_rows (NULL)-1);
 		sheet_style_set_range (state->pos.sheet, &r,
 			sheet_style_default (state->pos.sheet));
 	}
-	if (state->extent_style.row < gnm_sheet_get_max_rows (NULL)) {
-		range_init (&r, 0, state->extent_style.row,
+	if ((state->extent_style.row+1) < gnm_sheet_get_max_rows (NULL)) {
+		range_init (&r, 0, state->extent_style.row+1,
 			gnm_sheet_get_max_cols (NULL)-1, gnm_sheet_get_max_rows (NULL)-1);
 		sheet_style_set_range (state->pos.sheet, &r,
 			sheet_style_default (state->pos.sheet));
@@ -642,6 +642,23 @@
 }
 
 static void
+oo_update_data_extent (OOParseState *state, int cols, int rows)
+{
+	if (state->extent_data.col < (state->pos.eval.col + cols - 1))
+		state->extent_data.col = state->pos.eval.col + cols - 1;
+	if (state->extent_data.row < (state->pos.eval.row + rows - 1))
+		state->extent_data.row = state->pos.eval.row + rows - 1;
+}
+static void
+oo_update_style_extent (OOParseState *state, int cols, int rows)
+{
+	if (cols > 0 && state->extent_style.col < (state->pos.eval.col + cols - 1))
+		state->extent_style.col = state->pos.eval.col + cols - 1;
+	if (rows > 0 && state->extent_style.row < (state->pos.eval.row + rows - 1))
+		state->extent_style.row = state->pos.eval.row + rows - 1;
+}
+
+static void
 oo_col_start (GsfXMLIn *xin, xmlChar const **attrs)
 {
 	OOParseState *state = (OOParseState *)xin->user_state;
@@ -673,6 +690,7 @@
 		r.end.row  = gnm_sheet_get_max_rows (NULL) - 1;
 		gnm_style_ref (style);
 		sheet_style_set_range (state->pos.sheet, &r, style);
+		oo_update_style_extent (state, repeat_count, -1);
 	}
 	if (col_info != NULL) {
 		int const last = state->pos.eval.col + repeat_count;
@@ -728,6 +746,7 @@
 		r.end.col  = gnm_sheet_get_max_cols (NULL) - 1;
 		gnm_style_ref (style);
 		sheet_style_set_range (state->pos.sheet, &r, style);
+		oo_update_style_extent (state, -1, repeat_count);
 	}
 
 	if (row_info != NULL){
@@ -849,15 +868,6 @@
 }
 
 static void
-oo_update_data_extent (OOParseState *state, int cols, int rows)
-{
-	if (state->extent_data.col < (state->pos.eval.col + cols - 1))
-		state->extent_data.col = state->pos.eval.col + cols - 1;
-	if (state->extent_data.row < (state->pos.eval.row + rows - 1))
-		state->extent_data.row = state->pos.eval.row + rows - 1;
-}
-
-static void
 oo_cell_start (GsfXMLIn *xin, xmlChar const **attrs)
 {
 	OOParseState *state = (OOParseState *)xin->user_state;
@@ -961,14 +971,18 @@
 			range_init_cellpos_size (&tmp, &state->pos.eval,
 				state->col_inc, state->row_inc);
 			sheet_style_set_range (state->pos.sheet, &tmp, style);
+			oo_update_style_extent (state, state->col_inc, state->row_inc);
 		} else if (merge_cols > 1 || merge_rows > 1) {
 			range_init_cellpos_size (&tmp, &state->pos.eval,
 				merge_cols, merge_rows);
 			sheet_style_set_range (state->pos.sheet, &tmp, style);
-		} else
+			oo_update_style_extent (state, merge_cols, merge_rows);
+		} else {
 			sheet_style_set_pos (state->pos.sheet,
 				state->pos.eval.col, state->pos.eval.row,
 				style);
+			oo_update_style_extent (state, 1, 1);
+		}
 	}
 	state->content_is_simple = FALSE;
 	if (texpr != NULL) {
@@ -2411,7 +2425,7 @@
 GSF_XML_IN_NODE (START, OFFICE_STYLES, OO_NS_OFFICE, "styles", GSF_XML_NO_CONTENT, NULL, NULL),
   GSF_XML_IN_NODE (OFFICE_STYLES, STYLE, OO_NS_STYLE, "style", GSF_XML_NO_CONTENT, &oo_style, &oo_style_end),
     GSF_XML_IN_NODE (STYLE, TABLE_CELL_PROPS, OO_NS_STYLE,	"table-cell-properties", GSF_XML_NO_CONTENT, &oo_style_prop, NULL),
-    GSF_XML_IN_NODE (STYLE, TEXT_PROP, OO_NS_STYLE,		"text-properties", GSF_XML_NO_CONTENT, NULL, NULL),
+    GSF_XML_IN_NODE (STYLE, TEXT_PROP, OO_NS_STYLE,		"text-properties", GSF_XML_NO_CONTENT, &oo_style_prop, NULL),
     GSF_XML_IN_NODE (STYLE, PARAGRAPH_PROPS, OO_NS_STYLE,	"paragraph-properties", GSF_XML_NO_CONTENT, &oo_style_prop, NULL),
       GSF_XML_IN_NODE (PARAGRAPH_PROPS, PARA_TABS, OO_NS_STYLE,  "tab-stops", GSF_XML_NO_CONTENT, NULL, NULL),
     GSF_XML_IN_NODE (STYLE, STYLE_PROP, OO_NS_STYLE,		"properties", GSF_XML_NO_CONTENT, &oo_style_prop, NULL),



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