1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 31 32 public class SaveRecalcRecord 33 extends Record 34 { 35 public final static short sid = 0x5f; 36 private short field_1_recalc; 37 38 public SaveRecalcRecord() 39 { 40 } 41 42 49 50 public SaveRecalcRecord(short id, short size, byte [] data) 51 { 52 super(id, size, data); 53 } 54 55 63 64 public SaveRecalcRecord(short id, short size, byte [] data, int offset) 65 { 66 super(id, size, data, offset); 67 } 68 69 protected void validateSid(short id) 70 { 71 if (id != sid) 72 { 73 throw new RecordFormatException("NOT A Save Recalc RECORD"); 74 } 75 } 76 77 protected void fillFields(byte [] data, short size, int offset) 78 { 79 field_1_recalc = LittleEndian.getShort(data, 0 + offset); 80 } 81 82 86 87 public void setRecalc(boolean recalc) 88 { 89 field_1_recalc = ( short ) ((recalc == true) ? 1 90 : 0); 91 } 92 93 97 98 public boolean getRecalc() 99 { 100 return (field_1_recalc == 1); 101 } 102 103 public String toString() 104 { 105 StringBuffer buffer = new StringBuffer (); 106 107 buffer.append("[SAVERECALC]\n"); 108 buffer.append(" .recalc = ").append(getRecalc()) 109 .append("\n"); 110 buffer.append("[/SAVERECALC]\n"); 111 return buffer.toString(); 112 } 113 114 public int serialize(int offset, byte [] data) 115 { 116 LittleEndian.putShort(data, 0 + offset, sid); 117 LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); 118 LittleEndian.putShort(data, 4 + offset, field_1_recalc); 119 return getRecordSize(); 120 } 121 122 public int getRecordSize() 123 { 124 return 6; 125 } 126 127 public short getSid() 128 { 129 return this.sid; 130 } 131 132 public Object clone() { 133 SaveRecalcRecord rec = new SaveRecalcRecord(); 134 rec.field_1_recalc = field_1_recalc; 135 return rec; 136 } 137 } 138 | Popular Tags |