return true;
}
\f
+/* Renders a single output_item to an output device in one of two ways:
+
+ - 'print == true': Broken across multiple pages if necessary.
+
+ - 'print == false': In a single region that the user may scroll around if
+ needed.
+
+ Normally 'output_item' corresponds to a single rendering. There is a
+ special case when 'print == true' and 'output_item' is a table_item with
+ multiple layers and 'item->pt->table_look->print_all_layers == true'. In
+ that case, each layer is rendered separately from the FSM's internal point
+ of view; from the client's point of view, it is all one operation.
+*/
struct xr_fsm
{
struct xr_fsm_style *style;
struct output_item *item;
+ bool print;
/* Table items only. */
+ size_t *layer_indexes;
struct render_params rp;
struct render_pager *p;
cairo_t *cairo; /* XXX should this be here?! */
#define CHART_WIDTH 500
#define CHART_HEIGHT 375
-struct xr_fsm *
+static struct xr_fsm *
xr_fsm_create (const struct output_item *item_,
- const struct xr_fsm_style *style, cairo_t *cr)
+ const struct xr_fsm_style *style, cairo_t *cr,
+ bool print)
{
if (is_page_setup_item (item_)
|| is_group_open_item (item_)
|| is_chart_item (item)
|| is_page_eject_item (item));
+ size_t *layer_indexes = NULL;
+ if (is_table_item (item))
+ {
+ layer_indexes = pivot_table_next_layer (table_item->pt, NULL, print);
+ if (!layer_indexes)
+ return NULL;
+ }
+
static const struct render_ops xrr_render_ops = {
.measure_cell_width = xrr_measure_cell_width,
.measure_cell_height = xrr_measure_cell_height,
[RENDER_LINE_DOUBLE] = 2 * LW + LS,
};
+ size_t *layer_indexes = NULL;
+ if (is_table_item (item)
+ pivot_table_next_display_layer (
+
struct xr_fsm *fsm = xmalloc (sizeof *fsm);
*fsm = (struct xr_fsm) {
.style = xr_fsm_style_ref (style),
.item = item,
+ .print = print,
+ .layer_indexes = layer_indexes,
.rp = {
.ops = &xrr_render_ops,
.aux = fsm,
}
};
- if (is_table_item (item))
- {
- fsm->cairo = cr;
- fsm->p = render_pager_create (&fsm->rp, to_table_item (item));
- fsm->cairo = NULL;
- }
-
for (int i = 0; i < XR_N_FONTS; i++)
{
PangoContext *context = pango_cairo_create_context (cr);
g_object_unref (G_OBJECT (layout));
}
+ if (is_table_item (item))
+ {
+ struct table_item *table_item = to_table_item (item);
+
+ fsm->cairo = cr;
+ fsm->p = render_pager_create (&fsm->rp, table_item);
+ fsm->cairo = NULL;
+ }
+
return fsm;
}