#include "gettext.h"
#define _(msgid) gettext (msgid)
+/* This file uses TABLE_HORZ and TABLE_VERT enough to warrant abbreviating. */
+#define H TABLE_HORZ
+#define V TABLE_VERT
+
/* The desired maximum line length in the TeX file. */
#define TEX_LINE_MAX 80
static void
tex_put_footnote_markers (struct tex_driver *tex,
- const struct footnote **footnotes,
- size_t n_footnotes)
+ struct footnote **footnotes,
+ size_t n_footnotes)
{
if (n_footnotes > 0)
shipout (&tex->token_list, "$^{");
}
static void
-tex_put_table_item_text (struct tex_driver *tex,
- const struct table_item_text *text)
+tex_put_table_cell (struct tex_driver *tex, const struct table_cell *cell)
{
- tex_escape_string (tex, text->content, false);
- tex_put_footnote_markers (tex, text->footnotes, text->n_footnotes);
+ tex_escape_string (tex, cell->text, false);
+ tex_put_footnote_markers (tex, cell->footnotes, cell->n_footnotes);
}
static void
shipout (&tex->token_list, "\n{\\parindent=0pt\n");
- const struct table_item_text *caption = table_item_get_caption (item);
+ const struct table_cell *caption = table_item_get_caption (item);
if (caption)
{
shipout (&tex->token_list, "{\\sl ");
- tex_escape_string (tex, caption->content, false);
+ tex_escape_string (tex, caption->text, false);
shipout (&tex->token_list, "}\n\n");
}
- const struct footnote **f;
+ struct footnote **f;
size_t n_footnotes = table_collect_footnotes (item, &f);
- const struct table_item_text *title = table_item_get_title (item);
+ const struct table_cell *title = table_item_get_title (item);
const struct table_item_layers *layers = table_item_get_layers (item);
if (title || layers)
{
if (title)
{
shipout (&tex->token_list, "{\\bf ");
- tex_put_table_item_text (tex, title);
+ tex_put_table_cell (tex, title);
shipout (&tex->token_list, "}");
}
if (layers)
shipout (&tex->token_list, "\\offinterlineskip\\halign{\\strut%%\n");
/* Generate the preamble */
- for (int x = 0; x < table_nc (t); ++x)
+ for (int x = 0; x < t->n[H]; ++x)
{
- shipout (&tex->token_list, "{\\vbox{\\cell{%d}#}}", table_nc (t));
+ shipout (&tex->token_list, "{\\vbox{\\cell{%d}#}}", t->n[H]);
- if (x < table_nc (t) - 1)
+ if (x < t->n[H] - 1)
{
shipout (&tex->token_list, "\\hskip\\psppcolumnspace\\hfil");
shipout (&tex->token_list, "&\\vrule\n");
}
/* Emit the row data */
- for (int y = 0; y < table_nr (t); y++)
+ for (int y = 0; y < t->n[V]; y++)
{
- bool is_column_header = (y < table_ht (t)
- || y >= table_nr (t) - table_hb (t));
+ enum { H = TABLE_HORZ, V = TABLE_VERT };
+ bool is_column_header = y < t->h[V][0] || y >= t->n[V] - t->h[V][1];
int prev_x = -1;
int skipped = 0;
- for (int x = 0; x < table_nc (t);)
+ for (int x = 0; x < t->n[H];)
{
struct table_cell cell;
if (x != cell.d[TABLE_HORZ][0] || y != cell.d[TABLE_VERT][0])
goto next_1;
- /* bool is_header = (y < table_ht (t) */
- /* || y >= table_nr (t) - table_hb (t) */
- /* || x < table_hl (t) */
- /* || x >= table_nc (t) - table_hr (t)); */
-
+ /* bool is_header = (y < t->h[V][0] */
+ /* || y >= t->n[V] - t->h[V][1] */
+ /* || x < t->h[H][0] */
+ /* || x >= t->n[H] - t->h[H][1]); */
enum table_halign halign =
table_halign_interpret (cell.style->cell_style.halign,