From: Sergey Vladimirov Date: Sat, 29 Oct 2011 23:01:54 +0000 (+0000) Subject: update list types definitions using new Grfhic class X-Git-Tag: REL_3_8_BETA5~40 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=54b32f01e54ae26e75ed88c067b0b570764949f3;p=poi.git update list types definitions using new Grfhic class git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1195068 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/dev/FieldIterator.java b/src/scratchpad/src/org/apache/poi/hwpf/dev/FieldIterator.java index f55d696af4..1c15980b90 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/dev/FieldIterator.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/dev/FieldIterator.java @@ -70,7 +70,7 @@ public class FieldIterator String result = ""; if ( type.equals( "short[]" ) ) - result = "LittleEndian.getSimpleShortArray( data, 0x" + result = "LittleEndian.getShortArray( data, 0x" + Integer.toHexString( offset ) + " + offset, " + size + " )"; else if ( type.equals( "byte[]" ) ) @@ -86,6 +86,9 @@ public class FieldIterator else if ( type.equals( "DateAndTime" ) ) result = "new DateAndTime( data, 0x" + Integer.toHexString( offset ) + " + offset )"; + else if ( type.equals( "Grfhic" ) ) + result = "new Grfhic( data, 0x" + Integer.toHexString( offset ) + + " + offset )"; else if ( size.equals( "2" ) ) result = "LittleEndian.getShort( data, 0x" + Integer.toHexString( offset ) + " + offset )"; @@ -156,6 +159,9 @@ public class FieldIterator else if ( type.equals( "DateAndTime" ) ) result = javaFieldName + ".serialize( data, 0x" + Integer.toHexString( offset ) + " + offset );"; + else if ( type.equals( "Grfhic" ) ) + result = javaFieldName + ".serialize( data, 0x" + + Integer.toHexString( offset ) + " + offset );"; else if ( size.equals( "2" ) ) if ( type.equals( "short" ) ) { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/Grfhic.java b/src/scratchpad/src/org/apache/poi/hwpf/model/Grfhic.java new file mode 100644 index 0000000000..f627289a48 --- /dev/null +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/Grfhic.java @@ -0,0 +1,57 @@ +/* ==================================================================== + 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.GrfhicAbstractType; +import org.apache.poi.util.Internal; + +/** + * The grfhic structure is a set of HTML incompatibility flags that specify the + * HTML incompatibilities of a list structure. The values specify possible + * incompatibilities between an LVL or LVLF and HTML lists. The values do not + * define list properties. + *

+ * Class and fields descriptions are quoted from [MS-DOC] -- v20110315 Word + * (.doc) Binary File Format specification + *

+ * 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 [MS-DOC] -- v20110315 Word (.doc) + * Binary File Format specification + */ +@Internal +public class Grfhic extends GrfhicAbstractType +{ + + public Grfhic() + { + } + + public Grfhic( byte[] bytes, int offset ) + { + fillFields( bytes, offset ); + } + + public byte[] toByteArray() + { + byte[] buf = new byte[getSize()]; + serialize( buf, 0 ); + return buf; + } + +} diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/LFO.java b/src/scratchpad/src/org/apache/poi/hwpf/model/LFO.java index e561173c0b..4d8d099603 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/LFO.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/LFO.java @@ -31,7 +31,6 @@ import org.apache.poi.hwpf.model.types.LFOAbstractType; @Internal class LFO extends LFOAbstractType { - public LFO() { } @@ -40,46 +39,4 @@ class LFO extends LFOAbstractType { fillFields( std, offset ); } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - return true; - if ( obj == null ) - return false; - if ( getClass() != obj.getClass() ) - return false; - LFO other = (LFO) obj; - if ( field_1_lsid != other.field_1_lsid ) - return false; - if ( field_2_reserved1 != other.field_2_reserved1 ) - return false; - if ( field_3_reserved2 != other.field_3_reserved2 ) - return false; - if ( field_4_clfolvl != other.field_4_clfolvl ) - return false; - if ( field_5_ibstFltAutoNum != other.field_5_ibstFltAutoNum ) - return false; - if ( field_6_grfhic != other.field_6_grfhic ) - return false; - if ( field_7_reserved3 != other.field_7_reserved3 ) - 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_reserved1; - result = prime * result + field_3_reserved2; - result = prime * result + field_4_clfolvl; - result = prime * result + field_5_ibstFltAutoNum; - result = prime * result + field_6_grfhic; - result = prime * result + field_7_reserved3; - return result; - } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java index 139aa4f75c..9d4d97a655 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java @@ -45,9 +45,9 @@ public final class ListLevel private LVLF _lvlf; private char[] _xst = {}; - public ListLevel( final byte[] buf, final int originalOffset ) + public ListLevel( final byte[] buf, final int startOffset ) { - int offset = originalOffset; + int offset = startOffset; _lvlf = new LVLF( buf, offset ); offset += LVLF.getSize(); @@ -74,7 +74,7 @@ public final class ListLevel if ( numberTextLength != 1 ) { logger.log( POILogger.WARN, "LVL at offset ", - Integer.valueOf( originalOffset ), + Integer.valueOf( startOffset ), " has nfc == 0x17 (bullets), but cch != 1 (", Integer.valueOf( numberTextLength ), ")" ); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java new file mode 100644 index 0000000000..a20283970c --- /dev/null +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java @@ -0,0 +1,305 @@ +/* ==================================================================== + 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.util.BitField; +import org.apache.poi.util.Internal; + +/** + * The grfhic structure is a set of HTML incompatibility flags that specify the HTML + incompatibilities of a list structure. The values specify possible incompatibilities between + an LVL or LVLF and HTML lists. The values do not define list properties.

Class and + fields descriptions are quoted from [MS-DOC] -- v20110315 Word (.doc) Binary File Format + specification + + *

+ * 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 [MS-DOC] -- v20110315 Word (.doc) Binary File Format + specification + + */ +@Internal +public abstract class GrfhicAbstractType +{ + + protected byte field_1_grfhic; + /**/private static final BitField fHtmlChecked = new BitField(0x01); + /**/private static final BitField fHtmlUnsupported = new BitField(0x02); + /**/private static final BitField fHtmlListTextNotSharpDot = new BitField(0x04); + /**/private static final BitField fHtmlNotPeriod = new BitField(0x08); + /**/private static final BitField fHtmlFirstLineMismatch = new BitField(0x10); + /**/private static final BitField fHtmlTabLeftIndentMismatch = new BitField(0x20); + /**/private static final BitField fHtmlHangingIndentBeneathNumber = new BitField(0x40); + /**/private static final BitField fHtmlBuiltInBullet = new BitField(0x80); + + protected GrfhicAbstractType() + { + } + + protected void fillFields( byte[] data, int offset ) + { + field_1_grfhic = data[ 0x0 + offset ]; + } + + public void serialize( byte[] data, int offset ) + { + data[ 0x0 + offset ] = field_1_grfhic; + } + + public byte[] serialize() + { + final byte[] result = new byte[ getSize() ]; + serialize( result, 0 ); + return result; + } + + /** + * Size of record + */ + public static int getSize() + { + return 0 + 1; + } + + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + return true; + if ( obj == null ) + return false; + if ( getClass() != obj.getClass() ) + return false; + GrfhicAbstractType other = (GrfhicAbstractType) obj; + if ( field_1_grfhic != other.field_1_grfhic ) + return false; + return true; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + field_1_grfhic; + return result; + } + + public String toString() + { + StringBuilder builder = new StringBuilder(); + builder.append("[Grfhic]\n"); + builder.append(" .grfhic = "); + builder.append(" (").append(getGrfhic()).append(" )\n"); + builder.append(" .fHtmlChecked = ").append(isFHtmlChecked()).append('\n'); + builder.append(" .fHtmlUnsupported = ").append(isFHtmlUnsupported()).append('\n'); + builder.append(" .fHtmlListTextNotSharpDot = ").append(isFHtmlListTextNotSharpDot()).append('\n'); + builder.append(" .fHtmlNotPeriod = ").append(isFHtmlNotPeriod()).append('\n'); + builder.append(" .fHtmlFirstLineMismatch = ").append(isFHtmlFirstLineMismatch()).append('\n'); + builder.append(" .fHtmlTabLeftIndentMismatch = ").append(isFHtmlTabLeftIndentMismatch()).append('\n'); + builder.append(" .fHtmlHangingIndentBeneathNumber = ").append(isFHtmlHangingIndentBeneathNumber()).append('\n'); + builder.append(" .fHtmlBuiltInBullet = ").append(isFHtmlBuiltInBullet()).append('\n'); + + builder.append("[/Grfhic]\n"); + return builder.toString(); + } + + /** + * HTML compatibility flags. + */ + @Internal + public byte getGrfhic() + { + return field_1_grfhic; + } + + /** + * HTML compatibility flags. + */ + @Internal + public void setGrfhic( byte field_1_grfhic ) + { + this.field_1_grfhic = field_1_grfhic; + } + + /** + * Sets the fHtmlChecked field value. + * Checked + */ + @Internal + public void setFHtmlChecked( boolean value ) + { + field_1_grfhic = (byte)fHtmlChecked.setBoolean(field_1_grfhic, value); + } + + /** + * Checked + * @return the fHtmlChecked field value. + */ + @Internal + public boolean isFHtmlChecked() + { + return fHtmlChecked.isSet(field_1_grfhic); + } + + /** + * Sets the fHtmlUnsupported field value. + * The numbering sequence or format is unsupported (includes tab & size) + */ + @Internal + public void setFHtmlUnsupported( boolean value ) + { + field_1_grfhic = (byte)fHtmlUnsupported.setBoolean(field_1_grfhic, value); + } + + /** + * The numbering sequence or format is unsupported (includes tab & size) + * @return the fHtmlUnsupported field value. + */ + @Internal + public boolean isFHtmlUnsupported() + { + return fHtmlUnsupported.isSet(field_1_grfhic); + } + + /** + * Sets the fHtmlListTextNotSharpDot field value. + * The list text is not "#." + */ + @Internal + public void setFHtmlListTextNotSharpDot( boolean value ) + { + field_1_grfhic = (byte)fHtmlListTextNotSharpDot.setBoolean(field_1_grfhic, value); + } + + /** + * The list text is not "#." + * @return the fHtmlListTextNotSharpDot field value. + */ + @Internal + public boolean isFHtmlListTextNotSharpDot() + { + return fHtmlListTextNotSharpDot.isSet(field_1_grfhic); + } + + /** + * Sets the fHtmlNotPeriod field value. + * Something other than a period is used + */ + @Internal + public void setFHtmlNotPeriod( boolean value ) + { + field_1_grfhic = (byte)fHtmlNotPeriod.setBoolean(field_1_grfhic, value); + } + + /** + * Something other than a period is used + * @return the fHtmlNotPeriod field value. + */ + @Internal + public boolean isFHtmlNotPeriod() + { + return fHtmlNotPeriod.isSet(field_1_grfhic); + } + + /** + * Sets the fHtmlFirstLineMismatch field value. + * First line indent mismatch + */ + @Internal + public void setFHtmlFirstLineMismatch( boolean value ) + { + field_1_grfhic = (byte)fHtmlFirstLineMismatch.setBoolean(field_1_grfhic, value); + } + + /** + * First line indent mismatch + * @return the fHtmlFirstLineMismatch field value. + */ + @Internal + public boolean isFHtmlFirstLineMismatch() + { + return fHtmlFirstLineMismatch.isSet(field_1_grfhic); + } + + /** + * Sets the fHtmlTabLeftIndentMismatch field value. + * The list tab and the dxaLeft don't match (need table?) + */ + @Internal + public void setFHtmlTabLeftIndentMismatch( boolean value ) + { + field_1_grfhic = (byte)fHtmlTabLeftIndentMismatch.setBoolean(field_1_grfhic, value); + } + + /** + * The list tab and the dxaLeft don't match (need table?) + * @return the fHtmlTabLeftIndentMismatch field value. + */ + @Internal + public boolean isFHtmlTabLeftIndentMismatch() + { + return fHtmlTabLeftIndentMismatch.isSet(field_1_grfhic); + } + + /** + * Sets the fHtmlHangingIndentBeneathNumber field value. + * The hanging indent falls beneath the number (need plain text) + */ + @Internal + public void setFHtmlHangingIndentBeneathNumber( boolean value ) + { + field_1_grfhic = (byte)fHtmlHangingIndentBeneathNumber.setBoolean(field_1_grfhic, value); + } + + /** + * The hanging indent falls beneath the number (need plain text) + * @return the fHtmlHangingIndentBeneathNumber field value. + */ + @Internal + public boolean isFHtmlHangingIndentBeneathNumber() + { + return fHtmlHangingIndentBeneathNumber.isSet(field_1_grfhic); + } + + /** + * Sets the fHtmlBuiltInBullet field value. + * A built-in HTML bullet + */ + @Internal + public void setFHtmlBuiltInBullet( boolean value ) + { + field_1_grfhic = (byte)fHtmlBuiltInBullet.setBoolean(field_1_grfhic, value); + } + + /** + * A built-in HTML bullet + * @return the fHtmlBuiltInBullet field value. + */ + @Internal + public boolean isFHtmlBuiltInBullet() + { + return fHtmlBuiltInBullet.isSet(field_1_grfhic); + } + +} // END OF CLASS diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java index 88714972ca..f747435e94 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java @@ -16,7 +16,7 @@ ==================================================================== */ package org.apache.poi.hwpf.model.types; -import org.apache.poi.util.BitField; +import org.apache.poi.hwpf.model.Grfhic; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -44,19 +44,12 @@ public abstract class LFOAbstractType protected int field_3_reserved2; protected byte field_4_clfolvl; protected byte field_5_ibstFltAutoNum; - protected byte field_6_grfhic; - /**/private static final BitField fHtmlChecked = new BitField(0x01); - /**/private static final BitField fHtmlUnsupported = new BitField(0x02); - /**/private static final BitField fHtmlListTextNotSharpDot = new BitField(0x04); - /**/private static final BitField fHtmlNotPeriod = new BitField(0x08); - /**/private static final BitField fHtmlFirstLineMismatch = new BitField(0x10); - /**/private static final BitField fHtmlTabLeftIndentMismatch = new BitField(0x20); - /**/private static final BitField fHtmlHangingIndentBeneathNumber = new BitField(0x40); - /**/private static final BitField fHtmlBuiltInBullet = new BitField(0x80); + protected Grfhic field_6_grfhic; protected byte field_7_reserved3; protected LFOAbstractType() { + this.field_6_grfhic = new Grfhic(); } protected void fillFields( byte[] data, int offset ) @@ -66,7 +59,7 @@ public abstract class LFOAbstractType field_3_reserved2 = LittleEndian.getInt( data, 0x8 + offset ); field_4_clfolvl = data[ 0xc + offset ]; field_5_ibstFltAutoNum = data[ 0xd + offset ]; - field_6_grfhic = data[ 0xe + offset ]; + field_6_grfhic = new Grfhic( data, 0xe + offset ); field_7_reserved3 = data[ 0xf + offset ]; } @@ -77,7 +70,7 @@ public abstract class LFOAbstractType LittleEndian.putInt( data, 0x8 + offset, field_3_reserved2 ); data[ 0xc + offset ] = field_4_clfolvl; data[ 0xd + offset ] = field_5_ibstFltAutoNum; - data[ 0xe + offset ] = field_6_grfhic; + field_6_grfhic.serialize( data, 0xe + offset ); data[ 0xf + offset ] = field_7_reserved3; } @@ -96,6 +89,53 @@ public abstract class LFOAbstractType return 0 + 4 + 4 + 4 + 1 + 1 + 1 + 1; } + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + return true; + if ( obj == null ) + return false; + if ( getClass() != obj.getClass() ) + return false; + LFOAbstractType other = (LFOAbstractType) obj; + if ( field_1_lsid != other.field_1_lsid ) + return false; + if ( field_2_reserved1 != other.field_2_reserved1 ) + return false; + if ( field_3_reserved2 != other.field_3_reserved2 ) + return false; + if ( field_4_clfolvl != other.field_4_clfolvl ) + return false; + if ( field_5_ibstFltAutoNum != other.field_5_ibstFltAutoNum ) + return false; + if ( field_6_grfhic == null ) + { + if ( other.field_6_grfhic != null ) + return false; + } + else if ( !field_6_grfhic.equals( other.field_6_grfhic ) ) + return false; + if ( field_7_reserved3 != other.field_7_reserved3 ) + 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_reserved1; + result = prime * result + field_3_reserved2; + result = prime * result + field_4_clfolvl; + result = prime * result + field_5_ibstFltAutoNum; + result = prime * result + field_6_grfhic.hashCode(); + result = prime * result + field_7_reserved3; + return result; + } + public String toString() { StringBuilder builder = new StringBuilder(); @@ -112,14 +152,6 @@ public abstract class LFOAbstractType builder.append(" (").append(getIbstFltAutoNum()).append(" )\n"); builder.append(" .grfhic = "); builder.append(" (").append(getGrfhic()).append(" )\n"); - builder.append(" .fHtmlChecked = ").append(isFHtmlChecked()).append('\n'); - builder.append(" .fHtmlUnsupported = ").append(isFHtmlUnsupported()).append('\n'); - builder.append(" .fHtmlListTextNotSharpDot = ").append(isFHtmlListTextNotSharpDot()).append('\n'); - builder.append(" .fHtmlNotPeriod = ").append(isFHtmlNotPeriod()).append('\n'); - builder.append(" .fHtmlFirstLineMismatch = ").append(isFHtmlFirstLineMismatch()).append('\n'); - builder.append(" .fHtmlTabLeftIndentMismatch = ").append(isFHtmlTabLeftIndentMismatch()).append('\n'); - builder.append(" .fHtmlHangingIndentBeneathNumber = ").append(isFHtmlHangingIndentBeneathNumber()).append('\n'); - builder.append(" .fHtmlBuiltInBullet = ").append(isFHtmlBuiltInBullet()).append('\n'); builder.append(" .reserved3 = "); builder.append(" (").append(getReserved3()).append(" )\n"); @@ -221,7 +253,7 @@ public abstract class LFOAbstractType * HTML compatibility flags. */ @Internal - public byte getGrfhic() + public Grfhic getGrfhic() { return field_6_grfhic; } @@ -230,7 +262,7 @@ public abstract class LFOAbstractType * HTML compatibility flags. */ @Internal - public void setGrfhic( byte field_6_grfhic ) + public void setGrfhic( Grfhic field_6_grfhic ) { this.field_6_grfhic = field_6_grfhic; } @@ -253,164 +285,4 @@ public abstract class LFOAbstractType this.field_7_reserved3 = field_7_reserved3; } - /** - * Sets the fHtmlChecked field value. - * Checked - */ - @Internal - public void setFHtmlChecked( boolean value ) - { - field_6_grfhic = (byte)fHtmlChecked.setBoolean(field_6_grfhic, value); - } - - /** - * Checked - * @return the fHtmlChecked field value. - */ - @Internal - public boolean isFHtmlChecked() - { - return fHtmlChecked.isSet(field_6_grfhic); - } - - /** - * Sets the fHtmlUnsupported field value. - * The numbering sequence or format is unsupported (includes tab & size) - */ - @Internal - public void setFHtmlUnsupported( boolean value ) - { - field_6_grfhic = (byte)fHtmlUnsupported.setBoolean(field_6_grfhic, value); - } - - /** - * The numbering sequence or format is unsupported (includes tab & size) - * @return the fHtmlUnsupported field value. - */ - @Internal - public boolean isFHtmlUnsupported() - { - return fHtmlUnsupported.isSet(field_6_grfhic); - } - - /** - * Sets the fHtmlListTextNotSharpDot field value. - * The list text is not "#." - */ - @Internal - public void setFHtmlListTextNotSharpDot( boolean value ) - { - field_6_grfhic = (byte)fHtmlListTextNotSharpDot.setBoolean(field_6_grfhic, value); - } - - /** - * The list text is not "#." - * @return the fHtmlListTextNotSharpDot field value. - */ - @Internal - public boolean isFHtmlListTextNotSharpDot() - { - return fHtmlListTextNotSharpDot.isSet(field_6_grfhic); - } - - /** - * Sets the fHtmlNotPeriod field value. - * Something other than a period is used - */ - @Internal - public void setFHtmlNotPeriod( boolean value ) - { - field_6_grfhic = (byte)fHtmlNotPeriod.setBoolean(field_6_grfhic, value); - } - - /** - * Something other than a period is used - * @return the fHtmlNotPeriod field value. - */ - @Internal - public boolean isFHtmlNotPeriod() - { - return fHtmlNotPeriod.isSet(field_6_grfhic); - } - - /** - * Sets the fHtmlFirstLineMismatch field value. - * First line indent mismatch - */ - @Internal - public void setFHtmlFirstLineMismatch( boolean value ) - { - field_6_grfhic = (byte)fHtmlFirstLineMismatch.setBoolean(field_6_grfhic, value); - } - - /** - * First line indent mismatch - * @return the fHtmlFirstLineMismatch field value. - */ - @Internal - public boolean isFHtmlFirstLineMismatch() - { - return fHtmlFirstLineMismatch.isSet(field_6_grfhic); - } - - /** - * Sets the fHtmlTabLeftIndentMismatch field value. - * The list tab and the dxaLeft don't match (need table?) - */ - @Internal - public void setFHtmlTabLeftIndentMismatch( boolean value ) - { - field_6_grfhic = (byte)fHtmlTabLeftIndentMismatch.setBoolean(field_6_grfhic, value); - } - - /** - * The list tab and the dxaLeft don't match (need table?) - * @return the fHtmlTabLeftIndentMismatch field value. - */ - @Internal - public boolean isFHtmlTabLeftIndentMismatch() - { - return fHtmlTabLeftIndentMismatch.isSet(field_6_grfhic); - } - - /** - * Sets the fHtmlHangingIndentBeneathNumber field value. - * The hanging indent falls beneath the number (need plain text) - */ - @Internal - public void setFHtmlHangingIndentBeneathNumber( boolean value ) - { - field_6_grfhic = (byte)fHtmlHangingIndentBeneathNumber.setBoolean(field_6_grfhic, value); - } - - /** - * The hanging indent falls beneath the number (need plain text) - * @return the fHtmlHangingIndentBeneathNumber field value. - */ - @Internal - public boolean isFHtmlHangingIndentBeneathNumber() - { - return fHtmlHangingIndentBeneathNumber.isSet(field_6_grfhic); - } - - /** - * Sets the fHtmlBuiltInBullet field value. - * A built-in HTML bullet - */ - @Internal - public void setFHtmlBuiltInBullet( boolean value ) - { - field_6_grfhic = (byte)fHtmlBuiltInBullet.setBoolean(field_6_grfhic, value); - } - - /** - * A built-in HTML bullet - * @return the fHtmlBuiltInBullet field value. - */ - @Internal - public boolean isFHtmlBuiltInBullet() - { - return fHtmlBuiltInBullet.isSet(field_6_grfhic); - } - } // END OF CLASS 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 index 4f986e299b..70c16c722e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java @@ -18,6 +18,7 @@ package org.apache.poi.hwpf.model.types; import java.util.Arrays; +import org.apache.poi.hwpf.model.Grfhic; import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -52,11 +53,12 @@ public abstract class LSTFAbstractType /**/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 Grfhic field_5_grfhic; protected LSTFAbstractType() { this.field_3_rgistdPara = new short[0]; + this.field_5_grfhic = new Grfhic(); } protected void fillFields( byte[] data, int offset ) @@ -65,7 +67,7 @@ public abstract class LSTFAbstractType 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 ]; + field_5_grfhic = new Grfhic( data, 0x1b + offset ); } public void serialize( byte[] data, int offset ) @@ -74,7 +76,7 @@ public abstract class LSTFAbstractType 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; + field_5_grfhic.serialize( data, 0x1b + offset ); } public byte[] serialize() @@ -110,7 +112,12 @@ public abstract class LSTFAbstractType return false; if ( field_4_flags != other.field_4_flags ) return false; - if ( field_5_grfhic != other.field_5_grfhic ) + if ( field_5_grfhic == null ) + { + if ( other.field_5_grfhic != null ) + return false; + } + else if ( !field_5_grfhic.equals( other.field_5_grfhic ) ) return false; return true; } @@ -124,7 +131,7 @@ public abstract class LSTFAbstractType 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; + result = prime * result + field_5_grfhic.hashCode(); return result; } @@ -229,7 +236,7 @@ public abstract class LSTFAbstractType * A grfhic that specifies the HTML incompatibilities of the list.. */ @Internal - public byte getGrfhic() + public Grfhic getGrfhic() { return field_5_grfhic; } @@ -238,7 +245,7 @@ public abstract class LSTFAbstractType * A grfhic that specifies the HTML incompatibilities of the list.. */ @Internal - public void setGrfhic( byte field_5_grfhic ) + public void setGrfhic( Grfhic field_5_grfhic ) { this.field_5_grfhic = field_5_grfhic; } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java index 5e737d7ac5..a83b62e8d3 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java @@ -16,8 +16,10 @@ ==================================================================== */ package org.apache.poi.hwpf.model.types; + import java.util.Arrays; +import org.apache.poi.hwpf.model.Grfhic; import org.apache.poi.util.BitField; import org.apache.poi.util.Internal; import org.apache.poi.util.LittleEndian; @@ -59,11 +61,12 @@ public abstract class LVLFAbstractType protected short field_8_cbGrpprlChpx; protected short field_9_cbGrpprlPapx; protected short field_10_ilvlRestartLim; - protected short field_11_grfhic; + protected Grfhic field_11_grfhic; protected LVLFAbstractType() { this.field_4_rgbxchNums = new byte[9]; + this.field_11_grfhic = new Grfhic(); } protected void fillFields( byte[] data, int offset ) @@ -78,7 +81,7 @@ public abstract class LVLFAbstractType field_8_cbGrpprlChpx = LittleEndian.getUByte( data, 0x18 + offset ); field_9_cbGrpprlPapx = LittleEndian.getUByte( data, 0x19 + offset ); field_10_ilvlRestartLim = LittleEndian.getUByte( data, 0x1a + offset ); - field_11_grfhic = LittleEndian.getUByte( data, 0x1b + offset ); + field_11_grfhic = new Grfhic( data, 0x1b + offset ); } public void serialize( byte[] data, int offset ) @@ -93,7 +96,7 @@ public abstract class LVLFAbstractType LittleEndian.putUByte( data, 0x18 + offset, field_8_cbGrpprlChpx ); LittleEndian.putUByte( data, 0x19 + offset, field_9_cbGrpprlPapx ); LittleEndian.putUByte( data, 0x1a + offset, field_10_ilvlRestartLim ); - LittleEndian.putUByte( data, 0x1b + offset, field_11_grfhic ); + field_11_grfhic.serialize( data, 0x1b + offset ); } public byte[] serialize() @@ -141,7 +144,12 @@ public abstract class LVLFAbstractType return false; if ( field_10_ilvlRestartLim != other.field_10_ilvlRestartLim ) return false; - if ( field_11_grfhic != other.field_11_grfhic ) + if ( field_11_grfhic == null ) + { + if ( other.field_11_grfhic != null ) + return false; + } + else if ( !field_11_grfhic.equals( other.field_11_grfhic ) ) return false; return true; } @@ -161,7 +169,7 @@ public abstract class LVLFAbstractType result = prime * result + field_8_cbGrpprlChpx; result = prime * result + field_9_cbGrpprlPapx; result = prime * result + field_10_ilvlRestartLim; - result = prime * result + field_11_grfhic; + result = prime * result + field_11_grfhic.hashCode(); return result; } @@ -387,7 +395,7 @@ public abstract class LVLFAbstractType * A grfhic that specifies the HTML incompatibilities of the level.. */ @Internal - public short getGrfhic() + public Grfhic getGrfhic() { return field_11_grfhic; } @@ -396,7 +404,7 @@ public abstract class LVLFAbstractType * A grfhic that specifies the HTML incompatibilities of the level.. */ @Internal - public void setGrfhic( short field_11_grfhic ) + public void setGrfhic( Grfhic field_11_grfhic ) { this.field_11_grfhic = field_11_grfhic; } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java index 17e378d26a..bc243cdbb2 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java @@ -719,15 +719,31 @@ public class TestBugs extends TestCase HWPFTestDataSamples.writeOutAndReadBack( HWPFTestDataSamples .openSampleFile( "Bug51834.doc" ) ); } - + /** * Bug 52032 - [BUG] & [partial-PATCH] HWPF - ArrayIndexOutofBoundsException * with no stack trace (broken after revision 1178063) */ - public void testBug52032() throws Exception + public void testBug52032_1() throws Exception { - HWPFTestDataSamples.openSampleFile( "Bug52032.doc" ); - HWPFTestDataSamples.writeOutAndReadBack( HWPFTestDataSamples - .openSampleFile( "Bug52032.doc" ) ); + HWPFTestDataSamples.openSampleFile( "Bug52032_1.doc" ); + } + + /** + * Bug 52032 - [BUG] & [partial-PATCH] HWPF - ArrayIndexOutofBoundsException + * with no stack trace (broken after revision 1178063) + */ + public void testBug52032_2() throws Exception + { + HWPFTestDataSamples.openSampleFile( "Bug52032_2.doc" ); + } + + /** + * Bug 52032 - [BUG] & [partial-PATCH] HWPF - ArrayIndexOutofBoundsException + * with no stack trace (broken after revision 1178063) + */ + public void testBug52032_3() throws Exception + { + HWPFTestDataSamples.openSampleFile( "Bug52032_3.doc" ); } } diff --git a/src/types/definitions/grfhic_type.xml b/src/types/definitions/grfhic_type.xml new file mode 100644 index 0000000000..0c1cf5c7c5 --- /dev/null +++ b/src/types/definitions/grfhic_type.xml @@ -0,0 +1,46 @@ + + + + AbstractType + The grfhic structure is a set of HTML incompatibility flags that specify the HTML + incompatibilities of a list structure. The values specify possible incompatibilities between + an LVL or LVLF and HTML lists. The values do not define list properties. <p>Class and + fields descriptions are quoted from [MS-DOC] -- v20110315 Word (.doc) Binary File Format + specification + + Sergey Vladimirov; according to [MS-DOC] -- v20110315 Word (.doc) Binary File Format + specification + + + + + + + + + + + + + + diff --git a/src/types/definitions/lfo_type.xml b/src/types/definitions/lfo_type.xml index 03dc7d198e..cc4d88df34 100644 --- a/src/types/definitions/lfo_type.xml +++ b/src/types/definitions/lfo_type.xml @@ -33,19 +33,7 @@ - - - - - - - - - - + diff --git a/src/types/definitions/lstf_type.xml b/src/types/definitions/lstf_type.xml index 807b70ba26..5c7f1d334f 100644 --- a/src/types/definitions/lstf_type.xml +++ b/src/types/definitions/lstf_type.xml @@ -45,7 +45,7 @@ - diff --git a/src/types/definitions/lvlf_type.xml b/src/types/definitions/lvlf_type.xml index 910736bba4..c60a4f1b3f 100644 --- a/src/types/definitions/lvlf_type.xml +++ b/src/types/definitions/lvlf_type.xml @@ -59,7 +59,7 @@ description="An unsigned integer that specifies the size, in bytes, of the grpprlPapx in the LVL that contains this LVLF"/> - diff --git a/src/types/styles/hdftype.xsl b/src/types/styles/hdftype.xsl index 3360c53c3d..a93d22d875 100644 --- a/src/types/styles/hdftype.xsl +++ b/src/types/styles/hdftype.xsl @@ -227,28 +227,76 @@ public abstract class - if ( + if ( !Arrays.equals( , other. ) + ) + + + + + return false; + + + + if ( + + == null ) + + + + { + + + + + if ( other. + + != null ) + + + + + + return false; + + + + } + + + + else if ( ! + + .equals( other. + + ) ) + + + + + return false; + + if ( != other. + ) + + + + + return false; + - ) - - - - - return false; - @@ -279,6 +327,10 @@ public abstract class ) + + + .hashCode() +