KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > usermodel > HSSFPrintSetup


1 /* ====================================================================
2    Copyright 2003-2004 Apache Software Foundation
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 ==================================================================== */

16
17
18 package org.apache.poi.hssf.usermodel;
19
20 import org.apache.poi.hssf.record.PrintSetupRecord;
21
22 /**
23  * Used to modify the print setup.
24  * <P>
25  * Paper size constants have been added for the ones I have access
26  * to. They follow as:<br>
27  * public static final short LETTER_PAPERSIZE = 1;<br>
28  * public static final short LEGAL_PAPERSIZE = 5;<br>
29  * public static final short EXECUTIVE_PAPERSIZE = 7;<br>
30  * public static final short A4_PAPERSIZE = 9;<br>
31  * public static final short A5_PAPERSIZE = 11;<br>
32  * public static final short ENVELOPE_10_PAPERSIZE = 20;<br>
33  * public static final short ENVELOPE_DL_PAPERSIZE = 27;<br>
34  * public static final short ENVELOPE_CS_PAPERSIZE = 28;<br>
35  * public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
36  * <P>
37  * @author Shawn Laubach (slaubach at apache dot org) */

38 public class HSSFPrintSetup extends Object JavaDoc {
39     public static final short LETTER_PAPERSIZE = 1;
40     public static final short LEGAL_PAPERSIZE = 5;
41     public static final short EXECUTIVE_PAPERSIZE = 7;
42     public static final short A4_PAPERSIZE = 9;
43     public static final short A5_PAPERSIZE = 11;
44     public static final short ENVELOPE_10_PAPERSIZE = 20;
45     public static final short ENVELOPE_DL_PAPERSIZE = 27;
46     public static final short ENVELOPE_CS_PAPERSIZE = 28;
47     public static final short ENVELOPE_MONARCH_PAPERSIZE = 37;
48     PrintSetupRecord printSetupRecord;
49     
50     /**
51      * Constructor. Takes the low level print setup record.
52      * @param printSetupRecord the low level print setup record
53      */

54     protected HSSFPrintSetup(PrintSetupRecord printSetupRecord) {
55     this.printSetupRecord = printSetupRecord;
56     }
57     
58     /**
59      * Set the paper size.
60      * @param size the paper size.
61      */

62     public void setPaperSize(short size) {
63     printSetupRecord.setPaperSize(size);
64     }
65     
66     /**
67      * Set the scale.
68      * @param scale the scale to use
69      */

70     public void setScale(short scale) {
71     printSetupRecord.setScale(scale);
72     }
73     
74     /**
75      * Set the page numbering start.
76      * @param start the page numbering start
77      */

78     public void setPageStart(short start) {
79     printSetupRecord.setPageStart(start);
80     }
81     
82     /**
83      * Set the number of pages wide to fit the sheet in
84      * @param width the number of pages
85      */

86     public void setFitWidth(short width) {
87     printSetupRecord.setFitWidth(width);
88     }
89     
90     /**
91      * Set the number of pages high to fit the sheet in
92      * @param height the number of pages
93      */

94     public void setFitHeight(short height) {
95     printSetupRecord.setFitHeight(height);
96     }
97     
98     /**
99      * 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 }
Popular Tags