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 AxisParentRecord 34 extends Record 35 { 36 public final static short sid = 0x1041; 37 private short field_1_axisType; 38 public final static short AXIS_TYPE_MAIN = 0; 39 public final static short AXIS_TYPE_SECONDARY = 1; 40 private int field_2_x; 41 private int field_3_y; 42 private int field_4_width; 43 private int field_5_height; 44 45 46 public AxisParentRecord() 47 { 48 49 } 50 51 59 60 public AxisParentRecord(short id, short size, byte [] data) 61 { 62 super(id, size, data); 63 64 } 65 66 75 76 public AxisParentRecord(short id, short size, byte [] data, int offset) 77 { 78 super(id, size, data, offset); 79 80 } 81 82 87 protected void validateSid(short id) 88 { 89 if (id != sid) 90 { 91 throw new RecordFormatException("Not a AxisParent record"); 92 } 93 } 94 95 protected void fillFields(byte [] data, short size, int offset) 96 { 97 98 int pos = 0; 99 field_1_axisType = LittleEndian.getShort(data, pos + 0x0 + offset); 100 field_2_x = LittleEndian.getInt(data, pos + 0x2 + offset); 101 field_3_y = LittleEndian.getInt(data, pos + 0x6 + offset); 102 field_4_width = LittleEndian.getInt(data, pos + 0xa + offset); 103 field_5_height = LittleEndian.getInt(data, pos + 0xe + offset); 104 105 } 106 107 public String toString() 108 { 109 StringBuffer buffer = new StringBuffer (); 110 111 buffer.append("[AXISPARENT]\n"); 112 buffer.append(" .axisType = ") 113 .append("0x").append(HexDump.toHex( getAxisType ())) 114 .append(" (").append( getAxisType() ).append(" )"); 115 buffer.append(System.getProperty("line.separator")); 116 buffer.append(" .x = ") 117 .append("0x").append(HexDump.toHex( getX ())) 118 .append(" (").append( getX() ).append(" )"); 119 buffer.append(System.getProperty("line.separator")); 120 buffer.append(" .y = ") 121 .append("0x").append(HexDump.toHex( getY ())) 122 .append(" (").append( getY() ).append(" )"); 123 buffer.append(System.getProperty("line.separator")); 124 buffer.append(" .width = ") 125 .append("0x").append(HexDump.toHex( getWidth ())) 126 .append(" (").append( getWidth() ).append(" )"); 127 buffer.append(System.getProperty("line.separator")); 128 buffer.append(" .height = ") 129 .append("0x").append(HexDump.toHex( getHeight ())) 130 .append(" (").append( getHeight() ).append(" )"); 131 buffer.append(System.getProperty("line.separator")); 132 133 buffer.append("[/AXISPARENT]\n"); 134 return buffer.toString(); 135 } 136 137 public int serialize(int offset, byte[] data) 138 { 139 int pos = 0; 140 141 LittleEndian.putShort(data, 0 + offset, sid); 142 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 143 144 LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType); 145 LittleEndian.putInt(data, 6 + offset + pos, field_2_x); 146 LittleEndian.putInt(data, 10 + offset + pos, field_3_y); 147 LittleEndian.putInt(data, 14 + offset + pos, field_4_width); 148 LittleEndian.putInt(data, 18 + offset + pos, field_5_height); 149 150 return getRecordSize(); 151 } 152 153 156 public int getRecordSize() 157 { 158 return 4 + 2 + 4 + 4 + 4 + 4; 159 } 160 161 public short getSid() 162 { 163 return this.sid; 164 } 165 166 public Object clone() { 167 AxisParentRecord rec = new AxisParentRecord(); 168 169 rec.field_1_axisType = field_1_axisType; 170 rec.field_2_x = field_2_x; 171 rec.field_3_y = field_3_y; 172 rec.field_4_width = field_4_width; 173 rec.field_5_height = field_5_height; 174 return rec; 175 } 176 177 178 179 180 187 public short getAxisType() 188 { 189 return field_1_axisType; 190 } 191 192 200 public void setAxisType(short field_1_axisType) 201 { 202 this.field_1_axisType = field_1_axisType; 203 } 204 205 208 public int getX() 209 { 210 return field_2_x; 211 } 212 213 216 public void setX(int field_2_x) 217 { 218 this.field_2_x = field_2_x; 219 } 220 221 224 public int getY() 225 { 226 return field_3_y; 227 } 228 229 232 public void setY(int field_3_y) 233 { 234 this.field_3_y = field_3_y; 235 } 236 237 240 public int getWidth() 241 { 242 return field_4_width; 243 } 244 245 248 public void setWidth(int field_4_width) 249 { 250 this.field_4_width = field_4_width; 251 } 252 253 256 public int getHeight() 257 { 258 return field_5_height; 259 } 260 261 264 public void setHeight(int field_5_height) 265 { 266 this.field_5_height = field_5_height; 267 } 268 269 270 } 272 273 274 275 | Popular Tags |