correctly save PlfLst

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1178104 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-10-02 00:11:05 +00:00
parent 5041b7b215
commit c91b9c072d
8 changed files with 649 additions and 185 deletions

View File

@ -801,46 +801,40 @@ public final class HWPFDocument extends HWPFDocumentCore
_fib.setLcbPlcfsed(tableStream.getOffset() - tableOffset);
tableOffset = tableStream.getOffset();
/*
* plcflst (list formats) Written immediately after the end of the
* previously recorded, if there are any lists defined in the document.
* This begins with a short count of LSTF structures followed by those
* LSTF structures. This is immediately followed by the allocated data
* hanging off the LSTFs. This data consists of the array of LVLs for
* each LSTF. (Each LVL consists of an LVLF followed by two grpprls and
* an XST.)
*
* Microsoft Office Word 97-2007 Binary File Format (.doc)
* Specification; Page 25 of 210
*/
// write out the list tables
if ( _lt != null )
{
/*
* plcflst (list formats) Written immediately after the end of the
* previously recorded, if there are any lists defined in the
* document. This begins with a short count of LSTF structures
* followed by those LSTF structures. This is immediately followed
* by the allocated data hanging off the LSTFs. This data consists
* of the array of LVLs for each LSTF. (Each LVL consists of an LVLF
* followed by two grpprls and an XST.)
*
* Microsoft Office Word 97-2007 Binary File Format (.doc)
* Specification; Page 25 of 210
*/
_lt.writeListDataTo( _fib, tableStream );
tableOffset = tableStream.getOffset();
// write out the list tables
if (_lt != null)
{
_fib.setFcPlcfLst(tableOffset);
_lt.writeListDataTo(tableStream);
_fib.setLcbPlcfLst(tableStream.getOffset() - tableOffset);
}
/*
* plflfo (more list formats) Written immediately after the end of the
* plcflst and its accompanying data, if there are any lists defined in
* the document. This consists first of a PL of LFO records, followed by
* the allocated data (if any) hanging off the LFOs. The allocated data
* consists of the array of LFOLVLFs for each LFO (and each LFOLVLF is
* immediately followed by some LVLs).
*
* Microsoft Office Word 97-2007 Binary File Format (.doc)
* Specification; Page 26 of 210
*/
if (_lt != null)
{
_fib.setFcPlfLfo(tableStream.getOffset());
_lt.writeListOverridesTo(tableStream);
_fib.setLcbPlfLfo(tableStream.getOffset() - tableOffset);
tableOffset = tableStream.getOffset();
}
/*
* plflfo (more list formats) Written immediately after the end of
* the plcflst and its accompanying data, if there are any lists
* defined in the document. This consists first of a PL of LFO
* records, followed by the allocated data (if any) hanging off the
* LFOs. The allocated data consists of the array of LFOLVLFs for
* each LFO (and each LFOLVLF is immediately followed by some LVLs).
*
* Microsoft Office Word 97-2007 Binary File Format (.doc)
* Specification; Page 26 of 210
*/
_fib.setFcPlfLfo( tableStream.getOffset() );
_lt.writeListOverridesTo( tableStream );
_fib.setLcbPlfLfo( tableStream.getOffset() - tableOffset );
tableOffset = tableStream.getOffset();
}
/*
* sttbfBkmk (table of bookmark name strings) Written immediately after

View File

@ -0,0 +1,44 @@
/* ====================================================================
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;
import org.apache.poi.hwpf.model.types.LSTFAbstractType;
/**
* The LSTF structure contains formatting properties that apply to an entire
* list.
* <p>
* Class and fields descriptions are quoted from Microsoft Office Word 97-2007
* Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
*
* @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary
* File Format Specification [*.doc] and [MS-DOC] - v20110608 Word
* (.doc) Binary File Format
*/
class LSTF extends LSTFAbstractType
{
LSTF()
{
}
LSTF( byte[] buf, int offset )
{
super();
fillFields( buf, offset );
}
}

View File

