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