Lines 17-25
Link Here
|
17 |
|
17 |
|
18 |
package org.apache.poi.hdf.model.hdftypes.definitions; |
18 |
package org.apache.poi.hdf.model.hdftypes.definitions; |
19 |
|
19 |
|
20 |
import org.apache.poi.util.BitField; |
|
|
21 |
import org.apache.poi.util.BitFieldFactory; |
22 |
import org.apache.poi.hdf.model.hdftypes.HDFType; |
20 |
import org.apache.poi.hdf.model.hdftypes.HDFType; |
|
|
21 |
import org.apache.poi.hwpf.usermodel.BorderCode; |
22 |
import org.apache.poi.util.BitField; |
23 |
import org.apache.poi.util.LittleEndian; |
23 |
|
24 |
|
24 |
/** |
25 |
/** |
25 |
* Table Cell Descriptor. |
26 |
* Table Cell Descriptor. |
Lines 32-51
Link Here
|
32 |
implements HDFType |
33 |
implements HDFType |
33 |
{ |
34 |
{ |
34 |
|
35 |
|
35 |
private short field_1_rgf; |
36 |
protected short field_1_rgf; |
36 |
private static BitField fFirstMerged = BitFieldFactory.getInstance(0x0001); |
37 |
private static BitField fFirstMerged = new BitField(0x0001); |
37 |
private static BitField fMerged = BitFieldFactory.getInstance(0x0002); |
38 |
private static BitField fMerged = new BitField(0x0002); |
38 |
private static BitField fVertical = BitFieldFactory.getInstance(0x0004); |
39 |
private static BitField fVertical = new BitField(0x0004); |
39 |
private static BitField fBackward = BitFieldFactory.getInstance(0x0008); |
40 |
private static BitField fBackward = new BitField(0x0008); |
40 |
private static BitField fRotateFont = BitFieldFactory.getInstance(0x0010); |
41 |
private static BitField fRotateFont = new BitField(0x0010); |
41 |
private static BitField fVertMerge = BitFieldFactory.getInstance(0x0020); |
42 |
private static BitField fVertMerge = new BitField(0x0020); |
42 |
private static BitField fVertRestart = BitFieldFactory.getInstance(0x0040); |
43 |
private static BitField fVertRestart = new BitField(0x0040); |
43 |
private static BitField vertAlign = BitFieldFactory.getInstance(0x0180); |
44 |
private static BitField vertAlign = new BitField(0x0180); |
44 |
private short field_2_unused; |
45 |
private static BitField ftsWidth = new BitField(0x0E00); |
45 |
private short[] field_3_brcTop; |
46 |
private static BitField fFitText = new BitField(0x1000); |
46 |
private short[] field_4_brcLeft; |
47 |
private static BitField fNoWrap = new BitField(0x2000); |
47 |
private short[] field_5_brcBottom; |
48 |
private static BitField fUnused = new BitField(0xC000); |
48 |
private short[] field_6_brcRight; |
49 |
protected short field_2_unused; |
|
|
50 |
protected BorderCode field_3_brcTop; |
51 |
protected BorderCode field_4_brcLeft; |
52 |
protected BorderCode field_5_brcBottom; |
53 |
protected BorderCode field_6_brcRight; |
49 |
|
54 |
|
50 |
|
55 |
|
51 |
public TCAbstractType() |
56 |
public TCAbstractType() |
Lines 53-58
Link Here
|
53 |
|
58 |
|
54 |
} |
59 |
} |
55 |
|
60 |
|
|
|
61 |
protected void fillFields(byte [] data, int offset) |
62 |
{ |
63 |
field_1_rgf = LittleEndian.getShort(data, 0x0 + offset); |
64 |
field_2_unused = LittleEndian.getShort(data, 0x2 + offset); |
65 |
field_3_brcTop = new BorderCode(data, 0x4 + offset); |
66 |
field_4_brcLeft = new BorderCode(data, 0x8 + offset); |
67 |
field_5_brcBottom = new BorderCode(data, 0xc + offset); |
68 |
field_6_brcRight = new BorderCode(data, 0x10 + offset); |
69 |
|
70 |
} |
71 |
|
72 |
public void serialize(byte[] data, int offset) |
73 |
{ |
74 |
LittleEndian.putShort(data, 0x0 + offset, (short)field_1_rgf);; |
75 |
LittleEndian.putShort(data, 0x2 + offset, (short)field_2_unused);; |
76 |
field_3_brcTop.serialize(data, 0x4 + offset);; |
77 |
field_4_brcLeft.serialize(data, 0x8 + offset);; |
78 |
field_5_brcBottom.serialize(data, 0xc + offset);; |
79 |
field_6_brcRight.serialize(data, 0x10 + offset);; |
80 |
|
81 |
} |
82 |
|
83 |
public String toString() |
84 |
{ |
85 |
StringBuffer buffer = new StringBuffer(); |
86 |
|
87 |
buffer.append("[TC]\n"); |
88 |
|
89 |
buffer.append(" .rgf = "); |
90 |
buffer.append(" (").append(getRgf()).append(" )\n"); |
91 |
buffer.append(" .fFirstMerged = ").append(isFFirstMerged()).append('\n'); |
92 |
buffer.append(" .fMerged = ").append(isFMerged()).append('\n'); |
93 |
buffer.append(" .fVertical = ").append(isFVertical()).append('\n'); |
94 |
buffer.append(" .fBackward = ").append(isFBackward()).append('\n'); |
95 |
buffer.append(" .fRotateFont = ").append(isFRotateFont()).append('\n'); |
96 |
buffer.append(" .fVertMerge = ").append(isFVertMerge()).append('\n'); |
97 |
buffer.append(" .fVertRestart = ").append(isFVertRestart()).append('\n'); |
98 |
buffer.append(" .vertAlign = ").append(getVertAlign()).append('\n'); |
99 |
buffer.append(" .ftsWidth = ").append(getFtsWidth()).append('\n'); |
100 |
buffer.append(" .fFitText = ").append(isFFitText()).append('\n'); |
101 |
buffer.append(" .fNoWrap = ").append(isFNoWrap()).append('\n'); |
102 |
buffer.append(" .fUnused = ").append(getFUnused()).append('\n'); |
103 |
|
104 |
buffer.append(" .unused = "); |
105 |
buffer.append(" (").append(getUnused()).append(" )\n"); |
106 |
|
107 |
buffer.append(" .brcTop = "); |
108 |
buffer.append(" (").append(getBrcTop()).append(" )\n"); |
109 |
|
110 |
buffer.append(" .brcLeft = "); |
111 |
buffer.append(" (").append(getBrcLeft()).append(" )\n"); |
112 |
|
113 |
buffer.append(" .brcBottom = "); |
114 |
buffer.append(" (").append(getBrcBottom()).append(" )\n"); |
115 |
|
116 |
buffer.append(" .brcRight = "); |
117 |
buffer.append(" (").append(getBrcRight()).append(" )\n"); |
118 |
|
119 |
buffer.append("[/TC]\n"); |
120 |
return buffer.toString(); |
121 |
} |
122 |
|
56 |
/** |
123 |
/** |
57 |
* Size of record (exluding 4 byte header) |
124 |
* Size of record (exluding 4 byte header) |
58 |
*/ |
125 |
*/ |
Lines 98-104
Link Here
|
98 |
/** |
165 |
/** |
99 |
* Get the brcTop field for the TC record. |
166 |
* Get the brcTop field for the TC record. |
100 |
*/ |
167 |
*/ |
101 |
public short[] getBrcTop() |
168 |
public BorderCode getBrcTop() |
102 |
{ |
169 |
{ |
103 |
return field_3_brcTop; |
170 |
return field_3_brcTop; |
104 |
} |
171 |
} |
Lines 106-112
Link Here
|
106 |
/** |
173 |
/** |
107 |
* Set the brcTop field for the TC record. |
174 |
* Set the brcTop field for the TC record. |
108 |
*/ |
175 |
*/ |
109 |
public void setBrcTop(short[] field_3_brcTop) |
176 |
public void setBrcTop(BorderCode field_3_brcTop) |
110 |
{ |
177 |
{ |
111 |
this.field_3_brcTop = field_3_brcTop; |
178 |
this.field_3_brcTop = field_3_brcTop; |
112 |
} |
179 |
} |
Lines 114-120
Link Here
|
114 |
/** |
181 |
/** |
115 |
* Get the brcLeft field for the TC record. |
182 |
* Get the brcLeft field for the TC record. |
116 |
*/ |
183 |
*/ |
117 |
public short[] getBrcLeft() |
184 |
public BorderCode getBrcLeft() |
118 |
{ |
185 |
{ |
119 |
return field_4_brcLeft; |
186 |
return field_4_brcLeft; |
120 |
} |
187 |
} |
Lines 122-128
Link Here
|
122 |
/** |
189 |
/** |
123 |
* Set the brcLeft field for the TC record. |
190 |
* Set the brcLeft field for the TC record. |
124 |
*/ |
191 |
*/ |
125 |
public void setBrcLeft(short[] field_4_brcLeft) |
192 |
public void setBrcLeft(BorderCode field_4_brcLeft) |
126 |
{ |
193 |
{ |
127 |
this.field_4_brcLeft = field_4_brcLeft; |
194 |
this.field_4_brcLeft = field_4_brcLeft; |
128 |
} |
195 |
} |
Lines 130-136
Link Here
|
130 |
/** |
197 |
/** |
131 |
* Get the brcBottom field for the TC record. |
198 |
* Get the brcBottom field for the TC record. |
132 |
*/ |
199 |
*/ |
133 |
public short[] getBrcBottom() |
200 |
public BorderCode getBrcBottom() |
134 |
{ |
201 |
{ |
135 |
return field_5_brcBottom; |
202 |
return field_5_brcBottom; |
136 |
} |
203 |
} |
Lines 138-144
Link Here
|
138 |
/** |
205 |
/** |
139 |
* Set the brcBottom field for the TC record. |
206 |
* Set the brcBottom field for the TC record. |
140 |
*/ |
207 |
*/ |
141 |
public void setBrcBottom(short[] field_5_brcBottom) |
208 |
public void setBrcBottom(BorderCode field_5_brcBottom) |
142 |
{ |
209 |
{ |
143 |
this.field_5_brcBottom = field_5_brcBottom; |
210 |
this.field_5_brcBottom = field_5_brcBottom; |
144 |
} |
211 |
} |
Lines 146-152
Link Here
|
146 |
/** |
213 |
/** |
147 |
* Get the brcRight field for the TC record. |
214 |
* Get the brcRight field for the TC record. |
148 |
*/ |
215 |
*/ |
149 |
public short[] getBrcRight() |
216 |
public BorderCode getBrcRight() |
150 |
{ |
217 |
{ |
151 |
return field_6_brcRight; |
218 |
return field_6_brcRight; |
152 |
} |
219 |
} |
Lines 154-332
Link Here
|
154 |
/** |
221 |
/** |
155 |
* Set the brcRight field for the TC record. |
222 |
* Set the brcRight field for the TC record. |
156 |
*/ |
223 |
*/ |
157 |
public void setBrcRight(short[] field_6_brcRight) |
224 |
public void setBrcRight(BorderCode field_6_brcRight) |
158 |
{ |
225 |
{ |
159 |
this.field_6_brcRight = field_6_brcRight; |
226 |
this.field_6_brcRight = field_6_brcRight; |
160 |
} |
227 |
} |
161 |
|
228 |
|
162 |
/** |
229 |
/** |
163 |
* Sets the fFirstMerged field value. |
230 |
* Sets the fFirstMerged field value. |
164 |
* |
231 |
* |
165 |
*/ |
232 |
*/ |
166 |
public void setFFirstMerged(boolean value) |
233 |
public void setFFirstMerged(boolean value) |
167 |
{ |
234 |
{ |
168 |
field_1_rgf = (short)fFirstMerged.setBoolean(field_1_rgf, value); |
235 |
field_1_rgf = (short)fFirstMerged.setBoolean(field_1_rgf, value); |
169 |
|
236 |
|
170 |
|
237 |
|
171 |
} |
238 |
} |
172 |
|
239 |
|
173 |
/** |
240 |
/** |
174 |
* |
241 |
* |
175 |
* @return the fFirstMerged field value. |
242 |
* @return the fFirstMerged field value. |
176 |
*/ |
243 |
*/ |
177 |
public boolean isFFirstMerged() |
244 |
public boolean isFFirstMerged() |
178 |
{ |
245 |
{ |
179 |
return fFirstMerged.isSet(field_1_rgf); |
246 |
return fFirstMerged.isSet(field_1_rgf); |
180 |
|
247 |
|
181 |
} |
248 |
} |
182 |
|
249 |
|
183 |
/** |
250 |
/** |
184 |
* Sets the fMerged field value. |
251 |
* Sets the fMerged field value. |
185 |
* |
252 |
* |
186 |
*/ |
253 |
*/ |
187 |
public void setFMerged(boolean value) |
254 |
public void setFMerged(boolean value) |
188 |
{ |
255 |
{ |
189 |
field_1_rgf = (short)fMerged.setBoolean(field_1_rgf, value); |
256 |
field_1_rgf = (short)fMerged.setBoolean(field_1_rgf, value); |
190 |
|
257 |
|
191 |
|
258 |
|
192 |
} |
259 |
} |
193 |
|
260 |
|
194 |
/** |
261 |
/** |
195 |
* |
262 |
* |
196 |
* @return the fMerged field value. |
263 |
* @return the fMerged field value. |
197 |
*/ |
264 |
*/ |
198 |
public boolean isFMerged() |
265 |
public boolean isFMerged() |
199 |
{ |
266 |
{ |
200 |
return fMerged.isSet(field_1_rgf); |
267 |
return fMerged.isSet(field_1_rgf); |
201 |
|
268 |
|
202 |
} |
269 |
} |
203 |
|
270 |
|
204 |
/** |
271 |
/** |
205 |
* Sets the fVertical field value. |
272 |
* Sets the fVertical field value. |
206 |
* |
273 |
* |
207 |
*/ |
274 |
*/ |
208 |
public void setFVertical(boolean value) |
275 |
public void setFVertical(boolean value) |
209 |
{ |
276 |
{ |
210 |
field_1_rgf = (short)fVertical.setBoolean(field_1_rgf, value); |
277 |
field_1_rgf = (short)fVertical.setBoolean(field_1_rgf, value); |
211 |
|
278 |
|
212 |
|
279 |
|
213 |
} |
280 |
} |
214 |
|
281 |
|
215 |
/** |
282 |
/** |
216 |
* |
283 |
* |
217 |
* @return the fVertical field value. |
284 |
* @return the fVertical field value. |
218 |
*/ |
285 |
*/ |
219 |
public boolean isFVertical() |
286 |
public boolean isFVertical() |
220 |
{ |
287 |
{ |
221 |
return fVertical.isSet(field_1_rgf); |
288 |
return fVertical.isSet(field_1_rgf); |
222 |
|
289 |
|
223 |
} |
290 |
} |
224 |
|
291 |
|
225 |
/** |
292 |
/** |
226 |
* Sets the fBackward field value. |
293 |
* Sets the fBackward field value. |
227 |
* |
294 |
* |
228 |
*/ |
295 |
*/ |
229 |
public void setFBackward(boolean value) |
296 |
public void setFBackward(boolean value) |
230 |
{ |
297 |
{ |
231 |
field_1_rgf = (short)fBackward.setBoolean(field_1_rgf, value); |
298 |
field_1_rgf = (short)fBackward.setBoolean(field_1_rgf, value); |
232 |
|
299 |
|
233 |
|
300 |
|
234 |
} |
301 |
} |
235 |
|
302 |
|
236 |
/** |
303 |
/** |
237 |
* |
304 |
* |
238 |
* @return the fBackward field value. |
305 |
* @return the fBackward field value. |
239 |
*/ |
306 |
*/ |
240 |
public boolean isFBackward() |
307 |
public boolean isFBackward() |
241 |
{ |
308 |
{ |
242 |
return fBackward.isSet(field_1_rgf); |
309 |
return fBackward.isSet(field_1_rgf); |
243 |
|
310 |
|
244 |
} |
311 |
} |
245 |
|
312 |
|
246 |
/** |
313 |
/** |
247 |
* Sets the fRotateFont field value. |
314 |
* Sets the fRotateFont field value. |
248 |
* |
315 |
* |
249 |
*/ |
316 |
*/ |
250 |
public void setFRotateFont(boolean value) |
317 |
public void setFRotateFont(boolean value) |
251 |
{ |
318 |
{ |
252 |
field_1_rgf = (short)fRotateFont.setBoolean(field_1_rgf, value); |
319 |
field_1_rgf = (short)fRotateFont.setBoolean(field_1_rgf, value); |
253 |
|
320 |
|
254 |
|
321 |
|
255 |
} |
322 |
} |
256 |
|
323 |
|
257 |
/** |
324 |
/** |
258 |
* |
325 |
* |
259 |
* @return the fRotateFont field value. |
326 |
* @return the fRotateFont field value. |
260 |
*/ |
327 |
*/ |
261 |
public boolean isFRotateFont() |
328 |
public boolean isFRotateFont() |
262 |
{ |
329 |
{ |
263 |
return fRotateFont.isSet(field_1_rgf); |
330 |
return fRotateFont.isSet(field_1_rgf); |
264 |
|
331 |
|
265 |
} |
332 |
} |
266 |
|
333 |
|
267 |
/** |
334 |
/** |
268 |
* Sets the fVertMerge field value. |
335 |
* Sets the fVertMerge field value. |
269 |
* |
336 |
* |
270 |
*/ |
337 |
*/ |
271 |
public void setFVertMerge(boolean value) |
338 |
public void setFVertMerge(boolean value) |
272 |
{ |
339 |
{ |
273 |
field_1_rgf = (short)fVertMerge.setBoolean(field_1_rgf, value); |
340 |
field_1_rgf = (short)fVertMerge.setBoolean(field_1_rgf, value); |
274 |
|
341 |
|
275 |
|
342 |
|
276 |
} |
343 |
} |
277 |
|
344 |
|
278 |
/** |
345 |
/** |
279 |
* |
346 |
* |
280 |
* @return the fVertMerge field value. |
347 |
* @return the fVertMerge field value. |
281 |
*/ |
348 |
*/ |
282 |
public boolean isFVertMerge() |
349 |
public boolean isFVertMerge() |
283 |
{ |
350 |
{ |
284 |
return fVertMerge.isSet(field_1_rgf); |
351 |
return fVertMerge.isSet(field_1_rgf); |
285 |
|
352 |
|
286 |
} |
353 |
} |
287 |
|
354 |
|
288 |
/** |
355 |
/** |
289 |
* Sets the fVertRestart field value. |
356 |
* Sets the fVertRestart field value. |
290 |
* |
357 |
* |
291 |
*/ |
358 |
*/ |
292 |
public void setFVertRestart(boolean value) |
359 |
public void setFVertRestart(boolean value) |
293 |
{ |
360 |
{ |
294 |
field_1_rgf = (short)fVertRestart.setBoolean(field_1_rgf, value); |
361 |
field_1_rgf = (short)fVertRestart.setBoolean(field_1_rgf, value); |
295 |
|
362 |
|
296 |
|
363 |
|
297 |
} |
364 |
} |
298 |
|
365 |
|
299 |
/** |
366 |
/** |
300 |
* |
367 |
* |
301 |
* @return the fVertRestart field value. |
368 |
* @return the fVertRestart field value. |
302 |
*/ |
369 |
*/ |
303 |
public boolean isFVertRestart() |
370 |
public boolean isFVertRestart() |
304 |
{ |
371 |
{ |
305 |
return fVertRestart.isSet(field_1_rgf); |
372 |
return fVertRestart.isSet(field_1_rgf); |
306 |
|
373 |
|
307 |
} |
374 |
} |
308 |
|
375 |
|
309 |
/** |
376 |
/** |
310 |
* Sets the vertAlign field value. |
377 |
* Sets the vertAlign field value. |
311 |
* |
378 |
* |
312 |
*/ |
379 |
*/ |
313 |
public void setVertAlign(byte value) |
380 |
public void setVertAlign(byte value) |
314 |
{ |
381 |
{ |
315 |
field_1_rgf = (short)vertAlign.setValue(field_1_rgf, value); |
382 |
field_1_rgf = (short)vertAlign.setValue(field_1_rgf, value); |
316 |
|
383 |
|
317 |
|
384 |
|
318 |
} |
385 |
} |
319 |
|
386 |
|
320 |
/** |
387 |
/** |
321 |
* |
388 |
* |
322 |
* @return the vertAlign field value. |
389 |
* @return the vertAlign field value. |
323 |
*/ |
390 |
*/ |
324 |
public byte getVertAlign() |
391 |
public byte getVertAlign() |
325 |
{ |
392 |
{ |
326 |
return ( byte )vertAlign.getValue(field_1_rgf); |
393 |
return ( byte )vertAlign.getValue(field_1_rgf); |
|
|
394 |
|
395 |
} |
327 |
|
396 |
|
|
|
397 |
/** |
398 |
* Sets the ftsWidth field value. |
399 |
* |
400 |
*/ |
401 |
public void setFtsWidth(byte value) |
402 |
{ |
403 |
field_1_rgf = (short)ftsWidth.setValue(field_1_rgf, value); |
404 |
|
405 |
|
406 |
} |
407 |
|
408 |
/** |
409 |
* |
410 |
* @return the ftsWidth field value. |
411 |
*/ |
412 |
public byte getFtsWidth() |
413 |
{ |
414 |
return ( byte )ftsWidth.getValue(field_1_rgf); |
415 |
|
416 |
} |
417 |
|
418 |
/** |
419 |
* Sets the fFitText field value. |
420 |
* |
421 |
*/ |
422 |
public void setFFitText(boolean value) |
423 |
{ |
424 |
field_1_rgf = (short)fFitText.setBoolean(field_1_rgf, value); |
425 |
|
426 |
|
427 |
} |
428 |
|
429 |
/** |
430 |
* |
431 |
* @return the fFitText field value. |
432 |
*/ |
433 |
public boolean isFFitText() |
434 |
{ |
435 |
return fFitText.isSet(field_1_rgf); |
436 |
|
328 |
} |
437 |
} |
329 |
|
438 |
|
|
|
439 |
/** |
440 |
* Sets the fNoWrap field value. |
441 |
* |
442 |
*/ |
443 |
public void setFNoWrap(boolean value) |
444 |
{ |
445 |
field_1_rgf = (short)fNoWrap.setBoolean(field_1_rgf, value); |
446 |
|
447 |
|
448 |
} |
449 |
|
450 |
/** |
451 |
* |
452 |
* @return the fNoWrap field value. |
453 |
*/ |
454 |
public boolean isFNoWrap() |
455 |
{ |
456 |
return fNoWrap.isSet(field_1_rgf); |
457 |
|
458 |
} |
459 |
|
460 |
/** |
461 |
* Sets the fUnused field value. |
462 |
* |
463 |
*/ |
464 |
public void setFUnused(byte value) |
465 |
{ |
466 |
field_1_rgf = (short)fUnused.setValue(field_1_rgf, value); |
467 |
|
468 |
|
469 |
} |
470 |
|
471 |
/** |
472 |
* |
473 |
* @return the fUnused field value. |
474 |
*/ |
475 |
public byte getFUnused() |
476 |
{ |
477 |
return ( byte )fUnused.getValue(field_1_rgf); |
478 |
|
479 |
} |
480 |
|
330 |
|
481 |
|
331 |
} // END OF CLASS |
482 |
} // END OF CLASS |
332 |
|
483 |
|