]> _ Git - cubeextranet.git/blob
614afb0efb903a550aa14f74b6521e940def9dda
[cubeextranet.git] /
1 /*\r
2  * Licensed to the Apache Software Foundation (ASF) under one or more\r
3  * contributor license agreements.  See the NOTICE file distributed with\r
4  * this work for additional information regarding copyright ownership.\r
5  * The ASF licenses this file to You under the Apache License, Version 2.0\r
6  * (the "License"); you may not use this file except in compliance with\r
7  * the License.  You may obtain a copy of the License at\r
8  *\r
9  *      http://www.apache.org/licenses/LICENSE-2.0\r
10  *\r
11  * Unless required by applicable law or agreed to in writing, software\r
12  * distributed under the License is distributed on an "AS IS" BASIS,\r
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14  * See the License for the specific language governing permissions and\r
15  * limitations under the License.\r
16  */\r
17 package org.apache.pdfbox.pdmodel.interactive.viewerpreferences;\r
18 \r
19 import org.apache.pdfbox.cos.COSBase;\r
20 import org.apache.pdfbox.cos.COSDictionary;\r
21 \r
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;\r
23 \r
24 /**\r
25  * This is the document viewing preferences.\r
26  *\r
27  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>\r
28  * @version $Revision: 1.3 $\r
29  */\r
30 public class PDViewerPreferences implements COSObjectable\r
31 {\r
32     /**\r
33      * From PDF Reference: "Neither document outline nor thumbnail images visible".\r
34      */\r
35     public static final String NON_FULL_SCREEN_PAGE_MODE_USE_NONE = "UseNone";\r
36     /**\r
37      * From PDF Reference: "Document outline visible".\r
38      */\r
39     public static final String NON_FULL_SCREEN_PAGE_MODE_USE_OUTLINES = "UseOutlines";\r
40     /**\r
41      * From PDF Reference: "Thumbnail images visible".\r
42      */\r
43     public static final String NON_FULL_SCREEN_PAGE_MODE_USE_THUMBS = "UseThumbs";\r
44     /**\r
45      * From PDF Reference: "Optional content group panel visible".\r
46      */\r
47     public static final String NON_FULL_SCREEN_PAGE_MODE_USE_OPTIONAL_CONTENT = "UseOC";\r
48 \r
49     /**\r
50      * Reading direction.\r
51      */\r
52     public static final String READING_DIRECTION_L2R = "L2R";\r
53     /**\r
54      * Reading direction.\r
55      */\r
56     public static final String READING_DIRECTION_R2L = "R2L";\r
57 \r
58     /**\r
59      * Boundary constant.\r
60      */\r
61     public static final String BOUNDARY_MEDIA_BOX = "MediaBox";\r
62     /**\r
63      * Boundary constant.\r
64      */\r
65     public static final String BOUNDARY_CROP_BOX = "CropBox";\r
66     /**\r
67      * Boundary constant.\r
68      */\r
69     public static final String BOUNDARY_BLEED_BOX = "BleedBox";\r
70     /**\r
71      * Boundary constant.\r
72      */\r
73     public static final String BOUNDARY_TRIM_BOX = "TrimBox";\r
74     /**\r
75      * Boundary constant.\r
76      */\r
77     public static final String BOUNDARY_ART_BOX = "ArtBox";\r
78 \r
79 \r
80     private COSDictionary prefs;\r
81 \r
82     /**\r
83      * Constructor that is used for a preexisting dictionary.\r
84      *\r
85      * @param dic The underlying dictionary.\r
86      */\r
87     public PDViewerPreferences( COSDictionary dic )\r
88     {\r
89         prefs = dic;\r
90     }\r
91 \r
92     /**\r
93      * This will get the underlying dictionary that this object wraps.\r
94      *\r
95      * @return The underlying info dictionary.\r
96      */\r
97     public COSDictionary getDictionary()\r
98     {\r
99         return prefs;\r
100     }\r
101 \r
102     /**\r
103      * Convert this standard java object to a COS object.\r
104      *\r
105      * @return The cos object that matches this Java object.\r
106      */\r
107     public COSBase getCOSObject()\r
108     {\r
109         return prefs;\r
110     }\r
111 \r
112     /**\r
113      * Get the toolbar preference.\r
114      *\r
115      * @return the toolbar preference.\r
116      */\r
117     public boolean hideToolbar()\r
118     {\r
119         return prefs.getBoolean( "HideToolbar", false );\r
120     }\r
121 \r
122     /**\r
123      * Set the toolbar preference.\r
124      *\r
125      * @param value Set the toolbar preference.\r
126      */\r
127     public void setHideToolbar( boolean value )\r
128     {\r
129         prefs.setBoolean( "HideToolbar", value );\r
130     }\r
131 \r
132     /**\r
133      * Get the menubar preference.\r
134      *\r
135      * @return the menubar preference.\r
136      */\r
137     public boolean hideMenubar()\r
138     {\r
139         return prefs.getBoolean( "HideMenubar", false );\r
140     }\r
141 \r
142     /**\r
143      * Set the menubar preference.\r
144      *\r
145      * @param value Set the menubar preference.\r
146      */\r
147     public void setHideMenubar( boolean value )\r
148     {\r
149         prefs.setBoolean( "HideMenubar", value );\r
150     }\r
151 \r
152     /**\r
153      * Get the window UI preference.\r
154      *\r
155      * @return the window UI preference.\r
156      */\r
157     public boolean hideWindowUI()\r
158     {\r
159         return prefs.getBoolean( "HideWindowUI", false );\r
160     }\r
161 \r
162     /**\r
163      * Set the window UI preference.\r
164      *\r
165      * @param value Set the window UI preference.\r
166      */\r
167     public void setHideWindowUI( boolean value )\r
168     {\r
169         prefs.setBoolean( "HideWindowUI", value );\r
170     }\r
171 \r
172     /**\r
173      * Get the fit window preference.\r
174      *\r
175      * @return the fit window preference.\r
176      */\r
177     public boolean fitWindow()\r
178     {\r
179         return prefs.getBoolean( "FitWindow", false );\r
180     }\r
181 \r
182     /**\r
183      * Set the fit window preference.\r
184      *\r
185      * @param value Set the fit window preference.\r
186      */\r
187     public void setFitWindow( boolean value )\r
188     {\r
189         prefs.setBoolean( "FitWindow", value );\r
190     }\r
191 \r
192     /**\r
193      * Get the center window preference.\r
194      *\r
195      * @return the center window preference.\r
196      */\r
197     public boolean centerWindow()\r
198     {\r
199         return prefs.getBoolean( "CenterWindow", false );\r
200     }\r
201 \r
202     /**\r
203      * Set the center window preference.\r
204      *\r
205      * @param value Set the center window preference.\r
206      */\r
207     public void setCenterWindow( boolean value )\r
208     {\r
209         prefs.setBoolean( "CenterWindow", value );\r
210     }\r
211 \r
212     /**\r
213      * Get the display doc title preference.\r
214      *\r
215      * @return the display doc title preference.\r
216      */\r
217     public boolean displayDocTitle()\r
218     {\r
219         return prefs.getBoolean( "DisplayDocTitle", false );\r
220     }\r
221 \r
222     /**\r
223      * Set the display doc title preference.\r
224      *\r
225      * @param value Set the display doc title preference.\r
226      */\r
227     public void setDisplayDocTitle( boolean value )\r
228     {\r
229         prefs.setBoolean( "DisplayDocTitle", value );\r
230     }\r
231 \r
232     /**\r
233      * Get the non full screen page mode preference.\r
234      *\r
235      * @return the non full screen page mode preference.\r
236      */\r
237     public String getNonFullScreenPageMode()\r
238     {\r
239         return prefs.getNameAsString( "NonFullScreenPageMode", NON_FULL_SCREEN_PAGE_MODE_USE_NONE);\r
240     }\r
241 \r
242     /**\r
243      * Set the non full screen page mode preference.\r
244      *\r
245      * @param value Set the non full screen page mode preference.\r
246      */\r
247     public void setNonFullScreenPageMode( String value )\r
248     {\r
249         prefs.setName( "NonFullScreenPageMode", value );\r
250     }\r
251 \r
252     /**\r
253      * Get the reading direction preference.\r
254      *\r
255      * @return the reading direction preference.\r
256      */\r
257     public String getReadingDirection()\r
258     {\r
259         return prefs.getNameAsString( "Direction", READING_DIRECTION_L2R);\r
260     }\r
261 \r
262     /**\r
263      * Set the reading direction preference.\r
264      *\r
265      * @param value Set the reading direction preference.\r
266      */\r
267     public void setReadingDirection( String value )\r
268     {\r
269         prefs.setName( "Direction", value );\r
270     }\r
271 \r
272     /**\r
273      * Get the ViewArea preference.  See BOUNDARY_XXX constants.\r
274      *\r
275      * @return the ViewArea preference.\r
276      */\r
277     public String getViewArea()\r
278     {\r
279         return prefs.getNameAsString( "ViewArea", BOUNDARY_CROP_BOX);\r
280     }\r
281 \r
282     /**\r
283      * Set the ViewArea preference.  See BOUNDARY_XXX constants.\r
284      *\r
285      * @param value Set the ViewArea preference.\r
286      */\r
287     public void setViewArea( String value )\r
288     {\r
289         prefs.setName( "ViewArea", value );\r
290     }\r
291 \r
292     /**\r
293      * Get the ViewClip preference.  See BOUNDARY_XXX constants.\r
294      *\r
295      * @return the ViewClip preference.\r
296      */\r
297     public String getViewClip()\r
298     {\r
299         return prefs.getNameAsString( "ViewClip", BOUNDARY_CROP_BOX);\r
300     }\r
301 \r
302     /**\r
303      * Set the ViewClip preference.  See BOUNDARY_XXX constants.\r
304      *\r
305      * @param value Set the ViewClip preference.\r
306      */\r
307     public void setViewClip( String value )\r
308     {\r
309         prefs.setName( "ViewClip", value );\r
310     }\r
311 \r
312     /**\r
313      * Get the PrintArea preference.  See BOUNDARY_XXX constants.\r
314      *\r
315      * @return the PrintArea preference.\r
316      */\r
317     public String getPrintArea()\r
318     {\r
319         return prefs.getNameAsString( "PrintArea", BOUNDARY_CROP_BOX);\r
320     }\r
321 \r
322     /**\r
323      * Set the PrintArea preference.  See BOUNDARY_XXX constants.\r
324      *\r
325      * @param value Set the PrintArea preference.\r
326      */\r
327     public void setPrintArea( String value )\r
328     {\r
329         prefs.setName( "PrintArea", value );\r
330     }\r
331 \r
332     /**\r
333      * Get the PrintClip preference.  See BOUNDARY_XXX constants.\r
334      *\r
335      * @return the PrintClip preference.\r
336      */\r
337     public String getPrintClip()\r
338     {\r
339         return prefs.getNameAsString( "PrintClip", BOUNDARY_CROP_BOX);\r
340     }\r
341 \r
342     /**\r
343      * Set the PrintClip preference.  See BOUNDARY_XXX constants.\r
344      *\r
345      * @param value Set the PrintClip preference.\r
346      */\r
347     public void setPrintClip( String value )\r
348     {\r
349         prefs.setName( "PrintClip", value );\r
350     }\r
351 }\r