GUI: reduce vertical size of the toolbar area
[gnumeric.git] / src / position.h
blob26e7c347c4990ebdcf769e5ea20b8b1953516a16
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_POSITION_H_
3 # define _GNM_POSITION_H_
5 #include "gnumeric.h"
7 G_BEGIN_DECLS
9 GType gnm_cell_pos_get_type (void); /* boxed type */
11 struct _GnmEvalPos {
12 GnmCellPos eval;
13 Sheet *sheet;
14 GnmDependent *dep; /* optionally NULL */
15 GnmExprTop const *array_texpr; /* non-NULL if top level is array */
18 struct _GnmParsePos {
19 GnmCellPos eval;
20 Sheet *sheet;
21 Workbook *wb;
25 * Used for getting a valid Sheet *from a GnmCellRef
26 * Syntax is GnmCellRef, valid Sheet *
28 #define eval_sheet(a,b) (((a) != NULL) ? (a) : (b))
30 /* Initialization routines for Evaluation Positions */
31 GType gnm_eval_pos_get_type (void); /* Boxed type */
32 GnmEvalPos *eval_pos_init (GnmEvalPos *ep, Sheet *s, int col, int row);
33 GnmEvalPos *eval_pos_init_pos (GnmEvalPos *ep, Sheet *s, GnmCellPos const *pos);
34 GnmEvalPos *eval_pos_init_dep (GnmEvalPos *ep, GnmDependent const *dep);
35 GnmEvalPos *eval_pos_init_cell (GnmEvalPos *ep, GnmCell const *cell);
36 GnmEvalPos *eval_pos_init_editpos (GnmEvalPos *ep, SheetView const *sv);
37 GnmEvalPos *eval_pos_init_sheet (GnmEvalPos *ep, Sheet const *sheet);
38 gboolean eval_pos_is_array_context (GnmEvalPos const *ep);
40 /* Initialization routines for Parse Positions */
41 GType gnm_parse_pos_get_type (void); /* Boxed type */
42 GnmParsePos *parse_pos_init (GnmParsePos *pp, Workbook *wb,
43 Sheet const *sheet, int col, int row);
44 GnmParsePos *parse_pos_init_dep (GnmParsePos *pp, GnmDependent const *dep);
45 GnmParsePos *parse_pos_init_cell (GnmParsePos *pp, GnmCell const *cell);
46 GnmParsePos *parse_pos_init_evalpos (GnmParsePos *pp, GnmEvalPos const *pos);
47 GnmParsePos *parse_pos_init_editpos (GnmParsePos *pp, SheetView const *sv);
48 GnmParsePos *parse_pos_init_sheet (GnmParsePos *pp, Sheet const *sheet);
50 /*****************************************************************************/
52 struct _GnmCellRef {
53 Sheet *sheet;
54 int col, row;
56 unsigned char col_relative;
57 unsigned char row_relative;
59 struct _GnmRangeRef {
60 GnmCellRef a, b;
63 GType gnm_cellref_get_type (void); /* Boxed type */
64 GnmCellRef *gnm_cellref_init (GnmCellRef *ref, Sheet *sheet,
65 int col, int row, gboolean rel);
66 gboolean gnm_cellref_equal (GnmCellRef const *a, GnmCellRef const *b);
67 guint gnm_cellref_hash (GnmCellRef const *cr);
68 void gnm_cellref_make_abs (GnmCellRef *dest, GnmCellRef const *src,
69 GnmEvalPos const *ep);
70 void gnm_cellref_set_col_ar (GnmCellRef *cr, GnmParsePos const *pp,
71 gboolean abs_rel);
72 void gnm_cellref_set_row_ar (GnmCellRef *cr, GnmParsePos const *pp,
73 gboolean abs_rel);
74 int gnm_cellref_get_col (GnmCellRef const *cr, GnmEvalPos const *ep);
75 int gnm_cellref_get_row (GnmCellRef const *cr, GnmEvalPos const *ep);
77 GType gnm_rangeref_get_type (void); /* Boxed type */
78 gboolean gnm_rangeref_equal (GnmRangeRef const *a, GnmRangeRef const *b);
79 guint gnm_rangeref_hash (GnmRangeRef const *cr);
80 GnmRangeRef *gnm_rangeref_dup (GnmRangeRef const *cr);
81 void gnm_rangeref_normalize_pp (GnmRangeRef const *rr,
82 GnmParsePos const *pp,
83 Sheet **start_sheet, Sheet **end_sheet,
84 GnmRange *dest);
85 void gnm_rangeref_normalize (GnmRangeRef const *rr,
86 GnmEvalPos const *ep,
87 Sheet **start_sheet, Sheet **end_sheet,
88 GnmRange *dest);
90 guint gnm_cellpos_hash (GnmCellPos const *key);
91 gint gnm_cellpos_equal (GnmCellPos const *a, GnmCellPos const *b);
92 void gnm_cellpos_init_cellref_ss (GnmCellPos *res, GnmCellRef const *cell_ref,
93 GnmCellPos const *pos,
94 GnmSheetSize const *ss);
95 void gnm_cellpos_init_cellref (GnmCellPos *cp, GnmCellRef const *cr,
96 GnmCellPos const *pos, Sheet const *base_sheet);
98 G_END_DECLS
100 #endif /* _GNM_POSITION_H_ */