1 16 17 18 package org.apache.poi.hssf.record; 19 20 import org.apache.poi.util.*; 21 22 25 public class RightMarginRecord extends Record implements Margin 26 { 27 public final static short sid = 0x27; 28 private double field_1_margin; 29 30 public RightMarginRecord() { } 31 32 35 public RightMarginRecord( short id, short size, byte[] data ) 36 { super( id, size, data ); } 37 38 41 public RightMarginRecord( short id, short size, byte[] data, int offset ) 42 { super( id, size, data, offset ); } 43 44 47 protected void validateSid( short id ) 48 { 49 if ( id != sid ) 50 { 51 throw new RecordFormatException( "Not a RightMargin record" ); 52 } 53 } 54 55 protected void fillFields( byte[] data, short size, int offset ) 56 { 57 field_1_margin = LittleEndian.getDouble( data, 0x0 + offset ); 58 } 59 60 public String toString() 61 { 62 StringBuffer buffer = new StringBuffer (); 63 buffer.append( "[RightMargin]\n" ); 64 buffer.append( " .margin = " ).append( " (" ).append( getMargin() ).append( " )\n" ); 65 buffer.append( "[/RightMargin]\n" ); 66 return buffer.toString(); 67 } 68 69 public int serialize( int offset, byte[] data ) 70 { 71 LittleEndian.putShort( data, 0 + offset, sid ); 72 LittleEndian.putShort( data, 2 + offset, (short) ( getRecordSize() - 4 ) ); 73 LittleEndian.putDouble( data, 4 + offset, field_1_margin ); 74 return getRecordSize(); 75 } 76 77 80 public int getRecordSize() { return 4 + 8; } 81 82 public short getSid() { return this.sid; } 83 84 87 public double getMargin() { return field_1_margin; } 88 89 92 public void setMargin( double field_1_margin ) 93 { this.field_1_margin = field_1_margin; } 94 95 public Object clone() 96 { 97 RightMarginRecord rec = new RightMarginRecord(); 98 rec.field_1_margin = this.field_1_margin; 99 return rec; 100 } 101 } | Popular Tags |