1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 24 import org.apache.poi.util.*; 25 26 33 public class AxisLineFormatRecord 34 extends Record 35 { 36 public final static short sid = 0x1021; 37 private short field_1_axisType; 38 public final static short AXIS_TYPE_AXIS_LINE = 0; 39 public final static short AXIS_TYPE_MAJOR_GRID_LINE = 1; 40 public final static short AXIS_TYPE_MINOR_GRID_LINE = 2; 41 public final static short AXIS_TYPE_WALLS_OR_FLOOR = 3; 42 43 44 public AxisLineFormatRecord() 45 { 46 47 } 48 49 57 58 public AxisLineFormatRecord(short id, short size, byte [] data) 59 { 60 super(id, size, data); 61 62 } 63 64 73 74 public AxisLineFormatRecord(short id, short size, byte [] data, int offset) 75 { 76 super(id, size, data, offset); 77 78 } 79 80 85 protected void validateSid(short id) 86 { 87 if (id != sid) 88 { 89 throw new RecordFormatException("Not a AxisLineFormat record"); 90 } 91 } 92 93 protected void fillFields(byte [] data, short size, int offset) 94 { 95 96 int pos = 0; 97 field_1_axisType = LittleEndian.getShort(data, pos + 0x0 + offset); 98 99 } 100 101 public String toString() 102 { 103 StringBuffer buffer = new StringBuffer (); 104 105 buffer.append("[AXISLINEFORMAT]\n"); 106 buffer.append(" .axisType = ") 107 .append("0x").append(HexDump.toHex( getAxisType ())) 108 .append(" (").append( getAxisType() ).append(" )"); 109 buffer.append(System.getProperty("line.separator")); 110 111 buffer.append("[/AXISLINEFORMAT]\n"); 112 return buffer.toString(); 113 } 114 115 public int serialize(int offset, byte[] data) 116 { 117 int pos = 0; 118 119 LittleEndian.putShort(data, 0 + offset, sid); 120 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 121 122 LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType); 123 124 return getRecordSize(); 125 } 126 127 130 public int getRecordSize() 131 { 132 return 4 + 2; 133 } 134 135 public short getSid() 136 { 137 return this.sid; 138 } 139 140 public Object clone() { 141 AxisLineFormatRecord rec = new AxisLineFormatRecord(); 142 143 rec.field_1_axisType = field_1_axisType; 144 return rec; 145 } 146 147 148 149 150 159 public short getAxisType() 160 { 161 return field_1_axisType; 162 } 163 164 174 public void setAxisType(short field_1_axisType) 175 { 176 this.field_1_axisType = field_1_axisType; 177 } 178 179 180 } 182 183 184 185 | Popular Tags |