]> _ Git - cubeextranet.git/blob
cba5ccf83cca8b02df4a9a3cb9d3b3b4a75a68fb
[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.documentnavigation.destination;\r
18 \r
19 import org.apache.pdfbox.cos.COSArray;\r
20 import org.apache.pdfbox.cos.COSBase;\r
21 \r
22 /**\r
23  * This represents a destination to a page at a y location and the width is magnified\r
24  * to just fit on the screen.\r
25  *\r
26  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>\r
27  * @version $Revision: 1.2 $\r
28  */\r
29 public class PDPageFitRectangleDestination extends PDPageDestination\r
30 {\r
31     /**\r
32      * The type of this destination.\r
33      */\r
34     protected static final String TYPE = "FitR";\r
35 \r
36     /**\r
37      * Default constructor.\r
38      *\r
39      */\r
40     public PDPageFitRectangleDestination()\r
41     {\r
42         super();\r
43         array.growToSize(6);\r
44         array.setName( 1, TYPE );\r
45 \r
46     }\r
47 \r
48     /**\r
49      * Constructor from an existing destination array.\r
50      *\r
51      * @param arr The destination array.\r
52      */\r
53     public PDPageFitRectangleDestination( COSArray arr )\r
54     {\r
55         super( arr );\r
56     }\r
57 \r
58     /**\r
59      * Get the left x coordinate.  A return value of -1 implies that the current x-coordinate\r
60      * will be used.\r
61      *\r
62      * @return The left x coordinate.\r
63      */\r
64     public int getLeft()\r
65     {\r
66         return array.getInt( 2 );\r
67     }\r
68 \r
69     /**\r
70      * Set the left x-coordinate, a value of -1 implies that the current x-coordinate\r
71      * will be used.\r
72      * @param x The left x coordinate.\r
73      */\r
74     public void setLeft( int x )\r
75     {\r
76         array.growToSize( 3 );\r
77         if( x == -1 )\r
78         {\r
79             array.set( 2, (COSBase)null );\r
80         }\r
81         else\r
82         {\r
83             array.setInt( 2, x );\r
84         }\r
85     }\r
86 \r
87     /**\r
88      * Get the bottom y coordinate.  A return value of -1 implies that the current y-coordinate\r
89      * will be used.\r
90      *\r
91      * @return The bottom y coordinate.\r
92      */\r
93     public int getBottom()\r
94     {\r
95         return array.getInt( 3 );\r
96     }\r
97 \r
98     /**\r
99      * Set the bottom y-coordinate, a value of -1 implies that the current y-coordinate\r
100      * will be used.\r
101      * @param y The bottom y coordinate.\r
102      */\r
103     public void setBottom( int y )\r
104     {\r
105         array.growToSize( 6 );\r
106         if( y == -1 )\r
107         {\r
108             array.set( 3, (COSBase)null );\r
109         }\r
110         else\r
111         {\r
112             array.setInt( 3, y );\r
113         }\r
114     }\r
115 \r
116     /**\r
117      * Get the right x coordinate.  A return value of -1 implies that the current x-coordinate\r
118      * will be used.\r
119      *\r
120      * @return The right x coordinate.\r
121      */\r
122     public int getRight()\r
123     {\r
124         return array.getInt( 4 );\r
125     }\r
126 \r
127     /**\r
128      * Set the right x-coordinate, a value of -1 implies that the current x-coordinate\r
129      * will be used.\r
130      * @param x The right x coordinate.\r
131      */\r
132     public void setRight( int x )\r
133     {\r
134         array.growToSize( 6 );\r
135         if( x == -1 )\r
136         {\r
137             array.set( 4, (COSBase)null );\r
138         }\r
139         else\r
140         {\r
141             array.setInt( 4, x );\r
142         }\r
143     }\r
144 \r
145 \r
146     /**\r
147      * Get the top y coordinate.  A return value of -1 implies that the current y-coordinate\r
148      * will be used.\r
149      *\r
150      * @return The top y coordinate.\r
151      */\r
152     public int getTop()\r
153     {\r
154         return array.getInt( 5 );\r
155     }\r
156 \r
157     /**\r
158      * Set the top y-coordinate, a value of -1 implies that the current y-coordinate\r
159      * will be used.\r
160      * @param y The top ycoordinate.\r
161      */\r
162     public void setTop( int y )\r
163     {\r
164         array.growToSize( 6 );\r
165         if( y == -1 )\r
166         {\r
167             array.set( 5, (COSBase)null );\r
168         }\r
169         else\r
170         {\r
171             array.setInt( 5, y );\r
172         }\r
173     }\r
174 }\r