001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hwpf.model.types;
019:
020: import org.apache.poi.util.BitField;
021: import org.apache.poi.util.BitFieldFactory;
022: import org.apache.poi.util.LittleEndian;
023: import org.apache.poi.util.StringUtil;
024: import org.apache.poi.util.HexDump;
025: import org.apache.poi.hdf.model.hdftypes.HDFType;
026: import org.apache.poi.hwpf.usermodel.*;
027:
028: /**
029: * Table Cell Descriptor.
030: * NOTE: This source is automatically generated please do not modify this file. Either subclass or
031: * remove the record in src/records/definitions.
032:
033: * @author S. Ryan Ackley
034: */
035: public abstract class TCAbstractType implements HDFType {
036:
037: protected short field_1_rgf;
038: private static BitField fFirstMerged = BitFieldFactory
039: .getInstance(0x0001);
040: private static BitField fMerged = BitFieldFactory
041: .getInstance(0x0002);
042: private static BitField fVertical = BitFieldFactory
043: .getInstance(0x0004);
044: private static BitField fBackward = BitFieldFactory
045: .getInstance(0x0008);
046: private static BitField fRotateFont = BitFieldFactory
047: .getInstance(0x0010);
048: private static BitField fVertMerge = BitFieldFactory
049: .getInstance(0x0020);
050: private static BitField fVertRestart = BitFieldFactory
051: .getInstance(0x0040);
052: private static BitField vertAlign = BitFieldFactory
053: .getInstance(0x0180);
054: protected short field_2_unused;
055: protected BorderCode field_3_brcTop;
056: protected BorderCode field_4_brcLeft;
057: protected BorderCode field_5_brcBottom;
058: protected BorderCode field_6_brcRight;
059:
060: public TCAbstractType() {
061:
062: }
063:
064: protected void fillFields(byte[] data, int offset) {
065: field_1_rgf = LittleEndian.getShort(data, 0x0 + offset);
066: field_2_unused = LittleEndian.getShort(data, 0x2 + offset);
067: field_3_brcTop = new BorderCode(data, 0x4 + offset);
068: field_4_brcLeft = new BorderCode(data, 0x8 + offset);
069: field_5_brcBottom = new BorderCode(data, 0xc + offset);
070: field_6_brcRight = new BorderCode(data, 0x10 + offset);
071:
072: }
073:
074: public void serialize(byte[] data, int offset) {
075: LittleEndian.putShort(data, 0x0 + offset, (short) field_1_rgf);
076: ;
077: LittleEndian.putShort(data, 0x2 + offset,
078: (short) field_2_unused);
079: ;
080: field_3_brcTop.serialize(data, 0x4 + offset);
081: ;
082: field_4_brcLeft.serialize(data, 0x8 + offset);
083: ;
084: field_5_brcBottom.serialize(data, 0xc + offset);
085: ;
086: field_6_brcRight.serialize(data, 0x10 + offset);
087: ;
088:
089: }
090:
091: public String toString() {
092: StringBuffer buffer = new StringBuffer();
093:
094: buffer.append("[TC]\n");
095:
096: buffer.append(" .rgf = ");
097: buffer.append(" (").append(getRgf()).append(" )\n");
098: buffer.append(" .fFirstMerged = ").append(
099: isFFirstMerged()).append('\n');
100: buffer.append(" .fMerged = ").append(
101: isFMerged()).append('\n');
102: buffer.append(" .fVertical = ").append(
103: isFVertical()).append('\n');
104: buffer.append(" .fBackward = ").append(
105: isFBackward()).append('\n');
106: buffer.append(" .fRotateFont = ").append(
107: isFRotateFont()).append('\n');
108: buffer.append(" .fVertMerge = ").append(
109: isFVertMerge()).append('\n');
110: buffer.append(" .fVertRestart = ").append(
111: isFVertRestart()).append('\n');
112: buffer.append(" .vertAlign = ").append(
113: getVertAlign()).append('\n');
114:
115: buffer.append(" .unused = ");
116: buffer.append(" (").append(getUnused()).append(" )\n");
117:
118: buffer.append(" .brcTop = ");
119: buffer.append(" (").append(getBrcTop()).append(" )\n");
120:
121: buffer.append(" .brcLeft = ");
122: buffer.append(" (").append(getBrcLeft()).append(" )\n");
123:
124: buffer.append(" .brcBottom = ");
125: buffer.append(" (").append(getBrcBottom()).append(" )\n");
126:
127: buffer.append(" .brcRight = ");
128: buffer.append(" (").append(getBrcRight()).append(" )\n");
129:
130: buffer.append("[/TC]\n");
131: return buffer.toString();
132: }
133:
134: /**
135: * Size of record (exluding 4 byte header)
136: */
137: public int getSize() {
138: return 4 + +2 + 2 + 4 + 4 + 4 + 4;
139: }
140:
141: /**
142: * Get the rgf field for the TC record.
143: */
144: public short getRgf() {
145: return field_1_rgf;
146: }
147:
148: /**
149: * Set the rgf field for the TC record.
150: */
151: public void setRgf(short field_1_rgf) {
152: this .field_1_rgf = field_1_rgf;
153: }
154:
155: /**
156: * Get the unused field for the TC record.
157: */
158: public short getUnused() {
159: return field_2_unused;
160: }
161:
162: /**
163: * Set the unused field for the TC record.
164: */
165: public void setUnused(short field_2_unused) {
166: this .field_2_unused = field_2_unused;
167: }
168:
169: /**
170: * Get the brcTop field for the TC record.
171: */
172: public BorderCode getBrcTop() {
173: return field_3_brcTop;
174: }
175:
176: /**
177: * Set the brcTop field for the TC record.
178: */
179: public void setBrcTop(BorderCode field_3_brcTop) {
180: this .field_3_brcTop = field_3_brcTop;
181: }
182:
183: /**
184: * Get the brcLeft field for the TC record.
185: */
186: public BorderCode getBrcLeft() {
187: return field_4_brcLeft;
188: }
189:
190: /**
191: * Set the brcLeft field for the TC record.
192: */
193: public void setBrcLeft(BorderCode field_4_brcLeft) {
194: this .field_4_brcLeft = field_4_brcLeft;
195: }
196:
197: /**
198: * Get the brcBottom field for the TC record.
199: */
200: public BorderCode getBrcBottom() {
201: return field_5_brcBottom;
202: }
203:
204: /**
205: * Set the brcBottom field for the TC record.
206: */
207: public void setBrcBottom(BorderCode field_5_brcBottom) {
208: this .field_5_brcBottom = field_5_brcBottom;
209: }
210:
211: /**
212: * Get the brcRight field for the TC record.
213: */
214: public BorderCode getBrcRight() {
215: return field_6_brcRight;
216: }
217:
218: /**
219: * Set the brcRight field for the TC record.
220: */
221: public void setBrcRight(BorderCode field_6_brcRight) {
222: this .field_6_brcRight = field_6_brcRight;
223: }
224:
225: /**
226: * Sets the fFirstMerged field value.
227: *
228: */
229: public void setFFirstMerged(boolean value) {
230: field_1_rgf = (short) fFirstMerged.setBoolean(field_1_rgf,
231: value);
232:
233: }
234:
235: /**
236: *
237: * @return the fFirstMerged field value.
238: */
239: public boolean isFFirstMerged() {
240: return fFirstMerged.isSet(field_1_rgf);
241:
242: }
243:
244: /**
245: * Sets the fMerged field value.
246: *
247: */
248: public void setFMerged(boolean value) {
249: field_1_rgf = (short) fMerged.setBoolean(field_1_rgf, value);
250:
251: }
252:
253: /**
254: *
255: * @return the fMerged field value.
256: */
257: public boolean isFMerged() {
258: return fMerged.isSet(field_1_rgf);
259:
260: }
261:
262: /**
263: * Sets the fVertical field value.
264: *
265: */
266: public void setFVertical(boolean value) {
267: field_1_rgf = (short) fVertical.setBoolean(field_1_rgf, value);
268:
269: }
270:
271: /**
272: *
273: * @return the fVertical field value.
274: */
275: public boolean isFVertical() {
276: return fVertical.isSet(field_1_rgf);
277:
278: }
279:
280: /**
281: * Sets the fBackward field value.
282: *
283: */
284: public void setFBackward(boolean value) {
285: field_1_rgf = (short) fBackward.setBoolean(field_1_rgf, value);
286:
287: }
288:
289: /**
290: *
291: * @return the fBackward field value.
292: */
293: public boolean isFBackward() {
294: return fBackward.isSet(field_1_rgf);
295:
296: }
297:
298: /**
299: * Sets the fRotateFont field value.
300: *
301: */
302: public void setFRotateFont(boolean value) {
303: field_1_rgf = (short) fRotateFont
304: .setBoolean(field_1_rgf, value);
305:
306: }
307:
308: /**
309: *
310: * @return the fRotateFont field value.
311: */
312: public boolean isFRotateFont() {
313: return fRotateFont.isSet(field_1_rgf);
314:
315: }
316:
317: /**
318: * Sets the fVertMerge field value.
319: *
320: */
321: public void setFVertMerge(boolean value) {
322: field_1_rgf = (short) fVertMerge.setBoolean(field_1_rgf, value);
323:
324: }
325:
326: /**
327: *
328: * @return the fVertMerge field value.
329: */
330: public boolean isFVertMerge() {
331: return fVertMerge.isSet(field_1_rgf);
332:
333: }
334:
335: /**
336: * Sets the fVertRestart field value.
337: *
338: */
339: public void setFVertRestart(boolean value) {
340: field_1_rgf = (short) fVertRestart.setBoolean(field_1_rgf,
341: value);
342:
343: }
344:
345: /**
346: *
347: * @return the fVertRestart field value.
348: */
349: public boolean isFVertRestart() {
350: return fVertRestart.isSet(field_1_rgf);
351:
352: }
353:
354: /**
355: * Sets the vertAlign field value.
356: *
357: */
358: public void setVertAlign(byte value) {
359: field_1_rgf = (short) vertAlign.setValue(field_1_rgf, value);
360:
361: }
362:
363: /**
364: *
365: * @return the vertAlign field value.
366: */
367: public byte getVertAlign() {
368: return (byte) vertAlign.getValue(field_1_rgf);
369:
370: }
371:
372: } // END OF CLASS
|