From 4c38a8f5d1c745a5fc4bed8d443ca6e65d0a3976 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Sun, 2 Oct 2011 00:11:05 +0000 Subject: [PATCH] correctly save PlfLst git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1178104 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hwpf/HWPFDocument.java | 72 ++-- .../src/org/apache/poi/hwpf/model/LSTF.java | 44 +++ .../org/apache/poi/hwpf/model/ListData.java | 212 +++++----- .../org/apache/poi/hwpf/model/ListTables.java | 67 ++-- .../hwpf/model/types/LSTFAbstractType.java | 372 ++++++++++++++++++ .../apache/poi/hwpf/model/TestListTables.java | 2 +- src/types/definitions/lstf_type.xml | 51 +++ src/types/styles/hdftype.xsl | 4 +- 8 files changed, 644 insertions(+), 180 deletions(-) create mode 100644 src/scratchpad/src/org/apache/poi/hwpf/model/LSTF.java create mode 100644 src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java create mode 100644 src/types/definitions/lstf_type.xml diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java index ed23c127ac..4efa858db6 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java @@ -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) - { - _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 - */ + // 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(); - 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 diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/LSTF.java b/src/scratchpad/src/org/apache/poi/hwpf/model/LSTF.java new file mode 100644 index 0000000000..9e00ffed40 --- /dev/null +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/LSTF.java @@ -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. + *

+ * 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 ); + } + +} diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java index b0738c63fd..9893504012 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListData.java @@ -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; - - public ListData(int listID, boolean numbered) - { - _lsid = listID; - _rgistd = new short[9]; - - for (int x = 0; x < 9; x++) + private ListLevel[] _levels; + + private LSTF _lstf; + + ListData( byte[] buf, int offset ) + { + _lstf = new LSTF( buf, offset ); + + if ( _lstf.isFSimpleList() ) + { + _levels = new ListLevel[1]; + } + else + { + _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 ); + + _levels = new ListLevel[9]; + for ( int x = 0; x < _levels.length; x++ ) + { + _levels[x] = new ListLevel( x, numbered ); + } + } + + @Override + public boolean equals( Object obj ) + { + 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; + } + + /** + * 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 ) { - _rgistd[x] = StyleSheet.NIL_STYLE; + return _levels[index - 1]; } - _levels = new ListLevel[9]; + public ListLevel[] getLevels() + { + return _levels; + } - for (int x = 0; x < _levels.length; x++) + public int getLevelStyle( int index ) { - _levels[x] = new ListLevel(x, numbered); + return _lstf.getRgistdPara()[index]; } - } - - 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++) + + public int getLsid() { - _rgistd[x] = LittleEndian.getShort(buf, offset); - offset += LittleEndian.SHORT_SIZE; + return _lstf.getLsid(); } - _info = buf[offset++]; - _reserved = buf[offset]; - if (_fSimpleList.getValue(_info) > 0) + + @Override + public int hashCode() { - _levels = new ListLevel[1]; + final int prime = 31; + int result = 1; + result = prime * result + Arrays.hashCode( _levels ); + result = prime * result + ( ( _lstf == null ) ? 0 : _lstf.hashCode() ); + return result; } - else + + 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 = new ListLevel[9]; + _levels[index] = level; } - } - - 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) + public void setLevelStyle( int index, int styleIndex ) { - return false; + _lstf.getRgistdPara()[index] = (short) styleIndex; } - 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++) + public byte[] toByteArray() { - LittleEndian.putShort(buf, offset, _rgistd[x]); - offset += LittleEndian.SHORT_SIZE; + return _lstf.serialize(); } - buf[offset++] = _info; - buf[offset] = _reserved; - return buf; - } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java index 5e1b8d4118..88524d0f77 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java @@ -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 diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java new file mode 100644 index 0000000000..4f986e299b --- /dev/null +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java @@ -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. +

Class and fields descriptions are quoted from Microsoft Office Word 97-2007 Binary + File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format + + *

+ * NOTE: This source is automatically generated please do not modify this file. Either subclass or + * remove the record in src/types/definitions. + *

+ * 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 diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestListTables.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestListTables.java index 08cf5dc5fd..291fef3c8a 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestListTables.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestListTables.java @@ -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); diff --git a/src/types/definitions/lstf_type.xml b/src/types/definitions/lstf_type.xml new file mode 100644 index 0000000000..807b70ba26 --- /dev/null +++ b/src/types/definitions/lstf_type.xml @@ -0,0 +1,51 @@ + + + + AbstractType + 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 + + Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format + Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format + + + + + + + + + + + + + + + + diff --git a/src/types/styles/hdftype.xsl b/src/types/styles/hdftype.xsl index e5d0fd568f..3360c53c3d 100644 --- a/src/types/styles/hdftype.xsl +++ b/src/types/styles/hdftype.xsl @@ -229,7 +229,7 @@ public abstract class if ( - + !Arrays.equals( , other. @@ -274,7 +274,7 @@ public abstract class result = prime * result + - + Arrays.hashCode( ) -- 2.39.5