Inspired by bug #44958 - Record level support for Data Tables. (No formula parser...
[poi.git] / src / java / org / apache / poi / hssf / usermodel / HSSFPrintSetup.java
blob713f44b3d96382c1b703f0ca0a71b38eda2b8df2
1 /* ====================================================================
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 ==================================================================== */
19 package org.apache.poi.hssf.usermodel;
21 import org.apache.poi.hssf.record.PrintSetupRecord;
23 /**
24 * Used to modify the print setup.
25 * <P>
26 * Paper size constants have been added for the ones I have access
27 * to. They follow as:<br>
28 * public static final short LETTER_PAPERSIZE = 1;<br>
29 * public static final short LEGAL_PAPERSIZE = 5;<br>
30 * public static final short EXECUTIVE_PAPERSIZE = 7;<br>
31 * public static final short A4_PAPERSIZE = 9;<br>
32 * public static final short A5_PAPERSIZE = 11;<br>
33 * public static final short ENVELOPE_10_PAPERSIZE = 20;<br>
34 * public static final short ENVELOPE_DL_PAPERSIZE = 27;<br>
35 * public static final short ENVELOPE_CS_PAPERSIZE = 28;<br>
36 * public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
37 * <P>
38 * @author Shawn Laubach (slaubach at apache dot org) */
39 public class HSSFPrintSetup extends Object {
40 public static final short LETTER_PAPERSIZE = 1;
41 public static final short LEGAL_PAPERSIZE = 5;
42 public static final short EXECUTIVE_PAPERSIZE = 7;
43 public static final short A4_PAPERSIZE = 9;
44 public static final short A5_PAPERSIZE = 11;
45 public static final short ENVELOPE_10_PAPERSIZE = 20;
46 public static final short ENVELOPE_DL_PAPERSIZE = 27;
47 public static final short ENVELOPE_CS_PAPERSIZE = 28;
48 public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;
49 PrintSetupRecord printSetupRecord;
51 /**
52 * Constructor. Takes the low level print setup record.
53 * @param printSetupRecord the low level print setup record
55 protected HSSFPrintSetup(PrintSetupRecord printSetupRecord) {
56 this.printSetupRecord = printSetupRecord;
59 /**
60 * Set the paper size.
61 * @param size the paper size.
63 public void setPaperSize(short size) {
64 printSetupRecord.setPaperSize(size);
67 /**
68 * Set the scale.
69 * @param scale the scale to use
71 public void setScale(short scale) {
72 printSetupRecord.setScale(scale);
75 /**
76 * Set the page numbering start.
77 * @param start the page numbering start
79 public void setPageStart(short start) {
80 printSetupRecord.setPageStart(start);
83 /**
84 * Set the number of pages wide to fit the sheet in
85 * @param width the number of pages
87 public void setFitWidth(short width) {
88 printSetupRecord.setFitWidth(width);
91 /**
92 * Set the number of pages high to fit the sheet in
93 * @param height the number of pages
95 public void setFitHeight(short height) {
96 printSetupRecord.setFitHeight(height);
99 /**
100 * Sets the options flags. Not advisable to do it directly.
101 * @param options The bit flags for the options
103 public void setOptions(short options) {
104 printSetupRecord.setOptions(options);
107 /**
108 * Set whether to go left to right or top down in ordering
109 * @param ltor left to right
111 public void setLeftToRight(boolean ltor) {
112 printSetupRecord.setLeftToRight(ltor);
115 /**
116 * Set whether to print in landscape
117 * @param ls landscape
119 public void setLandscape(boolean ls) {
120 printSetupRecord.setLandscape(!ls);
123 /**
124 * Valid settings. I'm not for sure.
125 * @param valid Valid
127 public void setValidSettings(boolean valid) {
128 printSetupRecord.setValidSettings(valid);
131 /**
132 * Set whether it is black and white
133 * @param mono Black and white
135 public void setNoColor(boolean mono) {
136 printSetupRecord.setNoColor(mono);
139 /**
140 * Set whether it is in draft mode
141 * @param d draft
143 public void setDraft(boolean d) {
144 printSetupRecord.setDraft(d);
147 /**
148 * Print the include notes
149 * @param printnotes print the notes
151 public void setNotes(boolean printnotes) {
152 printSetupRecord.setNotes(printnotes);
155 /**
156 * Set no orientation. ?
157 * @param orientation Orientation.
159 public void setNoOrientation(boolean orientation) {
160 printSetupRecord.setNoOrientation(orientation);
163 /**
164 * Set whether to use page start
165 * @param page Use page start
167 public void setUsePage(boolean page) {
168 printSetupRecord.setUsePage(page);
171 /**
172 * Sets the horizontal resolution.
173 * @param resolution horizontal resolution
175 public void setHResolution(short resolution) {
176 printSetupRecord.setHResolution(resolution);
179 /**
180 * Sets the vertical resolution.
181 * @param resolution vertical resolution
183 public void setVResolution(short resolution) {
184 printSetupRecord.setVResolution(resolution);
187 /**
188 * Sets the header margin.
189 * @param headermargin header margin
191 public void setHeaderMargin(double headermargin) {
192 printSetupRecord.setHeaderMargin(headermargin);
195 /**
196 * Sets the footer margin.
197 * @param footermargin footer margin
199 public void setFooterMargin(double footermargin) {
200 printSetupRecord.setFooterMargin(footermargin);
203 /**
204 * Sets the number of copies.
205 * @param copies number of copies
207 public void setCopies(short copies) {
208 printSetupRecord.setCopies(copies);
211 /**
212 * Returns the paper size.
213 * @return paper size
215 public short getPaperSize() {
216 return printSetupRecord.getPaperSize();
219 /**
220 * Returns the scale.
221 * @return scale
223 public short getScale() {
224 return printSetupRecord.getScale();
227 /**
228 * Returns the page start.
229 * @return page start
231 public short getPageStart() {
232 return printSetupRecord.getPageStart();
235 /**
236 * Returns the number of pages wide to fit sheet in.
237 * @return number of pages wide to fit sheet in
239 public short getFitWidth() {
240 return printSetupRecord.getFitWidth();
243 /**
244 * Returns the number of pages high to fit the sheet in.
245 * @return number of pages high to fit the sheet in
247 public short getFitHeight() {
248 return printSetupRecord.getFitHeight();
251 /**
252 * Returns the bit flags for the options.
253 * @return bit flags for the options
255 public short getOptions() {
256 return printSetupRecord.getOptions();
259 /**
260 * Returns the left to right print order.
261 * @return left to right print order
263 public boolean getLeftToRight() {
264 return printSetupRecord.getLeftToRight();
267 /**
268 * Returns the landscape mode.
269 * @return landscape mode
271 public boolean getLandscape() {
272 return !printSetupRecord.getLandscape();
275 /**
276 * Returns the valid settings.
277 * @return valid settings
279 public boolean getValidSettings() {
280 return printSetupRecord.getValidSettings();
283 /**
284 * Returns the black and white setting.
285 * @return black and white setting
287 public boolean getNoColor() {
288 return printSetupRecord.getNoColor();
291 /**
292 * Returns the draft mode.
293 * @return draft mode
295 public boolean getDraft() {
296 return printSetupRecord.getDraft();
299 /**
300 * Returns the print notes.
301 * @return print notes
303 public boolean getNotes() {
304 return printSetupRecord.getNotes();
307 /**
308 * Returns the no orientation.
309 * @return no orientation
311 public boolean getNoOrientation() {
312 return printSetupRecord.getNoOrientation();
315 /**
316 * Returns the use page numbers.
317 * @return use page numbers
319 public boolean getUsePage() {
320 return printSetupRecord.getUsePage();
323 /**
324 * Returns the horizontal resolution.
325 * @return horizontal resolution
327 public short getHResolution() {
328 return printSetupRecord.getHResolution();
331 /**
332 * Returns the vertical resolution.
333 * @return vertical resolution
335 public short getVResolution() {
336 return printSetupRecord.getVResolution();
339 /**
340 * Returns the header margin.
341 * @return header margin
343 public double getHeaderMargin() {
344 return printSetupRecord.getHeaderMargin();
347 /**
348 * Returns the footer margin.
349 * @return footer margin
351 public double getFooterMargin() {
352 return printSetupRecord.getFooterMargin();
355 /**
356 * Returns the number of copies.
357 * @return number of copies
359 public short getCopies() {
360 return printSetupRecord.getCopies();