001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hssf.usermodel;
019:
020: import org.apache.poi.hssf.record.PrintSetupRecord;
021:
022: /**
023: * Used to modify the print setup.
024: * <P>
025: * Paper size constants have been added for the ones I have access
026: * to. They follow as:<br>
027: * public static final short LETTER_PAPERSIZE = 1;<br>
028: * public static final short LEGAL_PAPERSIZE = 5;<br>
029: * public static final short EXECUTIVE_PAPERSIZE = 7;<br>
030: * public static final short A4_PAPERSIZE = 9;<br>
031: * public static final short A5_PAPERSIZE = 11;<br>
032: * public static final short ENVELOPE_10_PAPERSIZE = 20;<br>
033: * public static final short ENVELOPE_DL_PAPERSIZE = 27;<br>
034: * public static final short ENVELOPE_CS_PAPERSIZE = 28;<br>
035: * public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
036: * <P>
037: * @author Shawn Laubach (slaubach at apache dot org) */
038: public class HSSFPrintSetup extends Object {
039: public static final short LETTER_PAPERSIZE = 1;
040: public static final short LEGAL_PAPERSIZE = 5;
041: public static final short EXECUTIVE_PAPERSIZE = 7;
042: public static final short A4_PAPERSIZE = 9;
043: public static final short A5_PAPERSIZE = 11;
044: public static final short ENVELOPE_10_PAPERSIZE = 20;
045: public static final short ENVELOPE_DL_PAPERSIZE = 27;
046: public static final short ENVELOPE_CS_PAPERSIZE = 28;
047: public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;
048: PrintSetupRecord printSetupRecord;
049:
050: /**
051: * Constructor. Takes the low level print setup record.
052: * @param printSetupRecord the low level print setup record
053: */
054: protected HSSFPrintSetup(PrintSetupRecord printSetupRecord) {
055: this .printSetupRecord = printSetupRecord;
056: }
057:
058: /**
059: * Set the paper size.
060: * @param size the paper size.
061: */
062: public void setPaperSize(short size) {
063: printSetupRecord.setPaperSize(size);
064: }
065:
066: /**
067: * Set the scale.
068: * @param scale the scale to use
069: */
070: public void setScale(short scale) {
071: printSetupRecord.setScale(scale);
072: }
073:
074: /**
075: * Set the page numbering start.
076: * @param start the page numbering start
077: */
078: public void setPageStart(short start) {
079: printSetupRecord.setPageStart(start);
080: }
081:
082: /**
083: * Set the number of pages wide to fit the sheet in
084: * @param width the number of pages
085: */
086: public void setFitWidth(short width) {
087: printSetupRecord.setFitWidth(width);
088: }
089:
090: /**
091: * Set the number of pages high to fit the sheet in
092: * @param height the number of pages
093: */
094: public void setFitHeight(short height) {
095: printSetupRecord.setFitHeight(height);
096: }
097:
098: /**
099: * Sets the options flags. Not advisable to do it directly.
100: * @param options The bit flags for the options
101: */
102: public void setOptions(short options) {
103: printSetupRecord.setOptions(options);
104: }
105:
106: /**
107: * Set whether to go left to right or top down in ordering
108: * @param ltor left to right
109: */
110: public void setLeftToRight(boolean ltor) {
111: printSetupRecord.setLeftToRight(ltor);
112: }
113:
114: /**
115: * Set whether to print in landscape
116: * @param ls landscape
117: */
118: public void setLandscape(boolean ls) {
119: printSetupRecord.setLandscape(!ls);
120: }
121:
122: /**
123: * Valid settings. I'm not for sure.
124: * @param valid Valid
125: */
126: public void setValidSettings(boolean valid) {
127: printSetupRecord.setValidSettings(valid);
128: }
129:
130: /**
131: * Set whether it is black and white
132: * @param mono Black and white
133: */
134: public void setNoColor(boolean mono) {
135: printSetupRecord.setNoColor(mono);
136: }
137:
138: /**
139: * Set whether it is in draft mode
140: * @param d draft
141: */
142: public void setDraft(boolean d) {
143: printSetupRecord.setDraft(d);
144: }
145:
146: /**
147: * Print the include notes
148: * @param printnotes print the notes
149: */
150: public void setNotes(boolean printnotes) {
151: printSetupRecord.setNotes(printnotes);
152: }
153:
154: /**
155: * Set no orientation. ?
156: * @param orientation Orientation.
157: */
158: public void setNoOrientation(boolean orientation) {
159: printSetupRecord.setNoOrientation(orientation);
160: }
161:
162: /**
163: * Set whether to use page start
164: * @param page Use page start
165: */
166: public void setUsePage(boolean page) {
167: printSetupRecord.setUsePage(page);
168: }
169:
170: /**
171: * Sets the horizontal resolution.
172: * @param resolution horizontal resolution
173: */
174: public void setHResolution(short resolution) {
175: printSetupRecord.setHResolution(resolution);
176: }
177:
178: /**
179: * Sets the vertical resolution.
180: * @param resolution vertical resolution
181: */
182: public void setVResolution(short resolution) {
183: printSetupRecord.setVResolution(resolution);
184: }
185:
186: /**
187: * Sets the header margin.
188: * @param headermargin header margin
189: */
190: public void setHeaderMargin(double headermargin) {
191: printSetupRecord.setHeaderMargin(headermargin);
192: }
193:
194: /**
195: * Sets the footer margin.
196: * @param footermargin footer margin
197: */
198: public void setFooterMargin(double footermargin) {
199: printSetupRecord.setFooterMargin(footermargin);
200: }
201:
202: /**
203: * Sets the number of copies.
204: * @param copies number of copies
205: */
206: public void setCopies(short copies) {
207: printSetupRecord.setCopies(copies);
208: }
209:
210: /**
211: * Returns the paper size.
212: * @return paper size
213: */
214: public short getPaperSize() {
215: return printSetupRecord.getPaperSize();
216: }
217:
218: /**
219: * Returns the scale.
220: * @return scale
221: */
222: public short getScale() {
223: return printSetupRecord.getScale();
224: }
225:
226: /**
227: * Returns the page start.
228: * @return page start
229: */
230: public short getPageStart() {
231: return printSetupRecord.getPageStart();
232: }
233:
234: /**
235: * Returns the number of pages wide to fit sheet in.
236: * @return number of pages wide to fit sheet in
237: */
238: public short getFitWidth() {
239: return printSetupRecord.getFitWidth();
240: }
241:
242: /**
243: * Returns the number of pages high to fit the sheet in.
244: * @return number of pages high to fit the sheet in
245: */
246: public short getFitHeight() {
247: return printSetupRecord.getFitHeight();
248: }
249:
250: /**
251: * Returns the bit flags for the options.
252: * @return bit flags for the options
253: */
254: public short getOptions() {
255: return printSetupRecord.getOptions();
256: }
257:
258: /**
259: * Returns the left to right print order.
260: * @return left to right print order
261: */
262: public boolean getLeftToRight() {
263: return printSetupRecord.getLeftToRight();
264: }
265:
266: /**
267: * Returns the landscape mode.
268: * @return landscape mode
269: */
270: public boolean getLandscape() {
271: return !printSetupRecord.getLandscape();
272: }
273:
274: /**
275: * Returns the valid settings.
276: * @return valid settings
277: */
278: public boolean getValidSettings() {
279: return printSetupRecord.getValidSettings();
280: }
281:
282: /**
283: * Returns the black and white setting.
284: * @return black and white setting
285: */
286: public boolean getNoColor() {
287: return printSetupRecord.getNoColor();
288: }
289:
290: /**
291: * Returns the draft mode.
292: * @return draft mode
293: */
294: public boolean getDraft() {
295: return printSetupRecord.getDraft();
296: }
297:
298: /**
299: * Returns the print notes.
300: * @return print notes
301: */
302: public boolean getNotes() {
303: return printSetupRecord.getNotes();
304: }
305:
306: /**
307: * Returns the no orientation.
308: * @return no orientation
309: */
310: public boolean getNoOrientation() {
311: return printSetupRecord.getNoOrientation();
312: }
313:
314: /**
315: * Returns the use page numbers.
316: * @return use page numbers
317: */
318: public boolean getUsePage() {
319: return printSetupRecord.getUsePage();
320: }
321:
322: /**
323: * Returns the horizontal resolution.
324: * @return horizontal resolution
325: */
326: public short getHResolution() {
327: return printSetupRecord.getHResolution();
328: }
329:
330: /**
331: * Returns the vertical resolution.
332: * @return vertical resolution
333: */
334: public short getVResolution() {
335: return printSetupRecord.getVResolution();
336: }
337:
338: /**
339: * Returns the header margin.
340: * @return header margin
341: */
342: public double getHeaderMargin() {
343: return printSetupRecord.getHeaderMargin();
344: }
345:
346: /**
347: * Returns the footer margin.
348: * @return footer margin
349: */
350: public double getFooterMargin() {
351: return printSetupRecord.getFooterMargin();
352: }
353:
354: /**
355: * Returns the number of copies.
356: * @return number of copies
357: */
358: public short getCopies() {
359: return printSetupRecord.getCopies();
360: }
361: }
|