work on docs
[pspp] / src / output / page-setup.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2009, 2010, 2011, 2018 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_PAGE_SETUP_H
18 #define OUTPUT_PAGE_SETUP_H 1
19
20 /* Page setup.
21
22    Configures the paper size, margins, header and footer, and other attributes
23    used for printing. */
24
25 #include <stdbool.h>
26 #include "table.h"
27
28 enum page_orientation
29   {
30     PAGE_PORTRAIT,
31     PAGE_LANDSCAPE
32   };
33
34 enum page_chart_size
35   {
36     PAGE_CHART_AS_IS,
37     PAGE_CHART_FULL_HEIGHT,
38     PAGE_CHART_HALF_HEIGHT,
39     PAGE_CHART_QUARTER_HEIGHT,
40   };
41
42 struct page_paragraph
43   {
44     char *markup;
45     enum table_halign halign;
46   };
47
48 bool page_paragraph_equals (const struct page_paragraph *,
49                             const struct page_paragraph *);
50
51 struct page_heading
52   {
53     struct page_paragraph *paragraphs;
54     size_t n;
55   };
56
57 void page_heading_copy (struct page_heading *, const struct page_heading *);
58 void page_heading_uninit (struct page_heading *);
59 bool page_heading_equals (const struct page_heading *,
60                           const struct page_heading *);
61
62 struct page_setup
63   {
64     int initial_page_number;
65     double paper[TABLE_N_AXES];         /* Paper size in inches. */
66     double margins[TABLE_N_AXES][2];    /* In inches. */
67     enum page_orientation orientation;
68     double object_spacing;      /* Space between objects, in inches. */
69     enum page_chart_size chart_size;
70     struct page_heading headings[2]; /* Header and footer. */
71     char *file_name;
72   };
73
74 #define PAGE_SETUP_INITIALIZER                                          \
75     {                                                                   \
76         .initial_page_number = 1,                                       \
77         .paper = { [TABLE_HORZ] = 8.5, [TABLE_VERT] = 11.0 },           \
78         .margins = { { 0.5, 0.5 }, { 0.5, 0.5 } },                      \
79         .orientation = PAGE_PORTRAIT,                                   \
80         .object_spacing = 12.0 / 72.0,                                  \
81         .chart_size = PAGE_CHART_AS_IS,                                 \
82     }
83
84 struct page_setup *page_setup_clone (const struct page_setup *);
85 void page_setup_destroy (struct page_setup *);
86
87 #endif /* output/page-setup.h */