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: * File information Block.
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 Andrew C. Oliver
034: */
035: public abstract class FIBAbstractType implements HDFType {
036:
037: protected int field_1_wIdent;
038: protected int field_2_nFib;
039: protected int field_3_nProduct;
040: protected int field_4_lid;
041: protected int field_5_pnNext;
042: protected short field_6_options;
043: private static BitField fDot = BitFieldFactory.getInstance(0x0001);
044: private static BitField fGlsy = BitFieldFactory.getInstance(0x0002);
045: private static BitField fComplex = BitFieldFactory
046: .getInstance(0x0004);
047: private static BitField fHasPic = BitFieldFactory
048: .getInstance(0x0008);
049: private static BitField cQuickSaves = BitFieldFactory
050: .getInstance(0x00F0);
051: private static BitField fEncrypted = BitFieldFactory
052: .getInstance(0x0100);
053: private static BitField fWhichTblStm = BitFieldFactory
054: .getInstance(0x0200);
055: private static BitField fReadOnlyRecommended = BitFieldFactory
056: .getInstance(0x0400);
057: private static BitField fWriteReservation = BitFieldFactory
058: .getInstance(0x0800);
059: private static BitField fExtChar = BitFieldFactory
060: .getInstance(0x1000);
061: private static BitField fLoadOverride = BitFieldFactory
062: .getInstance(0x2000);
063: private static BitField fFarEast = BitFieldFactory
064: .getInstance(0x4000);
065: private static BitField fCrypto = BitFieldFactory
066: .getInstance(0x8000);
067: protected int field_7_nFibBack;
068: protected int field_8_lKey;
069: protected int field_9_envr;
070: protected short field_10_history;
071: private static BitField fMac = BitFieldFactory.getInstance(0x0001);
072: private static BitField fEmptySpecial = BitFieldFactory
073: .getInstance(0x0002);
074: private static BitField fLoadOverridePage = BitFieldFactory
075: .getInstance(0x0004);
076: private static BitField fFutureSavedUndo = BitFieldFactory
077: .getInstance(0x0008);
078: private static BitField fWord97Saved = BitFieldFactory
079: .getInstance(0x0010);
080: private static BitField fSpare0 = BitFieldFactory
081: .getInstance(0x00FE);
082: protected int field_11_chs;
083: protected int field_12_chsTables;
084: protected int field_13_fcMin;
085: protected int field_14_fcMac;
086:
087: public FIBAbstractType() {
088:
089: }
090:
091: protected void fillFields(byte[] data, int offset) {
092: field_1_wIdent = LittleEndian.getShort(data, 0x0 + offset);
093: field_2_nFib = LittleEndian.getShort(data, 0x2 + offset);
094: field_3_nProduct = LittleEndian.getShort(data, 0x4 + offset);
095: field_4_lid = LittleEndian.getShort(data, 0x6 + offset);
096: field_5_pnNext = LittleEndian.getShort(data, 0x8 + offset);
097: field_6_options = LittleEndian.getShort(data, 0xa + offset);
098: field_7_nFibBack = LittleEndian.getShort(data, 0xc + offset);
099: field_8_lKey = LittleEndian.getShort(data, 0xe + offset);
100: field_9_envr = LittleEndian.getShort(data, 0x10 + offset);
101: field_10_history = LittleEndian.getShort(data, 0x12 + offset);
102: field_11_chs = LittleEndian.getShort(data, 0x14 + offset);
103: field_12_chsTables = LittleEndian.getShort(data, 0x16 + offset);
104: field_13_fcMin = LittleEndian.getInt(data, 0x18 + offset);
105: field_14_fcMac = LittleEndian.getInt(data, 0x1c + offset);
106:
107: }
108:
109: public void serialize(byte[] data, int offset) {
110: LittleEndian.putShort(data, 0x0 + offset,
111: (short) field_1_wIdent);
112: ;
113: LittleEndian.putShort(data, 0x2 + offset, (short) field_2_nFib);
114: ;
115: LittleEndian.putShort(data, 0x4 + offset,
116: (short) field_3_nProduct);
117: ;
118: LittleEndian.putShort(data, 0x6 + offset, (short) field_4_lid);
119: ;
120: LittleEndian.putShort(data, 0x8 + offset,
121: (short) field_5_pnNext);
122: ;
123: LittleEndian.putShort(data, 0xa + offset,
124: (short) field_6_options);
125: ;
126: LittleEndian.putShort(data, 0xc + offset,
127: (short) field_7_nFibBack);
128: ;
129: LittleEndian.putShort(data, 0xe + offset, (short) field_8_lKey);
130: ;
131: LittleEndian
132: .putShort(data, 0x10 + offset, (short) field_9_envr);
133: ;
134: LittleEndian.putShort(data, 0x12 + offset,
135: (short) field_10_history);
136: ;
137: LittleEndian
138: .putShort(data, 0x14 + offset, (short) field_11_chs);
139: ;
140: LittleEndian.putShort(data, 0x16 + offset,
141: (short) field_12_chsTables);
142: ;
143: LittleEndian.putInt(data, 0x18 + offset, field_13_fcMin);
144: ;
145: LittleEndian.putInt(data, 0x1c + offset, field_14_fcMac);
146: ;
147:
148: }
149:
150: public String toString() {
151: StringBuffer buffer = new StringBuffer();
152:
153: buffer.append("[FIB]\n");
154:
155: buffer.append(" .wIdent = ");
156: buffer.append(" (").append(getWIdent()).append(" )\n");
157:
158: buffer.append(" .nFib = ");
159: buffer.append(" (").append(getNFib()).append(" )\n");
160:
161: buffer.append(" .nProduct = ");
162: buffer.append(" (").append(getNProduct()).append(" )\n");
163:
164: buffer.append(" .lid = ");
165: buffer.append(" (").append(getLid()).append(" )\n");
166:
167: buffer.append(" .pnNext = ");
168: buffer.append(" (").append(getPnNext()).append(" )\n");
169:
170: buffer.append(" .options = ");
171: buffer.append(" (").append(getOptions()).append(" )\n");
172: buffer.append(" .fDot = ").append(
173: isFDot()).append('\n');
174: buffer.append(" .fGlsy = ").append(
175: isFGlsy()).append('\n');
176: buffer.append(" .fComplex = ").append(
177: isFComplex()).append('\n');
178: buffer.append(" .fHasPic = ").append(
179: isFHasPic()).append('\n');
180: buffer.append(" .cQuickSaves = ").append(
181: getCQuickSaves()).append('\n');
182: buffer.append(" .fEncrypted = ").append(
183: isFEncrypted()).append('\n');
184: buffer.append(" .fWhichTblStm = ").append(
185: isFWhichTblStm()).append('\n');
186: buffer.append(" .fReadOnlyRecommended = ").append(
187: isFReadOnlyRecommended()).append('\n');
188: buffer.append(" .fWriteReservation = ").append(
189: isFWriteReservation()).append('\n');
190: buffer.append(" .fExtChar = ").append(
191: isFExtChar()).append('\n');
192: buffer.append(" .fLoadOverride = ").append(
193: isFLoadOverride()).append('\n');
194: buffer.append(" .fFarEast = ").append(
195: isFFarEast()).append('\n');
196: buffer.append(" .fCrypto = ").append(
197: isFCrypto()).append('\n');
198:
199: buffer.append(" .nFibBack = ");
200: buffer.append(" (").append(getNFibBack()).append(" )\n");
201:
202: buffer.append(" .lKey = ");
203: buffer.append(" (").append(getLKey()).append(" )\n");
204:
205: buffer.append(" .envr = ");
206: buffer.append(" (").append(getEnvr()).append(" )\n");
207:
208: buffer.append(" .history = ");
209: buffer.append(" (").append(getHistory()).append(" )\n");
210: buffer.append(" .fMac = ").append(
211: isFMac()).append('\n');
212: buffer.append(" .fEmptySpecial = ").append(
213: isFEmptySpecial()).append('\n');
214: buffer.append(" .fLoadOverridePage = ").append(
215: isFLoadOverridePage()).append('\n');
216: buffer.append(" .fFutureSavedUndo = ").append(
217: isFFutureSavedUndo()).append('\n');
218: buffer.append(" .fWord97Saved = ").append(
219: isFWord97Saved()).append('\n');
220: buffer.append(" .fSpare0 = ").append(
221: getFSpare0()).append('\n');
222:
223: buffer.append(" .chs = ");
224: buffer.append(" (").append(getChs()).append(" )\n");
225:
226: buffer.append(" .chsTables = ");
227: buffer.append(" (").append(getChsTables()).append(" )\n");
228:
229: buffer.append(" .fcMin = ");
230: buffer.append(" (").append(getFcMin()).append(" )\n");
231:
232: buffer.append(" .fcMac = ");
233: buffer.append(" (").append(getFcMac()).append(" )\n");
234:
235: buffer.append("[/FIB]\n");
236: return buffer.toString();
237: }
238:
239: /**
240: * Size of record (exluding 4 byte header)
241: */
242: public int getSize() {
243: return 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 4 + 4;
244: }
245:
246: /**
247: * Get the wIdent field for the FIB record.
248: */
249: public int getWIdent() {
250: return field_1_wIdent;
251: }
252:
253: /**
254: * Set the wIdent field for the FIB record.
255: */
256: public void setWIdent(int field_1_wIdent) {
257: this .field_1_wIdent = field_1_wIdent;
258: }
259:
260: /**
261: * Get the nFib field for the FIB record.
262: */
263: public int getNFib() {
264: return field_2_nFib;
265: }
266:
267: /**
268: * Set the nFib field for the FIB record.
269: */
270: public void setNFib(int field_2_nFib) {
271: this .field_2_nFib = field_2_nFib;
272: }
273:
274: /**
275: * Get the nProduct field for the FIB record.
276: */
277: public int getNProduct() {
278: return field_3_nProduct;
279: }
280:
281: /**
282: * Set the nProduct field for the FIB record.
283: */
284: public void setNProduct(int field_3_nProduct) {
285: this .field_3_nProduct = field_3_nProduct;
286: }
287:
288: /**
289: * Get the lid field for the FIB record.
290: */
291: public int getLid() {
292: return field_4_lid;
293: }
294:
295: /**
296: * Set the lid field for the FIB record.
297: */
298: public void setLid(int field_4_lid) {
299: this .field_4_lid = field_4_lid;
300: }
301:
302: /**
303: * Get the pnNext field for the FIB record.
304: */
305: public int getPnNext() {
306: return field_5_pnNext;
307: }
308:
309: /**
310: * Set the pnNext field for the FIB record.
311: */
312: public void setPnNext(int field_5_pnNext) {
313: this .field_5_pnNext = field_5_pnNext;
314: }
315:
316: /**
317: * Get the options field for the FIB record.
318: */
319: public short getOptions() {
320: return field_6_options;
321: }
322:
323: /**
324: * Set the options field for the FIB record.
325: */
326: public void setOptions(short field_6_options) {
327: this .field_6_options = field_6_options;
328: }
329:
330: /**
331: * Get the nFibBack field for the FIB record.
332: */
333: public int getNFibBack() {
334: return field_7_nFibBack;
335: }
336:
337: /**
338: * Set the nFibBack field for the FIB record.
339: */
340: public void setNFibBack(int field_7_nFibBack) {
341: this .field_7_nFibBack = field_7_nFibBack;
342: }
343:
344: /**
345: * Get the lKey field for the FIB record.
346: */
347: public int getLKey() {
348: return field_8_lKey;
349: }
350:
351: /**
352: * Set the lKey field for the FIB record.
353: */
354: public void setLKey(int field_8_lKey) {
355: this .field_8_lKey = field_8_lKey;
356: }
357:
358: /**
359: * Get the envr field for the FIB record.
360: */
361: public int getEnvr() {
362: return field_9_envr;
363: }
364:
365: /**
366: * Set the envr field for the FIB record.
367: */
368: public void setEnvr(int field_9_envr) {
369: this .field_9_envr = field_9_envr;
370: }
371:
372: /**
373: * Get the history field for the FIB record.
374: */
375: public short getHistory() {
376: return field_10_history;
377: }
378:
379: /**
380: * Set the history field for the FIB record.
381: */
382: public void setHistory(short field_10_history) {
383: this .field_10_history = field_10_history;
384: }
385:
386: /**
387: * Get the chs field for the FIB record.
388: */
389: public int getChs() {
390: return field_11_chs;
391: }
392:
393: /**
394: * Set the chs field for the FIB record.
395: */
396: public void setChs(int field_11_chs) {
397: this .field_11_chs = field_11_chs;
398: }
399:
400: /**
401: * Get the chsTables field for the FIB record.
402: */
403: public int getChsTables() {
404: return field_12_chsTables;
405: }
406:
407: /**
408: * Set the chsTables field for the FIB record.
409: */
410: public void setChsTables(int field_12_chsTables) {
411: this .field_12_chsTables = field_12_chsTables;
412: }
413:
414: /**
415: * Get the fcMin field for the FIB record.
416: */
417: public int getFcMin() {
418: return field_13_fcMin;
419: }
420:
421: /**
422: * Set the fcMin field for the FIB record.
423: */
424: public void setFcMin(int field_13_fcMin) {
425: this .field_13_fcMin = field_13_fcMin;
426: }
427:
428: /**
429: * Get the fcMac field for the FIB record.
430: */
431: public int getFcMac() {
432: return field_14_fcMac;
433: }
434:
435: /**
436: * Set the fcMac field for the FIB record.
437: */
438: public void setFcMac(int field_14_fcMac) {
439: this .field_14_fcMac = field_14_fcMac;
440: }
441:
442: /**
443: * Sets the fDot field value.
444: *
445: */
446: public void setFDot(boolean value) {
447: field_6_options = (short) fDot.setBoolean(field_6_options,
448: value);
449:
450: }
451:
452: /**
453: *
454: * @return the fDot field value.
455: */
456: public boolean isFDot() {
457: return fDot.isSet(field_6_options);
458:
459: }
460:
461: /**
462: * Sets the fGlsy field value.
463: *
464: */
465: public void setFGlsy(boolean value) {
466: field_6_options = (short) fGlsy.setBoolean(field_6_options,
467: value);
468:
469: }
470:
471: /**
472: *
473: * @return the fGlsy field value.
474: */
475: public boolean isFGlsy() {
476: return fGlsy.isSet(field_6_options);
477:
478: }
479:
480: /**
481: * Sets the fComplex field value.
482: *
483: */
484: public void setFComplex(boolean value) {
485: field_6_options = (short) fComplex.setBoolean(field_6_options,
486: value);
487:
488: }
489:
490: /**
491: *
492: * @return the fComplex field value.
493: */
494: public boolean isFComplex() {
495: return fComplex.isSet(field_6_options);
496:
497: }
498:
499: /**
500: * Sets the fHasPic field value.
501: *
502: */
503: public void setFHasPic(boolean value) {
504: field_6_options = (short) fHasPic.setBoolean(field_6_options,
505: value);
506:
507: }
508:
509: /**
510: *
511: * @return the fHasPic field value.
512: */
513: public boolean isFHasPic() {
514: return fHasPic.isSet(field_6_options);
515:
516: }
517:
518: /**
519: * Sets the cQuickSaves field value.
520: *
521: */
522: public void setCQuickSaves(byte value) {
523: field_6_options = (short) cQuickSaves.setValue(field_6_options,
524: value);
525:
526: }
527:
528: /**
529: *
530: * @return the cQuickSaves field value.
531: */
532: public byte getCQuickSaves() {
533: return (byte) cQuickSaves.getValue(field_6_options);
534:
535: }
536:
537: /**
538: * Sets the fEncrypted field value.
539: *
540: */
541: public void setFEncrypted(boolean value) {
542: field_6_options = (short) fEncrypted.setBoolean(
543: field_6_options, value);
544:
545: }
546:
547: /**
548: *
549: * @return the fEncrypted field value.
550: */
551: public boolean isFEncrypted() {
552: return fEncrypted.isSet(field_6_options);
553:
554: }
555:
556: /**
557: * Sets the fWhichTblStm field value.
558: *
559: */
560: public void setFWhichTblStm(boolean value) {
561: field_6_options = (short) fWhichTblStm.setBoolean(
562: field_6_options, value);
563:
564: }
565:
566: /**
567: *
568: * @return the fWhichTblStm field value.
569: */
570: public boolean isFWhichTblStm() {
571: return fWhichTblStm.isSet(field_6_options);
572:
573: }
574:
575: /**
576: * Sets the fReadOnlyRecommended field value.
577: *
578: */
579: public void setFReadOnlyRecommended(boolean value) {
580: field_6_options = (short) fReadOnlyRecommended.setBoolean(
581: field_6_options, value);
582:
583: }
584:
585: /**
586: *
587: * @return the fReadOnlyRecommended field value.
588: */
589: public boolean isFReadOnlyRecommended() {
590: return fReadOnlyRecommended.isSet(field_6_options);
591:
592: }
593:
594: /**
595: * Sets the fWriteReservation field value.
596: *
597: */
598: public void setFWriteReservation(boolean value) {
599: field_6_options = (short) fWriteReservation.setBoolean(
600: field_6_options, value);
601:
602: }
603:
604: /**
605: *
606: * @return the fWriteReservation field value.
607: */
608: public boolean isFWriteReservation() {
609: return fWriteReservation.isSet(field_6_options);
610:
611: }
612:
613: /**
614: * Sets the fExtChar field value.
615: *
616: */
617: public void setFExtChar(boolean value) {
618: field_6_options = (short) fExtChar.setBoolean(field_6_options,
619: value);
620:
621: }
622:
623: /**
624: *
625: * @return the fExtChar field value.
626: */
627: public boolean isFExtChar() {
628: return fExtChar.isSet(field_6_options);
629:
630: }
631:
632: /**
633: * Sets the fLoadOverride field value.
634: *
635: */
636: public void setFLoadOverride(boolean value) {
637: field_6_options = (short) fLoadOverride.setBoolean(
638: field_6_options, value);
639:
640: }
641:
642: /**
643: *
644: * @return the fLoadOverride field value.
645: */
646: public boolean isFLoadOverride() {
647: return fLoadOverride.isSet(field_6_options);
648:
649: }
650:
651: /**
652: * Sets the fFarEast field value.
653: *
654: */
655: public void setFFarEast(boolean value) {
656: field_6_options = (short) fFarEast.setBoolean(field_6_options,
657: value);
658:
659: }
660:
661: /**
662: *
663: * @return the fFarEast field value.
664: */
665: public boolean isFFarEast() {
666: return fFarEast.isSet(field_6_options);
667:
668: }
669:
670: /**
671: * Sets the fCrypto field value.
672: *
673: */
674: public void setFCrypto(boolean value) {
675: field_6_options = (short) fCrypto.setBoolean(field_6_options,
676: value);
677:
678: }
679:
680: /**
681: *
682: * @return the fCrypto field value.
683: */
684: public boolean isFCrypto() {
685: return fCrypto.isSet(field_6_options);
686:
687: }
688:
689: /**
690: * Sets the fMac field value.
691: *
692: */
693: public void setFMac(boolean value) {
694: field_10_history = (short) fMac.setBoolean(field_10_history,
695: value);
696:
697: }
698:
699: /**
700: *
701: * @return the fMac field value.
702: */
703: public boolean isFMac() {
704: return fMac.isSet(field_10_history);
705:
706: }
707:
708: /**
709: * Sets the fEmptySpecial field value.
710: *
711: */
712: public void setFEmptySpecial(boolean value) {
713: field_10_history = (short) fEmptySpecial.setBoolean(
714: field_10_history, value);
715:
716: }
717:
718: /**
719: *
720: * @return the fEmptySpecial field value.
721: */
722: public boolean isFEmptySpecial() {
723: return fEmptySpecial.isSet(field_10_history);
724:
725: }
726:
727: /**
728: * Sets the fLoadOverridePage field value.
729: *
730: */
731: public void setFLoadOverridePage(boolean value) {
732: field_10_history = (short) fLoadOverridePage.setBoolean(
733: field_10_history, value);
734:
735: }
736:
737: /**
738: *
739: * @return the fLoadOverridePage field value.
740: */
741: public boolean isFLoadOverridePage() {
742: return fLoadOverridePage.isSet(field_10_history);
743:
744: }
745:
746: /**
747: * Sets the fFutureSavedUndo field value.
748: *
749: */
750: public void setFFutureSavedUndo(boolean value) {
751: field_10_history = (short) fFutureSavedUndo.setBoolean(
752: field_10_history, value);
753:
754: }
755:
756: /**
757: *
758: * @return the fFutureSavedUndo field value.
759: */
760: public boolean isFFutureSavedUndo() {
761: return fFutureSavedUndo.isSet(field_10_history);
762:
763: }
764:
765: /**
766: * Sets the fWord97Saved field value.
767: *
768: */
769: public void setFWord97Saved(boolean value) {
770: field_10_history = (short) fWord97Saved.setBoolean(
771: field_10_history, value);
772:
773: }
774:
775: /**
776: *
777: * @return the fWord97Saved field value.
778: */
779: public boolean isFWord97Saved() {
780: return fWord97Saved.isSet(field_10_history);
781:
782: }
783:
784: /**
785: * Sets the fSpare0 field value.
786: *
787: */
788: public void setFSpare0(byte value) {
789: field_10_history = (short) fSpare0.setValue(field_10_history,
790: value);
791:
792: }
793:
794: /**
795: *
796: * @return the fSpare0 field value.
797: */
798: public byte getFSpare0() {
799: return (byte) fSpare0.getValue(field_10_history);
800:
801: }
802:
803: } // END OF CLASS
|