refactor FieldDescriptor to be based on autogenerated code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144224 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
18b0247ee2
commit
d1c0ea5578
@ -17,146 +17,90 @@
|
||||
|
||||
package org.apache.poi.hwpf.model;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.apache.poi.util.HexDump;
|
||||
import org.apache.poi.hwpf.model.types.FLDAbstractType;
|
||||
|
||||
/**
|
||||
* Class for the FLD structure.
|
||||
*
|
||||
* @author Cedric Bosdonnat <cbosdonnat@novell.com>
|
||||
*
|
||||
*/
|
||||
public final class FieldDescriptor
|
||||
public final class FieldDescriptor extends FLDAbstractType
|
||||
{
|
||||
public static final int FIELD_BEGIN_MARK = 0x13;
|
||||
public static final int FIELD_SEPARATOR_MARK = 0x14;
|
||||
public static final int FIELD_END_MARK = 0x15;
|
||||
public static final int FIELD_BEGIN_MARK = 0x13;
|
||||
public static final int FIELD_SEPARATOR_MARK = 0x14;
|
||||
public static final int FIELD_END_MARK = 0x15;
|
||||
|
||||
private static final short BOUNDARY_MASK = 0x1F;
|
||||
private static final short TYPE_MASK = 0xFF;
|
||||
private static final short ZOMBIE_EMBED_MASK = 0x02;
|
||||
private static final short RESULT_DIRTY_MASK = 0x04;
|
||||
private static final short RESULT_EDITED_MASK = 0x08;
|
||||
private static final short LOCKED_MASK = 0x10;
|
||||
private static final short PRIVATE_RESULT_MASK = 0x20;
|
||||
private static final short NESTED_MASK = 0x40;
|
||||
private static final short HAS_SEP_MASK = 0x80;
|
||||
|
||||
byte _fieldBoundaryType;
|
||||
byte _info;
|
||||
|
||||
private int fieldType;
|
||||
private boolean zombieEmbed;
|
||||
private boolean resultDirty;
|
||||
private boolean resultEdited;
|
||||
private boolean locked;
|
||||
private boolean privateResult;
|
||||
private boolean nested;
|
||||
private boolean hasSep;
|
||||
|
||||
public FieldDescriptor(byte[] data)
|
||||
{
|
||||
_fieldBoundaryType = (byte) (data[0] & BOUNDARY_MASK);
|
||||
_info = data[1];
|
||||
|
||||
if (_fieldBoundaryType == FIELD_BEGIN_MARK)
|
||||
public FieldDescriptor( byte[] data )
|
||||
{
|
||||
fieldType = _info & TYPE_MASK;
|
||||
} else if (_fieldBoundaryType == FIELD_END_MARK)
|
||||
{
|
||||
zombieEmbed = ((_info & ZOMBIE_EMBED_MASK) == 1);
|
||||
resultDirty = ((_info & RESULT_DIRTY_MASK) == 1);
|
||||
resultEdited = ((_info & RESULT_EDITED_MASK) == 1);
|
||||
locked = ((_info & LOCKED_MASK) == 1);
|
||||
privateResult = ((_info & PRIVATE_RESULT_MASK) == 1);
|
||||
nested = ((_info & NESTED_MASK) == 1);
|
||||
hasSep = ((_info & HAS_SEP_MASK) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
public int getBoundaryType()
|
||||
{
|
||||
return _fieldBoundaryType;
|
||||
}
|
||||
|
||||
public int getFieldType()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_BEGIN_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for begin marks.");
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public boolean isZombieEmbed()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_END_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks.");
|
||||
return zombieEmbed;
|
||||
}
|
||||
|
||||
public boolean isResultDirty()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_END_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks.");
|
||||
return resultDirty;
|
||||
}
|
||||
|
||||
public boolean isResultEdited()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_END_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks.");
|
||||
return resultEdited;
|
||||
}
|
||||
|
||||
public boolean isLocked()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_END_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks.");
|
||||
return locked;
|
||||
}
|
||||
|
||||
public boolean isPrivateResult()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_END_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks.");
|
||||
return privateResult;
|
||||
}
|
||||
|
||||
public boolean isNested()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_END_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks.");
|
||||
return nested;
|
||||
}
|
||||
|
||||
public boolean isHasSep()
|
||||
{
|
||||
if (_fieldBoundaryType != FIELD_END_MARK)
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks.");
|
||||
return hasSep;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
String details = new String();
|
||||
if (_fieldBoundaryType == FIELD_BEGIN_MARK)
|
||||
{
|
||||
details = " type: " + fieldType;
|
||||
}
|
||||
else if (_fieldBoundaryType == FIELD_END_MARK)
|
||||
{
|
||||
details = " flags: 0x" + HexDump.toHex(_info);
|
||||
fillFields( data, 0 );
|
||||
}
|
||||
|
||||
return MessageFormat.format("FLD - 0x{0}{1}", HexDump
|
||||
.toHex((byte) _fieldBoundaryType), details);
|
||||
}
|
||||
public int getBoundaryType()
|
||||
{
|
||||
return getCh();
|
||||
}
|
||||
|
||||
public int getFieldType()
|
||||
{
|
||||
if ( getCh() != FIELD_BEGIN_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for begin marks." );
|
||||
return getFlt();
|
||||
}
|
||||
|
||||
public boolean isZombieEmbed()
|
||||
{
|
||||
if ( getCh() != FIELD_END_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks." );
|
||||
return isFZombieEmbed();
|
||||
}
|
||||
|
||||
public boolean isResultDirty()
|
||||
{
|
||||
if ( getCh() != FIELD_END_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks." );
|
||||
return isFResultDirty();
|
||||
}
|
||||
|
||||
public boolean isResultEdited()
|
||||
{
|
||||
if ( getCh() != FIELD_END_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks." );
|
||||
return isFResultEdited();
|
||||
}
|
||||
|
||||
public boolean isLocked()
|
||||
{
|
||||
if ( getCh() != FIELD_END_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks." );
|
||||
return isFLocked();
|
||||
}
|
||||
|
||||
public boolean isPrivateResult()
|
||||
{
|
||||
if ( getCh() != FIELD_END_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks." );
|
||||
return isFPrivateResult();
|
||||
}
|
||||
|
||||
public boolean isNested()
|
||||
{
|
||||
if ( getCh() != FIELD_END_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks." );
|
||||
return isFNested();
|
||||
}
|
||||
|
||||
public boolean isHasSep()
|
||||
{
|
||||
if ( getCh() != FIELD_END_MARK )
|
||||
throw new UnsupportedOperationException(
|
||||
"This field is only defined for end marks." );
|
||||
return isFHasSep();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,310 @@
|
||||
/* ====================================================================
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hwpf.model.types;
|
||||
|
||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||
import org.apache.poi.util.BitField;
|
||||
|
||||
/**
|
||||
* Field Descriptor (FLD).
|
||||
* <p>
|
||||
* 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 = (char) data[0x0 + offset];
|
||||
field_2_flt = data[0x1 + offset];
|
||||
|
||||
}
|
||||
|
||||
public void serialize( byte[] data, int offset )
|
||||
{
|
||||
data[0x0 + offset] = (byte) 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
|
||||
|
300
src/types/definitions/fld_type.out.xml
Normal file
300
src/types/definitions/fld_type.out.xml
Normal file
@ -0,0 +1,300 @@
|
||||
|
||||
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). <p>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
|
||||
|
||||
|
||||
|
||||
|
49
src/types/definitions/fld_type.xml
Normal file
49
src/types/definitions/fld_type.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
====================================================================
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
====================================================================
|
||||
-->
|
||||
<record fromfile="true" name="FLD" package="org.apache.poi.hwpf.model.types">
|
||||
<suffix>AbstractType</suffix>
|
||||
<extends>HDFType</extends>
|
||||
<description>Field Descriptor (FLD). <p>Class and fields descriptions are
|
||||
quoted from
|
||||
Microsoft Office Word 97-2007 Binary File Format
|
||||
</description>
|
||||
<author>Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
|
||||
Specification [*.doc]
|
||||
</author>
|
||||
<fields>
|
||||
<field type="char" size="1" name="ch"
|
||||
description="Type of field boundary the FLD describes: 19 -- field begin mark, 20 -- field separation mark; 21 -- field end mark"/>
|
||||
<field type="byte" size="1" name="flt"
|
||||
description="Field type when ch == 19 OR field flags when ch == 21 ">
|
||||
<bit number="0" mask="0x01" name="fDiffer" description="Ignored for saved file"/>
|
||||
<bit number="1" mask="0x02" name="fZombieEmbed"
|
||||
description="==1 when result still believes this field is an EMBED or LINK field"/>
|
||||
<bit number="2" mask="0x04" name="fResultDirty"
|
||||
description="==1 when user has edited or formatted the result. == 0 otherwise"/>
|
||||
<bit number="3" mask="0x08" name="fResultEdited"
|
||||
description="==1 when user has inserted text into or deleted text from the result"/>
|
||||
<bit number="4" mask="0x10" name="fLocked" description="==1 when field is locked from recalculation"/>
|
||||
<bit number="5" mask="0x20" name="fPrivateResult"
|
||||
description="==1 whenever the result of the field is never to be shown"/>
|
||||
<bit number="6" mask="0x40" name="fNested" description="==1 when field is nested within another field"/>
|
||||
<bit number="7" mask="0x40" name="fHasSep" description="==1 when field has a field separator"/>
|
||||
</field>
|
||||
</fields>
|
||||
</record>
|
Loading…
Reference in New Issue
Block a user