]> source.dussan.org Git - poi.git/commitdiff
add isEmpty() method to TALS and handle it by SPRM 0x740a compressor to preserve...
authorSergey Vladimirov <sergey@apache.org>
Tue, 5 Jul 2011 01:51:15 +0000 (01:51 +0000)
committerSergey Vladimirov <sergey@apache.org>
Tue, 5 Jul 2011 01:51:15 +0000 (01:51 +0000)
do not add 0x740a SPRM if TALS is empty

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142874 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java

index 31888f2e288818bcd6bb10aa04da4b91daadb7b2..195fed56535a118ced34bbc25793b1f450cfbd0f 100644 (file)
@@ -101,7 +101,7 @@ public final class TableSprmCompressor
 //      size += SprmUtils.addSpecialSprm((short)0xD609, buf, sprmList);
     }
 
-        if ( newTAP.getTlp() != null )
+        if ( newTAP.getTlp() != null && !newTAP.getTlp().isEmpty() )
         {
             byte[] buf = new byte[TableAutoformatLookSpecifier.SIZE];
             newTAP.getTlp().serialize( buf, 0 );
index affa4766934158ee32987db0311152725b634037..229b92dc9fe904a1ae6887b8de80186432f8d36b 100644 (file)
@@ -23,4 +23,36 @@ public class TableAutoformatLookSpecifier extends TLPAbstractType
     {
         return (TableAutoformatLookSpecifier) super.clone();
     }
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+            return true;
+        if ( obj == null )
+            return false;
+        if ( getClass() != obj.getClass() )
+            return false;
+        TableAutoformatLookSpecifier other = (TableAutoformatLookSpecifier) obj;
+        if ( field_1_itl != other.field_1_itl )
+            return false;
+        if ( field_2_tlp_flags != other.field_2_tlp_flags )
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + field_1_itl;
+        result = prime * result + field_2_tlp_flags;
+        return result;
+    }
+
+    public boolean isEmpty()
+    {
+        return field_1_itl == 0 && field_2_tlp_flags == 0;
+    }
 }