Commit 5b07ce50 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

use cell_is_blank. (parse_database_criteria) : ditto.

2002-02-17  Jody Goldberg <jody@gnome.org>

	* fn-database.c (parse_criteria_range) : use cell_is_blank.
	(parse_database_criteria) : ditto.
	(find_cells_that_match) : ditto.
	(find_rows_that_match) : ditto.
	(gnumeric_getpivotdata) : ditto.

2002-02-17  Jody Goldberg <jody@gnome.org>

	* plugins/excel/ms-escher.c (ms_escher_read_OPT) : add support for
	  blip cropping.
parent fabe8de5
2002-02-17 Jody Goldberg <jody@gnome.org>
* plugins/excel/ms-escher.c (ms_escher_read_OPT) : add support for
blip cropping.
2002-02-16 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.c (soi_get_pixbuf) : move things here.
......
2002-02-17 Jody Goldberg <jody@gnome.org>
* plugins/excel/ms-escher.c (ms_escher_read_OPT) : add support for
blip cropping.
2002-02-16 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.c (soi_get_pixbuf) : move things here.
......
2002-02-17 Jody Goldberg <jody@gnome.org>
* plugins/excel/ms-escher.c (ms_escher_read_OPT) : add support for
blip cropping.
2002-02-16 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.c (soi_get_pixbuf) : move things here.
......
......@@ -186,10 +186,6 @@ to features that already work.
+ Localise sheet/workbook Name import.
+ Import names even if they arn't referenced.
* Excel Export
+ Detect large style ranges and correctly set the default row/col/sheet styles.
1.1
==========
These section lists features that are for post 1.0 versions
......@@ -233,4 +229,6 @@ under "1.0" are more important.
* Autofilter
+ ?
+ Most of the major elements are there to support in place
filters. All we'd need is a new Dependent type to manage the
filter results.
......@@ -376,7 +376,7 @@ ms_escher_read_BSE (MSEscherState * state, MSEscherHeader * h)
static gboolean
ms_escher_read_Blip (MSEscherState * state, MSEscherHeader * h)
{
int primary_uid_size = 0;
int blip_header = -1, primary_uid_size = 0;
guint32 blip_instance = h->instance;
gboolean res = FALSE;
MSEscherBlip *blip = NULL;
......@@ -406,24 +406,33 @@ ms_escher_read_Blip (MSEscherState * state, MSEscherHeader * h)
/* Clients may set bit 0x800 */
blip_instance &= (~0x800);
/*
* TODO : read /scratch/openoffice/svx/source/msfilter/msdffimp.cxx
*/
switch (blip_instance) {
case 0x216 : /* compressed WMF, with Metafile header */
type = "wmf";
type = "wmf.gz";
blip_header = 20 + 8 + 6;
break;
case 0x3d4 : /* compressed EMF, with Metafile header */
type = "emf";
type = "emf.gz";
blip_header = 20 + 8 + 6;
break;
case 0x542 : /* compressed PICT, with Metafile header */
type = "pict";
type = "pict.gz";
blip_header = 20 + 8 + 6;
break;
case 0x46a : /* JPEG data, with 1 byte header */
type = "jpeg";
blip_header = 1;
break;
case 0x6e0 : /* PNG data, with 1 byte header */
type = "png";
blip_header = 1;
break;
case 0x7a8 : /* DIB data, with 1 byte header */
type = "dib";
blip_header = 1;
break;
default:
......@@ -432,8 +441,8 @@ ms_escher_read_Blip (MSEscherState * state, MSEscherHeader * h)
h->instance);
};
if (type != NULL) {
int const header = 17 + primary_uid_size + common_header_len;
if (blip_header >= 0) {
int const header = blip_header + 16 + primary_uid_size + common_header_len;
gboolean needs_free;
guint8 const *data = ms_escher_get_data (state, h->offset, h->len,
header, &needs_free);
......@@ -1221,10 +1230,18 @@ ms_escher_read_OPT (MSEscherState *state, MSEscherHeader *h)
/* Blip */
/* 0 : 16.16 fraction times total image width or height, as appropriate. */
case 256 : name = "fixed16_16 cropFromTop"; break;
case 257 : name = "fixed16_16 cropFromBottom"; break;
case 258 : name = "fixed16_16 cropFromLeft"; break;
case 259 : name = "fixed16_16 cropFromRight"; break;
case 256 : name = "fixed16_16 cropFromTop";
id = MS_OBJ_ATTR_BLIP_CROP_TOP;
break;
case 257 : name = "fixed16_16 cropFromBottom";
id = MS_OBJ_ATTR_BLIP_CROP_BOTTOM;
break;
case 258 : name = "fixed16_16 cropFromLeft";
id = MS_OBJ_ATTR_BLIP_CROP_LEFT;
break;
case 259 : name = "fixed16_16 cropFromRight";
id = MS_OBJ_ATTR_BLIP_CROP_RIGHT;
break;
/* NULL : Blip to display */
case 260 : id = MS_OBJ_ATTR_BLIP_ID;
......
......@@ -36,6 +36,10 @@ typedef enum {
MS_OBJ_ATTR_SCROLLBAR_MAX,
MS_OBJ_ATTR_SCROLLBAR_INC,
MS_OBJ_ATTR_SCROLLBAR_PAGE,
MS_OBJ_ATTR_BLIP_CROP_TOP,
MS_OBJ_ATTR_BLIP_CROP_BOTTOM,
MS_OBJ_ATTR_BLIP_CROP_LEFT,
MS_OBJ_ATTR_BLIP_CROP_RIGHT,
/* Ptrs */
MS_OBJ_ATTR_IS_PTR_MASK = 0x2000,
......
/* vim: set sw=8: */
/*
* fn-database.c: Built in database functions and functions registration
*
......@@ -235,7 +236,7 @@ parse_criteria_range(Sheet *sheet, int b_col, int b_row, int e_col, int e_row,
database_criteria_t *new_criteria;
GSList *criterias = NULL;
GSList *conditions;
Cell *cell;
Cell const *cell;
func_criteria_t *cond;
gchar *cell_str;
......@@ -247,7 +248,7 @@ parse_criteria_range(Sheet *sheet, int b_col, int b_row, int e_col, int e_row,
for (j = b_col; j <= e_col; j++) {
cell = sheet_cell_get (sheet, j, i);
if (cell == NULL || cell->value == NULL)
if (cell_is_blank (cell))
continue;
cond = g_new (func_criteria_t, 1);
......@@ -289,7 +290,7 @@ parse_database_criteria (const EvalPos *ep, Value *database,
{
Sheet *sheet;
GSList *criterias;
Cell *cell;
Cell const *cell;
int i;
int b_col, b_row, e_col, e_row;
......@@ -306,7 +307,7 @@ parse_database_criteria (const EvalPos *ep, Value *database,
/* Find the index numbers for the columns of criterias */
for (i = b_col; i <= e_col; i++) {
cell = sheet_cell_get (sheet, i, b_row);
if (cell == NULL || cell->value == NULL)
if (cell_is_blank (cell))
continue;
field_ind[i - b_col] =
find_column_of_field (ep, database, cell->value);
......@@ -335,6 +336,7 @@ find_cells_that_match (Sheet *sheet, Value *database,
GSList *ptr, *condition, *cells;
int row, first_row, last_row;
gboolean add_flag;
Cell *cell;
cells = NULL;
/* TODO : Why ignore the first row ? What if there is no header ? */
......@@ -342,8 +344,8 @@ find_cells_that_match (Sheet *sheet, Value *database,
last_row = database->v_range.cell.b.row;
for (row = first_row; row <= last_row; row++) {
Cell *cell = sheet_cell_get (sheet, col, row);
if (cell == NULL || cell->value == NULL)
cell = sheet_cell_get (sheet, col, row);
if (cell_is_blank (cell))
continue;
add_flag = TRUE;
......@@ -358,11 +360,10 @@ find_cells_that_match (Sheet *sheet, Value *database,
Cell const *tmp = sheet_cell_get (sheet,
cond->column, row);
if (tmp == NULL ||
tmp->value == NULL ||
if (cell_is_blank (tmp) ||
!cond->fun (tmp->value, cond->x)) {
add_flag = FALSE;
break;
add_flag = FALSE;
break;
}
}
......@@ -385,11 +386,11 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
GSList *criterias, gboolean unique_only)
{
GSList *current, *conditions, *rows;
Cell const *test_cell;
int row, add_flag;
rows = NULL;
for (row = first_row; row <= last_row; row++) {
Cell *test_cell;
current = criterias;
add_flag = 1;
......@@ -402,13 +403,11 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
conditions = current_criteria->conditions;
while (conditions != NULL) {
func_criteria_t *cond = conditions->data;
func_criteria_t const *cond = conditions->data;
test_cell =
sheet_cell_get (sheet,
first_col + cond->column, row);
if (test_cell == NULL ||
test_cell->value == NULL)
test_cell = sheet_cell_get (sheet,
first_col + cond->column, row);
if (cell_is_blank (test_cell))
continue;
if (!cond->fun (test_cell->value, cond->x)) {
......@@ -1348,7 +1347,7 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
/* FIXME: Lots of stuff missing */
if (cell == NULL || cell->value == NULL ||
if (cell_is_blank (cell) ||
!VALUE_IS_NUMBER (cell->value))
return value_new_error (ei->pos, gnumeric_err_REF);
......
......@@ -27,6 +27,7 @@
<child>
<widget class="GtkButton" id="okbutton">
<property name="can_default">yes</property>
<property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-ok</property>
......
......@@ -27,6 +27,7 @@
<child>
<widget class="GtkButton" id="ok_button">
<property name="can_default">yes</property>
<property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="visible">yes</property>
......
......@@ -29,7 +29,7 @@
<child>
<widget class="GtkButton" id="format_ok">
<property name="can_default">yes</property>
<!-- <property name="has_default">yes</property> libglade problem -->
<property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-ok</property>
......
......@@ -26,6 +26,7 @@
<child>
<widget class="GtkButton" id="button1">
<property name="can_default">yes</property>
<property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-ok</property>
......
......@@ -42,6 +42,7 @@
<child>
<widget class="GtkButton" id="okbutton">
<property name="can_default">yes</property>
<property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-ok</property>
......
......@@ -26,6 +26,7 @@
<child>
<widget class="GtkButton" id="ok_button">
<property name="can_default">yes</property>
<property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-ok</property>
......
......@@ -27,6 +27,7 @@
<child>
<widget class="GtkButton" id="btn_ok">
<property name="can_default">yes</property>
<property name="has_default">yes</property>
<property name="can_focus">yes</property>
<property name="visible">yes</property>
<property name="label" translatable="yes">gtk-ok</property>
......
2002-02-17 Jody Goldberg <jody@gnome.org>
* fn-database.c (parse_criteria_range) : use cell_is_blank.
(parse_database_criteria) : ditto.
(find_cells_that_match) : ditto.
(find_rows_that_match) : ditto.
(gnumeric_getpivotdata) : ditto.
2002-02-07 Morten Welinder <terra@diku.dk>
* fn-date.c (gnumeric_date2unix): Fix.
......
/* vim: set sw=8: */
/*
* fn-database.c: Built in database functions and functions registration
*
......@@ -235,7 +236,7 @@ parse_criteria_range(Sheet *sheet, int b_col, int b_row, int e_col, int e_row,
database_criteria_t *new_criteria;
GSList *criterias = NULL;
GSList *conditions;
Cell *cell;
Cell const *cell;
func_criteria_t *cond;
gchar *cell_str;
......@@ -247,7 +248,7 @@ parse_criteria_range(Sheet *sheet, int b_col, int b_row, int e_col, int e_row,
for (j = b_col; j <= e_col; j++) {
cell = sheet_cell_get (sheet, j, i);
if (cell == NULL || cell->value == NULL)
if (cell_is_blank (cell))
continue;
cond = g_new (func_criteria_t, 1);
......@@ -289,7 +290,7 @@ parse_database_criteria (const EvalPos *ep, Value *database,
{
Sheet *sheet;
GSList *criterias;
Cell *cell;
Cell const *cell;
int i;
int b_col, b_row, e_col, e_row;
......@@ -306,7 +307,7 @@ parse_database_criteria (const EvalPos *ep, Value *database,
/* Find the index numbers for the columns of criterias */
for (i = b_col; i <= e_col; i++) {
cell = sheet_cell_get (sheet, i, b_row);
if (cell == NULL || cell->value == NULL)
if (cell_is_blank (cell))
continue;
field_ind[i - b_col] =
find_column_of_field (ep, database, cell->value);
......@@ -335,6 +336,7 @@ find_cells_that_match (Sheet *sheet, Value *database,
GSList *ptr, *condition, *cells;
int row, first_row, last_row;
gboolean add_flag;
Cell *cell;
cells = NULL;
/* TODO : Why ignore the first row ? What if there is no header ? */
......@@ -342,8 +344,8 @@ find_cells_that_match (Sheet *sheet, Value *database,
last_row = database->v_range.cell.b.row;
for (row = first_row; row <= last_row; row++) {
Cell *cell = sheet_cell_get (sheet, col, row);
if (cell == NULL || cell->value == NULL)
cell = sheet_cell_get (sheet, col, row);
if (cell_is_blank (cell))
continue;
add_flag = TRUE;
......@@ -358,11 +360,10 @@ find_cells_that_match (Sheet *sheet, Value *database,
Cell const *tmp = sheet_cell_get (sheet,
cond->column, row);
if (tmp == NULL ||
tmp->value == NULL ||
if (cell_is_blank (tmp) ||
!cond->fun (tmp->value, cond->x)) {
add_flag = FALSE;
break;
add_flag = FALSE;
break;
}
}
......@@ -385,11 +386,11 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
GSList *criterias, gboolean unique_only)
{
GSList *current, *conditions, *rows;
Cell const *test_cell;
int row, add_flag;
rows = NULL;
for (row = first_row; row <= last_row; row++) {
Cell *test_cell;
current = criterias;
add_flag = 1;
......@@ -402,13 +403,11 @@ find_rows_that_match (Sheet *sheet, int first_col, int first_row,
conditions = current_criteria->conditions;
while (conditions != NULL) {
func_criteria_t *cond = conditions->data;
func_criteria_t const *cond = conditions->data;
test_cell =
sheet_cell_get (sheet,
first_col + cond->column, row);
if (test_cell == NULL ||
test_cell->value == NULL)
test_cell = sheet_cell_get (sheet,
first_col + cond->column, row);
if (cell_is_blank (test_cell))
continue;
if (!cond->fun (test_cell->value, cond->x)) {
......@@ -1348,7 +1347,7 @@ gnumeric_getpivotdata (FunctionEvalInfo *ei, Value **argv)
/* FIXME: Lots of stuff missing */
if (cell == NULL || cell->value == NULL ||
if (cell_is_blank (cell) ||
!VALUE_IS_NUMBER (cell->value))
return value_new_error (ei->pos, gnumeric_err_REF);
......
......@@ -72,6 +72,10 @@ sheet_object_image_finalize (GObject *object)
/**
* be sure to unref the result if it is non-NULL
*
* TODO : this is really overkill for now.
* only wmf/emf will require regenerating the pixbug for different scale
* factors. And even then we should cache them.
*/
static GdkPixbuf *
soi_get_pixbuf (SheetObjectImage *soi, double scale)
......@@ -94,7 +98,7 @@ soi_get_pixbuf (SheetObjectImage *soi, double scale)
if (!soi->dumped) {
static int count = 0;
char *filename = g_strdup_printf ("unknown%d", count++);
char *filename = g_strdup_printf ("unknown%d.%s", count++, soi->type);
FILE *file = fopen (filename, "w");
if (file != NULL) {
fwrite (soi->data, soi->data_len, 1, file);
......@@ -112,6 +116,7 @@ soi_get_pixbuf (SheetObjectImage *soi, double scale)
} else {
res = gdk_pixbuf_loader_get_pixbuf (loader),
g_object_ref (G_OBJECT (res));
/* TODO : use gdk_pixbuf_new_subpixbuf to implement clipping */
}
gdk_pixbuf_loader_close (loader, &err);
......@@ -236,11 +241,12 @@ sheet_object_image_print (SheetObject const *so, GnomePrintContext *ctx,
g_return_if_fail (GNOME_IS_PRINT_CONTEXT (ctx));
soi = SHEET_OBJECT_IMAGE (so);
sheet_object_position_pts_get (so, coords);
pixbuf = soi_get_pixbuf (soi, 1.);
if (pixbuf == NULL)
return;
sheet_object_position_pts_get (so, coords);
gnome_print_gsave (ctx);
pixbuf = soi_get_pixbuf (soi, 1.);
if (gdk_pixbuf_get_has_alpha (pixbuf))
gnome_print_rgbaimage (ctx,
gdk_pixbuf_get_pixels (pixbuf),
......@@ -254,7 +260,6 @@ sheet_object_image_print (SheetObject const *so, GnomePrintContext *ctx,
gdk_pixbuf_get_height (pixbuf),
gdk_pixbuf_get_rowstride (pixbuf));
g_object_unref (G_OBJECT (pixbuf));
gnome_print_grestore (ctx);
}
......
......@@ -270,54 +270,9 @@ font_init (void)
gnumeric_default_font = style_font_new_simple (DEFAULT_FONT, DEFAULT_SIZE,
1., FALSE, FALSE);
if (!gnumeric_default_font) {
char const *lc_all = getenv ("LC_ALL");
char const *lang = getenv ("LANG");
char *msg;
char *fontmap_fn = gnome_datadir_file ("fonts/fontmap2");
gboolean exists = (fontmap_fn != NULL);
if (!exists)
fontmap_fn = gnome_unconditional_datadir_file ("fonts/fontmap2");
if (lc_all == NULL)
lc_all = _("<Has not been set>");
if (lang == NULL)
lang = _("<Has not been set>");
msg = g_strdup_printf (
_("Gnumeric failed to find a suitable default font.\n"
"Your gnome-print installation is likely incomplete. Please\n"
"try reinstalling gnome-print.\n\n"
"%s\n"
"\n"
"If you still have no luck, please file a proper bug report (see\n"
"http://bugzilla.gnome.org) including the following extra items:\n"
"\n"
"1) The content of your fontmap2 file, if the file exists.\n"
"\t(typically located in %s)\n"
"2) The value of the LC_ALL environment variable\n"
"\tLC_ALL=%s\n"
"3) The value of the LANG environment variable\n"
"\tLANG=%s\n"
"4) What version of libxml gnumeric is running with.\n"
"\tYou may be able to use the 'ldd' command to get that information.\n"
"5) What version of gnome-print gnumeric is running with.\n"
"\tYou may be able to use the 'ldd' command to get that information.\n"
"\n"
"Thanks -- the Gnumeric Team\n"), exists
? _("Your fontmap2 file does not have a valid entry for Helvetica.")
: _("Your fontmap2 file could not be found in the expected location."),
fontmap_fn, lc_all, lang);
/* Ick ! We should do this somewhere when we have a command context. */
gnumeric_notice (NULL, GTK_MESSAGE_ERROR, msg);
if (!gnumeric_default_font)
exit (1);
}
/*
* Load bold font
*/
gnumeric_default_bold_font = style_font_new_simple (
DEFAULT_FONT, DEFAULT_SIZE, 1., TRUE, FALSE);
if (gnumeric_default_bold_font == NULL){
......@@ -325,9 +280,6 @@ font_init (void)
style_font_ref (gnumeric_default_bold_font);
}
/*
* Load italic font
*/
gnumeric_default_italic_font = style_font_new_simple (
DEFAULT_FONT, DEFAULT_SIZE, 1., FALSE, TRUE);
if (gnumeric_default_italic_font == NULL){
......
......@@ -603,6 +603,24 @@ cb_entry_changed (GtkEntry *ignored, GnumericExprEntry *gee)
g_signal_emit (G_OBJECT (gee), signals [CHANGED], 0);
}
static gboolean
gee_focus_in_event (GtkWidget *widget, GdkEventFocus *event, GnumericExprEntry *gee)
{
g_return_val_if_fail (IS_GNUMERIC_EXPR_ENTRY (gee), FALSE);
wbcg_set_entry (gee->wbcg, gee);
fprintf (stderr, "in %p\n",gee);
return FALSE;
}
static gboolean
gee_focus_out_event (GtkWidget *widget, GdkEventFocus *event, GnumericExprEntry *gee)
{
g_return_val_if_fail (IS_GNUMERIC_EXPR_ENTRY (gee), FALSE);
wbcg_set_entry (gee->wbcg, NULL);
fprintf (stderr, "out %p\n",gee);
return FALSE;
}
/**
* gnumeric_expr_entry_new:
*
......@@ -624,6 +642,12 @@ gnumeric_expr_entry_new (WorkbookControlGUI *wbcg, gboolean with_icon)
g_signal_connect (G_OBJECT (gee->entry),
"changed",
G_CALLBACK (cb_entry_changed), gee);
g_signal_connect (G_OBJECT (gee->entry),
"focus_in_event",
G_CALLBACK (gee_focus_in_event), gee);
g_signal_connect (G_OBJECT (gee->entry),
"focus_out_event",
G_CALLBACK (gee_focus_out_event), gee);
gtk_box_pack_start (GTK_BOX (gee), GTK_WIDGET (gee->entry),
TRUE, TRUE, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment