1    /* ====================================================================
2    
3     * The Apache Software License, Version 1.1
4    
5     *
6    
7     * Copyright (c) 2002 The Apache Software Foundation.  All rights
8    
9     * reserved.
10   
11    *
12   
13    * Redistribution and use in source and binary forms, with or without
14   
15    * modification, are permitted provided that the following conditions
16   
17    * are met:
18   
19    *
20   
21    * 1. Redistributions of source code must retain the above copyright
22   
23    *    notice, this list of conditions and the following disclaimer.
24   
25    *
26   
27    * 2. Redistributions in binary form must reproduce the above copyright
28   
29    *    notice, this list of conditions and the following disclaimer in
30   
31    *    the documentation and/or other materials provided with the
32   
33    *    distribution.
34   
35    *
36   
37    * 3. The end-user documentation included with the redistribution,
38   
39    *    if any, must include the following acknowledgment:
40   
41    *       "This product includes software developed by the
42   
43    *        Apache Software Foundation (http://www.apache.org/)."
44   
45    *    Alternately, this acknowledgment may appear in the software itself,
46   
47    *    if and wherever such third-party acknowledgments normally appear.
48   
49    *
50   
51    * 4. The names "Apache" and "Apache Software Foundation" and
52   
53    *    "Apache POI" must not be used to endorse or promote products
54   
55    *    derived from this software without prior written permission. For
56   
57    *    written permission, please contact apache@apache.org.
58   
59    *
60   
61    * 5. Products derived from this software may not be called "Apache",
62   
63    *    "Apache POI", nor may "Apache" appear in their name, without
64   
65    *    prior written permission of the Apache Software Foundation.
66   
67    *
68   
69    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
70   
71    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
72   
73    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
74   
75    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
76   
77    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
78   
79    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
80   
81    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
82   
83    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
84   
85    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
86   
87    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
88   
89    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
90   
91    * SUCH DAMAGE.
92   
93    * ====================================================================
94   
95    *
96   
97    * This software consists of voluntary contributions made by many
98   
99    * individuals on behalf of the Apache Software Foundation.  For more
100  
101   * information on the Apache Software Foundation, please see
102  
103   * <http://www.apache.org/>.
104  
105   */
106  
107  
108  
109  package org.apache.poi.hssf.usermodel;
110  
111  
112  
113  import org.apache.poi.hssf.record.PrintSetupRecord;
114  
115  
116  
117  /**
118  
119   * Used to modify the print setup.
120  
121   * <P>
122  
123   * @author Shawn Laubach (laubach@acm.org)
124  
125   */
126  
127  public class HSSFPrintSetup extends Object {
128  
129  
130  
131      PrintSetupRecord printSetupRecord;
132  
133  
134  
135      /**
136  
137       * Constructor.  Takes the low level print setup record.
138  
139       * @param printSetupRecord the low level print setup record
140  
141       */
142  
143      protected HSSFPrintSetup(PrintSetupRecord printSetupRecord) {
144  
145  	this.printSetupRecord = printSetupRecord;
146  
147      }
148  
149  
150  
151      /**
152  
153       * Set the paper size.
154  
155       * @param size the paper size.
156  
157       */
158  
159      public void setPaperSize(short size)
160  
161      {
162  
163  	printSetupRecord.setPaperSize(size);
164  
165      }
166  
167  
168  
169      /**
170  
171       * Set the scale.
172  
173       * @param scale the scale to use
174  
175       */
176  
177      public void setScale(short scale)
178  
179      {
180  
181  	printSetupRecord.setScale(scale);
182  
183      }
184  
185  
186  
187      /**
188  
189       * Set the page numbering start.
190  
191       * @param start the page numbering start
192  
193       */
194  
195      public void setPageStart(short start)
196  
197      {
198  
199  	printSetupRecord.setPageStart(start);
200  
201      }
202  
203  
204  
205      /**
206  
207       * Set the number of pages wide to fit the sheet in
208  
209       * @param width the number of pages
210  
211       */
212  
213      public void setFitWidth(short width)
214  
215      {
216  
217  	printSetupRecord.setFitWidth(width);
218  
219      }
220  
221  
222  
223      /**
224  
225       * Set the number of pages high to fit the sheet in
226  
227       * @param height the number of pages
228  
229       */
230  
231      public void setFitHeight(short height)
232  
233      {
234  
235  	printSetupRecord.setFitHeight(height);
236  
237      }
238  
239  
240  
241  
242  
243      /**
244  
245       * Sets the options flags.  Not advisable to do it directly.
246  
247       * @param options The bit flags for the options
248  
249       */
250  
251      public void setOptions(short options)
252  
253      {
254  
255  	printSetupRecord.setOptions(options);
256  
257      }
258  
259  
260  
261  
262  
263      /**
264  
265       * Set whether to go left to right or top down in ordering
266  
267       * @param ltor left to right
268  
269       */
270  
271      public void setLeftToRight(boolean ltor)
272  
273      {
274  
275  	printSetupRecord.setLeftToRight(ltor);
276  
277      }
278  
279  
280  
281      /**
282  
283       * Set whether to print in landscape
284  
285       * @param ls landscape
286  
287       */
288  
289      public void setLandscape(boolean ls)
290  
291      {
292  
293  	printSetupRecord.setLandscape(!ls);
294  
295      }
296  
297  
298  
299      /**
300  
301       * Valid settings.  I'm not for sure.
302  
303       * @param valid Valid
304  
305       */
306  
307      public void setValidSettings(boolean valid)
308  
309      {
310  
311  	printSetupRecord.setValidSettings(valid);
312  
313      }
314  
315  
316  
317  
318  
319      /**
320  
321       * Set whether it is black and white
322  
323       * @param mono Black and white
324  
325       */
326  
327      public void setNoColor(boolean mono)
328  
329      {
330  
331  	printSetupRecord.setNoColor(mono);
332  
333      }
334  
335  
336  
337      /**
338  
339       * Set whether it is in draft mode
340  
341       * @param d draft
342  
343       */
344  
345      public void setDraft(boolean d)
346  
347      {
348  
349  	printSetupRecord.setDraft(d);
350  
351      }
352  
353  
354  
355      /**
356  
357       * Print the include notes
358  
359       * @param printnotes print the notes
360  
361       */
362  
363      public void setNotes(boolean printnotes)
364  
365      {
366  
367  	printSetupRecord.setNotes(printnotes);
368  
369      }
370  
371  
372  
373      /**
374  
375       * Set no orientation. ?
376  
377       * @param orientation Orientation.
378  
379       */
380  
381      public void setNoOrientation(boolean orientation)
382  
383      {
384  
385  	printSetupRecord.setNoOrientation(orientation);
386  
387      }
388  
389  
390  
391      /**
392  
393       * Set whether to use page start
394  
395       * @param page Use page start
396  
397       */
398  
399      public void setUsePage(boolean page)
400  
401      {
402  
403  	printSetupRecord.setUsePage(page);
404  
405      }
406  
407  
408  
409      /**
410  
411       * Sets the horizontal resolution.
412  
413       * @param resolution horizontal resolution
414  
415       */
416  
417      public void setHResolution(short resolution)
418  
419      {
420  
421  	printSetupRecord.setHResolution(resolution);
422  
423      }
424  
425  
426  
427      /**
428  
429       * Sets the vertical resolution.
430  
431       * @param resolution vertical resolution
432  
433       */
434  
435      public void setVResolution(short resolution)
436  
437      {
438  
439  	printSetupRecord.setVResolution(resolution);
440  
441      }
442  
443  
444  
445      /**
446  
447       * Sets the header margin.
448  
449       * @param headermargin header margin
450  
451       */
452  
453      public void setHeaderMargin(double headermargin)
454  
455      {
456  
457  	printSetupRecord.setHeaderMargin(headermargin);
458  
459      }
460  
461  
462  
463      /**
464  
465       * Sets the footer margin.
466  
467       * @param footermargin footer margin
468  
469       */
470  
471      public void setFooterMargin(double footermargin)
472  
473      {
474  
475  	printSetupRecord.setFooterMargin(footermargin);
476  
477      }
478  
479  
480  
481      /**
482  
483       * Sets the number of copies.
484  
485       * @param copies number of copies
486  
487       */
488  
489      public void setCopies(short copies)
490  
491      {
492  
493  	printSetupRecord.setCopies(copies);
494  
495      }
496  
497  
498  
499      /**
500  
501       * Returns the paper size.
502  
503       * @return paper size
504  
505       */
506  
507      public short getPaperSize()
508  
509      {
510  
511          return printSetupRecord.getPaperSize();
512  
513      }
514  
515  
516  
517      /**
518  
519       * Returns the scale.
520  
521       * @return scale
522  
523       */
524  
525      public short getScale()
526  
527      {
528  
529          return printSetupRecord.getScale();
530  
531      }
532  
533  
534  
535      /**
536  
537       * Returns the page start.
538  
539       * @return page start
540  
541       */
542  
543      public short getPageStart()
544  
545      {
546  
547          return printSetupRecord.getPageStart();
548  
549      }
550  
551  
552  
553      /**
554  
555       * Returns the number of pages wide to fit sheet in.
556  
557       * @return number of pages wide to fit sheet in
558  
559       */
560  
561      public short getFitWidth()
562  
563      {
564  
565          return printSetupRecord.getFitWidth();
566  
567      }
568  
569  
570  
571      /**
572  
573       * Returns the number of pages high to fit the sheet in.
574  
575       * @return number of pages high to fit the sheet in
576  
577       */
578  
579      public short getFitHeight()
580  
581      {
582  
583          return printSetupRecord.getFitHeight();
584  
585      }
586  
587  
588  
589      /**
590  
591       * Returns the bit flags for the options.
592  
593       * @return bit flags for the options
594  
595       */
596  
597      public short getOptions()
598  
599      {
600  
601          return printSetupRecord.getOptions();
602  
603      }
604  
605  
606  
607      /**
608  
609       * Returns the left to right print order.
610  
611       * @return left to right print order
612  
613       */
614  
615      public boolean getLeftToRight()
616  
617      {
618  
619          return printSetupRecord.getLeftToRight();
620  
621      }
622  
623  
624  
625      /**
626  
627       * Returns the landscape mode.
628  
629       * @return landscape mode
630  
631       */
632  
633      public boolean getLandscape()
634  
635      {
636  
637          return !printSetupRecord.getLandscape();
638  
639      }
640  
641  
642  
643      /**
644  
645       * Returns the valid settings.
646  
647       * @return valid settings
648  
649       */
650  
651      public boolean getValidSettings()
652  
653      {
654  
655          return printSetupRecord.getValidSettings();
656  
657      }
658  
659  
660  
661      /**
662  
663       * Returns the black and white setting.
664  
665       * @return black and white setting
666  
667       */
668  
669      public boolean getNoColor()
670  
671      {
672  
673          return printSetupRecord.getNoColor();
674  
675      }
676  
677  
678  
679      /**
680  
681       * Returns the draft mode.
682  
683       * @return draft mode
684  
685       */
686  
687      public boolean getDraft()
688  
689      {
690  
691          return printSetupRecord.getDraft();
692  
693      }
694  
695  
696  
697      /**
698  
699       * Returns the print notes.
700  
701       * @return print notes
702  
703       */
704  
705      public boolean getNotes()
706  
707      {
708  
709          return printSetupRecord.getNotes();
710  
711      }
712  
713  
714  
715      /**
716  
717       * Returns the no orientation.
718  
719       * @return no orientation
720  
721       */
722  
723      public boolean getNoOrientation()
724  
725      {
726  
727          return printSetupRecord.getNoOrientation();
728  
729      }
730  
731  
732  
733      /**
734  
735       * Returns the use page numbers.
736  
737       * @return use page numbers
738  
739       */
740  
741      public boolean getUsePage()
742  
743      {
744  
745          return printSetupRecord.getUsePage();
746  
747      }
748  
749  
750  
751      /**
752  
753       * Returns the horizontal resolution.
754  
755       * @return horizontal resolution
756  
757       */
758  
759      public short getHResolution()
760  
761      {
762  
763          return printSetupRecord.getHResolution();
764  
765      }
766  
767  
768  
769      /**
770  
771       * Returns the vertical resolution.
772  
773       * @return vertical resolution
774  
775       */
776  
777      public short getVResolution()
778  
779      {
780  
781          return printSetupRecord.getVResolution();
782  
783      }
784  
785  
786  
787      /**
788  
789       * Returns the header margin.
790  
791       * @return header margin
792  
793       */
794  
795      public double getHeaderMargin()
796  
797      {
798  
799          return printSetupRecord.getHeaderMargin();
800  
801      }
802  
803  
804  
805      /**
806  
807       * Returns the footer margin.
808  
809       * @return footer margin
810  
811       */
812  
813      public double getFooterMargin()
814  
815      {
816  
817          return printSetupRecord.getFooterMargin();
818  
819      }
820  
821  
822  
823      /**
824  
825       * Returns the number of copies.
826  
827       * @return number of copies
828  
829       */
830  
831      public short getCopies()
832  
833      {
834  
835          return printSetupRecord.getCopies();
836  
837      }
838  
839  }
840  
841  ???????????????????????????????????????????????????????????????????????????????????????????????????????????????HSSFPrintSetup?????????????????????????????????????Object?????PrintSetupRecord??????????????????????printSetupRecord???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????HSSFPrintSetup??????????????????????????????PrintSetupRecord??????????????????????????printSetupRecord??????????????????????????????????????????????????????????????????????????????????????????????????setPaperSize??printSetupRecord???????????????????setPaperSize????????????????????????????????size???????????????????????????????????????????????????????????????????????????????????????????????setScale??printSetupRecord???????????????????setScale????????????????????????????scale??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????setPageStart??printSetupRecord???????????????????setPageStart????????????????????????????????start????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????setFitWidth??printSetupRecord???????????????????setFitWidth???????????????????????????????width?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????setFitHeight??printSetupRecord???????????????????setFitHeight????????????????????????????????height?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????setOptions??printSetupRecord???????????????????setOptions??????????????????????????????options????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????setLeftToRight??printSetupRecord???????????????????setLeftToRight??????????????????????????????????ltor????????????????????????????????????????????????????????????????????????????????????????????????????????setLandscape??printSetupRecord???????????????????setLandscape?????????????????????????????????ls????????????????????????????????????????????????????????????????????????????????????????????????????????setValidSettings??printSetupRecord???????????????????setValidSettings????????????????????????????????????valid????????????????????????????????????????????????????????????????????????????????????????????????????????????????setNoColor??printSetupRecord???????????????????setNoColor??????????????????????????????mono?????????????????????????????????????????????????????????????????????????????????????????????????setDraft??printSetupRecord???????????????????setDraft????????????????????????????d????????????????????????????????????????????????????????????????????????????????????????????????????????????setNotes??printSetupRecord???????????????????setNotes????????????????????????????printnotes????????????????????????????????????????????????????????????????????????????????????????????????????????setNoOrientation??printSetupRecord???????????????????setNoOrientation????????????????????????????????????orientation???????????????????????????????????????????????????????????????????????????????????????????????????????????setUsePage??printSetupRecord???????????????????setUsePage??????????????????????????????page??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????setHResolution??printSetupRecord???????????????????setHResolution??????????????????????????????????resolution??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????setVResolution??printSetupRecord???????????????????setVResolution??????????????????????????????????resolution????????????????????????????????????????????????????????????????????????????????????????????????????????????setHeaderMargin??printSetupRecord???????????????????setHeaderMargin???????????????????????????????????headermargin????????????????????????????????????????????????????????????????????????????????????????????????????????????setFooterMargin??printSetupRecord???????????????????setFooterMargin???????????????????????????????????footermargin????????????????????????????????????????????????????????????????????????????????????????????????????????????setCopies??printSetupRecord???????????????????setCopies?????????????????????????????copies??????????????????????????????????????????????????????????????????????????????????????????????getPaperSize????????????????printSetupRecord?????????????????????????????????getPaperSize????????????????????????????????????????????????????????????????????????????????????getScale????????????????printSetupRecord?????????????????????????????????getScale??????????????????????????????????????????????????????????????????????????????????????????????getPageStart????????????????printSetupRecord?????????????????????????????????getPageStart??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????getFitWidth????????????????printSetupRecord?????????????????????????????????getFitWidth??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????getFitHeight????????????????printSetupRecord?????????????????????????????????getFitHeight????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????getOptions????????????????printSetupRecord?????????????????????????????????getOptions??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????getLeftToRight????????????????printSetupRecord?????????????????????????????????getLeftToRight????????????????????????????????????????????????????????????????????????????????????????????????????????getLandscape?????????????????printSetupRecord??????????????????????????????????getLandscape????????????????????????????????????????????????????????????????????????????????????????????????????????getValidSettings????????????????printSetupRecord?????????????????????????????????getValidSettings??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????getNoColor????????????????printSetupRecord?????????????????????????????????getNoColor????????????????????????????????????????????????????????????????????????????????????????????????getDraft????????????????printSetupRecord?????????????????????????????????getDraft??????????????????????????????????????????????????????????????????????????????????????????????????getNotes????????????????printSetupRecord?????????????????????????????????getNotes????????????????????????????????????????????????????????????????????????????????????????????????????????getNoOrientation????????????????printSetupRecord?????????????????????????????????getNoOrientation????????????????????????????????????????????????????????????????????????????????????????????????????????????getUsePage????????????????printSetupRecord?????????????????????????????????getUsePage????????????????????????????????????????????????????????????????????????????????????????????????????????????????????getHResolution????????????????printSetupRecord?????????????????????????????????getHResolution????????????????????????????????????????????????????????????????????????????????????????????????????????????????getVResolution????????????????printSetupRecord?????????????????????????????????getVResolution?????????????????????????????????????????????????????????????????????????????????????????????????????getHeaderMargin????????????????printSetupRecord?????????????????????????????????getHeaderMargin?????????????????????????????????????????????????????????????????????????????????????????????????????getFooterMargin????????????????printSetupRecord?????????????????????????????????getFooterMargin??????????????????????????????????????????????????????????????????????????????????????????????????????????getCopies????????????????printSetupRecord?????????????????????????????????getCopies