@ -19,141 +19,125 @@ package org.apache.poi.hwpf.model;
import java.util.Arrays;
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
@Internal
public final class ListData
{
private int _lsid;
private int _tplc;
private short[] _rgistd;
private byte _info;
private static BitField _fSimpleList = BitFieldFactory.getInstance(0x1);
private static BitField _fRestartHdn = BitFieldFactory.getInstance(0x2);
private byte _reserved;
ListLevel[] _levels;
private ListLevel[] _levels;
public ListData(int listID, boolean numbered)
{
_lsid = listID;
_rgistd = new short[9];
private LSTF _lstf;
for (int x = 0; x < 9; x++)
ListData( byte[] buf, int offset )
{
_rgistd[x] = StyleSheet.NIL_STYLE;
_lstf = new LSTF( buf, offset );
if ( _lstf.isFSimpleList() )
{
_levels = new ListLevel[1];
}
else
{
_levels = new ListLevel[9];
}
}
_levels = new ListLevel[9];
public ListData( int listID, boolean numbered )
{
_lstf = new LSTF();
_lstf.setLsid( listID );
_lstf.setRgistdPara( new short[9] );
Arrays.fill( _lstf.getRgistdPara(), (short) StyleSheet.NIL_STYLE );
for (int x = 0; x < _levels.length; x++)
{
_levels[x] = new ListLevel(x, numbered);
}
}
ListData(byte[] buf, int offset)
{
_lsid = LittleEndian.getInt(buf, offset);
offset += LittleEndian.INT_SIZE;
_tplc = LittleEndian.getInt(buf, offset);
offset += LittleEndian.INT_SIZE;
_rgistd = new short[9];
for (int x = 0; x < 9; x++)
{
_rgistd[x] = LittleEndian.getShort(buf, offset);
offset += LittleEndian.SHORT_SIZE;
}
_info = buf[offset++];
_reserved = buf[offset];
if (_fSimpleList.getValue(_info) > 0)
{
_levels = new ListLevel[1];
}
else
{
_levels = new ListLevel[9];
_levels = new ListLevel[9];
for ( int x = 0; x < _levels.length; x++ )
{
_levels[x] = new ListLevel( x, numbered );
}
}
}
public int getLsid()
{
return _lsid;
}
public int numLevels()
{
return _levels.length;
}
public void setLevel(int index, ListLevel level)
{
_levels[index] = level;
}
public ListLevel[] getLevels()
{
return _levels;
}
/**
* Gets the level associated to a particular List at a particular index.
*
* @param index 1-based index
* @return a list level
*/
public ListLevel getLevel(int index)
{
return _levels[index - 1];
}
public int getLevelStyle(int index)
{
return _rgistd[index];
}
public void setLevelStyle(int index, int styleIndex)
{
_rgistd[index] = (short)styleIndex;
}
public boolean equals(Object obj)
{
if (obj == null)
@Override
public boolean equals( Object obj )
{
return false;
if ( this == obj )
return true;
if ( obj == null )
return false;
if ( getClass() != obj.getClass() )
return false;
ListData other = (ListData) obj;
if ( !Arrays.equals( _levels, other._levels ) )
return false;
if ( _lstf == null )
{
if ( other._lstf != null )
return false;
}
else if ( !_lstf.equals( other._lstf ) )
return false;
return true;
}
ListData lst = (ListData)obj;
return lst._info == _info && Arrays.equals(lst._levels, _levels) &&
lst._lsid == _lsid && lst._reserved == _reserved && lst._tplc == _tplc &&
Arrays.equals(lst._rgistd, _rgistd);
}
int resetListID()
{
_lsid = (int)(Math.random() * System.currentTimeMillis());
return _lsid;
}
public byte[] toByteArray()
{
byte[] buf = new byte[28];
int offset = 0;
LittleEndian.putInt(buf, _lsid);
offset += LittleEndian.INT_SIZE;
LittleEndian.putInt(buf, offset, _tplc);
offset += LittleEndian.INT_SIZE;
for (int x = 0; x < 9; x++)
/**
* Gets the level associated to a particular List at a particular index.
*
* @param index
* 1-based index
* @return a list level
*/
public ListLevel getLevel( int index )
{
LittleEndian.putShort(buf, offset, _rgistd[x]);
offset += LittleEndian.SHORT_SIZE;
return _levels[index - 1];
}
public ListLevel[] getLevels()
{
return _levels;
}
public int getLevelStyle( int index )
{
return _lstf.getRgistdPara()[index];
}
public int getLsid()
{
return _lstf.getLsid();
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode( _levels );
result = prime * result + ( ( _lstf == null ) ? 0 : _lstf.hashCode() );
return result;
}
public int numLevels()
{
return _levels.length;
}
int resetListID()
{
_lstf.setLsid( (int) ( Math.random() * System.currentTimeMillis() ) );
return _lstf.getLsid();
}
public void setLevel( int index, ListLevel level )
{
_levels[index] = level;
}
public void setLevelStyle( int index, int styleIndex )
{
_lstf.getRgistdPara()[index] = (short) styleIndex;
}
public byte[] toByteArray()
{
return _lstf.serialize();
}
buf[offset++] = _info;
buf[offset] = _reserved;
return buf;
}
}

View File

@ -52,27 +52,36 @@ public final class ListTables
}
public ListTables(byte[] tableStream, int lstOffset, final int lfoOffset)
{
// get the list data
int length = LittleEndian.getShort(tableStream, lstOffset);
lstOffset += LittleEndian.SHORT_SIZE;
int levelOffset = lstOffset + (length * LIST_DATA_SIZE);
for (int x = 0; x < length; x++)
public ListTables( byte[] tableStream, final int lstOffset,
final int lfoOffset )
{
ListData lst = new ListData(tableStream, lstOffset);
_listMap.put(Integer.valueOf(lst.getLsid()), lst);
lstOffset += LIST_DATA_SIZE;
{
/*
* The PlfLst structure contains the list formatting information for
* the document. -- Page 425 of 621. [MS-DOC] -- v20110315 Word
* (.doc) Binary File Format
*/
int offset = lstOffset;
int num = lst.numLevels();
for (int y = 0; y < num; y++)
{
ListLevel lvl = new ListLevel(tableStream, levelOffset);
lst.setLevel(y, lvl);
levelOffset += lvl.getSizeInBytes();
}
}
int cLst = LittleEndian.getShort( tableStream, offset );
offset += LittleEndian.SHORT_SIZE;
int levelOffset = offset + ( cLst * LIST_DATA_SIZE );
for ( int x = 0; x < cLst; x++ )
{
ListData lst = new ListData( tableStream, offset );
_listMap.put( Integer.valueOf( lst.getLsid() ), lst );
offset += LSTF.getSize();
int num = lst.numLevels();
for ( int y = 0; y < num; y++ )
{
ListLevel lvl = new ListLevel( tableStream, levelOffset );
lst.setLevel( y, lvl );
levelOffset += lvl.getSizeInBytes();
}
}
}
{
/*
@ -133,9 +142,12 @@ public final class ListTables
return lsid;
}
public void writeListDataTo(HWPFOutputStream tableStream)
throws IOException
{
public void writeListDataTo( FileInformationBlock fib,
HWPFOutputStream tableStream ) throws IOException
{
final int startOffset = tableStream.getOffset();
fib.setFcPlcfLst( startOffset );
int listSize = _listMap.size();
// use this stream as a buffer for the levels since their size varies.
@ -154,8 +166,15 @@ public final class ListTables
levelBuf.write(lvls[y].toByteArray());
}
}
tableStream.write(levelBuf.toByteArray());
}
/*
* An array of LVLs is appended to the PlfLst. lcbPlfLst does not
* account for the array of LVLs. -- Page 76 of 621 -- [MS-DOC] --
* v20110315 Word (.doc) Binary File Format
*/
fib.setLcbPlcfLst( tableStream.getOffset() - startOffset );
tableStream.write( levelBuf.toByteArray() );
}
public void writeListOverridesTo( HWPFOutputStream tableStream )
throws IOException

View File

@ -0,0 +1,372 @@
/* ====================================================================
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 java.util.Arrays;
import org.apache.poi.util.BitField;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
/**
* The LSTF structure contains formatting properties that apply to an entire list.
<p>Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary
File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
* <p>
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
* remove the record in src/types/definitions.
* <p>
* This class is internal. It content or properties may change without notice
* due to changes in our knowledge of internal Microsoft Word binary structures.
* @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
*/
@Internal
public abstract class LSTFAbstractType
{
protected int field_1_lsid;
protected int field_2_tplc;
protected short[] field_3_rgistdPara;
protected byte field_4_flags;
/**/private static final BitField fSimpleList = new BitField(0x01);
/**/private static final BitField unused1 = new BitField(0x02);
/**/private static final BitField fAutoNum = new BitField(0x04);
/**/private static final BitField unused2 = new BitField(0x08);
/**/private static final BitField fHybrid = new BitField(0x10);
/**/private static final BitField reserved1 = new BitField(0xE0);
protected byte field_5_grfhic;
protected LSTFAbstractType()
{
this.field_3_rgistdPara = new short[0];
}
protected void fillFields( byte[] data, int offset )
{
field_1_lsid = LittleEndian.getInt( data, 0x0 + offset );
field_2_tplc = LittleEndian.getInt( data, 0x4 + offset );
field_3_rgistdPara = LittleEndian.getShortArray( data, 0x8 + offset, 18 );
field_4_flags = data[ 0x1a + offset ];
field_5_grfhic = data[ 0x1b + offset ];
}
public void serialize( byte[] data, int offset )
{
LittleEndian.putInt( data, 0x0 + offset, field_1_lsid );
LittleEndian.putInt( data, 0x4 + offset, field_2_tplc );
LittleEndian.putShortArray( data, 0x8 + offset, field_3_rgistdPara );
data[ 0x1a + offset ] = field_4_flags;
data[ 0x1b + offset ] = field_5_grfhic;
}
public byte[] serialize()
{
final byte[] result = new byte[ getSize() ];
serialize( result, 0 );
return result;
}
/**
* Size of record
*/
public static int getSize()
{
return 0 + 4 + 4 + 18 + 1 + 1;
}
@Override
public boolean equals( Object obj )
{
if ( this == obj )
return true;
if ( obj == null )
return false;
if ( getClass() != obj.getClass() )
return false;
LSTFAbstractType other = (LSTFAbstractType) obj;
if ( field_1_lsid != other.field_1_lsid )
return false;
if ( field_2_tplc != other.field_2_tplc )
return false;
if ( !Arrays.equals( field_3_rgistdPara, other.field_3_rgistdPara ) )
return false;
if ( field_4_flags != other.field_4_flags )
return false;
if ( field_5_grfhic != other.field_5_grfhic )
return false;
return true;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + field_1_lsid;
result = prime * result + field_2_tplc;
result = prime * result + Arrays.hashCode( field_3_rgistdPara );
result = prime * result + field_4_flags;
result = prime * result + field_5_grfhic;
return result;
}
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("[LSTF]\n");
builder.append(" .lsid = ");
builder.append(" (").append(getLsid()).append(" )\n");
builder.append(" .tplc = ");
builder.append(" (").append(getTplc()).append(" )\n");
builder.append(" .rgistdPara = ");
builder.append(" (").append(getRgistdPara()).append(" )\n");
builder.append(" .flags = ");
builder.append(" (").append(getFlags()).append(" )\n");
builder.append(" .fSimpleList = ").append(isFSimpleList()).append('\n');
builder.append(" .unused1 = ").append(isUnused1()).append('\n');
builder.append(" .fAutoNum = ").append(isFAutoNum()).append('\n');
builder.append(" .unused2 = ").append(isUnused2()).append('\n');
builder.append(" .fHybrid = ").append(isFHybrid()).append('\n');
builder.append(" .reserved1 = ").append(getReserved1()).append('\n');
builder.append(" .grfhic = ");
builder.append(" (").append(getGrfhic()).append(" )\n");
builder.append("[/LSTF]\n");
return builder.toString();
}
/**
* A signed integer that specifies the list identifier. This MUST be unique for each LSTF. This value MUST not be 0xFFFFFFFF.
*/
@Internal
public int getLsid()
{
return field_1_lsid;
}
/**
* A signed integer that specifies the list identifier. This MUST be unique for each LSTF. This value MUST not be 0xFFFFFFFF.
*/
@Internal
public void setLsid( int field_1_lsid )
{
this.field_1_lsid = field_1_lsid;
}
/**
* A Tplc that specifies a unique identifier for this LSTF that MAY be used for user interface purposes. If fHybrid is nonzero, this MUST be ignored.
*/
@Internal
public int getTplc()
{
return field_2_tplc;
}
/**
* A Tplc that specifies a unique identifier for this LSTF that MAY be used for user interface purposes. If fHybrid is nonzero, this MUST be ignored.
*/
@Internal
public void setTplc( int field_2_tplc )
{
this.field_2_tplc = field_2_tplc;
}
/**
* An array of nine 16-bit signed integers. Each element of rgistdPara specifies the ISTD of the style that is linked to the corresponding level in the list. If no style is linked to a given level, the value of the corresponding element of rgistdPara MUST be 0x0FFF.
*/
@Internal
public short[] getRgistdPara()
{
return field_3_rgistdPara;
}
/**
* An array of nine 16-bit signed integers. Each element of rgistdPara specifies the ISTD of the style that is linked to the corresponding level in the list. If no style is linked to a given level, the value of the corresponding element of rgistdPara MUST be 0x0FFF.
*/
@Internal
public void setRgistdPara( short[] field_3_rgistdPara )
{
this.field_3_rgistdPara = field_3_rgistdPara;
}
/**
* Get the flags field for the LSTF record.
*/
@Internal
public byte getFlags()
{
return field_4_flags;
}
/**
* Set the flags field for the LSTF record.
*/
@Internal
public void setFlags( byte field_4_flags )
{
this.field_4_flags = field_4_flags;
}
/**
* A grfhic that specifies the HTML incompatibilities of the list..
*/
@Internal
public byte getGrfhic()
{
return field_5_grfhic;
}
/**
* A grfhic that specifies the HTML incompatibilities of the list..
*/
@Internal
public void setGrfhic( byte field_5_grfhic )
{
this.field_5_grfhic = field_5_grfhic;
}
/**
* Sets the fSimpleList field value.
* A bit that, when set to 0x1, specifies that this LSTF represents a simple (one-level) list that has one corresponding LVL (see the fcPlfLst field of FibRgFcLcb97). Otherwise, this LSTF represents a multi-level list that has nine corresponding LVLs
*/
@Internal
public void setFSimpleList( boolean value )
{
field_4_flags = (byte)fSimpleList.setBoolean(field_4_flags, value);
}
/**
* A bit that, when set to 0x1, specifies that this LSTF represents a simple (one-level) list that has one corresponding LVL (see the fcPlfLst field of FibRgFcLcb97). Otherwise, this LSTF represents a multi-level list that has nine corresponding LVLs
* @return the fSimpleList field value.
*/
@Internal
public boolean isFSimpleList()
{
return fSimpleList.isSet(field_4_flags);
}
/**
* Sets the unused1 field value.
* This bit MUST be ignored
*/
@Internal
public void setUnused1( boolean value )
{
field_4_flags = (byte)unused1.setBoolean(field_4_flags, value);
}
/**
* This bit MUST be ignored
* @return the unused1 field value.
* @deprecated This field should not be used according to specification
*/
@Internal
@Deprecated
public boolean isUnused1()
{
return unused1.isSet(field_4_flags);
}
/**
* Sets the fAutoNum field value.
* A bit that specifies whether the list that this LSTF represents is used for the AUTONUMOUT, AUTONUMLGL, and AUTONUM fields (see AUTONUMOUT, AUTONUMLGL, and AUTONUM in flt)
*/
@Internal
public void setFAutoNum( boolean value )
{
field_4_flags = (byte)fAutoNum.setBoolean(field_4_flags, value);
}
/**
* A bit that specifies whether the list that this LSTF represents is used for the AUTONUMOUT, AUTONUMLGL, and AUTONUM fields (see AUTONUMOUT, AUTONUMLGL, and AUTONUM in flt)
* @return the fAutoNum field value.
*/
@Internal
public boolean isFAutoNum()
{
return fAutoNum.isSet(field_4_flags);
}
/**
* Sets the unused2 field value.
* This bit MUST be ignored
*/
@Internal
public void setUnused2( boolean value )
{
field_4_flags = (byte)unused2.setBoolean(field_4_flags, value);
}
/**
* This bit MUST be ignored
* @return the unused2 field value.
* @deprecated This field should not be used according to specification
*/
@Internal
@Deprecated
public boolean isUnused2()
{
return unused2.isSet(field_4_flags);
}
/**
* Sets the fHybrid field value.
* A bit that specifies whether the list this LSTF defines is a hybrid list
*/
@Internal
public void setFHybrid( boolean value )
{
field_4_flags = (byte)fHybrid.setBoolean(field_4_flags, value);
}
/**
* A bit that specifies whether the list this LSTF defines is a hybrid list
* @return the fHybrid field value.
*/
@Internal
public boolean isFHybrid()
{
return fHybrid.isSet(field_4_flags);
}
/**
* Sets the reserved1 field value.
* This MUST be zero, and MUST be ignored.
*/
@Internal
public void setReserved1( byte value )
{
field_4_flags = (byte)reserved1.setValue(field_4_flags, value);
}
/**
* This MUST be zero, and MUST be ignored.
* @return the reserved1 field value.
* @deprecated This field should not be used according to specification
*/
@Internal
@Deprecated
public byte getReserved1()
{
return ( byte )reserved1.getValue(field_4_flags);
}
} // END OF CLASS

