1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 35 36 public class GridsetRecord 37 extends Record 38 { 39 public final static short sid = 0x82; 40 public short field_1_gridset_flag; 41 42 public GridsetRecord() 43 { 44 } 45 46 53 54 public GridsetRecord(short id, short size, byte [] data) 55 { 56 super(id, size, data); 57 } 58 59 67 68 public GridsetRecord(short id, short size, byte [] data, int offset) 69 { 70 super(id, size, data, offset); 71 } 72 73 protected void validateSid(short id) 74 { 75 if (id != sid) 76 { 77 throw new RecordFormatException("NOT A Gridset RECORD"); 78 } 79 } 80 81 protected void fillFields(byte [] data, short size, int offset) 82 { 83 field_1_gridset_flag = LittleEndian.getShort(data, 0 + offset); 84 } 85 86 91 92 public void setGridset(boolean gridset) 93 { 94 if (gridset == true) 95 { 96 field_1_gridset_flag = 1; 97 } 98 else 99 { 100 field_1_gridset_flag = 0; 101 } 102 } 103 104 109 110 public boolean getGridset() 111 { 112 return (field_1_gridset_flag == 1); 113 } 114 115 public String toString() 116 { 117 StringBuffer buffer = new StringBuffer (); 118 119 buffer.append("[GRIDSET]\n"); 120 buffer.append(" .gridset = ").append(getGridset()) 121 .append("\n"); 122 buffer.append("[/GRIDSET]\n"); 123 return buffer.toString(); 124 } 125 126 public int serialize(int offset, byte [] data) 127 { 128 LittleEndian.putShort(data, 0 + offset, sid); 129 LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); 130 LittleEndian.putShort(data, 4 + offset, field_1_gridset_flag); 131 return getRecordSize(); 132 } 133 134 public int getRecordSize() 135 { 136 return 6; 137 } 138 139 public short getSid() 140 { 141 return this.sid; 142 } 143 144 public Object clone() { 145 GridsetRecord rec = new GridsetRecord(); 146 rec.field_1_gridset_flag = field_1_gridset_flag; 147 return rec; 148 } 149 } 150 | Popular Tags |