1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2009, 2010, 2011, 2018 Free Sonftware 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 int halign; /* TAB_LEFT, TAB_CENTER, TAB_RIGHT. */
51 struct page_paragraph *paragraphs;
55 void page_heading_copy (struct page_heading *, const struct page_heading *);
56 void page_heading_uninit (struct page_heading *);
60 int initial_page_number;
61 double paper[TABLE_N_AXES]; /* Paper size in inches. */
62 double margins[TABLE_N_AXES][2]; /* In inches. */
63 enum page_orientation orientation;
64 double object_spacing; /* Space between objects, in inches. */
65 enum page_chart_size chart_size;
66 struct page_heading headings[2]; /* Header and footer. */
70 #define PAGE_SETUP_INITIALIZER \
72 .initial_page_number = 1, \
73 .paper = { [TABLE_HORZ] = 8.5, [TABLE_VERT] = 11.0 }, \
74 .margins = { { 0.5, 0.5 }, { 0.5, 0.5 } }, \
75 .orientation = PAGE_PORTRAIT, \
76 .object_spacing = 12.0 / 72.0, \
77 .chart_size = PAGE_CHART_AS_IS, \
80 struct page_setup *page_setup_clone (const struct page_setup *);
81 void page_setup_destroy (struct page_setup *);
83 /* A page setup item. */
84 struct page_setup_item
86 struct output_item output_item;
87 struct page_setup *page_setup;
90 struct page_setup_item *page_setup_item_create (const struct page_setup *);
92 /* This boilerplate for page_setup_item, a subclass of output_item, was
93 autogenerated by mk-class-boilerplate. */
96 #include "libpspp/cast.h"
98 extern const struct output_item_class page_setup_item_class;
100 /* Returns true if SUPER is a page_setup_item, otherwise false. */
102 is_page_setup_item (const struct output_item *super)
104 return super->class == &page_setup_item_class;
107 /* Returns SUPER converted to page_setup_item. SUPER must be a page_setup_item, as
108 reported by is_page_setup_item. */
109 static inline struct page_setup_item *
110 to_page_setup_item (const struct output_item *super)
112 assert (is_page_setup_item (super));
113 return UP_CAST (super, struct page_setup_item, output_item);
116 /* Returns INSTANCE converted to output_item. */
117 static inline struct output_item *
118 page_setup_item_super (const struct page_setup_item *instance)
120 return CONST_CAST (struct output_item *, &instance->output_item);
123 /* Increments INSTANCE's reference count and returns INSTANCE. */
124 static inline struct page_setup_item *
125 page_setup_item_ref (const struct page_setup_item *instance)
127 return to_page_setup_item (output_item_ref (&instance->output_item));
130 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
131 the reference count is now zero. */
133 page_setup_item_unref (struct page_setup_item *instance)
135 output_item_unref (&instance->output_item);
138 /* Returns true if INSTANCE's reference count is greater than 1,
141 page_setup_item_is_shared (const struct page_setup_item *instance)
143 return output_item_is_shared (&instance->output_item);
146 void page_setup_item_submit (struct page_setup_item *);
148 #endif /* output/page-setup-item.h */