]> source.dussan.org Git - poi.git/commitdiff
update list types definitions using new Grfhic class
authorSergey Vladimirov <sergey@apache.org>
Sat, 29 Oct 2011 23:01:54 +0000 (23:01 +0000)
committerSergey Vladimirov <sergey@apache.org>
Sat, 29 Oct 2011 23:01:54 +0000 (23:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1195068 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
src/scratchpad/src/org/apache/poi/hwpf/dev/FieldIterator.java
src/scratchpad/src/org/apache/poi/hwpf/model/Grfhic.java [new file with mode: 0644]
src/scratchpad/src/org/apache/poi/hwpf/model/LFO.java
src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java
src/scratchpad/src/org/apache/poi/hwpf/model/types/GrfhicAbstractType.java [new file with mode: 0644]
src/scratchpad/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java
src/scratchpad/src/org/apache/poi/hwpf/model/types/LSTFAbstractType.java
src/scratchpad/src/org/apache/poi/hwpf/model/types/LVLFAbstractType.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
src/types/definitions/grfhic_type.xml [new file with mode: 0644]
src/types/definitions/lfo_type.xml
src/types/definitions/lstf_type.xml
src/types/definitions/lvlf_type.xml
src/types/styles/hdftype.xsl

index f55d696af478da5332e95ede46a831e040d08fbc..1c15980b9041e0c01228b92ddd1dcfd8b775368f 100644 (file)
@@ -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 (file)
index 0000000..f627289
--- /dev/null
@@ -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.
+ * <p>
+ * Class and fields descriptions are quoted from [MS-DOC] -- v20110315 Word
+ * (.doc) Binary File Format specification
+ * <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 [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;
+    }
+
+}
index e561173c0baaf8c45ba3fb27ca83bf2813db687d..4d8d0996030fb3658beaa6be8b20ad4d0867b8e7 100644 (file)
@@ -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;
-    }
 }
