poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1142874 - in /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf: sprm/TableSprmCompressor.java usermodel/TableAutoformatLookSpecifier.java
Date Tue, 05 Jul 2011 01:51:15 GMT
Author: sergey
Date: Tue Jul  5 01:51:15 2011
New Revision: 1142874

URL: http://svn.apache.org/viewvc?rev=1142874&view=rev
Log:
add isEmpty() method to TALS and handle it by SPRM 0x740a compressor to preserve old behavior:
do not add 0x740a SPRM if TALS is empty

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

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java?rev=1142874&r1=1142873&r2=1142874&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java Tue Jul
 5 01:51:15 2011
@@ -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 );

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java?rev=1142874&r1=1142873&r2=1142874&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableAutoformatLookSpecifier.java
Tue Jul  5 01:51:15 2011
@@ -23,4 +23,36 @@ public class TableAutoformatLookSpecifie
     {
         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;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message