diff --git a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java index b06b187b6..b0a5447c4 100644 --- a/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/BottomMarginRecord.java @@ -56,7 +56,6 @@ package org.apache.poi.hssf.record; - import org.apache.poi.util.*; /** @@ -64,6 +63,7 @@ import org.apache.poi.util.*; * NOTE: This source was automatically generated. * @author Shawn Laubach (slaubach at apache dot org) */ + public class BottomMarginRecord extends Record implements Margin { diff --git a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java index 4c5afbfc1..48e952aa7 100644 --- a/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/LeftMarginRecord.java @@ -57,6 +57,7 @@ package org.apache.poi.hssf.record; import org.apache.poi.util.*; + /** * Record for the left margin. * NOTE: This source was automatically generated. @@ -67,10 +68,12 @@ public class LeftMarginRecord extends Record implements Margin{ public final static short sid = 0x26; private double field_1_margin; + public LeftMarginRecord() { } + /** * Constructs a LeftMargin record and sets its fields appropriately. * @@ -79,10 +82,12 @@ public class LeftMarginRecord * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len) */ + public LeftMarginRecord(short id, short size, byte [] data) { super(id, size, data); } + /** * Constructs a LeftMargin record and sets its fields appropriately. * @@ -92,15 +97,18 @@ public class LeftMarginRecord * @param data data of the record (should not contain sid/len) * @param offset of the record's data */ + public LeftMarginRecord(short id, short size, byte [] data, int offset) { super(id, size, data, offset); } + /** * Checks the sid matches the expected side for this record * * @param id the expected sid. */ + protected void validateSid(short id) { if (id != sid) @@ -108,10 +116,12 @@ public class LeftMarginRecord throw new RecordFormatException("Not a LeftMargin record"); } } + protected void fillFields(byte [] data, short size, int offset) { field_1_margin = LittleEndian.getDouble(data, 0x0 + offset); } + public String toString() { StringBuffer buffer = new StringBuffer(); @@ -120,6 +130,7 @@ public class LeftMarginRecord buffer.append("[/LeftMargin]\n"); return buffer.toString(); } + public int serialize(int offset, byte[] data) { LittleEndian.putShort(data, 0 + offset, sid); @@ -127,34 +138,43 @@ public class LeftMarginRecord LittleEndian.putDouble(data, 4 + offset, field_1_margin); return getRecordSize(); } + /** * Size of record (exluding 4 byte header) */ + public int getRecordSize() { return 4 + 8; } + public short getSid() { return this.sid; } + /** * Get the margin field for the LeftMargin record. */ + public double getMargin() { return field_1_margin; } + /** * Set the margin field for the LeftMargin record. */ + public void setMargin(double field_1_margin) { this.field_1_margin = field_1_margin; } + public Object clone() { LeftMarginRecord rec = new LeftMarginRecord(); rec.field_1_margin = this.field_1_margin; return rec; } + } diff --git a/src/java/org/apache/poi/hssf/record/Margin.java b/src/java/org/apache/poi/hssf/record/Margin.java index 0d63c32cf..416b3cd26 100644 --- a/src/java/org/apache/poi/hssf/record/Margin.java +++ b/src/java/org/apache/poi/hssf/record/Margin.java @@ -56,6 +56,7 @@ package org.apache.poi.hssf.record; import org.apache.poi.util.*; + /** * The margin interface is a parent used to define left, right, top and bottom margins. This allows much of the code to be generic when it comes to handling margins. * NOTE: This source wass automatically generated. @@ -63,12 +64,17 @@ import org.apache.poi.util.*; */ public interface Margin{ + /** * Get the margin field for the Margin. */ + public double getMargin(); + /** * Set the margin field for the Margin. */ + public void setMargin(double field_1_margin); + } diff --git a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java index 102110073..a54463e5e 100644 --- a/src/java/org/apache/poi/hssf/record/RightMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/RightMarginRecord.java @@ -53,9 +53,12 @@ */ -package org.apache.poi.hssf.record;import org.apache.poi.util.*; +package org.apache.poi.hssf.record; -/** * Record for the right margin. +import org.apache.poi.util.*; + +/** + * Record for the right margin. * NOTE: This source was automatically generated. * @author Shawn Laubach (slaubach at apache dot org) */ @@ -65,10 +68,12 @@ public class RightMarginRecord extends Record implements Margin{ public final static short sid = 0x27; private double field_1_margin; + public RightMarginRecord() { } + /** * Constructs a RightMargin record and sets its fields appropriately. * @@ -77,10 +82,12 @@ public class RightMarginRecord * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len) */ + public RightMarginRecord(short id, short size, byte [] data) { super(id, size, data); } + /** * Constructs a RightMargin record and sets its fields appropriately. * @@ -90,15 +97,18 @@ public class RightMarginRecord * @param data data of the record (should not contain sid/len) * @param offset of the record's data */ + public RightMarginRecord(short id, short size, byte [] data, int offset) { super(id, size, data, offset); } + /** * Checks the sid matches the expected side for this record * * @param id the expected sid. */ + protected void validateSid(short id) { if (id != sid) @@ -106,10 +116,12 @@ public class RightMarginRecord throw new RecordFormatException("Not a RightMargin record"); } } + protected void fillFields(byte [] data, short size, int offset) { field_1_margin = LittleEndian.getDouble(data, 0x0 + offset); } + public String toString() { StringBuffer buffer = new StringBuffer(); @@ -118,6 +130,7 @@ public class RightMarginRecord buffer.append("[/RightMargin]\n"); return buffer.toString(); } + public int serialize(int offset, byte[] data) { LittleEndian.putShort(data, 0 + offset, sid); @@ -125,34 +138,43 @@ public class RightMarginRecord LittleEndian.putDouble(data, 4 + offset, field_1_margin); return getRecordSize(); } + /** * Size of record (exluding 4 byte header) */ + public int getRecordSize() { return 4 + 8; } + public short getSid() { return this.sid; } + /** * Get the margin field for the RightMargin record. */ + public double getMargin() { return field_1_margin; } + /** * Set the margin field for the RightMargin record. */ + public void setMargin(double field_1_margin) { this.field_1_margin = field_1_margin; } + public Object clone() { RightMarginRecord rec = new RightMarginRecord(); rec.field_1_margin = this.field_1_margin; return rec; } + } diff --git a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java index 6ca24ab61..71dba6169 100644 --- a/src/java/org/apache/poi/hssf/record/TopMarginRecord.java +++ b/src/java/org/apache/poi/hssf/record/TopMarginRecord.java @@ -64,6 +64,7 @@ import org.apache.poi.util.*; * NOTE: This source was automatically generated. * @author Shawn Laubach (slaubach at apache dot org) */ + public class TopMarginRecord extends Record implements Margin { @@ -89,6 +90,7 @@ public class TopMarginRecord { super(id, size, data); } + /** * Constructs a TopMargin record and sets its fields appropriately. * @@ -98,15 +100,18 @@ public class TopMarginRecord * @param data data of the record (should not contain sid/len) * @param offset of the record's data */ + public TopMarginRecord(short id, short size, byte [] data, int offset) { super(id, size, data, offset); } + /** * Checks the sid matches the expected side for this record * * @param id the expected sid. */ + protected void validateSid(short id) { if (id != sid) @@ -114,10 +119,12 @@ public class TopMarginRecord throw new RecordFormatException("Not a TopMargin record"); } } + protected void fillFields(byte [] data, short size, int offset) { field_1_margin = LittleEndian.getDouble(data, 0x0 + offset); } + public String toString() { StringBuffer buffer = new StringBuffer(); @@ -127,6 +134,7 @@ public class TopMarginRecord buffer.append("[/TopMargin]\n"); return buffer.toString(); } + public int serialize(int offset, byte[] data) { LittleEndian.putShort(data, 0 + offset, sid); @@ -134,34 +142,43 @@ public class TopMarginRecord LittleEndian.putDouble(data, 4 + offset, field_1_margin); return getRecordSize(); } + /** * Size of record (exluding 4 byte header) */ + public int getRecordSize() { return 4 + 8; } + public short getSid() { return this.sid; } + /** * Get the margin field for the TopMargin record. */ + public double getMargin() { return field_1_margin; } + /** * Set the margin field for the TopMargin record. */ + public void setMargin(double field_1_margin) { this.field_1_margin = field_1_margin; } + public Object clone() { TopMarginRecord rec = new TopMarginRecord(); rec.field_1_margin = this.field_1_margin; return rec; } + }