1 16 17 18 package org.apache.poi.hssf.record; 19 20 21 import org.apache.poi.util.*; 22 23 24 30 public class BottomMarginRecord 31 extends Record implements Margin 32 { 33 public final static short sid = 0x29; 34 private double field_1_margin; 35 36 public BottomMarginRecord() 37 { 38 39 } 40 41 49 public BottomMarginRecord( short id, short size, byte[] data ) 50 { 51 super( id, size, data ); 52 } 53 54 63 public BottomMarginRecord( short id, short size, byte[] data, int offset ) 64 { 65 super( id, size, data, offset ); 66 } 67 68 73 protected void validateSid( short id ) 74 { 75 if ( id != sid ) 76 { 77 throw new RecordFormatException( "Not a BottomMargin record" ); 78 } 79 } 80 81 protected void fillFields( byte[] data, short size, int offset ) 82 { 83 field_1_margin = LittleEndian.getDouble( data, 0x0 + offset ); 84 } 85 86 public String toString() 87 { 88 StringBuffer buffer = new StringBuffer (); 89 buffer.append( "[BottomMargin]\n" ); 90 buffer.append( " .margin = " ) 91 .append( " (" ).append( getMargin() ).append( " )\n" ); 92 buffer.append( "[/BottomMargin]\n" ); 93 return buffer.toString(); 94 } 95 96 public int serialize( int offset, byte[] data ) 97 { 98 LittleEndian.putShort( data, 0 + offset, sid ); 99 LittleEndian.putShort( data, 2 + offset, (short) ( getRecordSize() - 4 ) ); 100 LittleEndian.putDouble( data, 4 + offset, field_1_margin ); 101 return getRecordSize(); 102 } 103 104 107 public int getRecordSize() 108 { 109 return 4 + 8; 110 } 111 112 public short getSid() 113 { 114 return this.sid; 115 } 116 117 120 public double getMargin() 121 { 122 return field_1_margin; 123 } 124 125 128 public void setMargin( double field_1_margin ) 129 { 130 this.field_1_margin = field_1_margin; 131 } 132 133 public Object clone() 134 { 135 BottomMarginRecord rec = new BottomMarginRecord(); 136 rec.field_1_margin = this.field_1_margin; 137 return rec; 138 } 139 140 } | Popular Tags |