1 /********************************************************************
2 This file is part of the abs 0.907 distribution.  abs is a spreadsheet
3 with graphical user interface.
4 
5 Copyright (C) 1998-2001  Andr� Bertin (Andre.Bertin@ping.be)
6 
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version if in the same spirit as version 2.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 Concact: abs@pi.be
22          http://home.pi.be/bertin/abs.shtml
23 
24 *********************************************************************/
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 #ifndef CELL_H
52 #define CELL_H
53 #include "style.h"
54 #include <stdio.h>
55 #include "object.h"
56 #include "node.h"
57 
58 typedef enum
59   {
60     undef, formula, constant, text
61   }
62 Ctype;
63 
64 struct _Cell;
65 struct _Worksheet;
66 
67 struct _Familly
68   {
69     struct _Cell **parentlist;
70     struct _Cell **childlist;
71     int numpar;
72     int numchi;
73     int dimparlist;
74     int dimchilist;
75   };
76 
77 typedef struct _Familly Familly;
78 
79 struct _Cell
80   {
81     obj val;
82     char *formula;
83     int is_text;
84     int r, c;
85     Style *style;
86     Familly *familly;
87     struct _Worksheet *worksheet;
88     int objnum;
89     nodeType *tree;
90     Ctype type;
91   };
92 
93 typedef struct _Cell Cell;
94 
95 extern Cell *currentcell;
96 extern Cell *ActiveCell;
97 
98 extern Cell *cell_activate (Cell * cell);
99 
100 extern Cell *newcell (int r, int c);
101 extern int freecell (Cell * cell);
102 extern int clear_cell (Cell * cell);
103 extern int cell_write (Cell * cell, FILE * fp);
104 
105 extern int cell_setnumberformat (Cell * cell, char *buf);
106 extern int cell_setformula (Cell * cell, char *buf);
107 extern int cell_settext (Cell * cell, char *buf);
108 extern char *cell_getformula (Cell * cell);
109 extern char *cell_getnumberformat (Cell * cell);
110 extern char *cell_gettext (Cell * cell);
111 extern int cell_istext (Cell * cell);
112 extern double cell_getvalue (Cell * cell);
113 extern obj cell_getobj (Cell * cell);
114 extern double cell_setvalue (Cell * cell, double val);
115 extern obj cell_setobj (Cell * cell, obj o);
116 extern obj cell_setresval (Cell * cell, obj o);
117 
118 extern int cell_setborders (Cell * cell, int border, int type);
119 extern int cell_setfg (Cell * cell, int f);
120 extern int cell_getfg (Cell * cell);
121 extern int cell_setbg (Cell * cell, int f);
122 extern int cell_getbg (Cell * cell);
123 
124 extern int cell_gettop (Cell * cell);
125 extern int cell_getbot (Cell * cell);
126 extern int cell_getrig (Cell * cell);
127 extern int cell_getlef (Cell * cell);
128 extern int cell_settop (Cell * cell, int f);
129 extern int cell_setbot (Cell * cell, int f);
130 extern int cell_setrig (Cell * cell, int f);
131 extern int cell_setlef (Cell * cell, int f);
132 
133 extern int cell_setformat (Cell * cell, int format, int deci);
134 extern int cell_getformat (Cell * cell, int *format, int *deci);
135 extern int cell_setjust (Cell * cell, int j);
136 extern int cell_getjust (Cell * cell);
137 extern int cell_setfont (Cell * cell, int f, int w, int s);
138 extern int cell_getfont (Cell * cell);
139 extern int cell_getfontw (Cell * cell);
140 extern int cell_getfonts (Cell * cell);
141 extern int cell_fontname (Cell * cell, char *name);
142 extern int cell_fontsize (Cell * cell, int v);
143 extern int cell_fontbold (Cell * cell, int v);
144 extern int cell_fontitalic (Cell * cell, int v);
145 
146 extern int cell_setborders (Cell * cell, int border, int type);
147 extern int cell_setborder (Cell * cell, int border);
148 extern int cell_getborder (Cell * cell);
149 
150 extern int cell_isnew (Cell * cell);
151 extern int cell1isfcell2 (Cell * cell1, Cell * cell2);
152 extern int nupdate2 (Cell * cell, int redraw);
153 
154 extern int StringInput ();
155 extern int macroparsing (char *buf);
156 extern char *textparsing (char *buf);
157 
158 extern int copymod (int ii, int jj, int i, int j, int incr);
159 extern int copymod2 (Cell * cell1, Cell * cell2, int curi, int curj, int di, int dj);
160 extern int copymod3 (Cell * cell1, Cell * cell2, int incr);
161 
162 extern Cell *cell_cpy (Cell * cell1, Cell * cell2);
163 extern Cell *cell_stycpy (Cell * cell1, Cell * cell2);
164 
165 extern int parsecell (Cell * cell);
166 
167 int cell_chgwksname (Cell * cell, char *oldname, char *newname);
168 int cell_calculate (Cell * cell);
169 
170 int cell_print (Cell * cell);
171 
172 void cell_auditcell (Cell * cell);
173 
174 #endif
175