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 WORKSHEET_H
52 #define WORKSHEET_H
53 #include "cell.h"
54 #include "graph.h"
55 #include "draw.h"
56 #include "button.h"
57 #include "selection.h"
58 
59 #include "stdio.h"
60 
61 #define NB_COLUMN  256
62 
63 
64 
65 
66 #define NB_LINE  32000
67 #define W_COL     84
68 #define H_LIN     20
69 
70 
71 struct _Worksheet
72   {
73     Cell *defcell;
74     Graph **Graphs;
75     Drawing **Drawings;
76     Button **Buttons;
77     char Name[32];
78 
79     Cell *activecell;
80     Graph *activegraph;
81     Drawing *activedrawing;
82     Button *activebutton;
83 
84     int nbcell, nbgraph, nbdrawing, nbbutton;
85     int zoom;
86     int objnum;
87     int nblin, nbcol;
88     int *cw;
89     int *lh;
90     int cwdim, lhdim;
91     int cc, ll;
92     Selection *selection;
93     Cell ***array;
94     int maxrow;
95     int *maxcol;
96     int _maxcol;
97     struct _Workbook *workbook;
98     int cur_r, cur_c;
99   };
100 
101 typedef struct _Worksheet Worksheet;
102 
103 extern Worksheet *ActiveWorksheet;
104 
105 extern Worksheet *newworksheet ();
106 extern Worksheet *newworksheet1 (int nbcell, int nbgraph, int nbdrawing);
107 extern int freeworksheet ();
108 
109 extern int worksheet_write (Worksheet * w, FILE * fp);
110 extern int worksheet_update (Worksheet * worksheet);
111 
112 extern int worksheet_find (Worksheet * worksheet, int x, int y);
113 extern Cell *worksheet_getcell (Worksheet * worksheet, int r, int c, int new);
114 extern int worksheet_delcell (Worksheet * worksheet, int r, int c);
115 extern Graph *worksheet_newgraph (Worksheet * worksheet);
116 extern Graph *worksheet_newgraph1 (Worksheet * worksheet, Graph * graph);
117 extern int worksheet_delgraph (Worksheet * worksheet, Graph * graph);
118 
119 extern Drawing *worksheet_newdrawing (Worksheet * worksheet);
120 extern Drawing *worksheet_newdrawing1 (Worksheet * worksheet, Drawing * drawing);
121 extern int worksheet_deldrawing (Worksheet * worksheet, Drawing * drawing);
122 
123 extern Button *worksheet_newbutton (Worksheet * worksheet);
124 
125 extern Worksheet *ActivateWorksheet (Worksheet * worksheet);
126 
127 extern Chart *worksheet_getchart (Worksheet * worksheet, int n);
128 extern Chart *worksheet_addchart (Worksheet * worksheet, int *args, int n);
129 extern Drawing *worksheet_addshape (Worksheet * worksheet, int *args, int n);
130 extern Button *worksheet_addbutton (Worksheet * worksheet, int *args, int n);
131 extern int worksheet_setcolw (Worksheet * worksheet, int col, double w);
132 extern int worksheet_setrowh (Worksheet * worksheet, int lin, double h);
133 extern double worksheet_getcolw (Worksheet * worksheet, int col);
134 extern double worksheet_getrowh (Worksheet * worksheet, int lin);
135 extern int worksheet_setname (Worksheet * worksheet, char *name);
136 extern int worksheet_calculate (Worksheet * worksheet);
137 extern int worksheet_printout (Worksheet * worksheet);
138 
139 extern int worksheet_setcursor (Worksheet * worksheet, int row, int column);
140 extern int worksheet_movecursor (Worksheet * worksheet, int drow, int dcolumn);
141 
142 extern int worksheet_select_cell (Worksheet * w, Cell * c);
143 extern int worksheet_select_range (Worksheet * w, int i1, int j1, int i2, int j2);
144 extern int worksheet_select_graph (Worksheet * w, Graph * c);
145 extern int worksheet_select_drawing (Worksheet * w, Drawing * d);
146 extern int worksheet_select_button (Worksheet * w, Button * b);
147 extern Cell *worksheet_selection_cells (Worksheet * w);
148 
149 extern int worksheet_cell_coord (Worksheet * w, Cell * c, int *x1, int *y1, int *x2, int *y2);
150 extern int worksheet_rc_coord (Worksheet * w, int r, int c, int *x1, int *y1, int *x2, int *y2);
151 extern Graph *worksheet_getchart_at (Worksheet * w, int x, int y);
152 
153 #endif
154