const struct cell_style *cell_style = cell->cell_style;
unsigned int options = cell->options;
- enum table_axis X = options & TAB_ROTATE ? V : H;
+ enum table_axis X = options & TABLE_CELL_ROTATE ? V : H;
enum table_axis Y = !X;
- int R = options & TAB_ROTATE ? 0 : 1;
+ int R = options & TABLE_CELL_ROTATE ? 0 : 1;
PangoFontDescription *desc = NULL;
if (font_style->typeface)
cell->cell_style->halign, numeric);
if (cell_style->halign == TABLE_HALIGN_DECIMAL
- && !(cell->options & TAB_ROTATE))
+ && !(cell->options & TABLE_CELL_ROTATE))
{
int margin_adjustment = -px_to_xr (cell_style->decimal_offset);
/* XXX should we report the error? */
}
}
- else if (options & TAB_ROTATE || bb[H][1] != INT_MAX)
+ else if (options & TABLE_CELL_ROTATE || bb[H][1] != INT_MAX)
{
const char *text = ds_cstr (&body);
const char *decimal = text + strcspn (text, ".,");
int footnote_adjustment = MIN (footnote_width, right_margin);
/* Adjust the bounding box. */
- if (options & TAB_ROTATE)
+ if (options & TABLE_CELL_ROTATE)
footnote_adjustment = -footnote_adjustment;
bb[X][R] += footnote_adjustment;
if (clip[H][0] != clip[H][1])
{
cairo_save (xr->cairo);
- if (!(options & TAB_ROTATE))
+ if (!(options & TABLE_CELL_ROTATE))
xr_clip (xr, clip);
- if (options & TAB_ROTATE)
+ if (options & TABLE_CELL_ROTATE)
{
int extra = bb[H][1] - bb[H][0] - size[V];
int halign_offset = extra > 0 ? extra / 2 : 0;
int h = pango_to_xr (size[Y]);
if (w > *widthp)
*widthp = w;
- if (bb[V][0] + h >= bb[V][1] && !(options & TAB_ROTATE))
+ if (bb[V][0] + h >= bb[V][1] && !(options & TABLE_CELL_ROTATE))
{
PangoLayoutIter *iter;
int best = 0;
break;
}
- if (cell->options & TAB_ROTATE)
+ if (cell->options & TABLE_CELL_ROTATE)
put_style (&style, "writing-mode", "sideways-lr");
if (cell->cell_style->valign != TABLE_VALIGN_TOP)
int style_idx, const struct pivot_value *value,
bool rotate_label)
{
- int options = style_idx << TAB_STYLE_SHIFT;
+ int options = style_idx << TABLE_CELL_STYLE_SHIFT;
if (rotate_label)
- options |= TAB_ROTATE;
+ options |= TABLE_CELL_ROTATE;
table_put (t, x1, y1, x2, y2, options, value);
}
fill_cell_owned (struct table *t, int x1, int y1, int x2, int y2,
int style_idx, struct string *s, bool rotate_label)
{
- int options = style_idx << TAB_STYLE_SHIFT;
+ int options = style_idx << TABLE_CELL_STYLE_SHIFT;
if (rotate_label)
- options |= TAB_ROTATE;
+ options |= TABLE_CELL_ROTATE;
table_put_owned (t, x1, y1, x2, y2, options,
pivot_value_new_user_text_nocopy (ds_steal_cstr (s)));
or both. */
int d[TABLE_N_AXES][2];
- unsigned int options; /* TAB_*. */
+ unsigned char options; /* TABLE_CELL_*. */
const struct pivot_value *value;
const struct font_style *font_style;
const struct cell_style *cell_style;
t->ref_cnt = 1;
t->cc = pool_calloc (t->container, nr * nc, sizeof *t->cc);
- t->ct = pool_calloc (t->container, nr * nc, sizeof *t->ct);
+ t->cp = pool_calloc (t->container, nr * nc, sizeof *t->cp);
t->rh = pool_nmalloc (t->container, nc, nr + 1);
memset (t->rh, TABLE_STROKE_NONE, nc * (nr + 1));
/* Fill TABLE cells (X1,X2)-(Y1,Y2), inclusive, with VALUE and OPT. */
void
table_put (struct table *table, int x1, int y1, int x2, int y2,
- unsigned opt, const struct pivot_value *value)
+ unsigned int opt, const struct pivot_value *value)
{
assert (0 <= x1 && x1 <= x2 && x2 < table->n[H]);
assert (0 <= y1 && y1 <= y2 && y2 < table->n[V]);
if (x1 == x2 && y1 == y2)
{
table->cc[x1 + y1 * table->n[H]] = CONST_CAST (struct pivot_value *, value);
- table->ct[x1 + y1 * table->n[H]] = opt;
+ table->cp[x1 + y1 * table->n[H]] = opt;
}
else
{
{
size_t ofs = x1 + y * table->n[H];
void **cc = &table->cc[ofs];
- unsigned short *ct = &table->ct[ofs];
+ unsigned char *ct = &table->cp[ofs];
for (int x = x1; x <= x2; x++)
{
*cc++ = cell;
- *ct++ = opt | TAB_JOIN;
+ *ct++ = opt | TABLE_CELL_JOIN;
}
}
}
assert (y >= 0 && y < t->n[TABLE_VERT]);
int index = x + y * t->n[H];
- unsigned short opt = t->ct[index];
+ unsigned char opt = t->cp[index];
const void *cc = t->cc[index];
struct table_area_style *style
- = t->styles[(opt & TAB_STYLE_MASK) >> TAB_STYLE_SHIFT];
+ = t->styles[(opt & TABLE_CELL_STYLE_MASK) >> TABLE_CELL_STYLE_SHIFT];
static const struct pivot_value empty_value = {
.text = {
},
};
- if (opt & TAB_JOIN)
+ if (opt & TABLE_CELL_JOIN)
{
const struct table_cell *jc = cc;
*cell = *jc;
void table_area_style_uninit (struct table_area_style *);
void table_area_style_free (struct table_area_style *);
-/* Properties of a table cell. */
+/* Cell properties. */
enum
{
- TAB_NONE = 0,
- TAB_ROTATE = 1 << 4, /* Rotate cell contents 90 degrees. */
-
- TAB_STYLE_SHIFT = 5,
- TAB_STYLE_MASK = 7 << TAB_STYLE_SHIFT,
-
- /* Internal use by tab.c only. */
- TAB_JOIN = 1 << 14,
+ TABLE_CELL_ROTATE = 1 << 0, /* Rotate cell contents 90 degrees. */
+ TABLE_CELL_JOIN = 1 << 1, /* Joined cell (internal use only). */
+ TABLE_CELL_STYLE_SHIFT = 2,
+ TABLE_CELL_STYLE_MASK = 7 << TABLE_CELL_STYLE_SHIFT,
};
/* A table. */
/* Table contents.
- Each array element in cc[] is ordinarily a "struct pivot_value *".
- If TAB_JOIN (defined in table.c) is set in ct[] for the element,
- however, it is a joined cell and the corresponding element of cc[]
- points to a struct table_cell. */
+ Each array element in cc[] is ordinarily a "struct pivot_value *". If
+ TABLE_CELL_JOIN is set in cp[] for the element, however, it is a joined
+ cell and the corresponding element of cc[] points to a struct
+ table_cell. */
void **cc; /* Cell contents; void *[nr][nc]. */
- unsigned short *ct; /* Cell types; unsigned short[nr][nc]. */
+ unsigned char *cp; /* Cell properties; unsigned char[nr][nc]. */
struct table_area_style *styles[8];
/* Rules. */