1 /*
2  * HomePrint.java 27 juil. 07
3  *
4  * Sweet Home 3D, Copyright (c) 2007 Emmanuel PUYBARET / eTeks <info@eteks.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 package com.eteks.sweethome3d.model;
21 
22 import java.io.Serializable;
23 
24 /**
25  * The print attributes for a home.
26  * @author Emmanuel Puybaret
27  */
28 public class HomePrint implements Serializable {
29   /**
30    * Paper orientation.
31    */
32   public enum PaperOrientation {PORTRAIT, LANDSCAPE, REVERSE_LANDSCAPE};
33 
34   private static final long serialVersionUID = -2868070768300325498L;
35 
36   private final PaperOrientation paperOrientation;
37   private final float            paperWidth;
38   private final float            paperHeight;
39   private final float            paperTopMargin;
40   private final float            paperLeftMargin;
41   private final float            paperBottomMargin;
42   private final float            paperRightMargin;
43   private final boolean          furniturePrinted;
44   private final boolean          planPrinted;
45   private final boolean          view3DPrinted;
46   private final Float            planScale;
47   private final String           headerFormat;
48   private final String           footerFormat;
49 
50 
51   /**
52    * Create a print attributes for home from the given parameters.
53    */
HomePrint(PaperOrientation paperOrientation, float paperWidth, float paperHeight, float paperTopMargin, float paperLeftMargin, float paperBottomMargin, float paperRightMargin, boolean furniturePrinted, boolean planPrinted, boolean view3DPrinted, Float planScale, String headerFormat, String footerFormat)54   public HomePrint(PaperOrientation paperOrientation,
55                    float paperWidth,
56                    float paperHeight,
57                    float paperTopMargin,
58                    float paperLeftMargin,
59                    float paperBottomMargin,
60                    float paperRightMargin,
61                    boolean furniturePrinted,
62                    boolean planPrinted,
63                    boolean view3DPrinted,
64                    Float planScale,
65                    String headerFormat,
66                    String footerFormat) {
67     this.paperOrientation = paperOrientation;
68     this.paperWidth = paperWidth;
69     this.paperHeight = paperHeight;
70     this.paperTopMargin = paperTopMargin;
71     this.paperLeftMargin = paperLeftMargin;
72     this.paperBottomMargin = paperBottomMargin;
73     this.paperRightMargin = paperRightMargin;
74     this.furniturePrinted = furniturePrinted;
75     this.planPrinted = planPrinted;
76     this.view3DPrinted = view3DPrinted;
77     this.planScale = planScale;
78     this.headerFormat = headerFormat;
79     this.footerFormat = footerFormat;
80   }
81 
82   /**
83    * Returns the paper orientation.
84    */
getPaperOrientation()85   public PaperOrientation getPaperOrientation() {
86     return this.paperOrientation;
87   }
88 
89   /**
90    * Returns the margin at paper bottom in 1/72nds of an inch.
91    */
getPaperBottomMargin()92   public float getPaperBottomMargin() {
93     return this.paperBottomMargin;
94   }
95 
96   /**
97    * Returns the paper height in 1/72nds of an inch.
98    */
getPaperHeight()99   public float getPaperHeight() {
100     return this.paperHeight;
101   }
102 
103   /**
104    * Returns the margin at paper left in 1/72nds of an inch.
105    */
getPaperLeftMargin()106   public float getPaperLeftMargin() {
107     return this.paperLeftMargin;
108   }
109 
110   /**
111    * Returns the margin at paper right in 1/72nds of an inch.
112    */
getPaperRightMargin()113   public float getPaperRightMargin() {
114     return this.paperRightMargin;
115   }
116 
117   /**
118    * Returns the margin at paper top in 1/72nds of an inch.
119    */
getPaperTopMargin()120   public float getPaperTopMargin() {
121     return this.paperTopMargin;
122   }
123 
124   /**
125    * Returns the paper width in 1/72nds of an inch.
126    */
getPaperWidth()127   public float getPaperWidth() {
128     return this.paperWidth;
129   }
130 
131   /**
132    * Returns whether home furniture should be printed or not.
133    */
isFurniturePrinted()134   public boolean isFurniturePrinted() {
135     return this.furniturePrinted;
136   }
137 
138   /**
139    * Returns whether home plan should be printed or not.
140    */
isPlanPrinted()141   public boolean isPlanPrinted() {
142     return this.planPrinted;
143   }
144 
145   /**
146    * Returns whether home 3D view should be printed or not.
147    */
isView3DPrinted()148   public boolean isView3DPrinted() {
149     return this.view3DPrinted;
150   }
151 
152   /**
153    * Returns the scale used to print home plan or
154    * <code>null</code> if no special scale is desired.
155    */
getPlanScale()156   public Float getPlanScale() {
157     return this.planScale;
158   }
159 
160   /**
161    * Returns the string format used to print page headers.
162    */
getHeaderFormat()163   public String getHeaderFormat() {
164     return this.headerFormat;
165   }
166 
167   /**
168    * Returns the string format used to print page footers.
169    */
getFooterFormat()170   public String getFooterFormat() {
171     return this.footerFormat;
172   }
173 }
174