1 2 17 18 package org.apache.poi.ddf; 19 20 import org.apache.poi.util.HexDump; 21 import org.apache.poi.util.LittleEndian; 22 23 30 public class EscherChildAnchorRecord 31 extends EscherRecord 32 { 33 public static final short RECORD_ID = (short) 0xF00F; 34 public static final String RECORD_DESCRIPTION = "MsofbtChildAnchor"; 35 36 private int field_1_dx1; 37 private int field_2_dy1; 38 private int field_3_dx2; 39 private int field_4_dy2; 40 41 49 public int fillFields( byte[] data, int offset, EscherRecordFactory recordFactory ) 50 { 51 int bytesRemaining = readHeader( data, offset ); 52 int pos = offset + 8; 53 int size = 0; 54 field_1_dx1 = LittleEndian.getInt( data, pos + size );size+=4; 55 field_2_dy1 = LittleEndian.getInt( data, pos + size );size+=4; 56 field_3_dx2 = LittleEndian.getInt( data, pos + size );size+=4; 57 field_4_dy2 = LittleEndian.getInt( data, pos + size );size+=4; 58 return 8 + size; 59 } 60 61 70 public int serialize( int offset, byte[] data, EscherSerializationListener listener ) 71 { 72 listener.beforeRecordSerialize( offset, getRecordId(), this ); 73 int pos = offset; 74 LittleEndian.putShort( data, pos, getOptions() ); pos += 2; 75 LittleEndian.putShort( data, pos, getRecordId() ); pos += 2; 76 LittleEndian.putInt( data, pos, getRecordSize()-8 ); pos += 4; 77 LittleEndian.putInt( data, pos, field_1_dx1 ); pos += 4; 78 LittleEndian.putInt( data, pos, field_2_dy1 ); pos += 4; 79 LittleEndian.putInt( data, pos, field_3_dx2 ); pos += 4; 80 LittleEndian.putInt( data, pos, field_4_dy2 ); pos += 4; 81 82 listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this ); 83 return pos - offset; 84 } 85 86 91 public int getRecordSize() 92 { 93 return 8 + 4 * 4; 94 } 95 96 99 public short getRecordId() 100 { 101 return RECORD_ID; 102 } 103 104 107 public String getRecordName() 108 { 109 return "ChildAnchor"; 110 } 111 112 115 public String toString() 116 { 117 String nl = System.getProperty("line.separator"); 118 119 return getClass().getName() + ":" + nl + 120 " RecordId: 0x" + HexDump.toHex(RECORD_ID) + nl + 121 " Options: 0x" + HexDump.toHex(getOptions()) + nl + 122 " X1: " + field_1_dx1 + nl + 123 " Y1: " + field_2_dy1 + nl + 124 " X2: " + field_3_dx2 + nl + 125 " Y2: " + field_4_dy2 + nl ; 126 127 } 128 129 132 public int getDx1() 133 { 134 return field_1_dx1; 135 } 136 137 140 public void setDx1( int field_1_dx1 ) 141 { 142 this.field_1_dx1 = field_1_dx1; 143 } 144 145 148 public int getDy1() 149 { 150 return field_2_dy1; 151 } 152 153 156 public void setDy1( int field_2_dy1 ) 157 { 158 this.field_2_dy1 = field_2_dy1; 159 } 160 161 164 public int getDx2() 165 { 166 return field_3_dx2; 167 } 168 169 172 public void setDx2( int field_3_dx2 ) 173 { 174 this.field_3_dx2 = field_3_dx2; 175 } 176 177 180 public int getDy2() 181 { 182 return field_4_dy2; 183 } 184 185 188 public void setDy2( int field_4_dy2 ) 189 { 190 this.field_4_dy2 = field_4_dy2; 191 } 192 193 } 194 | Popular Tags |