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

cut-n-paste-o in line creation support font color for text boxes.


2002-12-24  Jody Goldberg <jody@gnome.org>

	* ms-excel-read.c (ms_sheet_create_obj) : cut-n-paste-o in line creation
	  support font color for text boxes.
	  (excel_palette_get) : just call colour 64 black if it gets this far.
	    It only happens for shet objects and we need to do more research
	    on how to handle these.

	* ms-obj.c (ms_obj_read_pre_biff8_obj) : be more picky about what we
	  call an arrow head.  Fix the directions for lines.  Find the
	  undocumented flag to fix named objects.
parent 75e44e7b
......@@ -106,7 +106,7 @@ Pending Patches
21.10) select the current condition in the combos (DONE)
21.11) expression filters (DONE)
21.12) expression dialog (DONE)
21.13) Handle range changes (cut-n-paste or ins/del col/row)
21.13) Handle range changes (cut-n-paste or ins/del col/row)(DONE)
21.14) Handle the relationship between groups and filters (DONE)
21.15) xml import/export (DONE)
21.16) Fix cursor redraw after filter (DONE)
......@@ -121,6 +121,7 @@ Pending Patches
21.25) guess initial region if its a singleton
21.26) combo contains start to end of continuous region
not just the end of the selected region
21.27) filter changes should dirty things
22) Add dirty flags to workbook too, adding a sheet should
make workbook dirty not the new sheet.
......
Gnumeric 1.1.15
Jody:
* Fix some XL95 object issues.
Jon Kåre:
* Open DB connections read only
......
2002-12-24 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (ms_sheet_create_obj) : cut-n-paste-o in line creation
support font color for text boxes.
(excel_palette_get) : just call colour 64 black if it gets this far.
It only happens for shet objects and we need to do more research
on how to handle these.
* ms-obj.c (ms_obj_read_pre_biff8_obj) : be more picky about what we
call an arrow head. Fix the directions for lines. Find the
undocumented flag to fix named objects.
2002-12-22 Jody Goldberg <jody@gnome.org>
* Release 1.1.14
......
......@@ -418,7 +418,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
StyleColor *color;
MSObjAttr *is_arrow = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_ARROW_END);
so = sheet_object_line_new (is_arrow != NULL); break;
so = sheet_object_line_new (is_arrow != NULL);
color = ms_sheet_map_color (esheet, obj,
MS_OBJ_ATTR_FILL_COLOR);
......@@ -443,25 +443,32 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
break;
}
case 0x05: { /* Chart */
so = SHEET_OBJECT (gnm_graph_new (wb));
case 0x05: /* Chart */
so = SHEET_OBJECT (gnm_graph_new ());
break;
}
case 0x0E: /* Label */
case 0x06: { /* TextBox */
StyleColor *fill_color = NULL;
StyleColor *outline_color;
StyleColor *color = NULL;
so = g_object_new (sheet_object_text_get_type (), NULL);
if (ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FILLED))
fill_color = ms_sheet_map_color (esheet, obj,
if (ms_obj_attr_bag_lookup (obj->attrs, MS_OBJ_ATTR_FILLED)) {
color = ms_sheet_map_color (esheet, obj,
MS_OBJ_ATTR_FILL_COLOR);
outline_color = ms_sheet_map_color (esheet, obj,
sheet_object_graphic_fill_color_set (so, color);
}
color = ms_sheet_map_color (esheet, obj,
MS_OBJ_ATTR_OUTLINE_COLOR);
sheet_object_graphic_fill_color_set (so, fill_color);
if (outline_color)
sheet_object_filled_outline_color_set (so, outline_color);
if (color)
sheet_object_filled_outline_color_set (so, color);
color = ms_sheet_map_color (esheet, obj,
MS_OBJ_ATTR_FONT_COLOR);
if (color)
sheet_object_test_font_color_set (so, color);
sheet_object_text_set_text (so,
ms_obj_attr_get_ptr (obj, MS_OBJ_ATTR_TEXT, (char *)""));
break;
......@@ -1380,7 +1387,7 @@ excel_palette_get (ExcelPalette const *pal, gint idx)
d (4, fprintf (stderr,"Color Index %d\n", idx););
/* Black ? */
if (idx == 0)
if (idx == 0 || idx == 64)
return style_color_black ();
/* White ? */
if (idx == 1)
......@@ -4544,7 +4551,7 @@ excel_read_sheet (BiffQuery *q, ExcelWorkbook *ewb,
* at the NEXT record.
*/
if (q->opcode == BIFF_CHART_units) {
GObject *graph = gnm_graph_new (esheet->container.ewb->gnum_wb);
GObject *graph = gnm_graph_new ();
ms_excel_chart (q, sheet_container (esheet),
esheet->container.ver,
graph);
......@@ -5042,7 +5049,7 @@ excel_read_BOF (BiffQuery *q,
GObject *graph =
#if 0
/* enable when we support workbooklevel objects */
gnm_graph_new (ewb->gnum_wb);
gnm_graph_new ();
#else
NULL;
#endif
......
......@@ -1417,10 +1417,12 @@ excel_parse_formula (MSContainer const *container,
ptg_length = 6;
} else {
gint16 sheet_idx = GSF_LE_GET_GINT16 (cur);
#if 0
gsf_mem_dump (cur, 24);
name_idx = GSF_LE_GET_GUINT16 (cur+10);
d (-2, fprintf (stderr, "name = %hu, externsheet = %hd\n",
name_idx, sheet_idx););
#endif
if (sheet_idx < 0) {
a = container->ewb->container.names;
sheet_idx = -sheet_idx;
......
......@@ -401,12 +401,14 @@ ms_obj_dump_impl (guint8 const *data, int len, int data_left, char const *name)
static gboolean
ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
{
guint16 peek_op, tmp;
guint16 peek_op, tmp, len;
guint8 const *data;
/* TODO : Lots of docs for these things. Write the parser. */
gboolean const has_fmla = GSF_LE_GET_GUINT16 (q->data+26) != 0;
/* undocumented */
gboolean const has_name = GSF_LE_GET_GUINT16 (q->data+30) != 0;
#if 0
guint32 const numObjects = GSF_LE_GET_GUINT16(q->data);
guint16 const flags = GSF_LE_GET_GUINT16(q->data+8);
#endif
guint8 *anchor = g_malloc (MS_ANCHOR_SIZE);
......@@ -420,23 +422,27 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
switch (obj->excel_type) {
case 0: /* group */
break;
case 1: { /* line */
if (GSF_LE_GET_GUINT8 (q->data+38))
case 1: /* line */
tmp = GSF_LE_GET_GUINT8 (q->data+40);
if (GSF_LE_GET_GUINT16 (q->data + 10) == 0 &&
GSF_LE_GET_GUINT16 (q->data + 14) < 20) {
g_warning("%hhu", tmp);
}
if (GSF_LE_GET_GUINT8 (q->data+38) & 0x0F)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_flag (MS_OBJ_ATTR_ARROW_END));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_FILL_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+34)));
tmp = GSF_LE_GET_GUINT8 (q->data+40);
if (tmp & 0x1)
if (tmp == 1 || tmp == 2)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_flag (MS_OBJ_ATTR_FLIP_H));
if (tmp & 0x2)
if (tmp >= 2)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_flag (MS_OBJ_ATTR_FLIP_V));
break;
}
case 2: /* rectangle */
break;
case 3: /* oval */
......@@ -453,17 +459,31 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
ms_obj_attr_new_uint (MS_OBJ_ATTR_FILL_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+35)));
}
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_FONT_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+34)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_OUTLINE_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+38)));
data = q->data + 70;
g_return_val_if_fail ((unsigned)(data - q->data) < q->length, TRUE);
data += *data + ((*data & 0x1) ? 1 : 2); /* padding byte */
g_return_val_if_fail ((unsigned)(data - q->data) < q->length, TRUE);
/* docs lie, there is no fmla structure */
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_ptr (MS_OBJ_ATTR_TEXT,
g_strndup (data, GSF_LE_GET_GUINT16 (q->data + 44))));
/* only pull in the text if it exists */
len = GSF_LE_GET_GUINT16 (q->data + 44);
if (len > 0) {
data = q->data + 70;
g_return_val_if_fail ((unsigned)(data - q->data) < q->length, TRUE);
g_return_val_if_fail (!has_fmla, TRUE); /* how would this happen */
/* skip the obj name if defined */
if (has_name) {
data += *data + ((*data & 0x1) ? 1 : 2); /* padding byte */
g_return_val_if_fail ((unsigned)(data - q->data) < q->length, TRUE);
}
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_ptr (MS_OBJ_ATTR_TEXT,
g_strndup (data, len)));
}
break;
case 7: /* button */
......
......@@ -30,6 +30,7 @@ typedef enum {
/* Integers & Enums */
MS_OBJ_ATTR_IS_INT_MASK = 0x1000,
MS_OBJ_ATTR_BLIP_ID,
MS_OBJ_ATTR_FONT_COLOR,
MS_OBJ_ATTR_FILL_COLOR,
MS_OBJ_ATTR_OUTLINE_COLOR,
MS_OBJ_ATTR_SCROLLBAR_VALUE,
......
......@@ -151,7 +151,7 @@ cb_autofilter_ok (G_GNUC_UNUSED GtkWidget *button,
if (cond != NULL) {
gnm_filter_set_condition (state->filter, state->field,
cond, TRUE);
sheet_update (state->filter->dep.sheet);
sheet_update (state->filter->sheet);
}
gtk_widget_destroy (state->dialog);
......
......@@ -1663,7 +1663,7 @@ dialog_graph_guru (WorkbookControlGUI *wbcg, GnmGraph *graph, int page)
state->graph = graph;
g_object_ref (G_OBJECT (state->graph));
} else
state->graph = GNUMERIC_GRAPH (gnm_graph_new (state->wb));
state->graph = GNUMERIC_GRAPH (gnm_graph_new ());
if (state->graph != NULL && page == 0) {
GList *ptr = g_list_last (state->sv->selections);
......
......@@ -581,42 +581,8 @@ gnm_graph_add_vector (GnmGraph *graph, GnmExpr const *expr,
}
static gboolean
gnm_graph_setup (GnmGraph *graph, Workbook *wb)
gnm_graph_setup (GnmGraph *graph)
{
#ifdef GNOME2_CONVERSION_COMPLETE
CORBA_Environment ev;
Bonobo_Unknown o;
CORBA_exception_init (&ev);
o = bonobo_activation_activate ("repo_ids.has('" MANAGER_OAF "')",
NULL, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION || o == CORBA_OBJECT_NIL) {
g_warning ("'%s' : while attempting to activate a graphing component.\n"
"bonobo-activation-run-query \"repo_ids.has('" MANAGER_OAF "')\"\nshould return a value.",
bonobo_exception_get_text (&ev));
graph = NULL;
} else {
graph->manager = Bonobo_Unknown_queryInterface (o, MANAGER_OAF, &ev);
g_return_val_if_fail (graph->manager != CORBA_OBJECT_NIL, TRUE);
graph->manager_client = graph->manager;
bonobo_object_release_unref (o, &ev);
#warning FIXME - we need a Bonobo_UIContainer from somewhere.
if (sheet_object_bonobo_construct (SHEET_OBJECT_BONOBO (graph),
CORBA_OBJECT_NIL, NULL) == NULL ||
!sheet_object_bonobo_set_server (SHEET_OBJECT_BONOBO (graph),
graph->manager_client)) {
graph = NULL;
}
}
CORBA_exception_free (&ev);
#endif
return graph == NULL;
}
......@@ -625,14 +591,14 @@ gnm_graph_setup (GnmGraph *graph, Workbook *wb)
* so that we can handle standalone graphs.
*/
GObject *
gnm_graph_new (Workbook *wb)
gnm_graph_new (void)
{
GObject *graph = g_object_new (GNUMERIC_GRAPH_TYPE, NULL);
d(printf ("gnumeric : graph new %p\n", graph));
#ifdef GNOME2_CONVERSION_COMPLETE
if (gnm_graph_setup (GNM_GRAPH (graph), wb)) {
if (gnm_graph_setup (GNM_GRAPH (graph))) {
g_object_unref (graph);
return NULL;
}
......@@ -952,7 +918,7 @@ gnm_graph_read_xml (SheetObject *so,
xmlNode *tmp;
xmlDoc *doc;
if (gnm_graph_setup (graph, ctxt->wb))
if (gnm_graph_setup (graph))
return TRUE;
tmp = e_xml_get_child_by_name (tree, (xmlChar *)"Vectors");
......
......@@ -19,7 +19,7 @@ typedef enum {
GType gnm_graph_get_type (void);
GObject *gnm_graph_new (Workbook *wb);
GObject *gnm_graph_new (void);
void gnm_graph_clear_vectors (GnmGraph *g);
void gnm_graph_arrange_vectors (GnmGraph *g);
void gnm_graph_range_to_vectors (GnmGraph *g, Sheet *sheet,
......
......@@ -277,7 +277,7 @@ cb_filter_button_release (GtkWidget *popup, GdkEventButton *event,
if (set_condition) {
gnm_filter_set_condition (field->filter, field->i,
cond, TRUE);
sheet_update (field->filter->dep.sheet);
sheet_update (field->filter->sheet);
}
}
filter_popup_destroy (popup, GTK_WIDGET (list));
......@@ -371,7 +371,7 @@ collect_unique_elements (GnmFilterField *field,
uc.has_blank = FALSE;
uc.hash = g_hash_table_new (
(GHashFunc) value_hash, (GEqualFunc) value_equal);
sheet_foreach_cell_in_range (field->filter->dep.sheet,
sheet_foreach_cell_in_range (field->filter->sheet,
CELL_ITER_ALL,
r.start.col, r.start.row, r.end.col, r.end.row,
(CellIterFunc)&cb_collect_unique, &uc);
......@@ -820,7 +820,7 @@ filter_field_apply (GnmFilterField *field)
if (field->cond->op[1] != GNM_FILTER_UNUSED)
filter_expr_init (&data, 1, field->cond);
sheet_foreach_cell_in_range (filter->dep.sheet,
sheet_foreach_cell_in_range (filter->sheet,
CELL_ITER_IGNORE_HIDDEN,
col, start_row, col, end_row,
(CellIterFunc) cb_filter_expr, &data);
......@@ -829,12 +829,12 @@ filter_field_apply (GnmFilterField *field)
if (field->cond->op[1] != GNM_FILTER_UNUSED)
filter_expr_release (&data, 1);
} else if (field->cond->op[0] == GNM_FILTER_OP_BLANKS)
sheet_foreach_cell_in_range (filter->dep.sheet,
sheet_foreach_cell_in_range (filter->sheet,
CELL_ITER_IGNORE_HIDDEN,
col, start_row, col, end_row,
cb_filter_blanks, NULL);
else if (field->cond->op[0] == GNM_FILTER_OP_NON_BLANKS)
sheet_foreach_cell_in_range (filter->dep.sheet,
sheet_foreach_cell_in_range (filter->sheet,
CELL_ITER_IGNORE_HIDDEN,
col, start_row, col, end_row,
cb_filter_non_blanks, NULL);
......@@ -845,14 +845,14 @@ filter_field_apply (GnmFilterField *field)
data.find_max = (field->cond->op[0] & 0x1) ? FALSE : TRUE;
data.initialized = FALSE;
sheet_foreach_cell_in_range (filter->dep.sheet,
sheet_foreach_cell_in_range (filter->sheet,
CELL_ITER_IGNORE_HIDDEN | CELL_ITER_IGNORE_BLANK,
col, start_row, col, end_row,
(CellIterFunc) cb_filter_find_percentage, &data);
offset = (data.high - data.low) * field->cond->count / 100.;
data.high -= offset;
data.low += offset;
sheet_foreach_cell_in_range (filter->dep.sheet,
sheet_foreach_cell_in_range (filter->sheet,
CELL_ITER_IGNORE_HIDDEN,
col, start_row, col, end_row,
(CellIterFunc) cb_hide_unwanted_percentage, &data);
......@@ -862,11 +862,11 @@ filter_field_apply (GnmFilterField *field)
data.elements = 0;
data.count = field->cond->count;
data.vals = g_alloca (sizeof (Value *) * data.count);
sheet_foreach_cell_in_range (filter->dep.sheet,
sheet_foreach_cell_in_range (filter->sheet,
CELL_ITER_IGNORE_HIDDEN | CELL_ITER_IGNORE_BLANK,
col, start_row, col, end_row,
(CellIterFunc) cb_filter_find_items, &data);
sheet_foreach_cell_in_range (filter->dep.sheet,
sheet_foreach_cell_in_range (filter->sheet,
CELL_ITER_IGNORE_HIDDEN,
col, start_row, col, end_row,
(CellIterFunc) cb_hide_unwanted_items, &data);
......@@ -888,28 +888,6 @@ filter_field_set_active (GnmFilterField *field)
/*************************************************************************/
#define DEP_TO_FILTER(d_ptr) (GnmFilter *)(((char *)d_ptr) - G_STRUCT_OFFSET(GnmFilter, dep))
static void
filter_eval (Dependent *dep)
{
/* do nothing for now, its unclear whether people want the filter to
* auto reapply */
}
static void
filter_set_expr (Dependent *dep, GnmExpr const *new_expr)
{
g_warning ("TODO : move or invalidate the filter");
}
static void
filter_debug_name (Dependent const *dep, FILE *out)
{
fprintf (out, "Filter%p", dep);
}
static DEPENDENT_MAKE_TYPE (filter, filter_set_expr)
/**
* gnm_filter_new :
* @sheet :
......@@ -920,7 +898,6 @@ static DEPENDENT_MAKE_TYPE (filter, filter_set_expr)
GnmFilter *
gnm_filter_new (Sheet *sheet, Range const *r)
{
static CellPos const dummy = { 0, 0 };
/* pretend to fill the cell, then clip the X start later */
static SheetObjectAnchorType const anchor_types [4] = {
SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
......@@ -939,10 +916,7 @@ gnm_filter_new (Sheet *sheet, Range const *r)
g_return_val_if_fail (r != NULL, NULL);
filter = g_new0 (GnmFilter, 1);
filter->dep.sheet = sheet;
filter->dep.flags = filter_get_dep_type ();
filter->dep.expression = gnm_expr_new_constant (
value_new_cellrange_r (sheet, r));
filter->sheet = sheet;
filter->is_active = FALSE;
filter->r = *r;
......@@ -962,7 +936,6 @@ gnm_filter_new (Sheet *sheet, Range const *r)
g_object_unref (G_OBJECT (field));
}
dependent_link (&filter->dep, &dummy);
sheet->filters = g_slist_prepend (sheet->filters, filter);
return filter;
......@@ -979,7 +952,6 @@ gnm_filter_free (GnmFilter *filter)
sheet_object_clear_sheet (g_ptr_array_index (filter->fields, i));
g_ptr_array_free (filter->fields, TRUE);
gnm_expr_unref (filter->dep.expression);
filter->fields = NULL;
g_free (filter);
}
......@@ -987,16 +959,13 @@ gnm_filter_free (GnmFilter *filter)
void
gnm_filter_remove (GnmFilter *filter)
{
static CellPos const dummy = { 0, 0 };
Sheet *sheet;
int i;
g_return_if_fail (filter != NULL);
sheet = filter->dep.sheet;
sheet = filter->sheet;
sheet->filters = g_slist_remove (sheet->filters, filter);
dependent_unlink (&filter->dep, &dummy);
for (i = filter->r.start.row; ++i <= filter->r.end.row ; ) {
ColRowInfo *ri = sheet_row_fetch (sheet, i);
ri->in_filter = FALSE;
......@@ -1060,9 +1029,9 @@ gnm_filter_set_condition (GnmFilter *filter, unsigned i,
*/
if (existing_cond) {
for (r = filter->r.start.row; ++r <= filter->r.end.row ; ) {
ColRowInfo *ri = sheet_row_get (filter->dep.sheet, r);
ColRowInfo *ri = sheet_row_get (filter->sheet, r);
if (ri != NULL)
colrow_set_visibility (filter->dep.sheet,
colrow_set_visibility (filter->sheet,
FALSE, TRUE, r, r);
}
for (i = 0 ; i < filter->fields->len ; i++)
......@@ -1092,7 +1061,7 @@ gnm_filter_set_condition (GnmFilter *filter, unsigned i,
if (set_infilter)
for (r = filter->r.start.row; ++r <= filter->r.end.row ; ) {
ColRowInfo *ri = sheet_row_fetch (filter->dep.sheet, r);
ColRowInfo *ri = sheet_row_fetch (filter->sheet, r);
ri->in_filter = filter->is_active;
}
}
......
......@@ -3,8 +3,6 @@
#define GNUMERIC_FILTER_H
#include "gnumeric.h"
#include "dependent.h"
#include "expr.h"
typedef enum {
GNM_FILTER_UNUSED = -1,
......@@ -33,7 +31,7 @@ struct _GnmFilterCondition {
};
struct _GnmFilter {
Dependent dep;
Sheet *sheet;
Range r;
GPtrArray *fields;
......
......@@ -323,7 +323,7 @@ sheet_merge_relocate (GnmExprRelocateInfo const *ri)
if (range_contains (&ri->origin, r->start.col, r->start.row)) {
Range tmp = *r;
/* Toss any objects that would be clipped. */
/* Toss any merges that would be clipped. */
sheet_merge_remove (ri->origin_sheet, r, NULL);
if (!range_translate (&tmp, ri->col_offset, ri->row_offset))
to_move = g_slist_prepend (to_move, range_dup (&tmp));
......
......@@ -829,7 +829,7 @@ sheet_object_filled_clone (SheetObject const *so, Sheet *sheet)
new_so = sheet_object_graphic_clone (so, sheet);
new_sof = SHEET_OBJECT_FILLED (new_so);
new_sof->outline_color = sof->outline_color;
new_sof->outline_color = style_color_ref (sof->outline_color);
return SHEET_OBJECT (new_sof);
}
......@@ -1300,8 +1300,8 @@ sheet_object_polygon_clone (SheetObject const *so, Sheet *sheet)
new_sop = g_object_new (G_OBJECT_TYPE (so), NULL);
new_sop->fill_color = style_color_ref (sop->fill_color);
new_sop->outline_color = style_color_ref (sop->outline_color);
new_sop->fill_color = style_color_ref (sop->fill_color);
new_sop->outline_color = style_color_ref (sop->outline_color);
return SHEET_OBJECT (new_sop);
}
......@@ -1418,6 +1418,7 @@ typedef struct {
SheetObjectFilled parent;
char *label;
StyleColor *font_color;
} SheetObjectText;
typedef struct {
SheetObjectFilledClass parent;
......@@ -1466,6 +1467,7 @@ sheet_object_text_finalize (GObject *obj)
{
SheetObjectText *sot = SHEET_OBJECT_TEXT (obj);
style_color_unref (sot->font_color);
g_free (sot->label);
sot->label = NULL;
......@@ -1479,11 +1481,14 @@ sheet_object_text_new_view (SheetObject *so, SheetControl *sc, gpointer key)
SheetObjectText *sot = SHEET_OBJECT_TEXT (so);
FooCanvasItem *text = NULL, *back = NULL;
FooCanvasGroup *group;
GdkColor *font_color;
g_return_val_if_fail (IS_SHEET_OBJECT (so), NULL);
g_return_val_if_fail (IS_SHEET_CONTROL (sc), NULL);
g_return_val_if_fail (gcanvas != NULL, NULL);
font_color = (sot->font_color != NULL) ? &sot->font_color->color : NULL;
foo_canvas_item_raise_to_top (FOO_CANVAS_ITEM (gcanvas->sheet_object_group));
group = FOO_CANVAS_GROUP (foo_canvas_item_new (
gcanvas->sheet_object_group,
......@@ -1496,6 +1501,7 @@ sheet_object_text_new_view (SheetObject *so, SheetControl *sc, gpointer key)
"clip", TRUE,
"x", 0.,
"y", 0.,
"fill_color_gdk", font_color,
NULL);
back = sheet_object_filled_new_view_internal (so, sc, gcanvas, group);
foo_canvas_item_raise_to_top (text);
......@@ -1565,15 +1571,19 @@ sheet_object_text_write_xml (SheetObject const *so,
xml_node_set_cstr (tree, "Label", sot->label);
if (sot->font_color)
xml_node_set_color (tree, "FontColor", sot->font_color);
return FALSE;
}
static SheetObject *
sheet_object_text_clone (SheetObject const *src_swl, Sheet *new_sheet)
sheet_object_text_clone (SheetObject const *src_sot, Sheet *new_sheet)
{
SheetObjectText *sot = g_object_new (SHEET_OBJECT_TEXT_TYPE, NULL);
sheet_object_text_init_full (sot,
SHEET_OBJECT_TEXT (src_swl)->label);
SHEET_OBJECT_TEXT (src_sot)->label);
sot->font_color = style_color_ref (sot->font_color);
return SHEET_OBJECT (sot);
}
......@@ -1612,3 +1622,19 @@ sheet_object_text_class_init (GObjectClass *object_class)
GSF_CLASS (SheetObjectText, sheet_object_text,
sheet_object_text_class_init, sheet_object_text_init,
SHEET_OBJECT_FILLED_TYPE);
void
sheet_object_test_font_color_set (SheetObject *so, StyleColor *color)
{
SheetObjectText *sot = SHEET_OBJECT_TEXT (so);
GdkColor *gdk = (color != NULL) ? &color->color : NULL;
GList *l;
g_return_if_fail (sot != NULL);
style_color_unref (sot->font_color);
sot->font_color = color;
for (l = so->realized_list; l; l = l->next)
foo_canvas_item_set (l->data, "fill_color_gdk", gdk, NULL);
}
......@@ -32,6 +32,7 @@ void sheet_object_polygon_outline_color_set (SheetObject *so, StyleColor *color)
#define SHEET_OBJECT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SHEET_OBJECT_TEXT_TYPE, SheetObjectText))
GType sheet_object_text_get_type (void);
void sheet_object_text_set_text (SheetObject *so, char const *str);
void sheet_object_text_set_text (SheetObject *so, char const *str);
void sheet_object_test_font_color_set (SheetObject *so, StyleColor *color);
#endif /* GNUMERIC_SHEET_OBJECT_GRAPHIC_H */
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