From 33cb2db6dd29fe2942fb81b65a1f339fc5492c2f Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Fri, 8 Jul 2011 09:55:25 +0000 Subject: [PATCH] make getSize() static git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144229 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hwpf/model/types/FLDAbstractType.java | 2 +- src/types/definitions/fld_type.out.xml | 300 ------------------ src/types/styles/hdftype.xsl | 2 +- 3 files changed, 2 insertions(+), 302 deletions(-) delete mode 100644 src/types/definitions/fld_type.out.xml diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FLDAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FLDAbstractType.java index 34087512d..b99a0edc3 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FLDAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FLDAbstractType.java @@ -102,7 +102,7 @@ public abstract class FLDAbstractType implements HDFType /** * Size of record (exluding 4 byte header) */ - public int getSize() + public static int getSize() { return 4 + +1 + 1; } diff --git a/src/types/definitions/fld_type.out.xml b/src/types/definitions/fld_type.out.xml deleted file mode 100644 index a852f1601..000000000 --- a/src/types/definitions/fld_type.out.xml +++ /dev/null @@ -1,300 +0,0 @@ - -package org.apache.poi.hwpf.model.types; - - - -import org.apache.poi.util.BitField; -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.StringUtil; -import org.apache.poi.util.HexDump; -import org.apache.poi.hdf.model.hdftypes.HDFType; -import org.apache.poi.hwpf.usermodel.*; - -/** - * Field Descriptor (FLD).

Class and fields descriptions are - quoted from - Microsoft Office Word 97-2007 Binary File Format - - * NOTE: This source is automatically generated please do not modify this file. Either subclass or - * remove the record in src/records/definitions. - - * @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format - Specification [*.doc] - - */ -public abstract class FLDAbstractType - implements HDFType -{ - - protected char field_1_ch; - protected byte field_2_flt; - private static BitField fDiffer = new BitField(0x01); - private static BitField fZombieEmbed = new BitField(0x02); - private static BitField fResultDirty = new BitField(0x04); - private static BitField fResultEdited = new BitField(0x08); - private static BitField fLocked = new BitField(0x10); - private static BitField fPrivateResult = new BitField(0x20); - private static BitField fNested = new BitField(0x40); - private static BitField fHasSep = new BitField(0x40); - - - public FLDAbstractType() - { - - } - - protected void fillFields(byte [] data, int offset) - { - field_1_ch = data[ 0x0 + offset ]; - field_2_flt = data[ 0x1 + offset ]; - - } - - public void serialize(byte[] data, int offset) - { - data[ 0x0 + offset] = field_1_ch;; - data[ 0x1 + offset] = field_2_flt;; - - } - - - public String toString() - { - StringBuffer buffer = new StringBuffer(); - - buffer.append("[FLD]\n"); - - buffer.append(" .ch = "); - buffer.append(" (").append(getCh()).append(" )\n"); - - buffer.append(" .flt = "); - buffer.append(" (").append(getFlt()).append(" )\n"); - buffer.append(" .fDiffer = ").append(isFDiffer()).append('\n'); - buffer.append(" .fZombieEmbed = ").append(isFZombieEmbed()).append('\n'); - buffer.append(" .fResultDirty = ").append(isFResultDirty()).append('\n'); - buffer.append(" .fResultEdited = ").append(isFResultEdited()).append('\n'); - buffer.append(" .fLocked = ").append(isFLocked()).append('\n'); - buffer.append(" .fPrivateResult = ").append(isFPrivateResult()).append('\n'); - buffer.append(" .fNested = ").append(isFNested()).append('\n'); - buffer.append(" .fHasSep = ").append(isFHasSep()).append('\n'); - - buffer.append("[/FLD]\n"); - return buffer.toString(); - } - - /** - * Size of record (exluding 4 byte header) - */ - public int getSize() - { - return 4 + + 1 + 1; - } - - - - /** - * Type of field boundary the FLD describes: 19 -- field begin mark, 20 -- field separation mark; 21 -- field end mark. - */ - public char getCh() - { - return field_1_ch; - } - - /** - * Type of field boundary the FLD describes: 19 -- field begin mark, 20 -- field separation mark; 21 -- field end mark. - */ - public void setCh(char field_1_ch) - { - this.field_1_ch = field_1_ch; - } - - /** - * Field type when ch == 19 OR field flags when ch == 21 . - */ - public byte getFlt() - { - return field_2_flt; - } - - /** - * Field type when ch == 19 OR field flags when ch == 21 . - */ - public void setFlt(byte field_2_flt) - { - this.field_2_flt = field_2_flt; - } - - /** - * Sets the fDiffer field value. - * Ignored for saved file - */ - public void setFDiffer(boolean value) - { - field_2_flt = (byte)fDiffer.setBoolean(field_2_flt, value); - - - } - - /** - * Ignored for saved file - * @return the fDiffer field value. - */ - public boolean isFDiffer() - { - return fDiffer.isSet(field_2_flt); - - } - - /** - * Sets the fZombieEmbed field value. - * ==1 when result still believes this field is an EMBED or LINK field - */ - public void setFZombieEmbed(boolean value) - { - field_2_flt = (byte)fZombieEmbed.setBoolean(field_2_flt, value); - - - } - - /** - * ==1 when result still believes this field is an EMBED or LINK field - * @return the fZombieEmbed field value. - */ - public boolean isFZombieEmbed() - { - return fZombieEmbed.isSet(field_2_flt); - - } - - /** - * Sets the fResultDirty field value. - * ==1 when user has edited or formatted the result. == 0 otherwise - */ - public void setFResultDirty(boolean value) - { - field_2_flt = (byte)fResultDirty.setBoolean(field_2_flt, value); - - - } - - /** - * ==1 when user has edited or formatted the result. == 0 otherwise - * @return the fResultDirty field value. - */ - public boolean isFResultDirty() - { - return fResultDirty.isSet(field_2_flt); - - } - - /** - * Sets the fResultEdited field value. - * ==1 when user has inserted text into or deleted text from the result - */ - public void setFResultEdited(boolean value) - { - field_2_flt = (byte)fResultEdited.setBoolean(field_2_flt, value); - - - } - - /** - * ==1 when user has inserted text into or deleted text from the result - * @return the fResultEdited field value. - */ - public boolean isFResultEdited() - { - return fResultEdited.isSet(field_2_flt); - - } - - /** - * Sets the fLocked field value. - * ==1 when field is locked from recalculation - */ - public void setFLocked(boolean value) - { - field_2_flt = (byte)fLocked.setBoolean(field_2_flt, value); - - - } - - /** - * ==1 when field is locked from recalculation - * @return the fLocked field value. - */ - public boolean isFLocked() - { - return fLocked.isSet(field_2_flt); - - } - - /** - * Sets the fPrivateResult field value. - * ==1 whenever the result of the field is never to be shown - */ - public void setFPrivateResult(boolean value) - { - field_2_flt = (byte)fPrivateResult.setBoolean(field_2_flt, value); - - - } - - /** - * ==1 whenever the result of the field is never to be shown - * @return the fPrivateResult field value. - */ - public boolean isFPrivateResult() - { - return fPrivateResult.isSet(field_2_flt); - - } - - /** - * Sets the fNested field value. - * ==1 when field is nested within another field - */ - public void setFNested(boolean value) - { - field_2_flt = (byte)fNested.setBoolean(field_2_flt, value); - - - } - - /** - * ==1 when field is nested within another field - * @return the fNested field value. - */ - public boolean isFNested() - { - return fNested.isSet(field_2_flt); - - } - - /** - * Sets the fHasSep field value. - * ==1 when field has a field separator - */ - public void setFHasSep(boolean value) - { - field_2_flt = (byte)fHasSep.setBoolean(field_2_flt, value); - - - } - - /** - * ==1 when field has a field separator - * @return the fHasSep field value. - */ - public boolean isFHasSep() - { - return fHasSep.isSet(field_2_flt); - - } - - -} // END OF CLASS - - - - diff --git a/src/types/styles/hdftype.xsl b/src/types/styles/hdftype.xsl index f7be80188..6c9ab8cd5 100644 --- a/src/types/styles/hdftype.xsl +++ b/src/types/styles/hdftype.xsl @@ -91,7 +91,7 @@ public abstract class AbstractType /** * Size of record (exluding 4 byte header) */ - public int getSize() + public static int getSize() { return 4 +