-/* Prepare table T for submission, and submit it. */
-static void
-submit (struct crosstabs_proc *proc, struct pivot_table *pt,
- struct tab_table *t)
-{
- struct crosstabs_dim_aux *aux;
- int i;
-
- if (t == NULL)
- return;
-
- tab_resize (t, -1, 0);
- if (tab_nr (t) == tab_t (t))
- {
- tab_destroy (t);
- return;
- }
- tab_offset (t, 0, 0);
- if (pt != NULL)
- for (i = 2; i < pt->n_vars; i++)
- tab_text (t, pt->n_vars - i - 1, 0, TAB_RIGHT | TAT_TITLE,
- var_to_string (pt->vars[i]));
- tab_box (t, TAL_2, TAL_2, -1, -1, 0, 0, tab_nc (t) - 1, tab_nr (t) - 1);
- tab_box (t, -1, -1, -1, TAL_1, tab_l (t), tab_t (t) - 1, tab_nc (t) - 1,
- tab_nr (t) - 1);
- tab_box (t, -1, -1, -1, TAL_GAP, 0, tab_t (t), tab_l (t) - 1,
- tab_nr (t) - 1);
- tab_vline (t, TAL_2, tab_l (t), 0, tab_nr (t) - 1);
-
- aux = xmalloc (sizeof *aux);
- aux->exclude = proc->exclude;
- tab_dim (t, crosstabs_dim, crosstabs_dim_free, aux);
-
- tab_submit (t);
-}
-
-/* Sets the widths of all the columns and heights of all the rows in
- table T for driver D. */
-static void
-crosstabs_dim (struct tab_rendering *r, void *aux_)
-{
- const struct tab_table *t = r->table;
- struct outp_driver *d = r->driver;
- struct crosstabs_dim_aux *aux = aux_;
- int i;
-
- /* Width of a numerical column. */
- int c = outp_string_width (d, "0.000000", OUTP_PROPORTIONAL);
- if (aux->exclude == MV_NEVER)
- c += outp_string_width (d, "M", OUTP_PROPORTIONAL);
-
- /* Set width for header columns. */
- if (t->l != 0)
- {
- size_t i;
- int w;
-
- w = d->width - c * (t->nc - t->l);
- for (i = 0; i <= t->nc; i++)
- w -= r->wrv[i];
- w /= t->l;
-
- if (w < d->prop_em_width * 8)
- w = d->prop_em_width * 8;
-
- if (w > d->prop_em_width * 15)
- w = d->prop_em_width * 15;
-
- for (i = 0; i < t->l; i++)
- r->w[i] = w;
- }
-
- for (i = t->l; i < t->nc; i++)
- r->w[i] = c;
-
- for (i = 0; i < t->nr; i++)
- r->h[i] = tab_natural_height (r, i);
-}
-
-static void
-crosstabs_dim_free (void *aux_)
-{
- struct crosstabs_dim_aux *aux = aux_;
- free (aux);
-}
-