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 AxisOptionsRecord 34 extends Record 35 { 36 public final static short sid = 0x1062; 37 private short field_1_minimumCategory; 38 private short field_2_maximumCategory; 39 private short field_3_majorUnitValue; 40 private short field_4_majorUnit; 41 private short field_5_minorUnitValue; 42 private short field_6_minorUnit; 43 private short field_7_baseUnit; 44 private short field_8_crossingPoint; 45 private short field_9_options; 46 private BitField defaultMinimum = new BitField(0x1); 47 private BitField defaultMaximum = new BitField(0x2); 48 private BitField defaultMajor = new BitField(0x4); 49 private BitField defaultMinorUnit = new BitField(0x8); 50 private BitField isDate = new BitField(0x10); 51 private BitField defaultBase = new BitField(0x20); 52 private BitField defaultCross = new BitField(0x40); 53 private BitField defaultDateSettings = new BitField(0x80); 54 55 56 public AxisOptionsRecord() 57 { 58 59 } 60 61 69 70 public AxisOptionsRecord(short id, short size, byte [] data) 71 { 72 super(id, size, data); 73 74 } 75 76 85 86 public AxisOptionsRecord(short id, short size, byte [] data, int offset) 87 { 88 super(id, size, data, offset); 89 90 } 91 92 97 protected void validateSid(short id) 98 { 99 if (id != sid) 100 { 101 throw new RecordFormatException("Not a AxisOptions record"); 102 } 103 } 104 105 protected void fillFields(byte [] data, short size, int offset) 106 { 107 108 int pos = 0; 109 field_1_minimumCategory = LittleEndian.getShort(data, pos + 0x0 + offset); 110 field_2_maximumCategory = LittleEndian.getShort(data, pos + 0x2 + offset); 111 field_3_majorUnitValue = LittleEndian.getShort(data, pos + 0x4 + offset); 112 field_4_majorUnit = LittleEndian.getShort(data, pos + 0x6 + offset); 113 field_5_minorUnitValue = LittleEndian.getShort(data, pos + 0x8 + offset); 114 field_6_minorUnit = LittleEndian.getShort(data, pos + 0xa + offset); 115 field_7_baseUnit = LittleEndian.getShort(data, pos + 0xc + offset); 116 field_8_crossingPoint = LittleEndian.getShort(data, pos + 0xe + offset); 117 field_9_options = LittleEndian.getShort(data, pos + 0x10 + offset); 118 119 } 120 121 public String toString() 122 { 123 StringBuffer buffer = new StringBuffer (); 124 125 buffer.append("[AXCEXT]\n"); 126 buffer.append(" .minimumCategory = ") 127 .append("0x").append(HexDump.toHex( getMinimumCategory ())) 128 .append(" (").append( getMinimumCategory() ).append(" )"); 129 buffer.append(System.getProperty("line.separator")); 130 buffer.append(" .maximumCategory = ") 131 .append("0x").append(HexDump.toHex( getMaximumCategory ())) 132 .append(" (").append( getMaximumCategory() ).append(" )"); 133 buffer.append(System.getProperty("line.separator")); 134 buffer.append(" .majorUnitValue = ") 135 .append("0x").append(HexDump.toHex( getMajorUnitValue ())) 136 .append(" (").append( getMajorUnitValue() ).append(" )"); 137 buffer.append(System.getProperty("line.separator")); 138 buffer.append(" .majorUnit = ") 139 .append("0x").append(HexDump.toHex( getMajorUnit ())) 140 .append(" (").append( getMajorUnit() ).append(" )"); 141 buffer.append(System.getProperty("line.separator")); 142 buffer.append(" .minorUnitValue = ") 143 .append("0x").append(HexDump.toHex( getMinorUnitValue ())) 144 .append(" (").append( getMinorUnitValue() ).append(" )"); 145 buffer.append(System.getProperty("line.separator")); 146 buffer.append(" .minorUnit = ") 147 .append("0x").append(HexDump.toHex( getMinorUnit ())) 148 .append(" (").append( getMinorUnit() ).append(" )"); 149 buffer.append(System.getProperty("line.separator")); 150 buffer.append(" .baseUnit = ") 151 .append("0x").append(HexDump.toHex( getBaseUnit ())) 152 .append(" (").append( getBaseUnit() ).append(" )"); 153 buffer.append(System.getProperty("line.separator")); 154 buffer.append(" .crossingPoint = ") 155 .append("0x").append(HexDump.toHex( getCrossingPoint ())) 156 .append(" (").append( getCrossingPoint() ).append(" )"); 157 buffer.append(System.getProperty("line.separator")); 158 buffer.append(" .options = ") 159 .append("0x").append(HexDump.toHex( getOptions ())) 160 .append(" (").append( getOptions() ).append(" )"); 161 buffer.append(System.getProperty("line.separator")); 162 buffer.append(" .defaultMinimum = ").append(isDefaultMinimum()).append('\n'); 163 buffer.append(" .defaultMaximum = ").append(isDefaultMaximum()).append('\n'); 164 buffer.append(" .defaultMajor = ").append(isDefaultMajor()).append('\n'); 165 buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit()).append('\n'); 166 buffer.append(" .isDate = ").append(isIsDate()).append('\n'); 167 buffer.append(" .defaultBase = ").append(isDefaultBase()).append('\n'); 168 buffer.append(" .defaultCross = ").append(isDefaultCross()).append('\n'); 169 buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings()).append('\n'); 170 171 buffer.append("[/AXCEXT]\n"); 172 return buffer.toString(); 173 } 174 175 public int serialize(int offset, byte[] data) 176 { 177 int pos = 0; 178 179 LittleEndian.putShort(data, 0 + offset, sid); 180 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 181 182 LittleEndian.putShort(data, 4 + offset + pos, field_1_minimumCategory); 183 LittleEndian.putShort(data, 6 + offset + pos, field_2_maximumCategory); 184 LittleEndian.putShort(data, 8 + offset + pos, field_3_majorUnitValue); 185 LittleEndian.putShort(data, 10 + offset + pos, field_4_majorUnit); 186 LittleEndian.putShort(data, 12 + offset + pos, field_5_minorUnitValue); 187 LittleEndian.putShort(data, 14 + offset + pos, field_6_minorUnit); 188 LittleEndian.putShort(data, 16 + offset + pos, field_7_baseUnit); 189 LittleEndian.putShort(data, 18 + offset + pos, field_8_crossingPoint); 190 LittleEndian.putShort(data, 20 + offset + pos, field_9_options); 191 192 return getRecordSize(); 193 } 194 195 198 public int getRecordSize() 199 { 200 return 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; 201 } 202 203 public short getSid() 204 { 205 return this.sid; 206 } 207 208 public Object clone() { 209 AxisOptionsRecord rec = new AxisOptionsRecord(); 210 211 rec.field_1_minimumCategory = field_1_minimumCategory; 212 rec.field_2_maximumCategory = field_2_maximumCategory; 213 rec.field_3_majorUnitValue = field_3_majorUnitValue; 214 rec.field_4_majorUnit = field_4_majorUnit; 215 rec.field_5_minorUnitValue = field_5_minorUnitValue; 216 rec.field_6_minorUnit = field_6_minorUnit; 217 rec.field_7_baseUnit = field_7_baseUnit; 218 rec.field_8_crossingPoint = field_8_crossingPoint; 219 rec.field_9_options = field_9_options; 220 return rec; 221 } 222 223 224 225 226 229 public short getMinimumCategory() 230 { 231 return field_1_minimumCategory; 232 } 233 234 237 public void setMinimumCategory(short field_1_minimumCategory) 238 { 239 this.field_1_minimumCategory = field_1_minimumCategory; 240 } 241 242 245 public short getMaximumCategory() 246 { 247 return field_2_maximumCategory; 248 } 249 250 253 public void setMaximumCategory(short field_2_maximumCategory) 254 { 255 this.field_2_maximumCategory = field_2_maximumCategory; 256 } 257 258 261 public short getMajorUnitValue() 262 { 263 return field_3_majorUnitValue; 264 } 265 266 269 public void setMajorUnitValue(short field_3_majorUnitValue) 270 { 271 this.field_3_majorUnitValue = field_3_majorUnitValue; 272 } 273 274 277 public short getMajorUnit() 278 { 279 return field_4_majorUnit; 280 } 281 282 285 public void setMajorUnit(short field_4_majorUnit) 286 { 287 this.field_4_majorUnit = field_4_majorUnit; 288 } 289 290 293 public short getMinorUnitValue() 294 { 295 return field_5_minorUnitValue; 296 } 297 298 301 public void setMinorUnitValue(short field_5_minorUnitValue) 302 { 303 this.field_5_minorUnitValue = field_5_minorUnitValue; 304 } 305 306 309 public short getMinorUnit() 310 { 311 return field_6_minorUnit; 312 } 313 314 317 public void setMinorUnit(short field_6_minorUnit) 318 { 319 this.field_6_minorUnit = field_6_minorUnit; 320 } 321 322 325 public short getBaseUnit() 326 { 327 return field_7_baseUnit; 328 } 329 330 333 public void setBaseUnit(short field_7_baseUnit) 334 { 335 this.field_7_baseUnit = field_7_baseUnit; 336 } 337 338 341 public short getCrossingPoint() 342 { 343 return field_8_crossingPoint; 344 } 345 346 349 public void setCrossingPoint(short field_8_crossingPoint) 350 { 351 this.field_8_crossingPoint = field_8_crossingPoint; 352 } 353 354 357 public short getOptions() 358 { 359 return field_9_options; 360 } 361 362 365 public void setOptions(short field_9_options) 366 { 367 this.field_9_options = field_9_options; 368 } 369 370 374 public void setDefaultMinimum(boolean value) 375 { 376 field_9_options = defaultMinimum.setShortBoolean(field_9_options, value); 377 } 378 379 383 public boolean isDefaultMinimum() 384 { 385 return defaultMinimum.isSet(field_9_options); 386 } 387 388 392 public void setDefaultMaximum(boolean value) 393 { 394 field_9_options = defaultMaximum.setShortBoolean(field_9_options, value); 395 } 396 397 401 public boolean isDefaultMaximum() 402 { 403 return defaultMaximum.isSet(field_9_options); 404 } 405 406 410 public void setDefaultMajor(boolean value) 411 { 412 field_9_options = defaultMajor.setShortBoolean(field_9_options, value); 413 } 414 415 419 public boolean isDefaultMajor() 420 { 421 return defaultMajor.isSet(field_9_options); 422 } 423 424 428 public void setDefaultMinorUnit(boolean value) 429 { 430 field_9_options = defaultMinorUnit.setShortBoolean(field_9_options, value); 431 } 432 433 437 public boolean isDefaultMinorUnit() 438 { 439 return defaultMinorUnit.isSet(field_9_options); 440 } 441 442 446 public void setIsDate(boolean value) 447 { 448 field_9_options = isDate.setShortBoolean(field_9_options, value); 449 } 450 451 455 public boolean isIsDate() 456 { 457 return isDate.isSet(field_9_options); 458 } 459 460 464 public void setDefaultBase(boolean value) 465 { 466 field_9_options = defaultBase.setShortBoolean(field_9_options, value); 467 } 468 469 473 public boolean isDefaultBase() 474 { 475 return defaultBase.isSet(field_9_options); 476 } 477 478 482 public void setDefaultCross(boolean value) 483 { 484 field_9_options = defaultCross.setShortBoolean(field_9_options, value); 485 } 486 487 491 public boolean isDefaultCross() 492 { 493 return defaultCross.isSet(field_9_options); 494 } 495 496 500 public void setDefaultDateSettings(boolean value) 501 { 502 field_9_options = defaultDateSettings.setShortBoolean(field_9_options, value); 503 } 504 505 509 public boolean isDefaultDateSettings() 510 { 511 return defaultDateSettings.isSet(field_9_options); 512 } 513 514 515 } 517 518 519 520 | Popular Tags |