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 CategorySeriesAxisRecord 34 extends Record 35 { 36 public final static short sid = 0x1020; 37 private short field_1_crossingPoint; 38 private short field_2_labelFrequency; 39 private short field_3_tickMarkFrequency; 40 private short field_4_options; 41 private BitField valueAxisCrossing = new BitField(0x1); 42 private BitField crossesFarRight = new BitField(0x2); 43 private BitField reversed = new BitField(0x4); 44 45 46 public CategorySeriesAxisRecord() 47 { 48 49 } 50 51 59 60 public CategorySeriesAxisRecord(short id, short size, byte [] data) 61 { 62 super(id, size, data); 63 64 } 65 66 75 76 public CategorySeriesAxisRecord(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 CategorySeriesAxis record"); 92 } 93 } 94 95 protected void fillFields(byte [] data, short size, int offset) 96 { 97 98 int pos = 0; 99 field_1_crossingPoint = LittleEndian.getShort(data, pos + 0x0 + offset); 100 field_2_labelFrequency = LittleEndian.getShort(data, pos + 0x2 + offset); 101 field_3_tickMarkFrequency = LittleEndian.getShort(data, pos + 0x4 + offset); 102 field_4_options = LittleEndian.getShort(data, pos + 0x6 + offset); 103 104 } 105 106 public String toString() 107 { 108 StringBuffer buffer = new StringBuffer (); 109 110 buffer.append("[CATSERRANGE]\n"); 111 buffer.append(" .crossingPoint = ") 112 .append("0x").append(HexDump.toHex( getCrossingPoint ())) 113 .append(" (").append( getCrossingPoint() ).append(" )"); 114 buffer.append(System.getProperty("line.separator")); 115 buffer.append(" .labelFrequency = ") 116 .append("0x").append(HexDump.toHex( getLabelFrequency ())) 117 .append(" (").append( getLabelFrequency() ).append(" )"); 118 buffer.append(System.getProperty("line.separator")); 119 buffer.append(" .tickMarkFrequency = ") 120 .append("0x").append(HexDump.toHex( getTickMarkFrequency ())) 121 .append(" (").append( getTickMarkFrequency() ).append(" )"); 122 buffer.append(System.getProperty("line.separator")); 123 buffer.append(" .options = ") 124 .append("0x").append(HexDump.toHex( getOptions ())) 125 .append(" (").append( getOptions() ).append(" )"); 126 buffer.append(System.getProperty("line.separator")); 127 buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing()).append('\n'); 128 buffer.append(" .crossesFarRight = ").append(isCrossesFarRight()).append('\n'); 129 buffer.append(" .reversed = ").append(isReversed()).append('\n'); 130 131 buffer.append("[/CATSERRANGE]\n"); 132 return buffer.toString(); 133 } 134 135 public int serialize(int offset, byte[] data) 136 { 137 int pos = 0; 138 139 LittleEndian.putShort(data, 0 + offset, sid); 140 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 141 142 LittleEndian.putShort(data, 4 + offset + pos, field_1_crossingPoint); 143 LittleEndian.putShort(data, 6 + offset + pos, field_2_labelFrequency); 144 LittleEndian.putShort(data, 8 + offset + pos, field_3_tickMarkFrequency); 145 LittleEndian.putShort(data, 10 + offset + pos, field_4_options); 146 147 return getRecordSize(); 148 } 149 150 153 public int getRecordSize() 154 { 155 return 4 + 2 + 2 + 2 + 2; 156 } 157 158 public short getSid() 159 { 160 return this.sid; 161 } 162 163 public Object clone() { 164 CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord(); 165 166 rec.field_1_crossingPoint = field_1_crossingPoint; 167 rec.field_2_labelFrequency = field_2_labelFrequency; 168 rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency; 169 rec.field_4_options = field_4_options; 170 return rec; 171 } 172 173 174 175 176 179 public short getCrossingPoint() 180 { 181 return field_1_crossingPoint; 182 } 183 184 187 public void setCrossingPoint(short field_1_crossingPoint) 188 { 189 this.field_1_crossingPoint = field_1_crossingPoint; 190 } 191 192 195 public short getLabelFrequency() 196 { 197 return field_2_labelFrequency; 198 } 199 200 203 public void setLabelFrequency(short field_2_labelFrequency) 204 { 205 this.field_2_labelFrequency = field_2_labelFrequency; 206 } 207 208 211 public short getTickMarkFrequency() 212 { 213 return field_3_tickMarkFrequency; 214 } 215 216 219 public void setTickMarkFrequency(short field_3_tickMarkFrequency) 220 { 221 this.field_3_tickMarkFrequency = field_3_tickMarkFrequency; 222 } 223 224 227 public short getOptions() 228 { 229 return field_4_options; 230 } 231 232 235 public void setOptions(short field_4_options) 236 { 237 this.field_4_options = field_4_options; 238 } 239 240 244 public void setValueAxisCrossing(boolean value) 245 { 246 field_4_options = valueAxisCrossing.setShortBoolean(field_4_options, value); 247 } 248 249 253 public boolean isValueAxisCrossing() 254 { 255 return valueAxisCrossing.isSet(field_4_options); 256 } 257 258 262 public void setCrossesFarRight(boolean value) 263 { 264 field_4_options = crossesFarRight.setShortBoolean(field_4_options, value); 265 } 266 267 271 public boolean isCrossesFarRight() 272 { 273 return crossesFarRight.isSet(field_4_options); 274 } 275 276 280 public void setReversed(boolean value) 281 { 282 field_4_options = reversed.setShortBoolean(field_4_options, value); 283 } 284 285 289 public boolean isReversed() 290 { 291 return reversed.isSet(field_4_options); 292 } 293 294 295 } 297 298 299 300 | Popular Tags |