Commit e406c13c authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

new. (xml_sax_input_msg) : new.


2005-06-25  Jody Goldberg <jody@gnome.org>

	* src/xml-sax-read.c (xml_sax_hlink) : new.
	(xml_sax_input_msg) : new.

2005-06-22  Jody Goldberg <jody@gnome.org>

	* src/Makefile.am : enable pango-test

2005-06-22  Jody Goldberg <jody@gnome.org>

	* * : s/MStyle/GnmStyle/
	      s/mstyle_/gnm_style_/
	      s/StyleHAlignFlags/GnmHAlign/
	      s/StyleVAlignFlags/GnmVAlign/
parent ed98ccd8
......@@ -248,10 +248,11 @@ Architecture Changes
9.12) preview grid ??
9.12.1) do we need/want the autoformat examples to swap dir ?
34) Functions
10) Functions
- Function range_min_k uses an O(n*log n) algorithm. It should use O(n)
algorithm, see Knuth.
- WORKDAY Add holiday support (Leonard is working on this)
- Suport >100 style for SUBTOTAL
- docs
: Translate each arg name + description seperately to get better
commonality.
......@@ -282,6 +283,52 @@ Architecture Changes
2) The example text should have the expr in C locale
?? how to reference the sample data ??
11) Conditional formats
11.1) Data Structures in the core
11.1.1) Storage (DONE)
11.1.2) Update GnmStyle to flag changes (DONE)
11.1.3) Release (DONE)
11.1.5) Check re-merging on change
11.1.6) Check merging of auto pattern colours on link
11.2) XLS import (DONE)
11.2.1) CONDFMT (DONE)
11.2.2) CF fonts (DONE)
11.2.3) CF borders (DONE)
11.2.4) CF background (DONE)
11.3) XLS export (DONE)
11.3.1) CONDFMT (DONE)
11.3.2) CF fonts (DONE)
11.3.3) CF borders (DONE)
11.3.4) CF background (DONE)
11.3.5) collect colours (DONE)
11.4) Gnumeric XML import (DONE)
11.4.1) SAX (DONE)
11.4.2) DOM (DONE)
11.5) Gnumeric XML export (DONE)
11.5.1) SAX (DONE)
11.5.2) DOM (DONE)
11.6) Evaluation
11.6.1) Custom (DONE)
11.6.2) Comparisons
11.6.3) Optimize constants (=1)
11.6.4) Optimize non-position dependent (=$A$1>3)
11.7) Rendering
11.7.1) background (DONE)
11.7.2) borders (DONE)
11.7.3) font and font colour
11.8) UI to modify
12) Input Messages
12.1) Implement
12.1.1) Data Structure to store it (DONE)
12.1.2) Display them
12.2) UI to modify them
12.3) XLS Import (DONE)
12.4) XLS Export (DONE)
12.5) SAX Import (DONE)
12.6) SAX Export (DONE)
12.7) DOM Import (DONE)
12.8) DOM Export (DONE)
-------------------------------------------------------------------------------
Target Features
---------------
......@@ -289,13 +336,11 @@ Target Features
- add column selector to autofilter filter dialog ala OOo
- insert cut
- clipboard handlers in plugins
- input message (Stored)
- load/save of external references
- all the merged cell singleton bugs
- R1C1
- R1C1 (DONE)
- finish corba plugin
- conditional formats : could be done if someone wanted to work on the dialog
- scripting
- repeat (http://bugzilla.gnome.org/show_bug.cgi?id=143244) (DONE)
- ssconvert for non-gnome (DONE)
......@@ -306,10 +351,6 @@ Short Term Goals
- validate expression names to ensure that they are not simple values (eg TRUE)
- Force the "for" (and thus the "switch") in mstyle_hash to be unrolled.
- Why do both mstyle_element_equal and mstyle_equal check types?
0) UI
0.1) Missing toolbar borders for color and stack combos (DONE)
0.2) Add keynav for autoformat canvases (DONE)
......@@ -578,7 +619,7 @@ Short Term Goals
29.1) Check for errors (DONE)
29.2) update on remote changes
29.3) see if schema is installed (DONE)
29.4) Move the pref storage into app and compartmentalize
29.4) Move the pref storage into app and compartmentalize (DONE)
the use of gconf.
29.5) update the preference structure on local changes
(this is an automatic consequence of 29.2)
......@@ -689,7 +730,6 @@ auto-fill
or by selecting the first named expression in scope that contains the
current cell.
: Check scoping changes. (DONE)
: Is there such a thing as an array formula in a name ?
: Handle pasting an expression with an un-qualified sheet local name into
another sheet
......
2005-06-25 Jody Goldberg <jody@gnome.org>
* src/xml-sax-read.c (xml_sax_hlink) : new.
(xml_sax_input_msg) : new.
2005-06-22 Morten Welinder <terra@gnome.org>
* src/mathfunc.c (random_01): Use the Mersenne Twister as
......@@ -10,6 +15,21 @@
* src/sheet-control-gui.c (scg_drag_receive_same_scg): ditto.
(scg_objects_nudge): fix typo.
2005-06-22 Jody Goldberg <jody@gnome.org>
* src/Makefile.am : enable pango-test
2005-06-22 Jody Goldberg <jody@gnome.org>
* * : s/MStyle/GnmStyle/
s/mstyle_/gnm_style_/
s/StyleHAlignFlags/GnmHAlign/
s/StyleVAlignFlags/GnmVAlign/
2005-06-20 Morten Welinder <terra@gnome.org>
* src/commands.c (cmd_rename_sheet): Prevent renames to "".
2005-06-14 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=163414
......@@ -17,10 +37,6 @@
don't do that". Position the tooltip above the cursor for row
headers too :-)
2005-06-20 Morten Welinder <terra@gnome.org>
* src/commands.c (cmd_rename_sheet): Prevent renames to "".
2005-06-14 Morten Welinder <terra@gnome.org>
* src/gnumeric-gconf.c (gnm_gconf_get_toolbar_visible,
......
......@@ -3,6 +3,11 @@ Gnumeric 1.5.3
Jody:
* Handle ROW/COLUMN with no argument in an array.
* Fix problems with row height resizing on win32. [#163414]
* XLS, SAX, & DOM in/out for conditional Formating.
* SAX in/out for input messages.
* SAX in for hyperlinks.
* Conditional Formating for backgrounds.
* Conditional Formating for borders.
Morten:
* Make changes to toolbar visibility permanent.
......
2005-06-25 Jody Goldberg <jody@gnome.org>
* src/xml-sax-read.c (xml_sax_hlink) : new.
(xml_sax_input_msg) : new.
2005-06-22 Morten Welinder <terra@gnome.org>
* src/mathfunc.c (random_01): Use the Mersenne Twister as
......@@ -10,6 +15,21 @@
* src/sheet-control-gui.c (scg_drag_receive_same_scg): ditto.
(scg_objects_nudge): fix typo.
2005-06-22 Jody Goldberg <jody@gnome.org>
* src/Makefile.am : enable pango-test
2005-06-22 Jody Goldberg <jody@gnome.org>
* * : s/MStyle/GnmStyle/
s/mstyle_/gnm_style_/
s/StyleHAlignFlags/GnmHAlign/
s/StyleVAlignFlags/GnmVAlign/
2005-06-20 Morten Welinder <terra@gnome.org>
* src/commands.c (cmd_rename_sheet): Prevent renames to "".
2005-06-14 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=163414
......@@ -17,10 +37,6 @@
don't do that". Position the tooltip above the cursor for row
headers too :-)
2005-06-20 Morten Welinder <terra@gnome.org>
* src/commands.c (cmd_rename_sheet): Prevent renames to "".
2005-06-14 Morten Welinder <terra@gnome.org>
* src/gnumeric-gconf.c (gnm_gconf_get_toolbar_visible,
......
A discussion of the style code, version 0.2
A discussion of the style code, version 0.3
by Jody Goldberg <jody@gnome.org>
......@@ -19,13 +19,13 @@ to build upon the experience of and pitfalls of the Michael's work.
a) Create the style:
MStyle *empty = mstyle_new ();
MStyle *full_of_default_settings = mstyle_new_default ().
GnmStyle *empty = gnm_style_new ();
GnmStyle *full_of_default_settings = gnm_style_new_default ().
b) Set elements:
mstyle_set_font_name (mstyle, "Dingbats");
gnm_style_set_font_name (mstyle, "Dingbats");
The passed const font name in this case is hashed and ref-counted
internally for efficiency. The only case in which it is necessary to do
......@@ -54,9 +54,9 @@ to build upon the experience of and pitfalls of the Michael's work.
1.1.2 Getting a style
MStyle *mstyle = sheet_style_get (sheet, col, row);
GnmStyle *mstyle = sheet_style_get (sheet, col, row);
or
MStyle *mstyle = cell_get_mstyle (cell);
GnmStyle *mstyle = cell_get_mstyle (cell);
Neither of these adds a reference to the style. If you intend to store
the style for later use you will need to ref/unref it.
......@@ -66,8 +66,8 @@ to build upon the experience of and pitfalls of the Michael's work.
sheet_style_attach ie.
BAD BAD BAD
MStyle *mstyle = cell_get_mstyle (cell);
mstyle_set_font_size (mstyle, 12.0);
GnmStyle *mstyle = cell_get_mstyle (cell);
gnm_style_set_font_size (mstyle, 12.0);
BAD BAD BAD
Do _not_ even think of doing the above, it will produce wacky
......@@ -77,17 +77,17 @@ to build upon the experience of and pitfalls of the Michael's work.
If you do the following:
MStyle *mstyle = mstyle_new ();
mstyle_set_font_name (mstyle, "dingbats");
GnmStyle *mstyle = gnm_style_new ();
gnm_style_set_font_name (mstyle, "dingbats");
cell_set_style (cell, mstyle);
mstyle = mstyle_new ();
mstyle_set_font_bold (mstyle, TRUE);
mstyle = gnm_style_new ();
gnm_style_set_font_bold (mstyle, TRUE);
cell_set_style (cell, mstyle);
Then you needlessly create two style regions ( for the same cell )
where one would have sufficed. This is a degenerate case clearly,
but happens in real code ( often when subroutines are used ). If
you need to build up a style for a range pass an MStyle * around
you need to build up a style for a range pass an GnmStyle * around
and build it up before applying it once.
1.3 Ref counting for dummies.
......@@ -96,37 +96,37 @@ to build upon the experience of and pitfalls of the Michael's work.
to reference count them the followings ( standard ) conventions are
used namely:
MStyle *mstyle = mstyle_new ();
GnmStyle *mstyle = gnm_style_new ();
Creating an mstyle in this way hands you a single reference.
sheet_mstyle_attach (sheet, col, row, mstyle)
sheet_style_set_pos (sheet, col, row, mstyle)
Attaching a style passes that reference on to the style code.
The way to ascertain whether a style reference has been handed on is
to examine the prototype for the function. Should the MStyle *
to examine the prototype for the function. Should the GnmStyle *
parameter be 'const' the reference is _not_ passed, otherwise in
general it is ( don't get hung up on that rule ). Of course non const
parameters are needed for eg. mstyle_set_font_name, but these have
parameters are needed for eg. gnm_style_set_font_name, but these have
no conceivable reason to fiddle with the ref-count so they don't.
The real gotchas happen when you decide to add a cache to your
code to speed up style allocation. In general this is what you want
where 'cache' denotes an MStyle * cache item.
where 'cache' denotes an GnmStyle * cache item.
MStyle *cache = cache_lookup_fn (mstyle_cache);
GnmStyle *cache = cache_lookup_fn (gnm_style_cache);
if (!cache) { /* We must create the style */
cache = mstyle_new ();
mstyle_set_font_bold (cache, bold);
cache = gnm_style_new ();
gnm_style_set_font_bold (cache, bold);
cache_insert_fn (mstyle_cache, cache);
cache_insert_fn (gnm_style_cache, cache);
}
mstyle_ref (cache); /* NB. */
gnm_style_ref (cache); /* NB. */
return cache;
NB. we 'leave' a reference in the cache. This then must be removed when
we flush the cache with a simple mstyle_unref.
we flush the cache with a simple gnm_style_unref.
2 Implementation details
......@@ -140,10 +140,10 @@ to build upon the experience of and pitfalls of the Michael's work.
cell format dialog, since the toolbar used the settings of the 'terminal'
( first selected ) cell in a selection. The process of generating unique
styles is is effectively a merging of all styles with the target regions.
Conflicts are marked in the final MStyle result and can be tested for
Conflicts are marked in the final GnmStyle result and can be tested for
using:
mstyle_element_is_conflict (mstyle, MStyleElementType);
gnm_style_element_is_conflict (mstyle, GnmStyleElement);
2.3.1 Unique borders
......
......@@ -419,10 +419,10 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
char *sep = start;
/* Allocate the new style */
style = mstyle_new_default ();
style = gnm_style_new_default ();
mstyle_set_content_locked (style, is_protected);
mstyle_set_content_hidden (style, is_invisible);
gnm_style_set_content_locked (style, is_protected);
gnm_style_set_content_hidden (style, is_invisible);
if (sep[1] == '\'')
sep += 2;
......@@ -438,7 +438,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
}
if (g_ascii_isdigit (*sep)) {
StyleHAlignFlags a;
GnmHAlign a;
switch (*sep) {
case '1' : a = HALIGN_LEFT; break;
case '2' : a = HALIGN_RIGHT; break;
......@@ -448,10 +448,10 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
(void) applix_parse_error (state, "Unknown horizontal alignment '%c'", *sep);
return NULL;
};
mstyle_set_align_h (style, a);
gnm_style_set_align_h (style, a);
++sep;
} else if (*sep == 'V') {
StyleVAlignFlags a;
GnmVAlign a;
switch (sep[1]) {
case 'T' : a = VALIGN_TOP; break;
case 'C' : a = VALIGN_CENTER; break;
......@@ -460,7 +460,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
(void) applix_parse_error (state, "Unknown vertical alignment '%c'", *sep);
return NULL;
};
mstyle_set_align_v (style, a);
gnm_style_set_align_v (style, a);
sep += 2;
break;
} else {
......@@ -519,7 +519,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
break;
}
case 'G' : /* general */
mstyle_set_format_text (style, "General");
gnm_style_set_format_text (style, "General");
/* What is 'Gf' ? */
if (sep[1] == 'f')
......@@ -563,7 +563,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
format = g_strconcat (format_prefix, decimal, prec,
format_suffix, NULL);
mstyle_set_format_text (style, format);
gnm_style_set_format_text (style, format);
g_free (format);
break;
}
......@@ -585,7 +585,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
return NULL;
};
if (format)
mstyle_set_format_text (style, format);
gnm_style_set_format_text (style, format);
}
}
......@@ -595,19 +595,19 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
/* check for the 1 character modifiers */
switch (*sep) {
case 'B' :
mstyle_set_font_bold (style, TRUE);
gnm_style_set_font_bold (style, TRUE);
++sep;
break;
case 'I' :
mstyle_set_font_italic (style, TRUE);
gnm_style_set_font_italic (style, TRUE);
++sep;
break;
case 'U' :
mstyle_set_font_uline (style, UNDERLINE_SINGLE);
gnm_style_set_font_uline (style, UNDERLINE_SINGLE);
++sep;
break;
case 'D' :
mstyle_set_font_uline (style, UNDERLINE_DOUBLE);
gnm_style_set_font_uline (style, UNDERLINE_DOUBLE);
++sep;
break;
case 'f' :
......@@ -624,7 +624,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
GnmColor *color = applix_get_color (state, &sep);
if (color == NULL)
return NULL;
mstyle_set_color (style, MSTYLE_COLOR_FORE, color);
gnm_style_set_font_color (style, color);
break;
}
(void) applix_parse_error (state, "Unknown font modifier F%c", sep[1]);
......@@ -635,7 +635,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
double size = strtod (start, &sep);
if (start != sep && size > 0.) {
mstyle_set_font_size (style, size / gnm_app_dpi_to_pixels ());
gnm_style_set_font_size (style, size / gnm_app_dpi_to_pixels ());
break;
}
(void) applix_parse_error (state, "Invalid font size '%s", start);
......@@ -649,7 +649,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
sep +=3;
break;
}
mstyle_set_wrap_text (style, TRUE);
gnm_style_set_wrap_text (style, TRUE);
sep +=2;
break;
}
......@@ -682,7 +682,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
return NULL;
}
mstyle_set_font_name (style, g_ptr_array_index (state->font_names, font_id));
gnm_style_set_font_name (style, g_ptr_array_index (state->font_names, font_id));
/* Background, pattern, and borders */
for (++sep ; *sep && *sep != ')' ; ) {
......@@ -705,21 +705,21 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
}
num = map[num];
mstyle_set_pattern (style, num);
gnm_style_set_pattern (style, num);
sep = end;
if (sep[0] == 'F' && sep[1] == 'G' ) {
GnmColor *color = applix_get_color (state, &sep);
if (color == NULL)
return NULL;
mstyle_set_color (style, MSTYLE_COLOR_PATTERN, color);
gnm_style_set_pattern_color (style, color);
}
if (sep[0] == 'B' && sep[1] == 'G') {
GnmColor *color = applix_get_color (state, &sep);
if (color == NULL)
return NULL;
mstyle_set_color (style, MSTYLE_COLOR_BACK, color);
gnm_style_set_back_color (style, color);
}
} else if (sep[0] == 'T' || sep[0] == 'B' || sep[0] == 'L' || sep[0] == 'R') {
/* A map from applix border indicies to gnumeric. */
......@@ -732,7 +732,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
};
GnmColor *color;
MStyleElementType const type =
GnmStyleElement const type =
(sep[0] == 'T') ? MSTYLE_BORDER_TOP :
(sep[0] == 'B') ? MSTYLE_BORDER_BOTTOM :
(sep[0] == 'L') ? MSTYLE_BORDER_LEFT : MSTYLE_BORDER_RIGHT;
......@@ -754,7 +754,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
} else
color = style_color_black ();
mstyle_set_border (style, type,
gnm_style_set_border (style, type,
style_border_fetch (map[num], color, orient));
}
......@@ -778,7 +778,7 @@ applix_parse_style (ApplixReadState *state, unsigned char **buffer)
g_return_val_if_fail (style != NULL, NULL);
*buffer = tmp + 2;
mstyle_ref (style);
gnm_style_ref (style);
return style;
}
......@@ -1010,14 +1010,14 @@ applix_read_cells (ApplixReadState *state)
if (style == NULL)
return -1;
if (ptr == NULL) {
mstyle_unref (style);
gnm_style_unref (style);
return -1;
}
/* Get cell */
ptr = applix_parse_cellref (state, ptr, &sheet, &pos, '!');
if (ptr == NULL) {
mstyle_unref (style);
gnm_style_unref (style);
return applix_parse_error (state, "Expression did not specify target cell");
}
cell = sheet_cell_fetch (sheet, pos.col, pos.row);
......@@ -1192,7 +1192,7 @@ applix_read_row_list (ApplixReadState *state, unsigned char *ptr)
attr_index = strtol (ptr = tmp+1, (char **)&tmp, 10);
if (tmp != ptr && attr_index >= 2 && attr_index < state->attrs->len+2) {
GnmStyle *style = g_ptr_array_index(state->attrs, attr_index-2);
mstyle_ref (style);
gnm_style_ref (style);
sheet_style_set_range (sheet, &r, style);
} else if (attr_index != 1) /* TODO : What the hell is attr 1 ?? */
return applix_parse_error (state, "Invalid row format attr index");
......@@ -1456,7 +1456,7 @@ static gboolean
cb_remove_style (gpointer key, gpointer value, gpointer user_data)
{
g_free (key);
mstyle_unref (value);
gnm_style_unref (value);
return TRUE;
}
......@@ -1576,7 +1576,7 @@ applix_read (IOContext *io_context, WorkbookView *wb_view, GsfInput *src)
g_ptr_array_free (state.colors, TRUE);
for (i = state.attrs->len; --i >= 0 ; )
mstyle_unref (g_ptr_array_index(state.attrs, i));
gnm_style_unref (g_ptr_array_index(state.attrs, i));
g_ptr_array_free (state.attrs, TRUE);
for (i = state.font_names->len; --i >= 0 ; )
......
2005-06-22 Jody Goldberg <jody@gnome.org>
* ms-excel-write.c (map_color_to_palette) : simplify
and remove the direct comparisons to colours. Just take an
index and return it on NULL or auto.
(xl_le_set_range) : new.
(write_border) : new.
(cb_write_condition) : new.
(excel_write_conditions) : new.
(excel_write_DVALs) : renamed from excel_write_DVAL.
(excel_write_prep_conditions) : new.
(put_colors) : look in conditional styles too.
* ms-excel-read.c (excel_read_CF_border) : new.
(excel_read_CF) : implement.
(excel_read_CONDFMT) : complete.
2005-06-13 Jody Goldberg <jody@gnome.org>
* Release 1.5.2
......
......@@ -45,6 +45,7 @@
#include <sheet-filter.h>
#include <cell.h>
#include <style.h>
#include <style-conditions.h>
#include <gnm-format.h>
#include <print-info.h>
#include <selection.h>
......@@ -1593,39 +1594,39 @@ excel_get_style_from_xf (ExcelReadSheet *esheet, BiffXFData const *xf)
/* If we've already done the conversion use the cached style */
if (xf->mstyle != NULL) {
mstyle_ref (xf->mstyle);
gnm_style_ref (xf->mstyle);
return xf->mstyle;
}
/* Create a new style and fill it in */
mstyle = mstyle_new_default ();
mstyle = gnm_style_new_default ();
/* Format */
if (xf->style_format)
mstyle_set_format (mstyle, xf->style_format);
gnm_style_set_format (mstyle, xf->style_format);
/* protection */
mstyle_set_content_locked (mstyle, xf->locked);
mstyle_set_content_hidden (mstyle, xf->hidden);
gnm_style_set_content_locked (mstyle, xf->locked);
gnm_style_set_content_hidden (mstyle, xf->hidden);
/* Alignment */
mstyle_set_align_v (mstyle, xf->valign);
mstyle_set_align_h (mstyle, xf->halign);
mstyle_set_wrap_text (mstyle, xf->wrap_text);
mstyle_set_shrink_to_fit (mstyle, xf->shrink_to_fit);
mstyle_set_indent (mstyle, xf->indent);
mstyle_set_rotation (mstyle, xf->rotation);
mstyle_set_text_dir (mstyle, xf->text_dir);
gnm_style_set_align_v (mstyle, xf->valign);
gnm_style_set_align_h (mstyle, xf->halign);
gnm_style_set_wrap_text (mstyle, xf->wrap_text);
gnm_style_set_shrink_to_fit (mstyle, xf->shrink_to_fit);
gnm_style_set_indent (mstyle, xf->indent);
gnm_style_set_rotation (mstyle, xf->rotation);
gnm_style_set_text_dir (mstyle, xf->text_dir);
/* Font */
fd = excel_get_font (esheet->container.ewb, xf->font_idx);
if (fd != NULL) {
StyleUnderlineType underline = UNDERLINE_NONE;
mstyle_set_font_name (mstyle, fd->fontname);
mstyle_set_font_size (mstyle, fd->height / 20.0);
mstyle_set_font_bold (mstyle, fd->boldness >= 0x2bc);
mstyle_set_font_italic (mstyle, fd->italic);
mstyle_set_font_strike (mstyle, fd->struck_out);
GnmUnderline underline = UNDERLINE_NONE;
gnm_style_set_font_name (mstyle, fd->fontname);
gnm_style_set_font_size (mstyle, fd->height / 20.0);
gnm_style_set_font_bold (mstyle, fd->boldness >= 0x2bc);
gnm_style_set_font_italic (mstyle, fd->italic);
gnm_style_set_font_strike (mstyle, fd->struck_out);
switch (fd->underline) {
case MS_BIFF_F_U_SINGLE:
case MS_BIFF_F_U_SINGLE_ACC:
......@@ -1641,14 +1642,14 @@ excel_get_style_from_xf (ExcelReadSheet *esheet, BiffXFData const *xf)
default:
underline = UNDERLINE_NONE;
}
mstyle_set_font_uline (mstyle, underline);
gnm_style_set_font_uline (mstyle, underline);
font_index = fd->color_idx;
} else
font_index = 127; /* Default to Black */
/* Background */
mstyle_set_pattern (mstyle, xf->fill_pattern_idx);
gnm_style_set_pattern (mstyle, xf->fill_pattern_idx);
/* Solid patterns seem to reverse the meaning */
if (xf->fill_pattern_idx == 1) {
......@@ -1706,14 +1707,14 @@ excel_get_style_from_xf (ExcelReadSheet *esheet, BiffXFData const *xf)
font_color->gdk_color.red>>8, font_color->gdk_color.green>>8, font_color->gdk_color.blue>>8,
xf->fill_pattern_idx););
mstyle_set_color (mstyle, MSTYLE_COLOR_FORE, font_color);
mstyle_set_color (mstyle, MSTYLE_COLOR_BACK, back_color);
mstyle_set_color (mstyle, MSTYLE_COLOR_PATTERN, pattern_color);
gnm_style_set_font_color (mstyle, font_color);
gnm_style_set_back_color (mstyle, back_color);
gnm_style_set_pattern_color (mstyle, pattern_color);
/* Borders */
for (i = 0; i < STYLE_ORIENT_MAX; i++) {
GnmStyle *tmp = mstyle;
MStyleElementType const t = MSTYLE_BORDER_TOP + i;
GnmStyleElement const t = MSTYLE_BORDER_TOP + i;
int const color_index = xf->border_color[i];
GnmColor *color;
......@@ -1739,14 +1740,14 @@ excel_get_style_from_xf (ExcelReadSheet *esheet, BiffXFData const *xf)
color_index);
break;
}
mstyle_set_border (tmp, t,
gnm_style_set_border (tmp, t,
style_border_fetch (xf->border_type[i],
color, t));
}
/* Set the cache (const_cast) */
((BiffXFData *)xf)->mstyle = mstyle;
mstyle_ref (mstyle);
gnm_style_ref (mstyle);
return xf->mstyle;
}
......@@ -1905,7 +1906,7 @@ excel_read_XF_OLD (BiffQuery *q, ExcelWorkbook *ewb, MsBiffVersion ver)
if (xf->pat_foregnd_col >= 24)
xf->pat_foregnd_col += 40; /* Defaults */
xf->fill_pattern_idx =
excel_map_pattern_index_from_excel(data & 0x001f);
excel_map_pattern_index_from_excel(data & 0x001f);
data = GSF_LE_GET_GUINT8 (q->data + 10);
xf->border_type[STYLE_BOTTOM] = biff_xf_map_border(data & 0x07);
......@@ -2198,7 +2199,7 @@ biff_xf_data_destroy (BiffXFData *xf)
xf->style_format = NULL;
}
if (xf->mstyle) {
mstyle_unref (xf->mstyle);
gnm_style_unref (xf->mstyle);
xf->mstyle = NULL;
}
g_free (xf);
......@@ -3470,7 +3471,7 @@ excel_read_TAB_COLOR (BiffQuery *q, ExcelReadSheet *esheet)
g_return_if_fail (q->length == 20);
/* be conservative for now, we have not seen a pallete larger than 56
/* be conservative for now, we have not seen a palette larger than 56
* so this is largely moot, this is probably a uint32
*/
color_index = GSF_LE_GET_GUINT8 (q->data + 16);
......@@ -4345,38 +4346,48 @@ excel_read_WINDOW2 (BiffQuery *q, ExcelReadSheet *esheet, WorkbookView *wb_view)
}
static void
excel_read_CF (BiffQuery *q, ExcelReadSheet *esheet)
excel_read_CF_border (GnmStyleCond *cond, ExcelReadSheet *esheet,
StyleBorderLocation type,
unsigned xl_pat_index, unsigned xl_color_index)
{
gnm_style_set_border (cond->overlay, MSTYLE_BORDER_TOP + type,
style_border_fetch (biff_xf_map_border (xl_pat_index),
excel_palette_get (esheet->container.ewb->palette,