GUI: reduce vertical size of the toolbar area
[gnumeric.git] / src / print-info.h
blobd97a44e0c3545a67fe9f7dce41c8a05608e360d7
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_PRINT_INFO_H_
3 # define _GNM_PRINT_INFO_H_
5 #include "gnumeric.h"
6 #include <gtk/gtk.h>
7 #include "print.h"
9 G_BEGIN_DECLS
11 GType gnm_print_comment_placement_get_type (void);
12 #define GNM_PRINT_COMMENT_PLACEMENT_TYPE (gnm_print_comment_placement_get_type ())
14 GType gnm_print_errors_get_type (void);
15 #define GNM_PRINT_ERRORS_TYPE (gnm_print_errors_get_type ())
18 typedef struct {
19 GtkUnit top, bottom, left, right, header, footer;
20 } GnmPrintDesiredDisplay;
22 /* Header/Footer definition */
23 typedef struct {
24 char *left_format;
25 char *middle_format;
26 char *right_format;
27 } GnmPrintHF;
29 typedef enum {
30 GNM_PRINT_COMMENTS_NONE,
31 GNM_PRINT_COMMENTS_IN_PLACE,
32 GNM_PRINT_COMMENTS_AT_END
33 } GnmPrintCommentPlacementType;
35 typedef enum {
36 GNM_PRINT_ERRORS_AS_DISPLAYED,
37 GNM_PRINT_ERRORS_AS_BLANK,
38 GNM_PRINT_ERRORS_AS_DASHES,
39 GNM_PRINT_ERRORS_AS_NA
40 } GnmPrintErrorsType;
42 typedef enum {
43 GNM_PAGE_BREAK_NONE, /* Not actually a page break */
44 GNM_PAGE_BREAK_MANUAL, /* hard page break */
45 GNM_PAGE_BREAK_AUTO, /* soft (automatic) pagebreak */
46 GNM_PAGE_BREAK_DATA_SLICE /* place holder ? */
47 } GnmPageBreakType;
48 GnmPageBreakType gnm_page_break_type_from_str (char const *str);
50 typedef struct {
51 int pos; /* break before this 0 based position */
52 GnmPageBreakType type;
53 } GnmPageBreak;
55 typedef struct {
56 gboolean is_vert;
57 GArray *details; /* ordered array of GnmPageBreak */
58 } GnmPageBreaks;
60 struct GnmPrintInformation_ {
61 struct GnmPrintInfoScaling_ {
62 enum GnmPrintScaleType_ {
63 PRINT_SCALE_PERCENTAGE,
64 PRINT_SCALE_FIT_PAGES
65 } type;
67 /* We store separate x and y scales internally, for the
68 * 'fit-to' printing feature. (They are calculated at print-time)
69 * When the user is doing the simple scaling, both these values
70 * will be equal.
72 struct _PrintScalePercent {
73 double x;
74 double y;
75 } percentage;
77 struct _PrintScaleDim { /* zero == use as many as required */
78 int cols;
79 int rows;
80 } dim;
81 } scaling;
82 double edge_to_below_header;
83 double edge_to_above_footer;
84 GnmPrintDesiredDisplay desired_display;
85 char *repeat_top, *repeat_left;
86 unsigned int print_across_then_down;
87 unsigned int center_vertically:1;
88 unsigned int center_horizontally:1;
89 unsigned int print_grid_lines:1;
90 unsigned int print_titles:1; /* col/row headers */
91 unsigned int print_black_and_white:1;
92 unsigned int print_as_draft:1;
94 /* Gnumeric specific */
95 unsigned int print_even_if_only_styles:1;
96 unsigned int do_not_print:1;
98 GnmPrintCommentPlacementType comment_placement;
99 GnmPrintErrorsType error_display;
101 struct _PrintInfoPageBreaks {
102 GnmPageBreaks *h, /* between rows */
103 *v; /* between columns */
104 } page_breaks;
105 GnmPrintHF *header, *footer;
107 int start_page; /* < 0 implies auto */
108 int n_copies;
110 gchar *printtofile_uri;
111 PrintRange print_range;
113 /* page_setup doubles as a flag whether the defaults are loaded */
114 GtkPageSetup *page_setup;
117 typedef enum {
118 HF_RENDER_PRINT
119 } GnmPrintHFRenderType;
121 typedef struct {
122 Sheet const *sheet;
123 int page;
124 int pages;
125 GnmValue *date_time;
126 GODateConventions const *date_conv;
127 GnmRange page_area;
128 GnmCellPos top_repeating;
129 } GnmPrintHFRenderInfo;
131 GType gnm_print_information_get_type (void);
132 GnmPrintInformation *gnm_print_information_new (gboolean load_defaults);
133 GnmPrintInformation *gnm_print_info_load_defaults (GnmPrintInformation *pi);
134 GnmPrintInformation *gnm_print_info_dup (GnmPrintInformation const *pi);
135 void gnm_print_info_free (GnmPrintInformation *pi);
136 void gnm_print_info_save (GnmPrintInformation *pi);
138 GtkPageSetup *gnm_print_info_get_page_setup (GnmPrintInformation *pi); /* Does not return a ref! */
139 void gnm_print_info_set_page_setup (GnmPrintInformation *pi, GtkPageSetup *page_setup);
141 GType gnm_print_hf_get_type (void);
142 GnmPrintHF *gnm_print_hf_new (char const *left,
143 char const *middle,
144 char const *right);
145 void gnm_print_hf_free (GnmPrintHF *print_hf);
146 GnmPrintHF *gnm_print_hf_copy (GnmPrintHF const *source);
147 GnmPrintHF *gnm_print_hf_register (GnmPrintHF *hf);
148 gboolean gnm_print_hf_same (GnmPrintHF const *a, GnmPrintHF const *b);
150 char *gnm_print_hf_format_render (char const *format,
151 GnmPrintHFRenderInfo *info,
152 GnmPrintHFRenderType render_type);
154 GType gnm_print_hf_render_info_get_type (void);
155 GnmPrintHFRenderInfo *gnm_print_hf_render_info_new (void);
156 void gnm_print_hf_render_info_destroy (GnmPrintHFRenderInfo *hfi);
159 GtkUnit unit_name_to_unit (char const *name);
160 char const *unit_to_unit_name (GtkUnit unit);
162 void print_init (void);
163 void print_shutdown (void);
165 gboolean page_setup_set_paper (GtkPageSetup *page_setup, char const *paper);
166 char *page_setup_get_paper (GtkPageSetup *page_setup); /* caller frees result */
167 gboolean print_info_set_paper (GnmPrintInformation *pi, char const *paper);
168 char *print_info_get_paper (GnmPrintInformation *pi); /* caller frees result */
169 GtkPaperSize *print_info_get_paper_size (GnmPrintInformation *pi);
171 void print_info_set_paper_orientation (GnmPrintInformation *pi,
172 GtkPageOrientation orientation);
173 char const *print_info_get_paper_display_name (GnmPrintInformation *pi);
175 double print_info_get_paper_width (GnmPrintInformation *pi, GtkUnit unit);
176 double print_info_get_paper_height (GnmPrintInformation *pi, GtkUnit unit);
177 GtkPageOrientation print_info_get_paper_orientation (GnmPrintInformation *pi);
178 void print_info_get_margins (GnmPrintInformation *pi,
179 double *top, double *bottom,
180 double *left, double *right,
181 double *edge_to_below_header,
182 double *edge_to_above_footer);
183 void print_info_set_margins (GnmPrintInformation *pi,
184 double header, double footer, double left, double right);
185 void print_info_set_margin_header (GnmPrintInformation *pi, double header);
186 void print_info_set_margin_footer (GnmPrintInformation *pi, double footer);
187 void print_info_set_margin_left (GnmPrintInformation *pi, double left);
188 void print_info_set_margin_right (GnmPrintInformation *pi, double right);
189 void print_info_set_edge_to_above_footer (GnmPrintInformation *pi,
190 double e_f);
191 void print_info_set_edge_to_below_header (GnmPrintInformation *pi,
192 double e_h);
193 void print_info_set_printtofile_uri (GnmPrintInformation *pi,
194 gchar const *uri);
195 void print_info_set_printtofile_from_settings
196 (GnmPrintInformation *pi,
197 GtkPrintSettings *settings,
198 gchar const *default_uri);
199 void print_info_set_from_settings
200 (GnmPrintInformation *pi,
201 GtkPrintSettings *settings);
202 char const *print_info_get_printtofile_uri (GnmPrintInformation *pi);
203 PrintRange print_info_get_printrange (GnmPrintInformation *pi);
204 void print_info_set_printrange (GnmPrintInformation *pi, PrintRange pr);
206 void print_info_set_breaks (GnmPrintInformation *pi, GnmPageBreaks *breaks);
208 gboolean print_info_has_manual_breaks (GnmPrintInformation *pi);
210 GType gnm_page_breaks_get_type (void);
211 GnmPageBreaks *gnm_page_breaks_new (gboolean is_vert);
212 GnmPageBreaks *gnm_page_breaks_dup (GnmPageBreaks const *src);
213 void gnm_page_breaks_free (GnmPageBreaks *breaks);
214 void gnm_page_breaks_clean (GnmPageBreaks *breaks);
215 gboolean gnm_page_breaks_append_break (GnmPageBreaks *breaks,
216 int pos,
217 GnmPageBreakType type);
218 gboolean gnm_page_breaks_set_break (GnmPageBreaks *breaks,
219 int pos,
220 GnmPageBreakType type);
221 GnmPageBreakType gnm_page_breaks_get_break (GnmPageBreaks *breaks, int pos);
222 int gnm_page_breaks_get_next_manual_break (GnmPageBreaks *breaks, int pos);
223 int gnm_page_breaks_get_next_break (GnmPageBreaks *breaks, int pos);
224 GnmPageBreaks * gnm_page_breaks_dup_non_auto_breaks (GnmPageBreaks const *src);
226 gboolean print_load_repeat_range (char const *str, GnmRange *r, Sheet const *sheet);
230 /* Formats known */
231 extern GList *gnm_print_hf_formats;
233 G_END_DECLS
235 #endif /* _GNM_PRINT_INFO_H_ */