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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142874 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-05 01:51:15 +00:00
parent 02672056d8
commit efb7a720aa
2 changed files with 33 additions and 1 deletions

View 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 );

View 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;
}
}