1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2009, 2010, 2011, 2018 Free Software Foundation, Inc.
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.
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.
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/>. */
17 #ifndef OUTPUT_PAGE_SETUP_ITEM_H
18 #define OUTPUT_PAGE_SETUP_ITEM_H 1
22 A page setup item configures the paper size, margins, header and footer,
23 and other attributes used for printing. */
26 #include "output/output-item.h"
38 PAGE_CHART_FULL_HEIGHT,
39 PAGE_CHART_HALF_HEIGHT,
40 PAGE_CHART_QUARTER_HEIGHT,
46 enum table_halign halign;
49 bool page_paragraph_equals (const struct page_paragraph *,
50 const struct page_paragraph *);
54 struct page_paragraph *paragraphs;
58 void page_heading_copy (struct page_heading *, const struct page_heading *);
59 void page_heading_uninit (struct page_heading *);
60 bool page_heading_equals (const struct page_heading *,
61 const struct page_heading *);
65 int initial_page_number;
66 double paper[TABLE_N_AXES]; /* Paper size in inches. */
67 double margins[TABLE_N_AXES][2]; /* In inches. */
68 enum page_orientation orientation;
69 double object_spacing; /* Space between objects, in inches. */
70 enum page_chart_size chart_size;
71 struct page_heading headings[2]; /* Header and footer. */
75 #define PAGE_SETUP_INITIALIZER \
77 .initial_page_number = 1, \
78 .paper = { [TABLE_HORZ] = 8.5, [TABLE_VERT] = 11.0 }, \
79 .margins = { { 0.5, 0.5 }, { 0.5, 0.5 } }, \
80 .orientation = PAGE_PORTRAIT, \
81 .object_spacing = 12.0 / 72.0, \
82 .chart_size = PAGE_CHART_AS_IS, \
85 struct page_setup *page_setup_clone (const struct page_setup *);
86 void page_setup_destroy (struct page_setup *);
88 /* A page setup item. */
89 struct page_setup_item
91 struct output_item output_item;
92 struct page_setup *page_setup;
95 struct page_setup_item *page_setup_item_create (const struct page_setup *);
97 /* This boilerplate for page_setup_item, a subclass of output_item, was
98 autogenerated by mk-class-boilerplate. */
101 #include "libpspp/cast.h"
103 extern const struct output_item_class page_setup_item_class;
105 /* Returns true if SUPER is a page_setup_item, otherwise false. */
107 is_page_setup_item (const struct output_item *super)
109 return super->class == &page_setup_item_class;
112 /* Returns SUPER converted to page_setup_item. SUPER must be a page_setup_item, as
113 reported by is_page_setup_item. */
114 static inline struct page_setup_item *
115 to_page_setup_item (const struct output_item *super)
117 assert (is_page_setup_item (super));
118 return UP_CAST (super, struct page_setup_item, output_item);
121 /* Returns INSTANCE converted to output_item. */
122 static inline struct output_item *
123 page_setup_item_super (const struct page_setup_item *instance)
125 return CONST_CAST (struct output_item *, &instance->output_item);
128 /* Increments INSTANCE's reference count and returns INSTANCE. */
129 static inline struct page_setup_item *
130 page_setup_item_ref (const struct page_setup_item *instance)
132 return to_page_setup_item (output_item_ref (&instance->output_item));
135 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
136 the reference count is now zero. */
138 page_setup_item_unref (struct page_setup_item *instance)
140 output_item_unref (&instance->output_item);
143 /* Returns true if INSTANCE's reference count is greater than 1,
146 page_setup_item_is_shared (const struct page_setup_item *instance)
148 return output_item_is_shared (&instance->output_item);
151 void page_setup_item_submit (struct page_setup_item *);
153 #endif /* output/page-setup-item.h */