1    /* ====================================================================
2     * The Apache Software License, Version 1.1
3     *
4     * Copyright (c) 2002 The Apache Software Foundation.  All rights
5     * reserved.
6     *
7     * Redistribution and use in source and binary forms, with or without
8     * modification, are permitted provided that the following conditions
9     * are met:
10    *
11    * 1. Redistributions of source code must retain the above copyright
12    *    notice, this list of conditions and the following disclaimer.
13    *
14    * 2. Redistributions in binary form must reproduce the above copyright
15    *    notice, this list of conditions and the following disclaimer in
16    *    the documentation and/or other materials provided with the
17    *    distribution.
18    *
19    * 3. The end-user documentation included with the redistribution,
20    *    if any, must include the following acknowledgment:
21    *       "This product includes software developed by the
22    *        Apache Software Foundation (http://www.apache.org/)."
23    *    Alternately, this acknowledgment may appear in the software itself,
24    *    if and wherever such third-party acknowledgments normally appear.
25    *
26    * 4. The names "Apache" and "Apache Software Foundation" and
27    *    "Apache POI" must not be used to endorse or promote products
28    *    derived from this software without prior written permission. For
29    *    written permission, please contact apache@apache.org.
30    *
31    * 5. Products derived from this software may not be called "Apache",
32    *    "Apache POI", nor may "Apache" appear in their name, without
33    *    prior written permission of the Apache Software Foundation.
34    *
35    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46    * SUCH DAMAGE.
47    * ====================================================================
48    *
49    * This software consists of voluntary contributions made by many
50    * individuals on behalf of the Apache Software Foundation.  For more
51    * information on the Apache Software Foundation, please see
52    * <http://www.apache.org/>.
53    */
54   
55   package org.apache.poi.hssf.usermodel;
56   
57   import org.apache.poi.hssf.record.PrintSetupRecord;
58   
59   /**
60    * Used to modify the print setup.
61    * <P>
62    * @author Shawn Laubach (laubach@acm.org)
63    */
64   public class HSSFPrintSetup extends Object {
65   
66       PrintSetupRecord printSetupRecord;
67   
68       /**
69        * Constructor.  Takes the low level print setup record.
70        * @param printSetupRecord the low level print setup record
71        */
72       protected HSSFPrintSetup(PrintSetupRecord printSetupRecord) {
73   	this.printSetupRecord = printSetupRecord;
74       }
75   
76       /**
77        * Set the paper size.
78        * @param size the paper size.
79        */
80       public void setPaperSize(short size)
81       {
82   	printSetupRecord.setPaperSize(size);
83       }
84   
85       /**
86        * Set the scale.
87        * @param scale the scale to use
88        */
89       public void setScale(short scale)
90       {
91   	printSetupRecord.setScale(scale);
92       }
93   
94       /**
95        * Set the page numbering start.
96        * @param start the page numbering start
97        */
98       public void setPageStart(short start)
99       {
100  	printSetupRecord.setPageStart(start);
101      }
102  
103      /**
104       * Set the number of pages wide to fit the sheet in
105       * @param width the number of pages
106       */
107      public void setFitWidth(short width)
108      {
109  	printSetupRecord.setFitWidth(width);
110      }
111  
112      /**
113       * Set the number of pages high to fit the sheet in
114       * @param height the number of pages
115       */
116      public void setFitHeight(short height)
117      {
118  	printSetupRecord.setFitHeight(height);
119      }
120  
121  
122      /**
123       * Sets the options flags.  Not advisable to do it directly.
124       * @param options The bit flags for the options
125       */
126      public void setOptions(short options)
127      {
128  	printSetupRecord.setOptions(options);
129      }
130  
131  
132      /**
133       * Set whether to go left to right or top down in ordering
134       * @param ltor left to right
135       */
136      public void setLeftToRight(boolean ltor)
137      {
138  	printSetupRecord.setLeftToRight(ltor);
139      }
140  
141      /**
142       * Set whether to print in landscape
143       * @param ls landscape
144       */
145      public void setLandscape(boolean ls)
146      {
147  	printSetupRecord.setLandscape(!ls);
148      }
149  
150      /**
151       * Valid settings.  I'm not for sure.
152       * @param valid Valid
153       */
154      public void setValidSettings(boolean valid)
155      {
156  	printSetupRecord.setValidSettings(valid);
157      }
158  
159  
160      /**
161       * Set whether it is black and white
162       * @param mono Black and white
163       */
164      public void setNoColor(boolean mono)
165      {
166  	printSetupRecord.setNoColor(mono);
167      }
168  
169      /**
170       * Set whether it is in draft mode
171       * @param d draft
172       */
173      public void setDraft(boolean d)
174      {
175  	printSetupRecord.setDraft(d);
176      }
177  
178      /**
179       * Print the include notes
180       * @param printnotes print the notes
181       */
182      public void setNotes(boolean printnotes)
183      {
184  	printSetupRecord.setNotes(printnotes);
185      }
186  
187      /**
188       * Set no orientation. ?
189       * @param orientation Orientation.
190       */
191      public void setNoOrientation(boolean orientation)
192      {
193  	printSetupRecord.setNoOrientation(orientation);
194      }
195  
196      /**
197       * Set whether to use page start
198       * @param page Use page start
199       */
200      public void setUsePage(boolean page)
201      {
202  	printSetupRecord.setUsePage(page);
203      }
204  
205      /**
206       * Sets the horizontal resolution.
207       * @param resolution horizontal resolution
208       */
209      public void setHResolution(short resolution)
210      {
211  	printSetupRecord.setHResolution(resolution);
212      }
213  
214      /**
215       * Sets the vertical resolution.
216       * @param resolution vertical resolution
217       */
218      public void setVResolution(short resolution)
219      {
220  	printSetupRecord.setVResolution(resolution);
221      }
222  
223      /**
224       * Sets the header margin.
225       * @param headermargin header margin
226       */
227      public void setHeaderMargin(double headermargin)
228      {
229  	printSetupRecord.setHeaderMargin(headermargin);
230      }
231  
232      /**
233       * Sets the footer margin.
234       * @param footermargin footer margin
235       */
236      public void setFooterMargin(double footermargin)
237      {
238  	printSetupRecord.setFooterMargin(footermargin);
239      }
240  
241      /**
242       * Sets the number of copies.
243       * @param copies number of copies
244       */
245      public void setCopies(short copies)
246      {
247  	printSetupRecord.setCopies(copies);
248      }
249  
250      /**
251       * Returns the paper size.
252       * @return paper size
253       */
254      public short getPaperSize()
255      {
256          return printSetupRecord.getPaperSize();
257      }
258  
259      /**
260       * Returns the scale.
261       * @return scale
262       */
263      public short getScale()
264      {
265          return printSetupRecord.getScale();
266      }
267  
268      /**
269       * Returns the page start.
270       * @return page start
271       */
272      public short getPageStart()
273      {
274          return printSetupRecord.getPageStart();
275      }
276  
277      /**
278       * Returns the number of pages wide to fit sheet in.
279       * @return number of pages wide to fit sheet in
280       */
281      public short getFitWidth()
282      {
283          return printSetupRecord.getFitWidth();
284      }
285  
286      /**
287       * Returns the number of pages high to fit the sheet in.
288       * @return number of pages high to fit the sheet in
289       */
290      public short getFitHeight()
291      {
292          return printSetupRecord.getFitHeight();
293      }
294  
295      /**
296       * Returns the bit flags for the options.
297       * @return bit flags for the options
298       */
299      public short getOptions()
300      {
301          return printSetupRecord.getOptions();
302      }
303  
304      /**
305       * Returns the left to right print order.
306       * @return left to right print order
307       */
308      public boolean getLeftToRight()
309      {
310          return printSetupRecord.getLeftToRight();
311      }
312  
313      /**
314       * Returns the landscape mode.
315       * @return landscape mode
316       */
317      public boolean getLandscape()
318      {
319          return !printSetupRecord.getLandscape();
320      }
321  
322      /**
323       * Returns the valid settings.
324       * @return valid settings
325       */
326      public boolean getValidSettings()
327      {
328          return printSetupRecord.getValidSettings();
329      }
330  
331      /**
332       * Returns the black and white setting.
333       * @return black and white setting
334       */
335      public boolean getNoColor()
336      {
337          return printSetupRecord.getNoColor();
338      }
339  
340      /**
341       * Returns the draft mode.
342       * @return draft mode
343       */
344      public boolean getDraft()
345      {
346          return printSetupRecord.getDraft();
347      }
348  
349      /**
350       * Returns the print notes.
351       * @return print notes
352       */
353      public boolean getNotes()
354      {
355          return printSetupRecord.getNotes();
356      }
357  
358      /**
359       * Returns the no orientation.
360       * @return no orientation
361       */
362      public boolean getNoOrientation()
363      {
364          return printSetupRecord.getNoOrientation();
365      }
366  
367      /**
368       * Returns the use page numbers.
369       * @return use page numbers
370       */
371      public boolean getUsePage()
372      {
373          return printSetupRecord.getUsePage();
374      }
375  
376      /**
377       * Returns the horizontal resolution.
378       * @return horizontal resolution
379       */
380      public short getHResolution()
381      {
382          return printSetupRecord.getHResolution();
383      }
384  
385      /**
386       * Returns the vertical resolution.
387       * @return vertical resolution
388       */
389      public short getVResolution()
390      {
391          return printSetupRecord.getVResolution();
392      }
393  
394      /**
395       * Returns the header margin.
396       * @return header margin
397       */
398      public double getHeaderMargin()
399      {
400          return printSetupRecord.getHeaderMargin();
401      }
402  
403      /**
404       * Returns the footer margin.
405       * @return footer margin
406       */
407      public double getFooterMargin()
408      {
409          return printSetupRecord.getFooterMargin();
410      }
411  
412      /**
413       * Returns the number of copies.
414       * @return number of copies
415       */
416      public short getCopies()
417      {
418          return printSetupRecord.getCopies();
419      }
420  }
421