mirror of https://github.com/apache/poi.git
correctly handle last part of FIB
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1178063 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5f2b740165
commit
25df8a6a76
|
@ -154,9 +154,6 @@ public abstract class HWPFDocumentCore extends POIDocument
|
|||
|
||||
// Create our FIB, and check for the doc being encrypted
|
||||
_fib = new FileInformationBlock(_mainStream);
|
||||
if (_fib.getFibBase().isFEncrypted()) {
|
||||
throw new EncryptedDocumentException("Cannot process encrypted word files!");
|
||||
}
|
||||
|
||||
DirectoryEntry objectPoolEntry;
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* ====================================================================
|
||||
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;
|
||||
|
||||
interface FibRgLw
|
||||
{
|
||||
int getCbMac();
|
||||
|
||||
int getSubdocumentTextStreamLength( SubdocumentType subdocumentType );
|
||||
|
||||
void setCbMac( int cbMac );
|
||||
|
||||
void setSubdocumentTextStreamLength( SubdocumentType subdocumentType,
|
||||
int newLength );
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
/* ====================================================================
|
||||
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.FibRgLw95AbstractType;
|
||||
import org.apache.poi.util.Internal;
|
||||
|
||||
/**
|
||||
* The FibRgLw97 structure is the third section of the FIB. This contains an
|
||||
* array of 4-byte values.
|
||||
* <p>
|
||||
* Class and fields descriptions are quoted from Microsoft Office Word 97-2007
|
||||
* Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
|
||||
*
|
||||
* @author Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary
|
||||
* File Format Specification [*.doc] and [MS-DOC] - v20110608 Word
|
||||
* (.doc) Binary File Format
|
||||
*/
|
||||
@Internal
|
||||
class FibRgLw95 extends FibRgLw95AbstractType implements FibRgLw
|
||||
{
|
||||
|
||||
public FibRgLw95()
|
||||
{
|
||||
}
|
||||
|
||||
public FibRgLw95( byte[] std, int offset )
|
||||
{
|
||||
fillFields( std, offset );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public int getSubdocumentTextStreamLength( SubdocumentType subdocumentType )
|
||||
{
|
||||
switch ( subdocumentType )
|
||||
{
|
||||
case MAIN:
|
||||
return getCcpText();
|
||||
case FOOTNOTE:
|
||||
return getCcpFtn();
|
||||
case HEADER:
|
||||
return getCcpHdd();
|
||||
case MACRO:
|
||||
return getCcpMcr();
|
||||
case ANNOTATION:
|
||||
return getCcpAtn();
|
||||
case ENDNOTE:
|
||||
return getCcpEdn();
|
||||
case TEXTBOX:
|
||||
return getCcpTxbx();
|
||||
case HEADER_TEXTBOX:
|
||||
return getCcpHdrTxbx();
|
||||
}
|
||||
throw new UnsupportedOperationException( "Unsupported: "
|
||||
+ subdocumentType );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public void setSubdocumentTextStreamLength(
|
||||
SubdocumentType subdocumentType, int newLength )
|
||||
{
|
||||
switch ( subdocumentType )
|
||||
{
|
||||
case MAIN:
|
||||
setCcpText( newLength );
|
||||
return;
|
||||
case FOOTNOTE:
|
||||
setCcpFtn( newLength );
|
||||
return;
|
||||
case HEADER:
|
||||
setCcpHdd( newLength );
|
||||
return;
|
||||
case MACRO:
|
||||
setCbMac( newLength );
|
||||
return;
|
||||
case ANNOTATION:
|
||||
setCcpAtn( newLength );
|
||||
return;
|
||||
case ENDNOTE:
|
||||
setCcpEdn( newLength );
|
||||
return;
|
||||
case TEXTBOX:
|
||||
setCcpTxbx( newLength );
|
||||
return;
|
||||
case HEADER_TEXTBOX:
|
||||
setCcpHdrTxbx( newLength );
|
||||
return;
|
||||
}
|
||||
throw new UnsupportedOperationException( "Unsupported: "
|
||||
+ subdocumentType );
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ import org.apache.poi.util.Internal;
|
|||
* (.doc) Binary File Format
|
||||
*/
|
||||
@Internal
|
||||
class FibRgLw97 extends FibRgLw97AbstractType
|
||||
class FibRgLw97 extends FibRgLw97AbstractType implements FibRgLw
|
||||
{
|
||||
|
||||
public FibRgLw97()
|
||||
|
@ -104,93 +104,4 @@ class FibRgLw97 extends FibRgLw97AbstractType
|
|||
+ subdocumentType );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + field_10_ccpTxbx;
|
||||
result = prime * result + field_11_ccpHdrTxbx;
|
||||
result = prime * result + field_12_reserved4;
|
||||
result = prime * result + field_13_reserved5;
|
||||
result = prime * result + field_14_reserved6;
|
||||
result = prime * result + field_15_reserved7;
|
||||
result = prime * result + field_16_reserved8;
|
||||
result = prime * result + field_17_reserved9;
|
||||
result = prime * result + field_18_reserved10;
|
||||
result = prime * result + field_19_reserved11;
|
||||
result = prime * result + field_1_cbMac;
|
||||
result = prime * result + field_20_reserved12;
|
||||
result = prime * result + field_21_reserved13;
|
||||
result = prime * result + field_22_reserved14;
|
||||
result = prime * result + field_2_reserved1;
|
||||
result = prime * result + field_3_reserved2;
|
||||
result = prime * result + field_4_ccpText;
|
||||
result = prime * result + field_5_ccpFtn;
|
||||
result = prime * result + field_6_ccpHdd;
|
||||
result = prime * result + field_7_reserved3;
|
||||
result = prime * result + field_8_ccpAtn;
|
||||
result = prime * result + field_9_ccpEdn;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( this == obj )
|
||||
return true;
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
FibRgLw97 other = (FibRgLw97) obj;
|
||||
if ( field_10_ccpTxbx != other.field_10_ccpTxbx )
|
||||
return false;
|
||||
if ( field_11_ccpHdrTxbx != other.field_11_ccpHdrTxbx )
|
||||
return false;
|
||||
if ( field_12_reserved4 != other.field_12_reserved4 )
|
||||
return false;
|
||||
if ( field_13_reserved5 != other.field_13_reserved5 )
|
||||
return false;
|
||||
if ( field_14_reserved6 != other.field_14_reserved6 )
|
||||
return false;
|
||||
if ( field_15_reserved7 != other.field_15_reserved7 )
|
||||
return false;
|
||||
if ( field_16_reserved8 != other.field_16_reserved8 )
|
||||
return false;
|
||||
if ( field_17_reserved9 != other.field_17_reserved9 )
|
||||
return false;
|
||||
if ( field_18_reserved10 != other.field_18_reserved10 )
|
||||
return false;
|
||||
if ( field_19_reserved11 != other.field_19_reserved11 )
|
||||
return false;
|
||||
if ( field_1_cbMac != other.field_1_cbMac )
|
||||
return false;
|
||||
if ( field_20_reserved12 != other.field_20_reserved12 )
|
||||
return false;
|
||||
if ( field_21_reserved13 != other.field_21_reserved13 )
|
||||
return false;
|
||||
if ( field_22_reserved14 != other.field_22_reserved14 )
|
||||
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_ccpText != other.field_4_ccpText )
|
||||
return false;
|
||||
if ( field_5_ccpFtn != other.field_5_ccpFtn )
|
||||
return false;
|
||||
if ( field_6_ccpHdd != other.field_6_ccpHdd )
|
||||
return false;
|
||||
if ( field_7_reserved3 != other.field_7_reserved3 )
|
||||
return false;
|
||||
if ( field_8_ccpAtn != other.field_8_ccpAtn )
|
||||
return false;
|
||||
if ( field_9_ccpEdn != other.field_9_ccpEdn )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,9 +22,13 @@ import java.lang.reflect.Method;
|
|||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
|
||||
import org.apache.poi.hwpf.model.io.HWPFOutputStream;
|
||||
import org.apache.poi.util.Internal;
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
import org.apache.poi.util.POILogFactory;
|
||||
import org.apache.poi.util.POILogger;
|
||||
|
||||
/**
|
||||
* The File Information Block (FIB). Holds pointers
|
||||
|
@ -45,14 +49,19 @@ import org.apache.poi.util.LittleEndian;
|
|||
@Internal
|
||||
public final class FileInformationBlock implements Cloneable
|
||||
{
|
||||
public static final POILogger logger = POILogFactory
|
||||
.getLogger( FileInformationBlock.class );
|
||||
|
||||
private FibBase _fibBase;
|
||||
private int _csw;
|
||||
private FibRgW97 _fibRgW;
|
||||
private int _cslw;
|
||||
private FibRgLw97 _fibRgLw;
|
||||
private FibRgLw _fibRgLw;
|
||||
private int _cbRgFcLcb;
|
||||
private FIBFieldHandler _fieldHandler;
|
||||
private int _cswNew;
|
||||
private int _nFibNew;
|
||||
private byte[] _fibRgCswNew;
|
||||
|
||||
/** Creates a new instance of FileInformationBlock */
|
||||
public FileInformationBlock( byte[] mainDocument )
|
||||
|
@ -63,6 +72,12 @@ public final class FileInformationBlock implements Cloneable
|
|||
offset = FibBase.getSize();
|
||||
assert offset == 32;
|
||||
|
||||
if ( _fibBase.isFEncrypted() )
|
||||
{
|
||||
throw new EncryptedDocumentException(
|
||||
"Cannot process encrypted word file" );
|
||||
}
|
||||
|
||||
_csw = LittleEndian.getUShort( mainDocument, offset );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
assert offset == 34;
|
||||
|
@ -75,13 +90,129 @@ public final class FileInformationBlock implements Cloneable
|
|||
offset += LittleEndian.SHORT_SIZE;
|
||||
assert offset == 64;
|
||||
|
||||
if ( _fibBase.getNFib() < 105 )
|
||||
{
|
||||
_fibRgLw = new FibRgLw95( mainDocument, offset );
|
||||
offset += FibRgLw97.getSize();
|
||||
|
||||
// magic number, run tests after changes
|
||||
_cbRgFcLcb = 74;
|
||||
|
||||
// skip fibRgFcLcbBlob (read later at fillVariableFields)
|
||||
offset += _cbRgFcLcb * LittleEndian.INT_SIZE * 2;
|
||||
|
||||
_cswNew = LittleEndian.getUShort( mainDocument, offset );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
|
||||
_cswNew = 0;
|
||||
_nFibNew = -1;
|
||||
_fibRgCswNew = new byte[0];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_fibRgLw = new FibRgLw97( mainDocument, offset );
|
||||
offset += FibRgLw97.getSize();
|
||||
assert offset == 152;
|
||||
|
||||
|
||||
_cbRgFcLcb = LittleEndian.getUShort( mainDocument, offset );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
assert offset == 154;
|
||||
|
||||
// skip fibRgFcLcbBlob (read later at fillVariableFields)
|
||||
offset += _cbRgFcLcb * LittleEndian.INT_SIZE * 2;
|
||||
|
||||
_cswNew = LittleEndian.getUShort( mainDocument, offset );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
|
||||
if ( _cswNew != 0 )
|
||||
{
|
||||
_nFibNew = LittleEndian.getUShort( mainDocument, offset );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
|
||||
// first short is already read as _nFibNew
|
||||
final int fibRgCswNewLength = ( _cswNew - 1 )
|
||||
* LittleEndian.SHORT_SIZE;
|
||||
_fibRgCswNew = new byte[fibRgCswNewLength];
|
||||
LittleEndian.getByteArray( mainDocument, offset, fibRgCswNewLength );
|
||||
offset += fibRgCswNewLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
_nFibNew = -1;
|
||||
_fibRgCswNew = new byte[0];
|
||||
}
|
||||
|
||||
assertCbRgFcLcb();
|
||||
assertCswNew();
|
||||
}
|
||||
|
||||
private void assertCbRgFcLcb()
|
||||
{
|
||||
switch ( getNFib() )
|
||||
{
|
||||
case 0x00C1:
|
||||
assertCbRgFcLcb( "0x00C1", 0x005D, "0x005D", _cbRgFcLcb );
|
||||
break;
|
||||
case 0x00D9:
|
||||
assertCbRgFcLcb( "0x00D9", 0x006C, "0x006C", _cbRgFcLcb );
|
||||
break;
|
||||
case 0x0101:
|
||||
assertCbRgFcLcb( "0x0101", 0x0088, "0x0088", _cbRgFcLcb );
|
||||
break;
|
||||
case 0x010C:
|
||||
assertCbRgFcLcb( "0x010C", 0x00A4, "0x00A4", _cbRgFcLcb );
|
||||
break;
|
||||
case 0x0112:
|
||||
assertCbRgFcLcb( "0x0112", 0x00B7, "0x00B7", _cbRgFcLcb );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertCbRgFcLcb( final String strNFib,
|
||||
final int expectedCbRgFcLcb, final String strCbRgFcLcb,
|
||||
final int cbRgFcLcb )
|
||||
{
|
||||
if ( cbRgFcLcb == expectedCbRgFcLcb )
|
||||
return;
|
||||
|
||||
logger.log( POILogger.WARN, "Since FIB.nFib == ", strNFib,
|
||||
" value of FIB.cbRgFcLcb MUST be ", strCbRgFcLcb + ", not 0x",
|
||||
Integer.toHexString( cbRgFcLcb ) );
|
||||
}
|
||||
|
||||
private void assertCswNew()
|
||||
{
|
||||
switch ( getNFib() )
|
||||
{
|
||||
case 0x00C1:
|
||||
assertCswNew( "0x00C1", 0x0000, "0x0000", _cswNew );
|
||||
break;
|
||||
case 0x00D9:
|
||||
assertCswNew( "0x00D9", 0x0002, "0x0002", _cswNew );
|
||||
break;
|
||||
case 0x0101:
|
||||
assertCswNew( "0x0101", 0x0002, "0x0002", _cswNew );
|
||||
break;
|
||||
case 0x010C:
|
||||
assertCswNew( "0x010C", 0x0002, "0x0002", _cswNew );
|
||||
break;
|
||||
case 0x0112:
|
||||
assertCswNew( "0x0112", 0x0005, "0x0005", _cswNew );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertCswNew( final String strNFib,
|
||||
final int expectedCswNew, final String strExpectedCswNew,
|
||||
final int cswNew )
|
||||
{
|
||||
if ( cswNew == expectedCswNew )
|
||||
return;
|
||||
|
||||
logger.log( POILogger.WARN, "Since FIB.nFib == ", strNFib,
|
||||
" value of FIB.cswNew MUST be ",
|
||||
strExpectedCswNew + ", not 0x", Integer.toHexString( cswNew ) );
|
||||
}
|
||||
|
||||
public void fillVariableFields( byte[] mainDocument, byte[] tableStream )
|
||||
|
@ -198,6 +329,14 @@ public final class FileInformationBlock implements Cloneable
|
|||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
public int getNFib()
|
||||
{
|
||||
if ( _cswNew == 0 )
|
||||
return _fibBase.getNFib();
|
||||
|
||||
return _nFibNew;
|
||||
}
|
||||
|
||||
public int getFcDop()
|
||||
{
|
||||
return _fieldHandler.getFieldOffset(FIBFieldHandler.DOP);
|
||||
|
@ -884,13 +1023,26 @@ public final class FileInformationBlock implements Cloneable
|
|||
LittleEndian.putUShort( mainStream, offset, _cslw );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
|
||||
_fibRgLw.serialize( mainStream, offset );
|
||||
( (FibRgLw97) _fibRgLw ).serialize( mainStream, offset );
|
||||
offset += FibRgLw97.getSize();
|
||||
|
||||
LittleEndian.putUShort( mainStream, offset, _cbRgFcLcb );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
|
||||
_fieldHandler.writeTo( mainStream, offset, tableStream );
|
||||
offset += _cbRgFcLcb * LittleEndian.INT_SIZE * 2;
|
||||
|
||||
LittleEndian.putUShort( mainStream, offset, _cswNew );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
if ( _cswNew != 0 )
|
||||
{
|
||||
LittleEndian.putUShort( mainStream, offset, _nFibNew );
|
||||
offset += LittleEndian.SHORT_SIZE;
|
||||
|
||||
System.arraycopy( _fibRgCswNew, 0, mainStream, offset,
|
||||
_fibRgCswNew.length );
|
||||
offset += _fibRgCswNew.length;
|
||||
}
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
|
|
|
@ -0,0 +1,468 @@
|
|||
/* ====================================================================
|
||||
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.Internal;
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
|
||||
/**
|
||||
* The FibRgLw95 structure is the third section of the FIB for Word95.
|
||||
|
||||
* <p>
|
||||
* NOTE: This source is automatically generated please do not modify this file. Either subclass or
|
||||
* remove the record in src/types/definitions.
|
||||
* <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
|
||||
|
||||
*/
|
||||
@Internal
|
||||
public abstract class FibRgLw95AbstractType
|
||||
{
|
||||
|
||||
protected int field_1_cbMac;
|
||||
@Deprecated
|
||||
protected int field_2_reserved1;
|
||||
@Deprecated
|
||||
protected int field_3_reserved2;
|
||||
@Deprecated
|
||||
protected int field_4_reserved3;
|
||||
@Deprecated
|
||||
protected int field_5_reserved4;
|
||||
protected int field_6_ccpText;
|
||||
protected int field_7_ccpFtn;
|
||||
protected int field_8_ccpHdd;
|
||||
protected int field_9_ccpMcr;
|
||||
protected int field_10_ccpAtn;
|
||||
protected int field_11_ccpEdn;
|
||||
protected int field_12_ccpTxbx;
|
||||
protected int field_13_ccpHdrTxbx;
|
||||
@Deprecated
|
||||
protected int field_14_reserved5;
|
||||
|
||||
protected FibRgLw95AbstractType()
|
||||
{
|
||||
}
|
||||
|
||||
protected void fillFields( byte[] data, int offset )
|
||||
{
|
||||
field_1_cbMac = LittleEndian.getInt( data, 0x0 + offset );
|
||||
field_2_reserved1 = LittleEndian.getInt( data, 0x4 + offset );
|
||||
field_3_reserved2 = LittleEndian.getInt( data, 0x8 + offset );
|
||||
field_4_reserved3 = LittleEndian.getInt( data, 0xc + offset );
|
||||
field_5_reserved4 = LittleEndian.getInt( data, 0x10 + offset );
|
||||
field_6_ccpText = LittleEndian.getInt( data, 0x14 + offset );
|
||||
field_7_ccpFtn = LittleEndian.getInt( data, 0x18 + offset );
|
||||
field_8_ccpHdd = LittleEndian.getInt( data, 0x1c + offset );
|
||||
field_9_ccpMcr = LittleEndian.getInt( data, 0x20 + offset );
|
||||
field_10_ccpAtn = LittleEndian.getInt( data, 0x24 + offset );
|
||||
field_11_ccpEdn = LittleEndian.getInt( data, 0x28 + offset );
|
||||
field_12_ccpTxbx = LittleEndian.getInt( data, 0x2c + offset );
|
||||
field_13_ccpHdrTxbx = LittleEndian.getInt( data, 0x30 + offset );
|
||||
field_14_reserved5 = LittleEndian.getInt( data, 0x34 + offset );
|
||||
}
|
||||
|
||||
public void serialize( byte[] data, int offset )
|
||||
{
|
||||
LittleEndian.putInt( data, 0x0 + offset, field_1_cbMac );
|
||||
LittleEndian.putInt( data, 0x4 + offset, field_2_reserved1 );
|
||||
LittleEndian.putInt( data, 0x8 + offset, field_3_reserved2 );
|
||||
LittleEndian.putInt( data, 0xc + offset, field_4_reserved3 );
|
||||
LittleEndian.putInt( data, 0x10 + offset, field_5_reserved4 );
|
||||
LittleEndian.putInt( data, 0x14 + offset, field_6_ccpText );
|
||||
LittleEndian.putInt( data, 0x18 + offset, field_7_ccpFtn );
|
||||
LittleEndian.putInt( data, 0x1c + offset, field_8_ccpHdd );
|
||||
LittleEndian.putInt( data, 0x20 + offset, field_9_ccpMcr );
|
||||
LittleEndian.putInt( data, 0x24 + offset, field_10_ccpAtn );
|
||||
LittleEndian.putInt( data, 0x28 + offset, field_11_ccpEdn );
|
||||
LittleEndian.putInt( data, 0x2c + offset, field_12_ccpTxbx );
|
||||
LittleEndian.putInt( data, 0x30 + offset, field_13_ccpHdrTxbx );
|
||||
LittleEndian.putInt( data, 0x34 + offset, field_14_reserved5 );
|
||||
}
|
||||
|
||||
public byte[] serialize()
|
||||
{
|
||||
final byte[] result = new byte[ getSize() ];
|
||||
serialize( result, 0 );
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Size of record
|
||||
*/
|
||||
public static int getSize()
|
||||
{
|
||||
return 0 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( this == obj )
|
||||
return true;
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
FibRgLw95AbstractType other = (FibRgLw95AbstractType) obj;
|
||||
if ( field_1_cbMac != other.field_1_cbMac )
|
||||
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_reserved3 != other.field_4_reserved3 )
|
||||
return false;
|
||||
if ( field_5_reserved4 != other.field_5_reserved4 )
|
||||
return false;
|
||||
if ( field_6_ccpText != other.field_6_ccpText )
|
||||
return false;
|
||||
if ( field_7_ccpFtn != other.field_7_ccpFtn )
|
||||
return false;
|
||||
if ( field_8_ccpHdd != other.field_8_ccpHdd )
|
||||
return false;
|
||||
if ( field_9_ccpMcr != other.field_9_ccpMcr )
|
||||
return false;
|
||||
if ( field_10_ccpAtn != other.field_10_ccpAtn )
|
||||
return false;
|
||||
if ( field_11_ccpEdn != other.field_11_ccpEdn )
|
||||
return false;
|
||||
if ( field_12_ccpTxbx != other.field_12_ccpTxbx )
|
||||
return false;
|
||||
if ( field_13_ccpHdrTxbx != other.field_13_ccpHdrTxbx )
|
||||
return false;
|
||||
if ( field_14_reserved5 != other.field_14_reserved5 )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + field_1_cbMac;
|
||||
result = prime * result + field_2_reserved1;
|
||||
result = prime * result + field_3_reserved2;
|
||||
result = prime * result + field_4_reserved3;
|
||||
result = prime * result + field_5_reserved4;
|
||||
result = prime * result + field_6_ccpText;
|
||||
result = prime * result + field_7_ccpFtn;
|
||||
result = prime * result + field_8_ccpHdd;
|
||||
result = prime * result + field_9_ccpMcr;
|
||||
result = prime * result + field_10_ccpAtn;
|
||||
result = prime * result + field_11_ccpEdn;
|
||||
result = prime * result + field_12_ccpTxbx;
|
||||
result = prime * result + field_13_ccpHdrTxbx;
|
||||
result = prime * result + field_14_reserved5;
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[FibRgLw95]\n");
|
||||
builder.append(" .cbMac = ");
|
||||
builder.append(" (").append(getCbMac()).append(" )\n");
|
||||
builder.append(" .reserved1 = ");
|
||||
builder.append(" (").append(getReserved1()).append(" )\n");
|
||||
builder.append(" .reserved2 = ");
|
||||
builder.append(" (").append(getReserved2()).append(" )\n");
|
||||
builder.append(" .reserved3 = ");
|
||||
builder.append(" (").append(getReserved3()).append(" )\n");
|
||||
builder.append(" .reserved4 = ");
|
||||
builder.append(" (").append(getReserved4()).append(" )\n");
|
||||
builder.append(" .ccpText = ");
|
||||
builder.append(" (").append(getCcpText()).append(" )\n");
|
||||
builder.append(" .ccpFtn = ");
|
||||
builder.append(" (").append(getCcpFtn()).append(" )\n");
|
||||
builder.append(" .ccpHdd = ");
|
||||
builder.append(" (").append(getCcpHdd()).append(" )\n");
|
||||
builder.append(" .ccpMcr = ");
|
||||
builder.append(" (").append(getCcpMcr()).append(" )\n");
|
||||
builder.append(" .ccpAtn = ");
|
||||
builder.append(" (").append(getCcpAtn()).append(" )\n");
|
||||
builder.append(" .ccpEdn = ");
|
||||
builder.append(" (").append(getCcpEdn()).append(" )\n");
|
||||
builder.append(" .ccpTxbx = ");
|
||||
builder.append(" (").append(getCcpTxbx()).append(" )\n");
|
||||
builder.append(" .ccpHdrTxbx = ");
|
||||
builder.append(" (").append(getCcpHdrTxbx()).append(" )\n");
|
||||
builder.append(" .reserved5 = ");
|
||||
builder.append(" (").append(getReserved5()).append(" )\n");
|
||||
|
||||
builder.append("[/FibRgLw95]\n");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cbMac field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCbMac()
|
||||
{
|
||||
return field_1_cbMac;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cbMac field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCbMac( int field_1_cbMac )
|
||||
{
|
||||
this.field_1_cbMac = field_1_cbMac;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the reserved1 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getReserved1()
|
||||
{
|
||||
return field_2_reserved1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the reserved1 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setReserved1( int field_2_reserved1 )
|
||||
{
|
||||
this.field_2_reserved1 = field_2_reserved1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the reserved2 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getReserved2()
|
||||
{
|
||||
return field_3_reserved2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the reserved2 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setReserved2( int field_3_reserved2 )
|
||||
{
|
||||
this.field_3_reserved2 = field_3_reserved2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the reserved3 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getReserved3()
|
||||
{
|
||||
return field_4_reserved3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the reserved3 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setReserved3( int field_4_reserved3 )
|
||||
{
|
||||
this.field_4_reserved3 = field_4_reserved3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the reserved4 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getReserved4()
|
||||
{
|
||||
return field_5_reserved4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the reserved4 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setReserved4( int field_5_reserved4 )
|
||||
{
|
||||
this.field_5_reserved4 = field_5_reserved4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpText field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpText()
|
||||
{
|
||||
return field_6_ccpText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpText field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpText( int field_6_ccpText )
|
||||
{
|
||||
this.field_6_ccpText = field_6_ccpText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpFtn field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpFtn()
|
||||
{
|
||||
return field_7_ccpFtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpFtn field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpFtn( int field_7_ccpFtn )
|
||||
{
|
||||
this.field_7_ccpFtn = field_7_ccpFtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpHdd field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpHdd()
|
||||
{
|
||||
return field_8_ccpHdd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpHdd field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpHdd( int field_8_ccpHdd )
|
||||
{
|
||||
this.field_8_ccpHdd = field_8_ccpHdd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpMcr field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpMcr()
|
||||
{
|
||||
return field_9_ccpMcr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpMcr field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpMcr( int field_9_ccpMcr )
|
||||
{
|
||||
this.field_9_ccpMcr = field_9_ccpMcr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpAtn field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpAtn()
|
||||
{
|
||||
return field_10_ccpAtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpAtn field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpAtn( int field_10_ccpAtn )
|
||||
{
|
||||
this.field_10_ccpAtn = field_10_ccpAtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpEdn field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpEdn()
|
||||
{
|
||||
return field_11_ccpEdn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpEdn field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpEdn( int field_11_ccpEdn )
|
||||
{
|
||||
this.field_11_ccpEdn = field_11_ccpEdn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpTxbx field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpTxbx()
|
||||
{
|
||||
return field_12_ccpTxbx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpTxbx field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpTxbx( int field_12_ccpTxbx )
|
||||
{
|
||||
this.field_12_ccpTxbx = field_12_ccpTxbx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ccpHdrTxbx field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getCcpHdrTxbx()
|
||||
{
|
||||
return field_13_ccpHdrTxbx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ccpHdrTxbx field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setCcpHdrTxbx( int field_13_ccpHdrTxbx )
|
||||
{
|
||||
this.field_13_ccpHdrTxbx = field_13_ccpHdrTxbx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the reserved5 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public int getReserved5()
|
||||
{
|
||||
return field_14_reserved5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the reserved5 field for the FibRgLw95 record.
|
||||
*/
|
||||
@Internal
|
||||
public void setReserved5( int field_14_reserved5 )
|
||||
{
|
||||
this.field_14_reserved5 = field_14_reserved5;
|
||||
}
|
||||
|
||||
} // END OF CLASS
|
|
@ -147,6 +147,93 @@ public abstract class FibRgLw97AbstractType
|
|||
return 0 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( this == obj )
|
||||
return true;
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
FibRgLw97AbstractType other = (FibRgLw97AbstractType) obj;
|
||||
if ( field_1_cbMac != other.field_1_cbMac )
|
||||
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_ccpText != other.field_4_ccpText )
|
||||
return false;
|
||||
if ( field_5_ccpFtn != other.field_5_ccpFtn )
|
||||
return false;
|
||||
if ( field_6_ccpHdd != other.field_6_ccpHdd )
|
||||
return false;
|
||||
if ( field_7_reserved3 != other.field_7_reserved3 )
|
||||
return false;
|
||||
if ( field_8_ccpAtn != other.field_8_ccpAtn )
|
||||
return false;
|
||||
if ( field_9_ccpEdn != other.field_9_ccpEdn )
|
||||
return false;
|
||||
if ( field_10_ccpTxbx != other.field_10_ccpTxbx )
|
||||
return false;
|
||||
if ( field_11_ccpHdrTxbx != other.field_11_ccpHdrTxbx )
|
||||
return false;
|
||||
if ( field_12_reserved4 != other.field_12_reserved4 )
|
||||
return false;
|
||||
if ( field_13_reserved5 != other.field_13_reserved5 )
|
||||
return false;
|
||||
if ( field_14_reserved6 != other.field_14_reserved6 )
|
||||
return false;
|
||||
if ( field_15_reserved7 != other.field_15_reserved7 )
|
||||
return false;
|
||||
if ( field_16_reserved8 != other.field_16_reserved8 )
|
||||
return false;
|
||||
if ( field_17_reserved9 != other.field_17_reserved9 )
|
||||
return false;
|
||||
if ( field_18_reserved10 != other.field_18_reserved10 )
|
||||
return false;
|
||||
if ( field_19_reserved11 != other.field_19_reserved11 )
|
||||
return false;
|
||||
if ( field_20_reserved12 != other.field_20_reserved12 )
|
||||
return false;
|
||||
if ( field_21_reserved13 != other.field_21_reserved13 )
|
||||
return false;
|
||||
if ( field_22_reserved14 != other.field_22_reserved14 )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + field_1_cbMac;
|
||||
result = prime * result + field_2_reserved1;
|
||||
result = prime * result + field_3_reserved2;
|
||||
result = prime * result + field_4_ccpText;
|
||||
result = prime * result + field_5_ccpFtn;
|
||||
result = prime * result + field_6_ccpHdd;
|
||||
result = prime * result + field_7_reserved3;
|
||||
result = prime * result + field_8_ccpAtn;
|
||||
result = prime * result + field_9_ccpEdn;
|
||||
result = prime * result + field_10_ccpTxbx;
|
||||
result = prime * result + field_11_ccpHdrTxbx;
|
||||
result = prime * result + field_12_reserved4;
|
||||
result = prime * result + field_13_reserved5;
|
||||
result = prime * result + field_14_reserved6;
|
||||
result = prime * result + field_15_reserved7;
|
||||
result = prime * result + field_16_reserved8;
|
||||
result = prime * result + field_17_reserved9;
|
||||
result = prime * result + field_18_reserved10;
|
||||
result = prime * result + field_19_reserved11;
|
||||
result = prime * result + field_20_reserved12;
|
||||
result = prime * result + field_21_reserved13;
|
||||
result = prime * result + field_22_reserved14;
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?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="FibRgLw95" package="org.apache.poi.hwpf.model.types">
|
||||
<suffix>AbstractType</suffix>
|
||||
<description>The FibRgLw95 structure is the third section of the FIB for Word95.
|
||||
</description>
|
||||
<author>Sergey Vladimirov
|
||||
</author>
|
||||
<fields>
|
||||
<field type="int" size="4" name="cbMac"/>
|
||||
|
||||
<field type="int" size="4" name="reserved1" deprecated="true"/>
|
||||
<field type="int" size="4" name="reserved2" deprecated="true"/>
|
||||
<field type="int" size="4" name="reserved3" deprecated="true"/>
|
||||
<field type="int" size="4" name="reserved4" deprecated="true"/>
|
||||
|
||||
<field type="int" size="4" name="ccpText"/>
|
||||
<field type="int" size="4" name="ccpFtn"/>
|
||||
<field type="int" size="4" name="ccpHdd"/>
|
||||
<field type="int" size="4" name="ccpMcr"/>
|
||||
<field type="int" size="4" name="ccpAtn"/>
|
||||
<field type="int" size="4" name="ccpEdn"/>
|
||||
<field type="int" size="4" name="ccpTxbx"/>
|
||||
<field type="int" size="4" name="ccpHdrTxbx"/>
|
||||
|
||||
<field type="int" size="4" name="reserved5" deprecated="true"/>
|
||||
</fields>
|
||||
</record>
|
|
@ -25,6 +25,11 @@
|
|||
|
||||
<xsl:output method="text"/>
|
||||
|
||||
<xsl:template name="outputClassName">
|
||||
<xsl:value-of select="/record/@name"/>
|
||||
<xsl:value-of select="/record/suffix"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="record">
|
||||
|
||||
<xsl:if test="@package">
|
||||
|
@ -45,7 +50,7 @@ import org.apache.poi.util.*;
|
|||
<xsl:apply-templates select="author"/><xsl:text>
|
||||
*/
|
||||
@Internal
|
||||
public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>AbstractType
|
||||
public abstract class </xsl:text><xsl:call-template name="outputClassName"/><xsl:text>
|
||||
{
|
||||
|
||||
</xsl:text>
|
||||
|
@ -196,6 +201,78 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
|
|||
<xsl:call-template name="linebreak"/>
|
||||
</xsl:if>
|
||||
|
||||
<!-- equals() -->
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>@Override</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>public boolean equals( Object obj )
|
||||
{
|
||||
if ( this == obj )
|
||||
return true;
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
</xsl:text>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:call-template name="outputClassName"/>
|
||||
<xsl:text> other = (</xsl:text>
|
||||
<xsl:call-template name="outputClassName"/>
|
||||
<xsl:text>) obj;</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:for-each select="//fields/field">
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>if ( </xsl:text>
|
||||
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
|
||||
<xsl:text> != other.</xsl:text>
|
||||
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
|
||||
<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"/>
|
||||
<xsl:text>return true;</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>}</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
|
||||
<!-- hashCode() -->
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>@Override</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
</xsl:text>
|
||||
<xsl:for-each select="//fields/field">
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>result = prime * result + </xsl:text>
|
||||
<xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
|
||||
<xsl:text>;</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
</xsl:for-each>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>return result;</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>}</xsl:text>
|
||||
<xsl:call-template name="linebreak"/>
|
||||
|
||||
<xsl:call-template name="linebreak"/>
|
||||
<xsl:call-template name="indent"/>
|
||||
<xsl:text>public String toString()
|
||||
|
|
Loading…
Reference in New Issue