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 PlotGrowthRecord 34 extends Record 35 { 36 public final static short sid = 0x1064; 37 private int field_1_horizontalScale; 38 private int field_2_verticalScale; 39 40 41 public PlotGrowthRecord() 42 { 43 44 } 45 46 54 55 public PlotGrowthRecord(short id, short size, byte [] data) 56 { 57 super(id, size, data); 58 59 } 60 61 70 71 public PlotGrowthRecord(short id, short size, byte [] data, int offset) 72 { 73 super(id, size, data, offset); 74 75 } 76 77 82 protected void validateSid(short id) 83 { 84 if (id != sid) 85 { 86 throw new RecordFormatException("Not a PlotGrowth record"); 87 } 88 } 89 90 protected void fillFields(byte [] data, short size, int offset) 91 { 92 93 int pos = 0; 94 field_1_horizontalScale = LittleEndian.getInt(data, pos + 0x0 + offset); 95 field_2_verticalScale = LittleEndian.getInt(data, pos + 0x4 + offset); 96 97 } 98 99 public String toString() 100 { 101 StringBuffer buffer = new StringBuffer (); 102 103 buffer.append("[PLOTGROWTH]\n"); 104 buffer.append(" .horizontalScale = ") 105 .append("0x").append(HexDump.toHex( getHorizontalScale ())) 106 .append(" (").append( getHorizontalScale() ).append(" )"); 107 buffer.append(System.getProperty("line.separator")); 108 buffer.append(" .verticalScale = ") 109 .append("0x").append(HexDump.toHex( getVerticalScale ())) 110 .append(" (").append( getVerticalScale() ).append(" )"); 111 buffer.append(System.getProperty("line.separator")); 112 113 buffer.append("[/PLOTGROWTH]\n"); 114 return buffer.toString(); 115 } 116 117 public int serialize(int offset, byte[] data) 118 { 119 int pos = 0; 120 121 LittleEndian.putShort(data, 0 + offset, sid); 122 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 123 124 LittleEndian.putInt(data, 4 + offset + pos, field_1_horizontalScale); 125 LittleEndian.putInt(data, 8 + offset + pos, field_2_verticalScale); 126 127 return getRecordSize(); 128 } 129 130 133 public int getRecordSize() 134 { 135 return 4 + 4 + 4; 136 } 137 138 public short getSid() 139 { 140 return this.sid; 141 } 142 143 public Object clone() { 144 PlotGrowthRecord rec = new PlotGrowthRecord(); 145 146 rec.field_1_horizontalScale = field_1_horizontalScale; 147 rec.field_2_verticalScale = field_2_verticalScale; 148 return rec; 149 } 150 151 152 153 154 157 public int getHorizontalScale() 158 { 159 return field_1_horizontalScale; 160 } 161 162 165 public void setHorizontalScale(int field_1_horizontalScale) 166 { 167 this.field_1_horizontalScale = field_1_horizontalScale; 168 } 169 170 173 public int getVerticalScale() 174 { 175 return field_2_verticalScale; 176 } 177 178 181 public void setVerticalScale(int field_2_verticalScale) 182 { 183 this.field_2_verticalScale = field_2_verticalScale; 184 } 185 186 187 } 189 190 191 192 | Popular Tags |