#include "libpspp/cast.h"
#include "libpspp/compiler.h"
+#include "libpspp/pool.h"
#include "libpspp/str.h"
#include "output/table-item.h"
}
\f
struct cell_style *
-cell_style_clone (const struct cell_style *old)
+cell_style_clone (struct pool *pool, const struct cell_style *old)
{
- struct cell_style *new = xmalloc (sizeof *new);
+ struct cell_style *new = pool_malloc (pool, sizeof *new);
*new = *old;
- if (new->font)
- new->font = strdup (new->font);
+ if (new->typeface)
+ new->typeface = pool_strdup (pool, new->typeface);
return new;
}
{
if (style)
{
- free (style->font);
+ free (style->typeface);
free (style);
}
}
between that cell and cell (0,1); and so on, up to (0,NR), which runs
horizontally below cell (0,NR-1). */
int
-table_get_rule (const struct table *table, enum table_axis axis, int x, int y)
+table_get_rule (const struct table *table, enum table_axis axis, int x, int y,
+ struct cell_color *color)
{
assert (x >= 0 && x < table->n[TABLE_HORZ] + (axis == TABLE_HORZ));
assert (y >= 0 && y < table->n[TABLE_VERT] + (axis == TABLE_VERT));
- return table->klass->get_rule (table, axis, x, y);
+ *color = CELL_COLOR_BLACK;
+ return table->klass->get_rule (table, axis, x, y, color);
}
void
-cell_contents_format_footnote_markers (const struct cell_contents *c,
- struct string *s)
+table_cell_format_footnote_markers (const struct table_cell *cell,
+ struct string *s)
{
- for (size_t i = 0; i < c->n_footnotes; i++)
+ for (size_t i = 0; i < cell->n_footnotes; i++)
{
if (i)
ds_put_byte (s, ',');
- ds_put_cstr (s, c->footnotes[i]->marker);
+ ds_put_cstr (s, cell->footnotes[i]->marker);
}
}
table_get_cell (t, x, y, &cell);
if (x == cell.d[TABLE_HORZ][0] && y == cell.d[TABLE_VERT][0])
- for (size_t i = 0; i < cell.n_contents; i++)
- {
- const struct cell_contents *c = &cell.contents[i];
- footnotes = add_footnotes (c->footnotes, c->n_footnotes,
- footnotes, &allocated, &n);
- }
+ footnotes = add_footnotes (cell.footnotes, cell.n_footnotes,
+ footnotes, &allocated, &n);
table_cell_free (&cell);
}
}
static int
table_unshared_get_rule (const struct table *tiu_,
- enum table_axis axis, int x, int y)
+ enum table_axis axis, int x, int y,
+ struct cell_color *color)
{
struct table_unshared *tiu = table_unshared_cast (tiu_);
- return table_get_rule (tiu->subtable, axis, x, y);
+ return table_get_rule (tiu->subtable, axis, x, y, color);
}
static const struct table_class table_unshared_class =
cell->d[TABLE_HORZ][1] = 1;
cell->d[TABLE_VERT][0] = 0;
cell->d[TABLE_VERT][1] = 1;
- cell->contents = &cell->inline_contents;
- cell->inline_contents.options = ts->options;
- cell->inline_contents.text = ts->string;
- cell->inline_contents.n_footnotes = 0;
- cell->n_contents = 1;
+ cell->options = ts->options;
+ cell->text = ts->string;
+ cell->n_footnotes = 0;
cell->destructor = NULL;
}
static int
table_string_get_rule (const struct table *ts UNUSED,
- enum table_axis axis UNUSED, int x UNUSED, int y UNUSED)
+ enum table_axis axis UNUSED, int x UNUSED, int y UNUSED,
+ struct cell_color *color UNUSED)
{
return TAL_0;
}