It used to be important for these to be adjustable, but no longer.
[V] = pt->axes[PIVOT_AXIS_COLUMN].label_depth,
};
struct tab_table *table = tab_create (body[H] + stub[H],
- body[V] + stub[V]);
- tab_headers (table, stub[H], 0, stub[V], 0);
+ body[V] + stub[V],
+ stub[H], 0, stub[V], 0);
for (size_t i = 0; i < PIVOT_N_AREAS; i++)
table->styles[i] = area_style_override (table->container, &pt->areas[i],
if (!n_footnotes)
return;
- struct tab_table *t = tab_create (1, n_footnotes);
+ struct tab_table *t = tab_create (1, n_footnotes, 0, 0, 0, 0);
for (size_t i = 0; i < n_footnotes; i++)
{
tab_text_format (t, 0, i, TAB_LEFT, "%s. %s",
if (!t)
return;
- struct tab_table *tab = tab_create (1, 1);
+ struct tab_table *tab = tab_create (1, 1, 0, 0, 0, 0);
tab_text (tab, 0, 0, 0, t->content);
for (size_t i = 0; i < t->n_footnotes; i++)
tab_add_footnote (tab, 0, 0, t->footnotes[i]);
if (!layers)
return;
- struct tab_table *tab = tab_create (1, layers->n_layers);
+ struct tab_table *tab = tab_create (1, layers->n_layers, 0, 0, 0, 0);
for (size_t i = 0; i < layers->n_layers; i++)
{
const struct table_item_layer *layer = &layers->layers[i];
};
/* Creates and returns a new table with NC columns and NR rows and initially no
- header rows or columns. The table's cells are initially empty. */
+ header rows or columns.
+
+ Sets the number of header rows on each side of TABLE to HL on the
+ left, HR on the right, HT on the top, HB on the bottom. Header rows
+ are repeated when a table is broken across multiple columns or
+ multiple pages.
+
+ The table's cells are initially empty. */
struct tab_table *
-tab_create (int nc, int nr)
+tab_create (int nc, int nr, int hl, int hr, int ht, int hb)
{
struct tab_table *t;
t = pool_create_container (struct tab_table, container);
t->table.n[TABLE_HORZ] = nc;
t->table.n[TABLE_VERT] = nr;
- t->table.h[TABLE_HORZ][0] = t->table.h[TABLE_HORZ][1] = 0;
- t->table.h[TABLE_VERT][0] = t->table.h[TABLE_VERT][1] = 0;
+ t->table.h[TABLE_HORZ][0] = hl;
+ t->table.h[TABLE_HORZ][1] = hr;
+ t->table.h[TABLE_VERT][0] = ht;
+ t->table.h[TABLE_VERT][1] = hb;
t->table.ref_cnt = 1;
t->cc = pool_calloc (t->container, nr * nc, sizeof *t->cc);
return t;
}
-
-
-/* Sets the number of header rows on each side of TABLE to L on the
- left, R on the right, T on the top, B on the bottom. Header rows
- are repeated when a table is broken across multiple columns or
- multiple pages. */
-void
-tab_headers (struct tab_table *table, int l, int r, int t, int b)
-{
- table_set_hl (&table->table, l);
- table_set_hr (&table->table, r);
- table_set_ht (&table->table, t);
- table_set_hb (&table->table, b);
-}
\f
/* Rules. */
static inline int tab_nc (const struct tab_table *table)
{ return table_nc (&table->table); }
-/* Number of left/right/top/bottom header columns/rows in TABLE. */
-static inline int tab_l (const struct tab_table *table)
- { return table_hl (&table->table); }
-static inline int tab_r (const struct tab_table *table)
- { return table_hr (&table->table); }
-static inline int tab_t (const struct tab_table *table)
- { return table_ht (&table->table); }
-static inline int tab_b (const struct tab_table *table)
- { return table_hb (&table->table); }
-
/* Tables. */
-struct tab_table *tab_create (int nc, int nr);
-void tab_headers (struct tab_table *, int l, int r, int t, int b);
+struct tab_table *tab_create (int nc, int nr,
+ int l, int r, int t, int b);
/* Rules. */
void tab_hline (struct tab_table *, int style, int x1, int x2, int y);
{
return table->ref_cnt > 1;
}
-
-/* Sets the number of left header columns in TABLE to HL. */
-void
-table_set_hl (struct table *table, int hl)
-{
- assert (!table_is_shared (table));
- table->h[TABLE_HORZ][0] = hl;
-}
-
-/* Sets the number of right header columns in TABLE to HR. */
-void
-table_set_hr (struct table *table, int hr)
-{
- assert (!table_is_shared (table));
- table->h[TABLE_HORZ][1] = hr;
-}
-
-/* Sets the number of top header rows in TABLE to HT. */
-void
-table_set_ht (struct table *table, int ht)
-{
- assert (!table_is_shared (table));
- table->h[TABLE_VERT][0] = ht;
-}
-
-/* Sets the number of top header rows in TABLE to HB. */
-void
-table_set_hb (struct table *table, int hb)
-{
- assert (!table_is_shared (table));
- table->h[TABLE_VERT][1] = hb;
-}
\f
struct area_style *
area_style_clone (struct pool *pool, const struct area_style *old)
struct table *
table_from_string (const char *text)
{
- struct tab_table *t = tab_create (1, 1);
+ struct tab_table *t = tab_create (1, 1, 0, 0, 0, 0);
tab_text (t, 0, 0, TAB_LEFT, text);
return &t->table;
}
{ return t->h[TABLE_VERT][0]; }
static inline int table_hb (const struct table *t)
{ return t->h[TABLE_VERT][1]; }
-
-/* Set headers. */
-void table_set_hl (struct table *, int hl);
-void table_set_hr (struct table *, int hr);
-void table_set_ht (struct table *, int ht);
-void table_set_hb (struct table *, int hb);
\f
/* Table classes. */
struct table_item *
text_item_to_table_item (struct text_item *text_item)
{
- struct tab_table *tab = tab_create (1, 1);
+ struct tab_table *tab = tab_create (1, 1, 0, 0, 0, 0);
struct area_style *style = pool_alloc (tab->container, sizeof *style);
*style = (struct area_style) { AREA_STYLE_INITIALIZER__,
ht = n_input >= 5 ? input[4] : 0;
hb = n_input >= 6 ? input[5] : 0;
- tab = tab_create (nc, nr);
- tab_headers (tab, hl, hr, ht, hb);
+ tab = tab_create (nc, nr, hl, hr, ht, hb);
for (r = 0; r < nr; r++)
for (c = 0; c < nc; c++)
if (tab_cell_is_empty (tab, c, r))