cairo output works again
[pspp] / src / output / cairo-pager.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2009, 2010, 2014, 2020 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef OUTPUT_CAIRO_PAGER_H
18 #define OUTPUT_CAIRO_PAGER_H 1
19
20 #include <stdbool.h>
21
22 #ifdef HAVE_CAIRO
23
24 /* Cairo output driver paginater. */
25
26 #include <cairo/cairo.h>
27 #include <pango/pango-font.h>
28 #include "output/cairo-fsm.h"
29 #include "output/page-setup-item.h"
30 #include "output/table.h"
31
32 struct xr_page_style
33   {
34     int ref_cnt;
35
36     int size[TABLE_N_AXES];          /* Page size minus margins. */
37     int margins[TABLE_N_AXES][2];    /* Margins. */
38
39     struct page_heading headings[2]; /* Top and bottom headings. */
40     PangoFontDescription *font;
41
42     struct cell_color bg;            /* Background color. */
43     double font_scale;
44     int initial_page_number;
45     int object_spacing;
46   };
47 struct xr_page_style *xr_page_style_ref (const struct xr_page_style *);
48 void xr_page_style_unref (struct xr_page_style *);
49 bool xr_page_style_equals (const struct xr_page_style *,
50                            const struct xr_page_style *);
51 struct xr_page_style *xr_page_style_default (void);
52
53 static inline int
54 xr_page_style_paper_size (const struct xr_page_style *ps, enum table_axis a)
55 {
56   return ps->size[a] + ps->margins[a][0] + ps->margins[a][1];
57 }
58
59 struct xr_pager *xr_pager_create (const struct xr_page_style *);
60 void xr_pager_destroy (struct xr_pager *);
61
62 bool xr_pager_has_item (const struct xr_pager *);
63 void xr_pager_add_item (struct xr_pager *, const struct xr_fsm_style *,
64                         const struct output_item *);
65
66 bool xr_pager_has_page (const struct xr_pager *);
67 void xr_pager_add_page (struct xr_pager *, cairo_t *);
68 bool xr_pager_needs_new_page (struct xr_pager *);
69
70 #endif  /* HAVE_CAIRO */
71
72 #endif /* output/cairo-pager.h */