index 139aa4f75c6d2b16fbaab9e3fb29305335b88ed3..9d4d97a65503bc78e56c34bfa0d0f7037af18a1b 100644 (file)
@@ -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 (file)
index 0000000..a202839
--- /dev/null
@@ -0,0 +1,305 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.hwpf.model.types;\r
+\r
+\r
+import org.apache.poi.util.BitField;\r
+import org.apache.poi.util.Internal;\r
+\r
+/**\r
+ * The grfhic structure is a set of HTML incompatibility flags that specify the HTML\r
+        incompatibilities of a list structure. The values specify possible incompatibilities between\r
+        an LVL or LVLF and HTML lists. The values do not define list properties. <p>Class and\r
+        fields descriptions are quoted from [MS-DOC] -- v20110315 Word (.doc) Binary File Format\r
+        specification\r
+    \r
+ * <p>\r
+ * NOTE: This source is automatically generated please do not modify this file.  Either subclass or\r
+ *       remove the record in src/types/definitions.\r
+ * <p>\r
+ * This class is internal. It content or properties may change without notice \r
+ * due to changes in our knowledge of internal Microsoft Word binary structures.\r
+\r
+ * @author Sergey Vladimirov; according to [MS-DOC] -- v20110315 Word (.doc) Binary File Format\r
+        specification\r
+    \r
+ */\r
+@Internal\r
+public abstract class GrfhicAbstractType\r
+{\r
+\r
+    protected byte field_1_grfhic;\r
+    /**/private static final BitField fHtmlChecked = new BitField(0x01);\r
+    /**/private static final BitField fHtmlUnsupported = new BitField(0x02);\r
+    /**/private static final BitField fHtmlListTextNotSharpDot = new BitField(0x04);\r
+    /**/private static final BitField fHtmlNotPeriod = new BitField(0x08);\r
+    /**/private static final BitField fHtmlFirstLineMismatch = new BitField(0x10);\r
+    /**/private static final BitField fHtmlTabLeftIndentMismatch = new BitField(0x20);\r
+    /**/private static final BitField fHtmlHangingIndentBeneathNumber = new BitField(0x40);\r
+    /**/private static final BitField fHtmlBuiltInBullet = new BitField(0x80);\r
+\r
+    protected GrfhicAbstractType()\r
+    {\r
+    }\r
+\r
+    protected void fillFields( byte[] data, int offset )\r
+    {\r
+        field_1_grfhic                 = data[ 0x0 + offset ];\r
+    }\r
+\r
+    public void serialize( byte[] data, int offset )\r
+    {\r
+        data[ 0x0 + offset ] = field_1_grfhic;\r
+    }\r
+\r
+    public byte[] serialize()\r
+    {\r
+        final byte[] result = new byte[ getSize() ];\r
+        serialize( result, 0 );\r
+        return result;\r
+    }\r
+\r
+    /**\r
+     * Size of record\r
+     */\r
+    public static int getSize()\r
+    {\r
+        return 0 + 1;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals( Object obj )\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        if ( obj == null )\r
+            return false;\r
+        if ( getClass() != obj.getClass() )\r
+            return false;\r
+        GrfhicAbstractType other = (GrfhicAbstractType) obj;\r
+        if ( field_1_grfhic != other.field_1_grfhic )\r
+            return false;\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public int hashCode()\r
+    {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + field_1_grfhic;\r
+        return result;\r
+    }\r
+\r
+    public String toString()\r
+    {\r
+        StringBuilder builder = new StringBuilder();\r
+        builder.append("[Grfhic]\n");\r
+        builder.append("    .grfhic               = ");\r
+        builder.append(" (").append(getGrfhic()).append(" )\n");\r
+        builder.append("         .fHtmlChecked             = ").append(isFHtmlChecked()).append('\n');\r
+        builder.append("         .fHtmlUnsupported         = ").append(isFHtmlUnsupported()).append('\n');\r
+        builder.append("         .fHtmlListTextNotSharpDot     = ").append(isFHtmlListTextNotSharpDot()).append('\n');\r
+        builder.append("         .fHtmlNotPeriod           = ").append(isFHtmlNotPeriod()).append('\n');\r
+        builder.append("         .fHtmlFirstLineMismatch     = ").append(isFHtmlFirstLineMismatch()).append('\n');\r
+        builder.append("         .fHtmlTabLeftIndentMismatch     = ").append(isFHtmlTabLeftIndentMismatch()).append('\n');\r
+        builder.append("         .fHtmlHangingIndentBeneathNumber     = ").append(isFHtmlHangingIndentBeneathNumber()).append('\n');\r
+        builder.append("         .fHtmlBuiltInBullet       = ").append(isFHtmlBuiltInBullet()).append('\n');\r
+\r
+        builder.append("[/Grfhic]\n");\r
+        return builder.toString();\r
+    }\r
+\r
+    /**\r
+     * HTML compatibility flags.\r
+     */\r
+    @Internal\r
+    public byte getGrfhic()\r
+    {\r
+        return field_1_grfhic;\r
+    }\r
+\r
+    /**\r
+     * HTML compatibility flags.\r
+     */\r
+    @Internal\r
+    public void setGrfhic( byte field_1_grfhic )\r
+    {\r
+        this.field_1_grfhic = field_1_grfhic;\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlChecked field value.\r
+     * Checked\r
+     */\r
+    @Internal\r
+    public void setFHtmlChecked( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlChecked.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * Checked\r
+     * @return  the fHtmlChecked field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlChecked()\r
+    {\r
+        return fHtmlChecked.isSet(field_1_grfhic);\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlUnsupported field value.\r
+     * The numbering sequence or format is unsupported (includes tab & size)\r
+     */\r
+    @Internal\r
+    public void setFHtmlUnsupported( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlUnsupported.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * The numbering sequence or format is unsupported (includes tab & size)\r
+     * @return  the fHtmlUnsupported field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlUnsupported()\r
+    {\r
+        return fHtmlUnsupported.isSet(field_1_grfhic);\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlListTextNotSharpDot field value.\r
+     * The list text is not "#."\r
+     */\r
+    @Internal\r
+    public void setFHtmlListTextNotSharpDot( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlListTextNotSharpDot.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * The list text is not "#."\r
+     * @return  the fHtmlListTextNotSharpDot field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlListTextNotSharpDot()\r
+    {\r
+        return fHtmlListTextNotSharpDot.isSet(field_1_grfhic);\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlNotPeriod field value.\r
+     * Something other than a period is used\r
+     */\r
+    @Internal\r
+    public void setFHtmlNotPeriod( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlNotPeriod.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * Something other than a period is used\r
+     * @return  the fHtmlNotPeriod field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlNotPeriod()\r
+    {\r
+        return fHtmlNotPeriod.isSet(field_1_grfhic);\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlFirstLineMismatch field value.\r
+     * First line indent mismatch\r
+     */\r
+    @Internal\r
+    public void setFHtmlFirstLineMismatch( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlFirstLineMismatch.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * First line indent mismatch\r
+     * @return  the fHtmlFirstLineMismatch field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlFirstLineMismatch()\r
+    {\r
+        return fHtmlFirstLineMismatch.isSet(field_1_grfhic);\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlTabLeftIndentMismatch field value.\r
+     * The list tab and the dxaLeft don't match (need table?)\r
+     */\r
+    @Internal\r
+    public void setFHtmlTabLeftIndentMismatch( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlTabLeftIndentMismatch.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * The list tab and the dxaLeft don't match (need table?)\r
+     * @return  the fHtmlTabLeftIndentMismatch field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlTabLeftIndentMismatch()\r
+    {\r
+        return fHtmlTabLeftIndentMismatch.isSet(field_1_grfhic);\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlHangingIndentBeneathNumber field value.\r
+     * The hanging indent falls beneath the number (need plain text)\r
+     */\r
+    @Internal\r
+    public void setFHtmlHangingIndentBeneathNumber( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlHangingIndentBeneathNumber.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * The hanging indent falls beneath the number (need plain text)\r
+     * @return  the fHtmlHangingIndentBeneathNumber field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlHangingIndentBeneathNumber()\r
+    {\r
+        return fHtmlHangingIndentBeneathNumber.isSet(field_1_grfhic);\r
+    }\r
+\r
+    /**\r
+     * Sets the fHtmlBuiltInBullet field value.\r
+     * A built-in HTML bullet\r
+     */\r
+    @Internal\r
+    public void setFHtmlBuiltInBullet( boolean value )\r
+    {\r
+        field_1_grfhic = (byte)fHtmlBuiltInBullet.setBoolean(field_1_grfhic, value);\r
+    }\r
+\r
+    /**\r
+     * A built-in HTML bullet\r
+     * @return  the fHtmlBuiltInBullet field value.\r
+     */\r
+    @Internal\r
+    public boolean isFHtmlBuiltInBullet()\r
+    {\r
+        return fHtmlBuiltInBullet.isSet(field_1_grfhic);\r
+    }\r
+\r
+}  // END OF CLASS\r
index 88714972caf7ab3249c632a0150847b178efbf5b..f747435e94804c4ab3684885d7dca4b8e81cf4cb 100644 (file)
@@ -16,7 +16,7 @@
 ==================================================================== */\r
 package org.apache.poi.hwpf.model.types;\r
 \r
-import org.apache.poi.util.BitField;\r
+import org.apache.poi.hwpf.model.Grfhic;\r
 import org.apache.poi.util.Internal;\r
 import org.apache.poi.util.LittleEndian;\r
 \r
@@ -44,19 +44,12 @@ public abstract class LFOAbstractType
     protected int field_3_reserved2;\r
     protected byte field_4_clfolvl;\r
     protected byte field_5_ibstFltAutoNum;\r
-    protected byte field_6_grfhic;\r
-    /**/private static final BitField fHtmlChecked = new BitField(0x01);\r
-    /**/private static final BitField fHtmlUnsupported = new BitField(0x02);\r
-    /**/private static final BitField fHtmlListTextNotSharpDot = new BitField(0x04);\r
-    /**/private static final BitField fHtmlNotPeriod = new BitField(0x08);\r
-    /**/private static final BitField fHtmlFirstLineMismatch = new BitField(0x10);\r
-    /**/private static final BitField fHtmlTabLeftIndentMismatch = new BitField(0x20);\r
-    /**/private static final BitField fHtmlHangingIndentBeneathNumber = new BitField(0x40);\r
-    /**/private static final BitField fHtmlBuiltInBullet = new BitField(0x80);\r
+    protected Grfhic field_6_grfhic;\r
     protected byte field_7_reserved3;\r
 \r
     protected LFOAbstractType()\r
     {\r
+        this.field_6_grfhic = new Grfhic();\r
     }\r
 \r
     protected void fillFields( byte[] data, int offset )\r
@@ -66,7 +59,7 @@ public abstract class LFOAbstractType
         field_3_reserved2              = LittleEndian.getInt( data, 0x8 + offset );\r
         field_4_clfolvl                = data[ 0xc + offset ];\r
         field_5_ibstFltAutoNum         = data[ 0xd + offset ];\r
-        field_6_grfhic                 = data[ 0xe + offset ];\r
+        field_6_grfhic                 = new Grfhic( data, 0xe + offset );\r
         field_7_reserved3              = data[ 0xf + offset ];\r
     }\r
 \r
@@ -77,7 +70,7 @@ public abstract class LFOAbstractType
         LittleEndian.putInt( data, 0x8 + offset, field_3_reserved2 );\r
         data[ 0xc + offset ] = field_4_clfolvl;\r
         data[ 0xd + offset ] = field_5_ibstFltAutoNum;\r
-        data[ 0xe + offset ] = field_6_grfhic;\r
+        field_6_grfhic.serialize( data, 0xe + offset );\r
         data[ 0xf + offset ] = field_7_reserved3;\r
     }\r
 \r
@@ -96,6 +89,53 @@ public abstract class LFOAbstractType
         return 0 + 4 + 4 + 4 + 1 + 1 + 1 + 1;\r
     }\r
 \r
+    @Override\r
+    public boolean equals( Object obj )\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        if ( obj == null )\r
+            return false;\r
+        if ( getClass() != obj.getClass() )\r
+            return false;\r
+        LFOAbstractType other = (LFOAbstractType) obj;\r
+        if ( field_1_lsid != other.field_1_lsid )\r
+            return false;\r
+        if ( field_2_reserved1 != other.field_2_reserved1 )\r
+            return false;\r
+        if ( field_3_reserved2 != other.field_3_reserved2 )\r
+            return false;\r
+        if ( field_4_clfolvl != other.field_4_clfolvl )\r
+            return false;\r
+        if ( field_5_ibstFltAutoNum != other.field_5_ibstFltAutoNum )\r
+            return false;\r
+        if ( field_6_grfhic == null )\r
+        {\r
+            if ( other.field_6_grfhic != null )\r
+                return false;\r
+        }\r
+        else if ( !field_6_grfhic.equals( other.field_6_grfhic ) )\r
+            return false;\r
+        if ( field_7_reserved3 != other.field_7_reserved3 )\r
+            return false;\r
+        return true;\r
+    }\r
+\r
+    @Override\r
+    public int hashCode()\r
+    {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + field_1_lsid;\r
+        result = prime * result + field_2_reserved1;\r
+        result = prime * result + field_3_reserved2;\r
+        result = prime * result + field_4_clfolvl;\r
+        result = prime * result + field_5_ibstFltAutoNum;\r
+        result = prime * result + field_6_grfhic.hashCode();\r
+        result = prime * result + field_7_reserved3;\r
+        return result;\r
+    }\r
+\r
     public String toString()\r
     {\r
         StringBuilder builder = new StringBuilder();\r
@@ -112,14 +152,6 @@ public abstract class LFOAbstractType
         builder.append(" (").append(getIbstFltAutoNum()).append(" )\n");\r
         builder.append("    .grfhic               = ");\r
         builder.append(" (").append(getGrfhic()).append(" )\n");\r
-        builder.append("         .fHtmlChecked             = ").append(isFHtmlChecked()).append('\n');\r
-        builder.append("         .fHtmlUnsupported         = ").append(isFHtmlUnsupported()).append('\n');\r
-        builder.append("         .fHtmlListTextNotSharpDot     = ").append(isFHtmlListTextNotSharpDot()).append('\n');\r
-        builder.append("         .fHtmlNotPeriod           = ").append(isFHtmlNotPeriod()).append('\n');\r
-        builder.append("         .fHtmlFirstLineMismatch     = ").append(isFHtmlFirstLineMismatch()).append('\n');\r
-        builder.append("         .fHtmlTabLeftIndentMismatch     = ").append(isFHtmlTabLeftIndentMismatch()).append('\n');\r
-        builder.append("         .fHtmlHangingIndentBeneathNumber     = ").append(isFHtmlHangingIndentBeneathNumber()).append('\n');\r
-        builder.append("         .fHtmlBuiltInBullet       = ").append(isFHtmlBuiltInBullet()).append('\n');\r
         builder.append("    .reserved3            = ");\r
         builder.append(" (").append(getReserved3()).append(" )\n");\r
 \r
@@ -221,7 +253,7 @@ public abstract class LFOAbstractType
      * HTML compatibility flags.\r
      */\r
     @Internal\r
-    public byte getGrfhic()\r
+    public Grfhic getGrfhic()\r
     {\r
         return field_6_grfhic;\r
     }\r
@@ -230,7 +262,7 @@ public abstract class LFOAbstractType
      * HTML compatibility flags.\r
      */\r
     @Internal\r
-    public void setGrfhic( byte field_6_grfhic )\r
+    public void setGrfhic( Grfhic field_6_grfhic )\r
     {\r
         this.field_6_grfhic = field_6_grfhic;\r
     }\r
@@ -253,164 +285,4 @@ public abstract class LFOAbstractType
         this.field_7_reserved3 = field_7_reserved3;\r
     }\r
 \r
-    /**\r
-     * Sets the fHtmlChecked field value.\r
-     * Checked\r
-     */\r
-    @Internal\r
-    public void setFHtmlChecked( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlChecked.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * Checked\r
-     * @return  the fHtmlChecked field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlChecked()\r
-    {\r
-        return fHtmlChecked.isSet(field_6_grfhic);\r
-    }\r
-\r
-    /**\r
-     * Sets the fHtmlUnsupported field value.\r
-     * The numbering sequence or format is unsupported (includes tab & size)\r
-     */\r
-    @Internal\r
-    public void setFHtmlUnsupported( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlUnsupported.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * The numbering sequence or format is unsupported (includes tab & size)\r
-     * @return  the fHtmlUnsupported field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlUnsupported()\r
-    {\r
-        return fHtmlUnsupported.isSet(field_6_grfhic);\r
-    }\r
-\r
-    /**\r
-     * Sets the fHtmlListTextNotSharpDot field value.\r
-     * The list text is not "#."\r
-     */\r
-    @Internal\r
-    public void setFHtmlListTextNotSharpDot( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlListTextNotSharpDot.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * The list text is not "#."\r
-     * @return  the fHtmlListTextNotSharpDot field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlListTextNotSharpDot()\r
-    {\r
-        return fHtmlListTextNotSharpDot.isSet(field_6_grfhic);\r
-    }\r
-\r
-    /**\r
-     * Sets the fHtmlNotPeriod field value.\r
-     * Something other than a period is used\r
-     */\r
-    @Internal\r
-    public void setFHtmlNotPeriod( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlNotPeriod.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * Something other than a period is used\r
-     * @return  the fHtmlNotPeriod field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlNotPeriod()\r
-    {\r
-        return fHtmlNotPeriod.isSet(field_6_grfhic);\r
-    }\r
-\r
-    /**\r
-     * Sets the fHtmlFirstLineMismatch field value.\r
-     * First line indent mismatch\r
-     */\r
-    @Internal\r
-    public void setFHtmlFirstLineMismatch( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlFirstLineMismatch.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * First line indent mismatch\r
-     * @return  the fHtmlFirstLineMismatch field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlFirstLineMismatch()\r
-    {\r
-        return fHtmlFirstLineMismatch.isSet(field_6_grfhic);\r
-    }\r
-\r
-    /**\r
-     * Sets the fHtmlTabLeftIndentMismatch field value.\r
-     * The list tab and the dxaLeft don't match (need table?)\r
-     */\r
-    @Internal\r
-    public void setFHtmlTabLeftIndentMismatch( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlTabLeftIndentMismatch.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * The list tab and the dxaLeft don't match (need table?)\r
-     * @return  the fHtmlTabLeftIndentMismatch field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlTabLeftIndentMismatch()\r
-    {\r
-        return fHtmlTabLeftIndentMismatch.isSet(field_6_grfhic);\r
-    }\r
-\r
-    /**\r
-     * Sets the fHtmlHangingIndentBeneathNumber field value.\r
-     * The hanging indent falls beneath the number (need plain text)\r
-     */\r
-    @Internal\r
-    public void setFHtmlHangingIndentBeneathNumber( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlHangingIndentBeneathNumber.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * The hanging indent falls beneath the number (need plain text)\r
-     * @return  the fHtmlHangingIndentBeneathNumber field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlHangingIndentBeneathNumber()\r
-    {\r
-        return fHtmlHangingIndentBeneathNumber.isSet(field_6_grfhic);\r
-    }\r
-\r
-    /**\r
-     * Sets the fHtmlBuiltInBullet field value.\r
-     * A built-in HTML bullet\r
-     */\r
-    @Internal\r
-    public void setFHtmlBuiltInBullet( boolean value )\r
-    {\r
-        field_6_grfhic = (byte)fHtmlBuiltInBullet.setBoolean(field_6_grfhic, value);\r
-    }\r
-\r
-    /**\r
-     * A built-in HTML bullet\r
-     * @return  the fHtmlBuiltInBullet field value.\r
-     */\r
-    @Internal\r
-    public boolean isFHtmlBuiltInBullet()\r
-    {\r
-        return fHtmlBuiltInBullet.isSet(field_6_grfhic);\r
-    }\r
-\r
 }  // END OF CLASS\r
index 4f986e299bdd7acdf02a590db466d549dd8e7569..70c16c722e2e952405e03790f7cd6180ddc56149 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.poi.hwpf.model.types;
 \r
 import java.util.Arrays;\r
 \r
+import org.apache.poi.hwpf.model.Grfhic;\r
 import org.apache.poi.util.BitField;\r
 import org.apache.poi.util.Internal;\r
 import org.apache.poi.util.LittleEndian;\r
@@ -52,11 +53,12 @@ public abstract class LSTFAbstractType
     /**/private static final BitField unused2 = new BitField(0x08);\r
     /**/private static final BitField fHybrid = new BitField(0x10);\r
     /**/private static final BitField reserved1 = new BitField(0xE0);\r
-    protected byte field_5_grfhic;\r
+    protected Grfhic field_5_grfhic;\r
 \r
     protected LSTFAbstractType()\r
     {\r
         this.field_3_rgistdPara = new short[0];\r
+        this.field_5_grfhic = new Grfhic();\r
     }\r
 \r
     protected void fillFields( byte[] data, int offset )\r
@@ -65,7 +67,7 @@ public abstract class LSTFAbstractType
         field_2_tplc                   = LittleEndian.getInt( data, 0x4 + offset );\r
         field_3_rgistdPara             = LittleEndian.getShortArray( data, 0x8 + offset, 18 );\r
         field_4_flags                  = data[ 0x1a + offset ];\r
-        field_5_grfhic                 = data[ 0x1b + offset ];\r
+        field_5_grfhic                 = new Grfhic( data, 0x1b + offset );\r
     }\r
 \r
     public void serialize( byte[] data, int offset )\r
@@ -74,7 +76,7 @@ public abstract class LSTFAbstractType
         LittleEndian.putInt( data, 0x4 + offset, field_2_tplc );\r
         LittleEndian.putShortArray( data, 0x8 + offset, field_3_rgistdPara );\r
         data[ 0x1a + offset ] = field_4_flags;\r
-        data[ 0x1b + offset ] = field_5_grfhic;\r
+        field_5_grfhic.serialize( data, 0x1b + offset );\r
     }\r
 \r
     public byte[] serialize()\r
@@ -110,7 +112,12 @@ public abstract class LSTFAbstractType
             return false;\r
         if ( field_4_flags != other.field_4_flags )\r
             return false;\r
-        if ( field_5_grfhic != other.field_5_grfhic )\r
+        if ( field_5_grfhic == null )\r
+        {\r
+            if ( other.field_5_grfhic != null )\r
+                return false;\r
+        }\r
+        else if ( !field_5_grfhic.equals( other.field_5_grfhic ) )\r
             return false;\r
         return true;\r
     }\r
@@ -124,7 +131,7 @@ public abstract class LSTFAbstractType
         result = prime * result + field_2_tplc;\r
         result = prime * result + Arrays.hashCode( field_3_rgistdPara );\r
         result = prime * result + field_4_flags;\r
-        result = prime * result + field_5_grfhic;\r
+        result = prime * result + field_5_grfhic.hashCode();\r
         return result;\r
     }\r
 \r
@@ -229,7 +236,7 @@ public abstract class LSTFAbstractType
      * A grfhic that specifies the HTML incompatibilities of the list..\r
      */\r
     @Internal\r
-    public byte getGrfhic()\r
+    public Grfhic getGrfhic()\r
     {\r
         return field_5_grfhic;\r
     }\r
@@ -238,7 +245,7 @@ public abstract class LSTFAbstractType
      * A grfhic that specifies the HTML incompatibilities of the list..\r
      */\r
     @Internal\r
-    public void setGrfhic( byte field_5_grfhic )\r
+    public void setGrfhic( Grfhic field_5_grfhic )\r
     {\r
         this.field_5_grfhic = field_5_grfhic;\r
     }\r
index 5e737d7ac5349ec5e5cd27f57a21917962747fda..a83b62e8d35fc932cc5ef790152d943ef22c660a 100644 (file)
 ==================================================================== */
 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;
     }
index 17e378d26a2d679babbb4138f6fd5e00db44655c..bc243cdbb276b2703038e75b79146d4aadaf0b53 100644 (file)
@@ -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 (file)
index 0000000..0c1cf5c
--- /dev/null
@@ -0,0 +1,46 @@
+<?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="Grfhic" package="org.apache.poi.hwpf.model.types">
+    <suffix>AbstractType</suffix>
+    <description>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. &lt;p&gt;Class and
+        fields descriptions are quoted from [MS-DOC] -- v20110315 Word (.doc) Binary File Format
+        specification
+    </description>
+    <author>Sergey Vladimirov; according to [MS-DOC] -- v20110315 Word (.doc) Binary File Format
+        specification
+    </author>
+    <fields>
+        <field type="byte" size="1" name="grfhic" description="HTML compatibility flags">
+            <bit number="0" mask="0x01" name="fHtmlChecked" description="Checked"/>
+            <bit number="1" mask="0x02" name="fHtmlUnsupported"
+                description="The numbering sequence or format is unsupported (includes tab &amp; size)"/>
+            <bit number="2" mask="0x04" name="fHtmlListTextNotSharpDot" description="The list text is not &quot;#.&quot;"/>
+            <bit number="3" mask="0x08" name="fHtmlNotPeriod" description="Something other than a period is used"/>
+            <bit number="4" mask="0x10" name="fHtmlFirstLineMismatch" description="First line indent mismatch"/>
+            <bit number="5" mask="0x20" name="fHtmlTabLeftIndentMismatch"
+                description="The list tab and the dxaLeft don't match (need table?)"/>
+            <bit number="6" mask="0x40" name="fHtmlHangingIndentBeneathNumber"
+                description="The hanging indent falls beneath the number (need plain text)"/>
+            <bit number="7" mask="0x80" name="fHtmlBuiltInBullet" description="A built-in HTML bullet"/>
+        </field>
+    </fields>
+</record>
index 03dc7d198e611e4ccb07c39b3f84963ae4a54a6d..cc4d88df34e79c097bda7b0990dbf899728ee7dc 100644 (file)
         <field type="byte" size="1" name="clfolvl"
             description="Count of levels whose format is overridden (see LFOLVL)"/>
         <field type="byte" size="1" name="ibstFltAutoNum" description="Used for AUTONUM field emulation"/>
-        <field type="byte" size="1" name="grfhic" description="HTML compatibility flags">
-            <bit number="0" mask="0x01" name="fHtmlChecked" description="Checked"/>
-            <bit number="1" mask="0x02" name="fHtmlUnsupported"
-                description="The numbering sequence or format is unsupported (includes tab &amp; size)"/>
-            <bit number="2" mask="0x04" name="fHtmlListTextNotSharpDot" description="The list text is not &quot;#.&quot;"/>
-            <bit number="3" mask="0x08" name="fHtmlNotPeriod" description="Something other than a period is used"/>
-            <bit number="4" mask="0x10" name="fHtmlFirstLineMismatch" description="First line indent mismatch"/>
-            <bit number="5" mask="0x20" name="fHtmlTabLeftIndentMismatch"
-                description="The list tab and the dxaLeft don't match (need table?)"/>
-            <bit number="6" mask="0x40" name="fHtmlHangingIndentBeneathNumber"
-                description="The hanging indent falls beneath the number (need plain text)"/>
-            <bit number="7" mask="0x80" name="fHtmlBuiltInBullet" description="A built-in HTML bullet"/>
-        </field>
+        <field type="Grfhic" size="1" name="grfhic" description="HTML compatibility flags" />
         <field type="byte" size="1" name="reserved3" description="Reserved"/>
     </fields>
 </record>
index 807b70ba262496a3e8bccaa83a8cbbf6200c7acd..5c7f1d334f1316546036657f7c87c623402c95ad 100644 (file)
@@ -45,7 +45,7 @@
             <bit mask="0xE0" name="reserved1" deprecated="true"
                 description="This MUST be zero, and MUST be ignored."/>
         </field>
-        <field type="byte" size="1" name="grfhic"
+        <field type="Grfhic" size="1" name="grfhic"
             description="A grfhic that specifies the HTML incompatibilities of the list."/>
     </fields>
 </record>
index 910736bba4a7c08e0159e91a9f22f61943ab1743..c60a4f1b3f4b5e677b3f692d1c20ab7d13c2bcae 100644 (file)
@@ -59,7 +59,7 @@
             description="An unsigned integer that specifies the size, in bytes, of the grpprlPapx in the LVL that contains this LVLF"/>
         <field type="short" size="1" name="ilvlRestartLim"
             description="An unsigned integer that specifies the first (most-significant) zero-based level after which the number sequence of this level does not restart. The number sequence of this level does restart after any level that is more significant than the specified level. This MUST be less than or equal to the zero-based level of the list to which this LVLF corresponds. If fNoRestart is zero, this MUST be ignored. If this level does not have a number sequence (see nfc), this MUST be ignored"/>
-        <field type="short" size="1" name="grfhic"
+        <field type="Grfhic" size="1" name="grfhic"
             description="A grfhic that specifies the HTML incompatibilities of the level."/>
     </fields>
 </record>
index 3360c53c3da12c2bc99fd4af22009be6cd5a9e46..a93d22d8755aca5669ebe12c73c78d3218d4620c 100644 (file)
@@ -227,28 +227,76 @@ public abstract class </xsl:text><xsl:call-template name="outputClassName"/><xsl
         <xsl:variable name="fieldName" select="recutil:getFieldName(position(),@name,0)"/>
         <xsl:call-template name="indent"/>
         <xsl:call-template name="indent"/>
-        <xsl:text>if ( </xsl:text>
         <xsl:choose>
             <xsl:when test="substring(@type, string-length(@type)-1)='[]'">
+                <xsl:text>if ( </xsl:text>
                 <xsl:text>!Arrays.equals( </xsl:text>
                 <xsl:value-of select="$fieldName"/>
                 <xsl:text>, other.</xsl:text>
                 <xsl:value-of select="$fieldName"/>
                 <xsl:text> )</xsl:text>
+                <xsl:text> )</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>return false;</xsl:text>
+                <xsl:call-template name="linebreak"/>
+            </xsl:when>
+            <xsl:when test="@type='Grfhic'">
+                <xsl:text>if ( </xsl:text>
+                <xsl:value-of select="$fieldName"/>
+                <xsl:text> == null )</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>{</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>if ( other.</xsl:text>
+                <xsl:value-of select="$fieldName"/>
+                <xsl:text> != null )</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>return false;</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>}</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>else if ( !</xsl:text>
+                <xsl:value-of select="$fieldName"/>
+                <xsl:text>.equals( other.</xsl:text>
+                <xsl:value-of select="$fieldName"/>
+                <xsl:text> ) )</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>return false;</xsl:text>
+                <xsl:call-template name="linebreak"/>
             </xsl:when>
             <xsl:otherwise>
+                <xsl:text>if ( </xsl:text>
                 <xsl:value-of select="$fieldName"/>
                 <xsl:text> != other.</xsl:text>
                 <xsl:value-of select="$fieldName"/>
+                <xsl:text> )</xsl:text>
+                <xsl:call-template name="linebreak"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>return false;</xsl:text>
+                <xsl:call-template name="linebreak"/>
             </xsl:otherwise>
         </xsl:choose>
-        <xsl:text> )</xsl:text>
-        <xsl:call-template name="linebreak"/>
-        <xsl:call-template name="indent"/>
-        <xsl:call-template name="indent"/>
-        <xsl:call-template name="indent"/>
-        <xsl:text>return false;</xsl:text>
-        <xsl:call-template name="linebreak"/>
     </xsl:for-each>
     <xsl:call-template name="indent"/>
     <xsl:call-template name="indent"/>
@@ -279,6 +327,10 @@ public abstract class </xsl:text><xsl:call-template name="outputClassName"/><xsl
                 <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
                 <xsl:text> )</xsl:text>
             </xsl:when>
+            <xsl:when test="@type='Grfhic'">
+                <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
+                <xsl:text>.hashCode()</xsl:text>
+            </xsl:when>
             <xsl:otherwise>
                 <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
             </xsl:otherwise>