View File

@ -45,7 +45,7 @@ public final class TestListTables
HWPFOutputStream tableOut = fileSys.getStream ("1Table");
listTables.writeListDataTo (tableOut);
listTables.writeListDataTo (fib, tableOut);
int offset = tableOut.getOffset ();
listTables.writeListOverridesTo (tableOut);

View File

@ -0,0 +1,51 @@
<?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="LSTF" package="org.apache.poi.hwpf.model.types">
<suffix>AbstractType</suffix>
<description>The LSTF structure contains formatting properties that apply to an entire list.
&lt;p&gt;Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary
File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
</description>
<author>Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
</author>
<fields>
<field type="int" size="4" name="lsid"
description="A signed integer that specifies the list identifier. This MUST be unique for each LSTF. This value MUST not be 0xFFFFFFFF"/>
<field type="int" size="4" name="tplc"
description="A Tplc that specifies a unique identifier for this LSTF that MAY be used for user interface purposes. If fHybrid is nonzero, this MUST be ignored"/>
<field type="short[]" size="18" name="rgistdPara"
description="An array of nine 16-bit signed integers. Each element of rgistdPara specifies the ISTD of the style that is linked to the corresponding level in the list. If no style is linked to a given level, the value of the corresponding element of rgistdPara MUST be 0x0FFF"/>
<field type="byte" size="1" name="flags">
<bit mask="0x01" name="fSimpleList"
description="A bit that, when set to 0x1, specifies that this LSTF represents a simple (one-level) list that has one corresponding LVL (see the fcPlfLst field of FibRgFcLcb97). Otherwise, this LSTF represents a multi-level list that has nine corresponding LVLs"/>
<bit mask="0x02" name="unused1" deprecated="true" description="This bit MUST be ignored"/>
<bit mask="0x04" name="fAutoNum"
description="A bit that specifies whether the list that this LSTF represents is used for the AUTONUMOUT, AUTONUMLGL, and AUTONUM fields (see AUTONUMOUT, AUTONUMLGL, and AUTONUM in flt)"/>
<bit mask="0x08" name="unused2" deprecated="true" description="This bit MUST be ignored"/>
<bit mask="0x10" name="fHybrid"
description="A bit that specifies whether the list this LSTF defines is a hybrid list"/>
<bit mask="0xE0" name="reserved1" deprecated="true"
description="This MUST be zero, and MUST be ignored."/>
</field>
<field type="byte" size="1" name="grfhic"
description="A grfhic that specifies the HTML incompatibilities of the list."/>
</fields>
</record>

View File

@ -229,7 +229,7 @@ public abstract class </xsl:text><xsl:call-template name="outputClassName"/><xsl
<xsl:call-template name="indent"/>
<xsl:text>if ( </xsl:text>
<xsl:choose>
<xsl:when test="@type='byte[]'">
<xsl:when test="substring(@type, string-length(@type)-1)='[]'">
<xsl:text>!Arrays.equals( </xsl:text>
<xsl:value-of select="$fieldName"/>
<xsl:text>, other.</xsl:text>
@ -274,7 +274,7 @@ public abstract class </xsl:text><xsl:call-template name="outputClassName"/><xsl
<xsl:call-template name="indent"/>
<xsl:text>result = prime * result + </xsl:text>
<xsl:choose>
<xsl:when test="@type='byte[]'">
<xsl:when test="substring(@type, string-length(@type)-1)='[]'">
<xsl:text>Arrays.hashCode( </xsl:text>
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
<xsl:text> )</xsl:text>