1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 1997, 1998, 1999, 2000, 2009, 2011, 2013, 2014, 2018 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #ifndef OUTPUT_TABLE_PROVIDER
18 #define OUTPUT_TABLE_PROVIDER 1
21 #include "output/table.h"
26 enum table_halign table_halign_interpret (enum table_halign, bool numeric);
28 /* A cell in a table. */
31 /* Occupied table region.
33 d[TABLE_HORZ][0] is the leftmost column.
34 d[TABLE_HORZ][1] is the rightmost column, plus 1.
35 d[TABLE_VERT][0] is the top row.
36 d[TABLE_VERT][1] is the bottom row, plus 1.
39 d[TABLE_HORZ][1] == d[TABLE_HORZ][0] + 1
40 and d[TABLE_VERT][1] == d[TABLE_VERT][0] + 1
43 d[TABLE_HORZ][1] > d[TABLE_HORZ][0] + 1
44 or d[TABLE_VERT][1] > d[TABLE_VERT][0] + 1
46 int d[TABLE_N_AXES][2];
48 unsigned char options; /* TABLE_CELL_*. */
49 const struct pivot_value *value;
50 const struct font_style *font_style;
51 const struct cell_style *cell_style;
54 /* Returns the number of columns that CELL spans. This is 1 for an ordinary
55 cell and greater than one for a cell that joins multiple columns. */
57 table_cell_colspan (const struct table_cell *cell)
59 return cell->d[TABLE_HORZ][1] - cell->d[TABLE_HORZ][0];
62 /* Returns the number of rows that CELL spans. This is 1 for an ordinary cell
63 and greater than one for a cell that joins multiple rows. */
65 table_cell_rowspan (const struct table_cell *cell)
67 return cell->d[TABLE_VERT][1] - cell->d[TABLE_VERT][0];
70 /* Returns true if CELL is a joined cell, that is, if it spans multiple rows
71 or columns. Otherwise, returns false. */
73 table_cell_is_joined (const struct table_cell *cell)
75 return table_cell_colspan (cell) > 1 || table_cell_rowspan (cell) > 1;
78 /* For use primarily by output drivers. */
80 void table_get_cell (const struct table *, int x, int y, struct table_cell *);
81 struct table_border_style table_get_rule (const struct table *,
82 enum table_axis, int x, int y);
84 #endif /* output/table-provider.h */