Use application properties instead of ugly dual-use global variable
[gnumeric.git] / src / cell.h
blob0afe302b2003cb6ffd6886022279946057341a08
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_CELL_H_
3 # define _GNM_CELL_H_
5 #include "gnumeric.h"
6 #include "dependent.h"
8 G_BEGIN_DECLS
10 typedef enum {
11 /* MUST BE > 0xFFF,FFFF to avoid conflict with GnmDependentFlags */
12 /* GnmCell is linked into the sheet */
13 GNM_CELL_IN_SHEET_LIST = 0x10000000,
14 /* Is the top left corner of a merged region */
15 GNM_CELL_IS_MERGED = 0x20000000,
16 /* Cells expression was changed, recalc before rendering */
17 GNM_CELL_HAS_NEW_EXPR = 0x40000000
18 } GnmCellFlags;
20 /* Definition of a GnmCell */
21 #define GNM_DEP_TO_CELL(dep) ((GnmCell *)(dep))
22 #define GNM_CELL_TO_DEP(cell) (&(cell)->base)
23 struct _GnmCell {
24 GnmDependent base;
26 /* Mandatory state information */
27 GnmCellPos pos;
29 GnmValue *value; /* computed or entered (Must be non NULL) */
32 GType gnm_cell_get_type (void);
35 * GnmCell state checking
37 #define gnm_cell_needs_recalc(cell) ((cell)->base.flags & DEPENDENT_NEEDS_RECALC)
38 #define gnm_cell_expr_is_linked(cell) ((cell)->base.flags & DEPENDENT_IS_LINKED)
39 #define gnm_cell_has_expr(cell) ((cell)->base.texpr != NULL)
40 #define gnm_cell_is_merged(cell) ((cell)->base.flags & GNM_CELL_IS_MERGED)
41 gboolean gnm_cell_is_empty (GnmCell const *cell);
42 gboolean gnm_cell_is_blank (GnmCell const *cell); /* empty, or "" */
43 GnmValue *gnm_cell_is_error (GnmCell const *cell);
44 gboolean gnm_cell_is_number (GnmCell const *cell);
45 gboolean gnm_cell_is_zero (GnmCell const *cell);
46 GnmValue *gnm_cell_get_value (GnmCell const *cell);
48 gboolean gnm_cell_is_array (GnmCell const *cell);
49 gboolean gnm_cell_is_nonsingleton_array (GnmCell const *cell);
50 gboolean gnm_cell_array_bound (GnmCell const *cell, GnmRange *res);
53 * Utilities to assign the contents of a cell
55 void gnm_cell_set_text (GnmCell *cell, char const *text);
56 void gnm_cell_assign_value (GnmCell *cell, GnmValue *v);
57 void gnm_cell_set_value (GnmCell *c, GnmValue *v);
58 void gnm_cell_set_expr_and_value(GnmCell *cell,
59 GnmExprTop const *texpr, GnmValue *v,
60 gboolean link_expr);
61 void gnm_cell_set_expr (GnmCell *cell, GnmExprTop const *texpr);
62 void gnm_cell_set_expr_unsafe (GnmCell *cell, GnmExprTop const *texpr);
63 void gnm_cell_set_array_formula (Sheet *sheet,
64 int cola, int rowa, int colb, int rowb,
65 GnmExprTop const *texpr);
66 GOUndo *gnm_cell_set_array_formula_undo (GnmSheetRange *sr,
67 GnmExprTop const *texpr);
68 gboolean gnm_cell_set_array (Sheet *sheet,
69 const GnmRange *r,
70 GnmExprTop const *texpr);
71 void gnm_cell_cleanout (GnmCell *cell);
72 void gnm_cell_convert_expr_to_value (GnmCell *cell);
75 * Manipulate GnmCell attributes
77 GnmStyle const *gnm_cell_get_style (GnmCell const *cell);
78 GOFormat const *gnm_cell_get_format (GnmCell const *cell);
79 GOFormat const *gnm_cell_get_format_given_style (GnmCell const *cell, GnmStyle const *style);
81 GnmRenderedValue *gnm_cell_get_rendered_value (GnmCell const *cell);
82 GnmRenderedValue *gnm_cell_fetch_rendered_value (GnmCell const *cell,
83 gboolean allow_variable_width);
84 GnmRenderedValue *gnm_cell_render_value (GnmCell const *cell,
85 gboolean allow_variable_width);
86 void gnm_cell_unrender (GnmCell const *cell);
88 int gnm_cell_rendered_height (GnmCell const * cell);
89 int gnm_cell_rendered_width (GnmCell const * cell); /* excludes offset */
90 int gnm_cell_rendered_offset (GnmCell const * cell);
91 GOColor gnm_cell_get_render_color (GnmCell const * cell);
92 char * gnm_cell_get_entered_text (GnmCell const * cell);
93 char * gnm_cell_get_text_for_editing (GnmCell const * cell,
94 gboolean *quoted, int *cursor_pos);
95 char * gnm_cell_get_rendered_text (GnmCell *cell);
97 G_END_DECLS
99 #endif /* _GNM_CELL_H_ */