]> _ Git - cubeextranet.git/blob
00edfd56b348fbc3d1e19bd33413e1425ae4b443
[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.documentinterchange.taggedpdf;\r
18 \r
19 import org.apache.pdfbox.cos.COSDictionary;\r
20 import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement;\r
21 \r
22 /**\r
23  * An Export Format attribute object.\r
24  * \r
25  * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>\r
26  * @version $Revision: $\r
27  */\r
28 public class PDExportFormatAttributeObject extends PDLayoutAttributeObject\r
29 {\r
30 \r
31     /**\r
32      *  standard attribute owner: XML-1.00\r
33      */\r
34     public static final String OWNER_XML_1_00 = "XML-1.00";\r
35     /**\r
36      *  standard attribute owner: HTML-3.2\r
37      */\r
38     public static final String OWNER_HTML_3_20 = "HTML-3.2";\r
39     /**\r
40      *  standard attribute owner: HTML-4.01\r
41      */\r
42     public static final String OWNER_HTML_4_01 = "HTML-4.01";\r
43     /**\r
44      *  standard attribute owner: OEB-1.00\r
45      */\r
46     public static final String OWNER_OEB_1_00 = "OEB-1.00";\r
47     /**\r
48      *  standard attribute owner: RTF-1.05\r
49      */\r
50     public static final String OWNER_RTF_1_05 = "RTF-1.05";\r
51     /**\r
52      *  standard attribute owner: CSS-1.00\r
53      */\r
54     public static final String OWNER_CSS_1_00 = "CSS-1.00";\r
55     /**\r
56      *  standard attribute owner: CSS-2.00\r
57      */\r
58     public static final String OWNER_CSS_2_00 = "CSS-2.00";\r
59 \r
60 \r
61     /**\r
62      * Default constructor.\r
63      */\r
64     public PDExportFormatAttributeObject(String owner)\r
65     {\r
66         this.setOwner(owner);\r
67     }\r
68 \r
69     /**\r
70      * Creates a new ExportFormat attribute object with a given dictionary.\r
71      * \r
72      * @param dictionary the dictionary\r
73      */\r
74     public PDExportFormatAttributeObject(COSDictionary dictionary)\r
75     {\r
76         super(dictionary);\r
77     }\r
78 \r
79 \r
80     /**\r
81      * Gets the list numbering (ListNumbering). The default value is\r
82      * {@link #LIST_NUMBERING_NONE}.\r
83      * \r
84      * @return the list numbering\r
85      */\r
86     public String getListNumbering()\r
87     {\r
88         return this.getName(PDListAttributeObject.LIST_NUMBERING,\r
89             PDListAttributeObject.LIST_NUMBERING_NONE);\r
90     }\r
91 \r
92     /**\r
93      * Sets the list numbering (ListNumbering). The value shall be one of the\r
94      * following:\r
95      * <ul>\r
96      *   <li>{@link #LIST_NUMBERING_NONE},</li>\r
97      *   <li>{@link #LIST_NUMBERING_DISC},</li>\r
98      *   <li>{@link #LIST_NUMBERING_CIRCLE},</li>\r
99      *   <li>{@link #LIST_NUMBERING_SQUARE},</li>\r
100      *   <li>{@link #LIST_NUMBERING_DECIMAL},</li>\r
101      *   <li>{@link #LIST_NUMBERING_UPPER_ROMAN},</li>\r
102      *   <li>{@link #LIST_NUMBERING_LOWER_ROMAN},</li>\r
103      *   <li>{@link #LIST_NUMBERING_UPPER_ALPHA},</li>\r
104      *   <li>{@link #LIST_NUMBERING_LOWER_ALPHA}.</li>\r
105      * </ul>\r
106      * \r
107      * @param listNumbering the list numbering\r
108      */\r
109     public void setListNumbering(String listNumbering)\r
110     {\r
111         this.setName(PDListAttributeObject.LIST_NUMBERING, listNumbering);\r
112     }\r
113 \r
114     /**\r
115      * Gets the number of rows in the enclosing table that shall be spanned by\r
116      * the cell (RowSpan). The default value is 1.\r
117      * \r
118      * @return the row span\r
119      */\r
120     public int getRowSpan()\r
121     {\r
122         return this.getInteger(PDTableAttributeObject.ROW_SPAN, 1);\r
123     }\r
124 \r
125     /**\r
126      * Sets the number of rows in the enclosing table that shall be spanned by\r
127      * the cell (RowSpan).\r
128      * \r
129      * @param rowSpan the row span\r
130      */\r
131     public void setRowSpan(int rowSpan)\r
132     {\r
133         this.setInteger(PDTableAttributeObject.ROW_SPAN, rowSpan);\r
134     }\r
135 \r
136     /**\r
137      * Gets the number of columns in the enclosing table that shall be spanned\r
138      * by the cell (ColSpan). The default value is 1.\r
139      * \r
140      * @return the column span\r
141      */\r
142     public int getColSpan()\r
143     {\r
144         return this.getInteger(PDTableAttributeObject.COL_SPAN, 1);\r
145     }\r
146 \r
147     /**\r
148      * Sets the number of columns in the enclosing table that shall be spanned\r
149      * by the cell (ColSpan).\r
150      * \r
151      * @param colSpan the column span\r
152      */\r
153     public void setColSpan(int colSpan)\r
154     {\r
155         this.setInteger(PDTableAttributeObject.COL_SPAN, colSpan);\r
156     }\r
157 \r
158     /**\r
159      * Gets the headers (Headers). An array of byte strings, where each string\r
160      * shall be the element identifier (see the\r
161      * {@link PDStructureElement#getElementIdentifier()}) for a TH structure\r
162      * element that shall be used as a header associated with this cell.\r
163      * \r
164      * @return the headers.\r
165      */\r
166     public String[] getHeaders()\r
167     {\r
168         return this.getArrayOfString(PDTableAttributeObject.HEADERS);\r
169     }\r
170 \r
171     /**\r
172      * Sets the headers (Headers). An array of byte strings, where each string\r
173      * shall be the element identifier (see the\r
174      * {@link PDStructureElement#getElementIdentifier()}) for a TH structure\r
175      * element that shall be used as a header associated with this cell.\r
176      * \r
177      * @param headers the headers\r
178      */\r
179     public void setHeaders(String[] headers)\r
180     {\r
181         this.setArrayOfString(PDTableAttributeObject.HEADERS, headers);\r
182     }\r
183 \r
184     /**\r
185      * Gets the scope (Scope). It shall reflect whether the header cell applies\r
186      * to the rest of the cells in the row that contains it, the column that\r
187      * contains it, or both the row and the column that contain it.\r
188      * \r
189      * @return the scope\r
190      */\r
191     public String getScope()\r
192     {\r
193         return this.getName(PDTableAttributeObject.SCOPE);\r
194     }\r
195 \r
196     /**\r
197      * Sets the scope (Scope). It shall reflect whether the header cell applies\r
198      * to the rest of the cells in the row that contains it, the column that\r
199      * contains it, or both the row and the column that contain it. The value\r
200      * shall be one of the following:\r
201      * <ul>\r
202      *   <li>{@link #SCOPE_ROW},</li>\r
203      *   <li>{@link #SCOPE_COLUMN}, or</li>\r
204      *   <li>{@link #SCOPE_BOTH}.</li>\r
205      * </ul>\r
206      * \r
207      * @param scope the scope\r
208      */\r
209     public void setScope(String scope)\r
210     {\r
211         this.setName(PDTableAttributeObject.SCOPE, scope);\r
212     }\r
213 \r
214     /**\r
215      * Gets the summary of the table’s purpose and structure.\r
216      * \r
217      * @return the summary\r
218      */\r
219     public String getSummary()\r
220     {\r
221         return this.getString(PDTableAttributeObject.SUMMARY);\r
222     }\r
223 \r
224     /**\r
225      * Sets the summary of the table’s purpose and structure.\r
226      * \r
227      * @param summary the summary\r
228      */\r
229     public void setSummary(String summary)\r
230     {\r
231         this.setString(PDTableAttributeObject.SUMMARY, summary);\r
232     }\r
233 \r
234 \r
235     @Override\r
236     public String toString()\r
237     {\r
238         StringBuilder sb = new StringBuilder().append(super.toString());\r
239         if (this.isSpecified(PDListAttributeObject.LIST_NUMBERING))\r
240         {\r
241             sb.append(", ListNumbering=").append(this.getListNumbering());\r
242         }\r
243         if (this.isSpecified(PDTableAttributeObject.ROW_SPAN))\r
244         {\r
245             sb.append(", RowSpan=").append(String.valueOf(this.getRowSpan()));\r
246         }\r
247         if (this.isSpecified(PDTableAttributeObject.COL_SPAN))\r
248         {\r
249             sb.append(", ColSpan=").append(String.valueOf(this.getColSpan()));\r
250         }\r
251         if (this.isSpecified(PDTableAttributeObject.HEADERS))\r
252         {\r
253             sb.append(", Headers=").append(arrayToString(this.getHeaders()));\r
254         }\r
255         if (this.isSpecified(PDTableAttributeObject.SCOPE))\r
256         {\r
257             sb.append(", Scope=").append(this.getScope());\r
258         }\r
259         if (this.isSpecified(PDTableAttributeObject.SUMMARY))\r
260         {\r
261             sb.append(", Summary=").append(this.getSummary());\r
262         }\r
263         return sb.toString();\r
264     }\r
265 \r
266 }\r