Update Spanish translation
[gnumeric.git] / src / cell.h
blob29f601e7cc1bb8646b3887836d99b99aea37091c
1 #ifndef _GNM_CELL_H_
2 # define _GNM_CELL_H_
4 #include <gnumeric.h>
5 #include <dependent.h>
7 G_BEGIN_DECLS
9 typedef enum {
10 /* MUST BE > 0xFFF,FFFF to avoid conflict with GnmDependentFlags */
11 /* GnmCell is linked into the sheet */
12 GNM_CELL_IN_SHEET_LIST = 0x10000000,
13 /* Is the top left corner of a merged region */
14 GNM_CELL_IS_MERGED = 0x20000000,
15 /* Cells expression was changed, recalc before rendering */
16 GNM_CELL_HAS_NEW_EXPR = 0x40000000
17 } GnmCellFlags;
19 /* Definition of a GnmCell */
20 #define GNM_DEP_TO_CELL(dep) ((GnmCell *)(dep))
21 #define GNM_CELL_TO_DEP(cell) (&(cell)->base)
22 struct _GnmCell {
23 GnmDependent base;
25 /* Mandatory state information */
26 GnmCellPos pos;
28 GnmValue *value; /* computed or entered (Must be non NULL) */
31 GType gnm_cell_get_type (void);
34 * GnmCell state checking
36 #define gnm_cell_needs_recalc(cell) ((cell)->base.flags & DEPENDENT_NEEDS_RECALC)
37 #define gnm_cell_expr_is_linked(cell) ((cell)->base.flags & DEPENDENT_IS_LINKED)
38 #define gnm_cell_has_expr(cell) ((cell)->base.texpr != NULL)
39 #define gnm_cell_is_merged(cell) ((cell)->base.flags & GNM_CELL_IS_MERGED)
40 gboolean gnm_cell_is_empty (GnmCell const *cell);
41 gboolean gnm_cell_is_blank (GnmCell const *cell); /* empty, or "" */
42 GnmValue *gnm_cell_is_error (GnmCell const *cell);
43 gboolean gnm_cell_is_number (GnmCell const *cell);
44 gboolean gnm_cell_is_zero (GnmCell const *cell);
45 GnmValue *gnm_cell_get_value (GnmCell const *cell);
47 gboolean gnm_cell_is_array (GnmCell const *cell);
48 gboolean gnm_cell_is_nonsingleton_array (GnmCell const *cell);
49 gboolean gnm_cell_array_bound (GnmCell const *cell, GnmRange *res);
52 * Utilities to assign the contents of a cell
54 void gnm_cell_set_text (GnmCell *cell, char const *text);
55 void gnm_cell_assign_value (GnmCell *cell, GnmValue *v);
56 void gnm_cell_set_value (GnmCell *c, GnmValue *v);
57 void gnm_cell_set_expr_and_value(GnmCell *cell,
58 GnmExprTop const *texpr, GnmValue *v,
59 gboolean link_expr);
60 void gnm_cell_set_expr (GnmCell *cell, GnmExprTop const *texpr);
61 void gnm_cell_set_expr_unsafe (GnmCell *cell, GnmExprTop const *texpr);
62 void gnm_cell_set_array_formula (Sheet *sheet,
63 int cola, int rowa, int colb, int rowb,
64 GnmExprTop const *texpr);
65 GOUndo *gnm_cell_set_array_formula_undo (GnmSheetRange *sr,
66 GnmExprTop const *texpr);
67 gboolean gnm_cell_set_array (Sheet *sheet,
68 const GnmRange *r,
69 GnmExprTop const *texpr);
70 void gnm_cell_cleanout (GnmCell *cell);
71 void gnm_cell_convert_expr_to_value (GnmCell *cell);
74 * Manipulate GnmCell attributes
76 GnmStyle const *gnm_cell_get_style (GnmCell const *cell);
77 GOFormat const *gnm_cell_get_format (GnmCell const *cell);
78 GOFormat const *gnm_cell_get_format_given_style (GnmCell const *cell, GnmStyle const *style);
80 GnmRenderedValue *gnm_cell_get_rendered_value (GnmCell const *cell);
81 GnmRenderedValue *gnm_cell_fetch_rendered_value (GnmCell const *cell,
82 gboolean allow_variable_width);
83 GnmRenderedValue *gnm_cell_render_value (GnmCell const *cell,
84 gboolean allow_variable_width);
85 void gnm_cell_unrender (GnmCell const *cell);
87 int gnm_cell_rendered_height (GnmCell const * cell);
88 int gnm_cell_rendered_width (GnmCell const * cell); /* excludes offset */
89 int gnm_cell_rendered_offset (GnmCell const * cell);
90 GOColor gnm_cell_get_render_color (GnmCell const * cell);
91 char * gnm_cell_get_entered_text (GnmCell const * cell);
92 char * gnm_cell_get_text_for_editing (GnmCell const * cell,
93 gboolean *quoted, int *cursor_pos);
94 char * gnm_cell_get_rendered_text (GnmCell *cell);
96 G_END_DECLS
98 #endif /* _GNM_CELL_H_ */