replcae FIBLongHandler with FibRgLw97 and remove CPSplitCalculator
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1178038 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2dc849577d
commit
23a44c7c6d
@ -28,7 +28,6 @@ import org.apache.poi.hpsf.DocumentSummaryInformation;
|
|||||||
import org.apache.poi.hpsf.SummaryInformation;
|
import org.apache.poi.hpsf.SummaryInformation;
|
||||||
import org.apache.poi.hwpf.model.BookmarksTables;
|
import org.apache.poi.hwpf.model.BookmarksTables;
|
||||||
import org.apache.poi.hwpf.model.CHPBinTable;
|
import org.apache.poi.hwpf.model.CHPBinTable;
|
||||||
import org.apache.poi.hwpf.model.CPSplitCalculator;
|
|
||||||
import org.apache.poi.hwpf.model.ComplexFileTable;
|
import org.apache.poi.hwpf.model.ComplexFileTable;
|
||||||
import org.apache.poi.hwpf.model.DocumentProperties;
|
import org.apache.poi.hwpf.model.DocumentProperties;
|
||||||
import org.apache.poi.hwpf.model.EscherRecordHolder;
|
import org.apache.poi.hwpf.model.EscherRecordHolder;
|
||||||
@ -88,10 +87,6 @@ public final class HWPFDocument extends HWPFDocumentCore
|
|||||||
private static final String STREAM_TABLE_0 = "0Table";
|
private static final String STREAM_TABLE_0 = "0Table";
|
||||||
private static final String STREAM_TABLE_1 = "1Table";
|
private static final String STREAM_TABLE_1 = "1Table";
|
||||||
|
|
||||||
/** And for making sense of CP lengths in the FIB */
|
|
||||||
@Deprecated
|
|
||||||
protected CPSplitCalculator _cpSplit;
|
|
||||||
|
|
||||||
/** table stream buffer*/
|
/** table stream buffer*/
|
||||||
protected byte[] _tableStream;
|
protected byte[] _tableStream;
|
||||||
|
|
||||||
@ -222,9 +217,6 @@ public final class HWPFDocument extends HWPFDocumentCore
|
|||||||
// Also handles HPSF bits
|
// Also handles HPSF bits
|
||||||
super(directory);
|
super(directory);
|
||||||
|
|
||||||
// Do the CP Split
|
|
||||||
_cpSplit = new CPSplitCalculator(_fib);
|
|
||||||
|
|
||||||
// Is this document too old for us?
|
// Is this document too old for us?
|
||||||
if(_fib.getFibBase().getNFib() < 106) {
|
if(_fib.getFibBase().getNFib() < 106) {
|
||||||
throw new OldWordFileFormatException("The document is too old - Word 95 or older. Try HWPFOldDocument instead?");
|
throw new OldWordFileFormatException("The document is too old - Word 95 or older. Try HWPFOldDocument instead?");
|
||||||
@ -350,7 +342,7 @@ public final class HWPFDocument extends HWPFDocumentCore
|
|||||||
_officeDrawingsHeaders = new OfficeDrawingsImpl( _fspaHeaders, _escherRecordHolder, _mainStream );
|
_officeDrawingsHeaders = new OfficeDrawingsImpl( _fspaHeaders, _escherRecordHolder, _mainStream );
|
||||||
_officeDrawingsMain = new OfficeDrawingsImpl( _fspaMain , _escherRecordHolder, _mainStream);
|
_officeDrawingsMain = new OfficeDrawingsImpl( _fspaMain , _escherRecordHolder, _mainStream);
|
||||||
|
|
||||||
_st = new SectionTable(_mainStream, _tableStream, _fib.getFcPlcfsed(), _fib.getLcbPlcfsed(), fcMin, _tpt, _cpSplit);
|
_st = new SectionTable(_mainStream, _tableStream, _fib.getFcPlcfsed(), _fib.getLcbPlcfsed(), fcMin, _tpt, _fib.getSubdocumentTextStreamLength( SubdocumentType.MAIN));
|
||||||
_ss = new StyleSheet(_tableStream, _fib.getFcStshf());
|
_ss = new StyleSheet(_tableStream, _fib.getFcStshf());
|
||||||
_ft = new FontTable(_tableStream, _fib.getFcSttbfffn(), _fib.getLcbSttbfffn());
|
_ft = new FontTable(_tableStream, _fib.getFcSttbfffn(), _fib.getLcbSttbfffn());
|
||||||
|
|
||||||
@ -400,12 +392,6 @@ public final class HWPFDocument extends HWPFDocumentCore
|
|||||||
return _text;
|
return _text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public CPSplitCalculator getCPSplitCalculator()
|
|
||||||
{
|
|
||||||
return _cpSplit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DocumentProperties getDocProperties()
|
public DocumentProperties getDocProperties()
|
||||||
{
|
{
|
||||||
return _dop;
|
return _dop;
|
||||||
|
@ -1,145 +0,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.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
package org.apache.poi.hwpf.model;
|
|
||||||
|
|
||||||
import org.apache.poi.hwpf.HWPFDocument;
|
|
||||||
import org.apache.poi.util.Internal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper class for {@link HWPFDocument}, which figures out
|
|
||||||
* where different kinds of text can be found within the
|
|
||||||
* overall CP splurge.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@Internal
|
|
||||||
public final class CPSplitCalculator {
|
|
||||||
private FileInformationBlock fib;
|
|
||||||
public CPSplitCalculator(FileInformationBlock fib) {
|
|
||||||
this.fib = fib;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the main document text starts. Always 0.
|
|
||||||
*/
|
|
||||||
public int getMainDocumentStart() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Where the main document text ends.
|
|
||||||
* Given by FibRgLw97.ccpText
|
|
||||||
*/
|
|
||||||
public int getMainDocumentEnd() {
|
|
||||||
return fib.getCcpText();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the Footnotes text starts.
|
|
||||||
* Follows straight on from the main text.
|
|
||||||
*/
|
|
||||||
public int getFootnoteStart() {
|
|
||||||
return getMainDocumentEnd();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Where the Footnotes text ends.
|
|
||||||
* Length comes from FibRgLw97.ccpFtn
|
|
||||||
*/
|
|
||||||
public int getFootnoteEnd() {
|
|
||||||
return getFootnoteStart() +
|
|
||||||
fib.getCcpFtn();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the "Header Story" text starts.
|
|
||||||
* Follows straight on from the footnotes.
|
|
||||||
*/
|
|
||||||
public int getHeaderStoryStart() {
|
|
||||||
return getFootnoteEnd();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Where the "Header Story" text ends.
|
|
||||||
* Length comes from FibRgLw97.ccpHdd
|
|
||||||
*/
|
|
||||||
public int getHeaderStoryEnd() {
|
|
||||||
return getHeaderStoryStart() +
|
|
||||||
fib.getCcpHdd();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the Comment (Atn) text starts.
|
|
||||||
* Follows straight on from the header stories.
|
|
||||||
*/
|
|
||||||
public int getCommentsStart() {
|
|
||||||
return getHeaderStoryEnd();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Where the Comment (Atn) text ends.
|
|
||||||
* Length comes from FibRgLw97.ccpAtn
|
|
||||||
*/
|
|
||||||
public int getCommentsEnd() {
|
|
||||||
return getCommentsStart() +
|
|
||||||
fib.getCcpCommentAtn();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the End Note text starts.
|
|
||||||
* Follows straight on from the comments.
|
|
||||||
*/
|
|
||||||
public int getEndNoteStart() {
|
|
||||||
return getCommentsEnd();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Where the End Note text ends.
|
|
||||||
* Length comes from FibRgLw97.ccpEdn
|
|
||||||
*/
|
|
||||||
public int getEndNoteEnd() {
|
|
||||||
return getEndNoteStart() +
|
|
||||||
fib.getCcpEdn();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the Main Textbox text starts.
|
|
||||||
* Follows straight on from the end note.
|
|
||||||
*/
|
|
||||||
public int getMainTextboxStart() {
|
|
||||||
return getEndNoteEnd();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Where the Main textbox text ends.
|
|
||||||
* Length comes from FibRgLw97.ccpTxBx
|
|
||||||
*/
|
|
||||||
public int getMainTextboxEnd() {
|
|
||||||
return getMainTextboxStart() +
|
|
||||||
fib.getCcpTxtBx();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the Header Textbox text starts.
|
|
||||||
* Follows straight on from the main textbox.
|
|
||||||
*/
|
|
||||||
public int getHeaderTextboxStart() {
|
|
||||||
return getMainTextboxEnd();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Where the Header textbox text ends.
|
|
||||||
* Length comes from FibRgLw97.ccpHdrTxBx
|
|
||||||
*/
|
|
||||||
public int getHeaderTextboxEnd() {
|
|
||||||
return getHeaderTextboxStart() +
|
|
||||||
fib.getCcpHdrTxtBx();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,140 +0,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.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
package org.apache.poi.hwpf.model;
|
|
||||||
|
|
||||||
import org.apache.poi.util.Internal;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the fibRgLw / The FibRgLw97 part of
|
|
||||||
* the FIB (File Information Block)
|
|
||||||
*/
|
|
||||||
@Internal
|
|
||||||
public final class FIBLongHandler {
|
|
||||||
public static final int CBMAC = 0;
|
|
||||||
public static final int PRODUCTCREATED = 1;
|
|
||||||
public static final int PRODUCTREVISED = 2;
|
|
||||||
/**
|
|
||||||
* Pointer to length of main document text stream 1
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPTEXT = 3;
|
|
||||||
/**
|
|
||||||
* Pointer to length of footnote subdocument text stream
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPFTN = 4;
|
|
||||||
/**
|
|
||||||
* Pointer to length of header subdocument text stream
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPHDD = 5;
|
|
||||||
/**
|
|
||||||
* Pointer to length of macro subdocument text stream, which should now
|
|
||||||
* always be 0
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPMCR = 6;
|
|
||||||
/**
|
|
||||||
* Pointer to length of annotation subdocument text stream
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPATN = 7;
|
|
||||||
/**
|
|
||||||
* Pointer to length of endnote subdocument text stream
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPEDN = 8;
|
|
||||||
/**
|
|
||||||
* Pointer to length of textbox subdocument text stream
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPTXBX = 9;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Length of header textbox subdocument text stream
|
|
||||||
*
|
|
||||||
* @since Word 97
|
|
||||||
*/
|
|
||||||
public static final int CCPHDRTXBX = 10;
|
|
||||||
public static final int PNFBPCHPFIRST = 11;
|
|
||||||
public static final int PNCHPFIRST = 12;
|
|
||||||
public static final int CPNBTECHP = 13;
|
|
||||||
public static final int PNFBPPAPFIRST = 14;
|
|
||||||
public static final int PNPAPFIRST = 15;
|
|
||||||
public static final int CPNBTEPAP = 16;
|
|
||||||
public static final int PNFBPLVCFIRST = 17;
|
|
||||||
public static final int PNLVCFIRST = 18;
|
|
||||||
public static final int CPNBTELVC = 19;
|
|
||||||
public static final int FCISLANDFIRST = 20;
|
|
||||||
public static final int FCISLANDLIM = 21;
|
|
||||||
|
|
||||||
int[] _longs;
|
|
||||||
|
|
||||||
public FIBLongHandler(byte[] mainStream, int offset)
|
|
||||||
{
|
|
||||||
int longCount = LittleEndian.getShort(mainStream, offset);
|
|
||||||
offset += LittleEndian.SHORT_SIZE;
|
|
||||||
_longs = new int[longCount];
|
|
||||||
|
|
||||||
for (int x = 0; x < longCount; x++)
|
|
||||||
{
|
|
||||||
_longs[x] = LittleEndian.getInt(mainStream, offset + (x * LittleEndian.INT_SIZE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refers to a 32 bit windows "long" same as a Java int
|
|
||||||
* @param longCode FIXME: Document this!
|
|
||||||
* @return FIXME: Document this!
|
|
||||||
*/
|
|
||||||
public int getLong(int longCode)
|
|
||||||
{
|
|
||||||
return _longs[longCode];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLong(int longCode, int value)
|
|
||||||
{
|
|
||||||
_longs[longCode] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void serialize(byte[] mainStream, int offset) {
|
|
||||||
LittleEndian.putShort(mainStream, offset, (short)_longs.length);
|
|
||||||
offset += LittleEndian.SHORT_SIZE;
|
|
||||||
|
|
||||||
for (int x = 0; x < _longs.length; x++)
|
|
||||||
{
|
|
||||||
LittleEndian.putInt(mainStream, offset, _longs[x]);
|
|
||||||
offset += LittleEndian.INT_SIZE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int sizeInBytes()
|
|
||||||
{
|
|
||||||
return (_longs.length * LittleEndian.INT_SIZE) + LittleEndian.SHORT_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
196
src/scratchpad/src/org/apache/poi/hwpf/model/FibRgLw97.java
Normal file
196
src/scratchpad/src/org/apache/poi/hwpf/model/FibRgLw97.java
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
/* ====================================================================
|
||||||
|
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.FibRgLw97AbstractType;
|
||||||
|
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 FibRgLw97 extends FibRgLw97AbstractType
|
||||||
|
{
|
||||||
|
|
||||||
|
public FibRgLw97()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public FibRgLw97( 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 field_7_reserved3;
|
||||||
|
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:
|
||||||
|
field_7_reserved3 = 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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -48,9 +48,10 @@ public final class FileInformationBlock implements Cloneable
|
|||||||
|
|
||||||
private FibBase _fibBase;
|
private FibBase _fibBase;
|
||||||
private int _csw;
|
private int _csw;
|
||||||
private FibRgW97 _fibRgW97;
|
private FibRgW97 _fibRgW;
|
||||||
|
private int _cslw;
|
||||||
|
private FibRgLw97 _fibRgLw;
|
||||||
|
|
||||||
FIBLongHandler _longHandler;
|
|
||||||
FIBFieldHandler _fieldHandler;
|
FIBFieldHandler _fieldHandler;
|
||||||
|
|
||||||
/** Creates a new instance of FileInformationBlock */
|
/** Creates a new instance of FileInformationBlock */
|
||||||
@ -66,15 +67,21 @@ public final class FileInformationBlock implements Cloneable
|
|||||||
offset += 2;
|
offset += 2;
|
||||||
assert offset == 34;
|
assert offset == 34;
|
||||||
|
|
||||||
_fibRgW97 = new FibRgW97( mainDocument, 34 );
|
_fibRgW = new FibRgW97( mainDocument, offset );
|
||||||
offset += FibRgW97.getSize();
|
offset += FibRgW97.getSize();
|
||||||
assert offset == 62;
|
assert offset == 62;
|
||||||
|
|
||||||
|
_cslw = LittleEndian.getUShort( mainDocument, offset );
|
||||||
|
offset += 2;
|
||||||
|
assert offset == 64;
|
||||||
|
|
||||||
|
_fibRgLw = new FibRgLw97( mainDocument, offset );
|
||||||
|
offset += FibRgLw97.getSize();
|
||||||
|
assert offset == 152;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillVariableFields( byte[] mainDocument, byte[] tableStream )
|
public void fillVariableFields( byte[] mainDocument, byte[] tableStream )
|
||||||
{
|
{
|
||||||
_longHandler = new FIBLongHandler( mainDocument, 62 );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Listed fields won't be treat as UnhandledDataStructure. For all other
|
* Listed fields won't be treat as UnhandledDataStructure. For all other
|
||||||
* fields FIBFieldHandler will load it content into
|
* fields FIBFieldHandler will load it content into
|
||||||
@ -113,9 +120,8 @@ public final class FileInformationBlock implements Cloneable
|
|||||||
knownFieldSet.add( Integer.valueOf( FIBFieldHandler.STTBSAVEDBY ) );
|
knownFieldSet.add( Integer.valueOf( FIBFieldHandler.STTBSAVEDBY ) );
|
||||||
knownFieldSet.add( Integer.valueOf( FIBFieldHandler.MODIFIED ) );
|
knownFieldSet.add( Integer.valueOf( FIBFieldHandler.MODIFIED ) );
|
||||||
|
|
||||||
_fieldHandler = new FIBFieldHandler( mainDocument,
|
_fieldHandler = new FIBFieldHandler( mainDocument, 152, tableStream,
|
||||||
62 + _longHandler.sizeInBytes(), tableStream, knownFieldSet,
|
knownFieldSet, true );
|
||||||
true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -535,16 +541,18 @@ public final class FileInformationBlock implements Cloneable
|
|||||||
/**
|
/**
|
||||||
* How many bytes of the main stream contain real data.
|
* How many bytes of the main stream contain real data.
|
||||||
*/
|
*/
|
||||||
public int getCbMac() {
|
public int getCbMac()
|
||||||
return _longHandler.getLong(FIBLongHandler.CBMAC);
|
{
|
||||||
|
return _fibRgLw.getCbMac();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the count of the number of bytes in the
|
* Updates the count of the number of bytes in the
|
||||||
* main stream which contain real data
|
* main stream which contain real data
|
||||||
*/
|
*/
|
||||||
public void setCbMac(int cbMac) {
|
public void setCbMac( int cbMac )
|
||||||
_longHandler.setLong(FIBLongHandler.CBMAC, cbMac);
|
{
|
||||||
|
_fibRgLw.setCbMac( cbMac );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -555,7 +563,7 @@ public final class FileInformationBlock implements Cloneable
|
|||||||
if ( type == null )
|
if ( type == null )
|
||||||
throw new IllegalArgumentException( "argument 'type' is null" );
|
throw new IllegalArgumentException( "argument 'type' is null" );
|
||||||
|
|
||||||
return _longHandler.getLong( type.getFibLongFieldIndex() );
|
return _fibRgLw.getSubdocumentTextStreamLength( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubdocumentTextStreamLength( SubdocumentType type, int length )
|
public void setSubdocumentTextStreamLength( SubdocumentType type, int length )
|
||||||
@ -568,120 +576,9 @@ public final class FileInformationBlock implements Cloneable
|
|||||||
+ length + "). " + "If there is no subdocument "
|
+ length + "). " + "If there is no subdocument "
|
||||||
+ "length must be set to zero." );
|
+ "length must be set to zero." );
|
||||||
|
|
||||||
_longHandler.setLong( type.getFibLongFieldIndex(), length );
|
_fibRgLw.setSubdocumentTextStreamLength( type, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The count of CPs in the main document
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpText() {
|
|
||||||
return _longHandler.getLong(FIBLongHandler.CCPTEXT);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Updates the count of CPs in the main document
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCcpText(int ccpText) {
|
|
||||||
_longHandler.setLong(FIBLongHandler.CCPTEXT, ccpText);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The count of CPs in the footnote subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpFtn() {
|
|
||||||
return _longHandler.getLong(FIBLongHandler.CCPFTN);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Updates the count of CPs in the footnote subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCcpFtn(int ccpFtn) {
|
|
||||||
_longHandler.setLong(FIBLongHandler.CCPFTN, ccpFtn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The count of CPs in the header story subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpHdd() {
|
|
||||||
return _longHandler.getLong(FIBLongHandler.CCPHDD);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Updates the count of CPs in the header story subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCcpHdd(int ccpHdd) {
|
|
||||||
_longHandler.setLong(FIBLongHandler.CCPHDD, ccpHdd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The count of CPs in the comments (atn) subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpAtn() {
|
|
||||||
return _longHandler.getLong(FIBLongHandler.CCPATN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpCommentAtn() {
|
|
||||||
return getCcpAtn();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Updates the count of CPs in the comments (atn) story subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCcpAtn(int ccpAtn) {
|
|
||||||
_longHandler.setLong(FIBLongHandler.CCPATN, ccpAtn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The count of CPs in the end note subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpEdn() {
|
|
||||||
return _longHandler.getLong(FIBLongHandler.CCPEDN);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Updates the count of CPs in the end note subdocument
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCcpEdn(int ccpEdn) {
|
|
||||||
_longHandler.setLong(FIBLongHandler.CCPEDN, ccpEdn);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The count of CPs in the main document textboxes
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpTxtBx() {
|
|
||||||
return _longHandler.getLong(FIBLongHandler.CCPTXBX);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Updates the count of CPs in the main document textboxes
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCcpTxtBx(int ccpTxtBx) {
|
|
||||||
_longHandler.setLong(FIBLongHandler.CCPTXBX, ccpTxtBx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The count of CPs in the header textboxes
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getCcpHdrTxtBx() {
|
|
||||||
return _longHandler.getLong(FIBLongHandler.CCPHDRTXBX);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Updates the count of CPs in the header textboxes
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setCcpHdrTxtBx(int ccpTxtBx) {
|
|
||||||
_longHandler.setLong(FIBLongHandler.CCPHDRTXBX, ccpTxtBx);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void clearOffsetsSizes()
|
public void clearOffsetsSizes()
|
||||||
{
|
{
|
||||||
_fieldHandler.clearFields();
|
_fieldHandler.clearFields();
|
||||||
@ -978,19 +875,22 @@ public final class FileInformationBlock implements Cloneable
|
|||||||
LittleEndian.putUShort( mainStream, offset, _csw );
|
LittleEndian.putUShort( mainStream, offset, _csw );
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
|
||||||
_fibRgW97.serialize( mainStream, offset );
|
_fibRgW.serialize( mainStream, offset );
|
||||||
offset += FibRgW97.getSize();
|
offset += FibRgW97.getSize();
|
||||||
|
|
||||||
_longHandler.serialize( mainStream, offset );
|
LittleEndian.putUShort( mainStream, offset, _cslw );
|
||||||
offset += _longHandler.sizeInBytes();
|
offset += 2;
|
||||||
|
|
||||||
|
_fibRgLw.serialize( mainStream, offset );
|
||||||
|
offset += FibRgLw97.getSize();
|
||||||
|
|
||||||
_fieldHandler.writeTo( mainStream, offset, tableStream );
|
_fieldHandler.writeTo( mainStream, offset, tableStream );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize()
|
public int getSize()
|
||||||
{
|
{
|
||||||
return FibBase.getSize() + 2 + FibRgW97.getSize()
|
return FibBase.getSize() + 2 + FibRgW97.getSize() + 2
|
||||||
+ _longHandler.sizeInBytes() + _fieldHandler.sizeInBytes();
|
+ FibRgLw97.getSize() + _fieldHandler.sizeInBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FibBase getFibBase()
|
public FibBase getFibBase()
|
||||||
|
@ -51,7 +51,7 @@ public class SectionTable
|
|||||||
|
|
||||||
public SectionTable(byte[] documentStream, byte[] tableStream, int offset,
|
public SectionTable(byte[] documentStream, byte[] tableStream, int offset,
|
||||||
int size, int fcMin,
|
int size, int fcMin,
|
||||||
TextPieceTable tpt, CPSplitCalculator cps)
|
TextPieceTable tpt, int mainLength)
|
||||||
{
|
{
|
||||||
PlexOfCps sedPlex = new PlexOfCps(tableStream, offset, size, SED_SIZE);
|
PlexOfCps sedPlex = new PlexOfCps(tableStream, offset, size, SED_SIZE);
|
||||||
this.tpt = tpt;
|
this.tpt = tpt;
|
||||||
@ -89,7 +89,7 @@ public class SectionTable
|
|||||||
// Some files seem to lie about their unicode status, which
|
// Some files seem to lie about their unicode status, which
|
||||||
// is very very pesky. Try to work around these, but this
|
// is very very pesky. Try to work around these, but this
|
||||||
// is getting on for black magic...
|
// is getting on for black magic...
|
||||||
int mainEndsAt = cps.getMainDocumentEnd();
|
int mainEndsAt = mainLength;
|
||||||
boolean matchAt = false;
|
boolean matchAt = false;
|
||||||
boolean matchHalf = false;
|
boolean matchHalf = false;
|
||||||
for(int i=0; i<_sections.size(); i++) {
|
for(int i=0; i<_sections.size(); i++) {
|
||||||
|
@ -25,21 +25,22 @@ import org.apache.poi.util.Internal;
|
|||||||
*/
|
*/
|
||||||
@Internal
|
@Internal
|
||||||
public enum SubdocumentType {
|
public enum SubdocumentType {
|
||||||
MAIN( FIBLongHandler.CCPTEXT ),
|
MAIN(),
|
||||||
|
|
||||||
FOOTNOTE( FIBLongHandler.CCPFTN ),
|
FOOTNOTE(),
|
||||||
|
|
||||||
HEADER( FIBLongHandler.CCPHDD ),
|
HEADER(),
|
||||||
|
|
||||||
MACRO( FIBLongHandler.CCPMCR ),
|
@Deprecated
|
||||||
|
MACRO(),
|
||||||
|
|
||||||
ANNOTATION( FIBLongHandler.CCPATN ),
|
ANNOTATION(),
|
||||||
|
|
||||||
ENDNOTE( FIBLongHandler.CCPEDN ),
|
ENDNOTE(),
|
||||||
|
|
||||||
TEXTBOX( FIBLongHandler.CCPTXBX ),
|
TEXTBOX(),
|
||||||
|
|
||||||
HEADER_TEXTBOX( FIBLongHandler.CCPHDRTXBX );
|
HEADER_TEXTBOX();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of {@link SubdocumentType}s ordered by document position and FIB
|
* Array of {@link SubdocumentType}s ordered by document position and FIB
|
||||||
@ -49,16 +50,8 @@ public enum SubdocumentType {
|
|||||||
MAIN, FOOTNOTE, HEADER, MACRO, ANNOTATION, ENDNOTE, TEXTBOX,
|
MAIN, FOOTNOTE, HEADER, MACRO, ANNOTATION, ENDNOTE, TEXTBOX,
|
||||||
HEADER_TEXTBOX };
|
HEADER_TEXTBOX };
|
||||||
|
|
||||||
private final int fibLongFieldIndex;
|
private SubdocumentType()
|
||||||
|
|
||||||
private SubdocumentType( int fibLongFieldIndex )
|
|
||||||
{
|
{
|
||||||
this.fibLongFieldIndex = fibLongFieldIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFibLongFieldIndex()
|
|
||||||
{
|
|
||||||
return fibLongFieldIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,599 @@
|
|||||||
|
/* ====================================================================
|
||||||
|
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 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
|
||||||
|
|
||||||
|
* <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; according to Microsoft Office Word 97-2007 Binary File Format
|
||||||
|
Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
|
||||||
|
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public abstract class FibRgLw97AbstractType
|
||||||
|
{
|
||||||
|
|
||||||
|
protected int field_1_cbMac;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_2_reserved1;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_3_reserved2;
|
||||||
|
protected int field_4_ccpText;
|
||||||
|
protected int field_5_ccpFtn;
|
||||||
|
protected int field_6_ccpHdd;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_7_reserved3;
|
||||||
|
protected int field_8_ccpAtn;
|
||||||
|
protected int field_9_ccpEdn;
|
||||||
|
protected int field_10_ccpTxbx;
|
||||||
|
protected int field_11_ccpHdrTxbx;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_12_reserved4;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_13_reserved5;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_14_reserved6;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_15_reserved7;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_16_reserved8;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_17_reserved9;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_18_reserved10;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_19_reserved11;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_20_reserved12;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_21_reserved13;
|
||||||
|
@Deprecated
|
||||||
|
protected int field_22_reserved14;
|
||||||
|
|
||||||
|
protected FibRgLw97AbstractType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
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_ccpText = LittleEndian.getInt( data, 0xc + offset );
|
||||||
|
field_5_ccpFtn = LittleEndian.getInt( data, 0x10 + offset );
|
||||||
|
field_6_ccpHdd = LittleEndian.getInt( data, 0x14 + offset );
|
||||||
|
field_7_reserved3 = LittleEndian.getInt( data, 0x18 + offset );
|
||||||
|
field_8_ccpAtn = LittleEndian.getInt( data, 0x1c + offset );
|
||||||
|
field_9_ccpEdn = LittleEndian.getInt( data, 0x20 + offset );
|
||||||
|
field_10_ccpTxbx = LittleEndian.getInt( data, 0x24 + offset );
|
||||||
|
field_11_ccpHdrTxbx = LittleEndian.getInt( data, 0x28 + offset );
|
||||||
|
field_12_reserved4 = LittleEndian.getInt( data, 0x2c + offset );
|
||||||
|
field_13_reserved5 = LittleEndian.getInt( data, 0x30 + offset );
|
||||||
|
field_14_reserved6 = LittleEndian.getInt( data, 0x34 + offset );
|
||||||
|
field_15_reserved7 = LittleEndian.getInt( data, 0x38 + offset );
|
||||||
|
field_16_reserved8 = LittleEndian.getInt( data, 0x3c + offset );
|
||||||
|
field_17_reserved9 = LittleEndian.getInt( data, 0x40 + offset );
|
||||||
|
field_18_reserved10 = LittleEndian.getInt( data, 0x44 + offset );
|
||||||
|
field_19_reserved11 = LittleEndian.getInt( data, 0x48 + offset );
|
||||||
|
field_20_reserved12 = LittleEndian.getInt( data, 0x4c + offset );
|
||||||
|
field_21_reserved13 = LittleEndian.getInt( data, 0x50 + offset );
|
||||||
|
field_22_reserved14 = LittleEndian.getInt( data, 0x54 + 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_ccpText );
|
||||||
|
LittleEndian.putInt( data, 0x10 + offset, field_5_ccpFtn );
|
||||||
|
LittleEndian.putInt( data, 0x14 + offset, field_6_ccpHdd );
|
||||||
|
LittleEndian.putInt( data, 0x18 + offset, field_7_reserved3 );
|
||||||
|
LittleEndian.putInt( data, 0x1c + offset, field_8_ccpAtn );
|
||||||
|
LittleEndian.putInt( data, 0x20 + offset, field_9_ccpEdn );
|
||||||
|
LittleEndian.putInt( data, 0x24 + offset, field_10_ccpTxbx );
|
||||||
|
LittleEndian.putInt( data, 0x28 + offset, field_11_ccpHdrTxbx );
|
||||||
|
LittleEndian.putInt( data, 0x2c + offset, field_12_reserved4 );
|
||||||
|
LittleEndian.putInt( data, 0x30 + offset, field_13_reserved5 );
|
||||||
|
LittleEndian.putInt( data, 0x34 + offset, field_14_reserved6 );
|
||||||
|
LittleEndian.putInt( data, 0x38 + offset, field_15_reserved7 );
|
||||||
|
LittleEndian.putInt( data, 0x3c + offset, field_16_reserved8 );
|
||||||
|
LittleEndian.putInt( data, 0x40 + offset, field_17_reserved9 );
|
||||||
|
LittleEndian.putInt( data, 0x44 + offset, field_18_reserved10 );
|
||||||
|
LittleEndian.putInt( data, 0x48 + offset, field_19_reserved11 );
|
||||||
|
LittleEndian.putInt( data, 0x4c + offset, field_20_reserved12 );
|
||||||
|
LittleEndian.putInt( data, 0x50 + offset, field_21_reserved13 );
|
||||||
|
LittleEndian.putInt( data, 0x54 + offset, field_22_reserved14 );
|
||||||
|
}
|
||||||
|
|
||||||
|
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 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("[FibRgLw97]\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(" .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(" .reserved3 = ");
|
||||||
|
builder.append(" (").append(getReserved3()).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(" .reserved4 = ");
|
||||||
|
builder.append(" (").append(getReserved4()).append(" )\n");
|
||||||
|
builder.append(" .reserved5 = ");
|
||||||
|
builder.append(" (").append(getReserved5()).append(" )\n");
|
||||||
|
builder.append(" .reserved6 = ");
|
||||||
|
builder.append(" (").append(getReserved6()).append(" )\n");
|
||||||
|
builder.append(" .reserved7 = ");
|
||||||
|
builder.append(" (").append(getReserved7()).append(" )\n");
|
||||||
|
builder.append(" .reserved8 = ");
|
||||||
|
builder.append(" (").append(getReserved8()).append(" )\n");
|
||||||
|
builder.append(" .reserved9 = ");
|
||||||
|
builder.append(" (").append(getReserved9()).append(" )\n");
|
||||||
|
builder.append(" .reserved10 = ");
|
||||||
|
builder.append(" (").append(getReserved10()).append(" )\n");
|
||||||
|
builder.append(" .reserved11 = ");
|
||||||
|
builder.append(" (").append(getReserved11()).append(" )\n");
|
||||||
|
builder.append(" .reserved12 = ");
|
||||||
|
builder.append(" (").append(getReserved12()).append(" )\n");
|
||||||
|
builder.append(" .reserved13 = ");
|
||||||
|
builder.append(" (").append(getReserved13()).append(" )\n");
|
||||||
|
builder.append(" .reserved14 = ");
|
||||||
|
builder.append(" (").append(getReserved14()).append(" )\n");
|
||||||
|
|
||||||
|
builder.append("[/FibRgLw97]\n");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the count of bytes of those written to the WordDocument stream of the file that have any meaning. All bytes in the WordDocument stream at offset cbMac and greater MUST be ignored..
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCbMac()
|
||||||
|
{
|
||||||
|
return field_1_cbMac;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the count of bytes of those written to the WordDocument stream of the file that have any meaning. All bytes in the WordDocument stream at offset cbMac and greater MUST be ignored..
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCbMac( int field_1_cbMac )
|
||||||
|
{
|
||||||
|
this.field_1_cbMac = field_1_cbMac;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved1()
|
||||||
|
{
|
||||||
|
return field_2_reserved1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved1( int field_2_reserved1 )
|
||||||
|
{
|
||||||
|
this.field_2_reserved1 = field_2_reserved1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved2()
|
||||||
|
{
|
||||||
|
return field_3_reserved2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved2( int field_3_reserved2 )
|
||||||
|
{
|
||||||
|
this.field_3_reserved2 = field_3_reserved2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the main document. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCcpText()
|
||||||
|
{
|
||||||
|
return field_4_ccpText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the main document. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCcpText( int field_4_ccpText )
|
||||||
|
{
|
||||||
|
this.field_4_ccpText = field_4_ccpText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the footnote subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCcpFtn()
|
||||||
|
{
|
||||||
|
return field_5_ccpFtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the footnote subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCcpFtn( int field_5_ccpFtn )
|
||||||
|
{
|
||||||
|
this.field_5_ccpFtn = field_5_ccpFtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the header subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCcpHdd()
|
||||||
|
{
|
||||||
|
return field_6_ccpHdd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the header subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCcpHdd( int field_6_ccpHdd )
|
||||||
|
{
|
||||||
|
this.field_6_ccpHdd = field_6_ccpHdd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved3()
|
||||||
|
{
|
||||||
|
return field_7_reserved3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved3( int field_7_reserved3 )
|
||||||
|
{
|
||||||
|
this.field_7_reserved3 = field_7_reserved3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the comment subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCcpAtn()
|
||||||
|
{
|
||||||
|
return field_8_ccpAtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the comment subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCcpAtn( int field_8_ccpAtn )
|
||||||
|
{
|
||||||
|
this.field_8_ccpAtn = field_8_ccpAtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the endnote subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCcpEdn()
|
||||||
|
{
|
||||||
|
return field_9_ccpEdn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the endnote subdocument. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCcpEdn( int field_9_ccpEdn )
|
||||||
|
{
|
||||||
|
this.field_9_ccpEdn = field_9_ccpEdn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the textbox subdocument of the main document. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCcpTxbx()
|
||||||
|
{
|
||||||
|
return field_10_ccpTxbx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the textbox subdocument of the main document. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCcpTxbx( int field_10_ccpTxbx )
|
||||||
|
{
|
||||||
|
this.field_10_ccpTxbx = field_10_ccpTxbx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the textbox subdocument of the header. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getCcpHdrTxbx()
|
||||||
|
{
|
||||||
|
return field_11_ccpHdrTxbx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A signed integer that specifies the count of CPs in the textbox subdocument of the header. This value MUST be zero, 1, or greater.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setCcpHdrTxbx( int field_11_ccpHdrTxbx )
|
||||||
|
{
|
||||||
|
this.field_11_ccpHdrTxbx = field_11_ccpHdrTxbx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved4()
|
||||||
|
{
|
||||||
|
return field_12_reserved4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved4( int field_12_reserved4 )
|
||||||
|
{
|
||||||
|
this.field_12_reserved4 = field_12_reserved4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved5()
|
||||||
|
{
|
||||||
|
return field_13_reserved5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved5( int field_13_reserved5 )
|
||||||
|
{
|
||||||
|
this.field_13_reserved5 = field_13_reserved5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be equal or less than the number of data elements in PlcBteChpx, as specified by FibRgFcLcb97.fcPlcfBteChpx and FibRgFcLcb97.lcbPlcfBteChpx. This value MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved6()
|
||||||
|
{
|
||||||
|
return field_14_reserved6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be equal or less than the number of data elements in PlcBteChpx, as specified by FibRgFcLcb97.fcPlcfBteChpx and FibRgFcLcb97.lcbPlcfBteChpx. This value MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved6( int field_14_reserved6 )
|
||||||
|
{
|
||||||
|
this.field_14_reserved6 = field_14_reserved6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved7()
|
||||||
|
{
|
||||||
|
return field_15_reserved7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved7( int field_15_reserved7 )
|
||||||
|
{
|
||||||
|
this.field_15_reserved7 = field_15_reserved7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved8()
|
||||||
|
{
|
||||||
|
return field_16_reserved8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved8( int field_16_reserved8 )
|
||||||
|
{
|
||||||
|
this.field_16_reserved8 = field_16_reserved8;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be less than or equal to the number of data elements in PlcBtePapx, as specified by FibRgFcLcb97.fcPlcfBtePapx and FibRgFcLcb97.lcbPlcfBtePapx. This value MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved9()
|
||||||
|
{
|
||||||
|
return field_17_reserved9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be less than or equal to the number of data elements in PlcBtePapx, as specified by FibRgFcLcb97.fcPlcfBtePapx and FibRgFcLcb97.lcbPlcfBtePapx. This value MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved9( int field_17_reserved9 )
|
||||||
|
{
|
||||||
|
this.field_17_reserved9 = field_17_reserved9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved10()
|
||||||
|
{
|
||||||
|
return field_18_reserved10;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved10( int field_18_reserved10 )
|
||||||
|
{
|
||||||
|
this.field_18_reserved10 = field_18_reserved10;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved11()
|
||||||
|
{
|
||||||
|
return field_19_reserved11;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is undefined and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved11( int field_19_reserved11 )
|
||||||
|
{
|
||||||
|
this.field_19_reserved11 = field_19_reserved11;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value SHOULD be zero, and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved12()
|
||||||
|
{
|
||||||
|
return field_20_reserved12;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value SHOULD be zero, and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved12( int field_20_reserved12 )
|
||||||
|
{
|
||||||
|
this.field_20_reserved12 = field_20_reserved12;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be zero and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved13()
|
||||||
|
{
|
||||||
|
return field_21_reserved13;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be zero and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved13( int field_21_reserved13 )
|
||||||
|
{
|
||||||
|
this.field_21_reserved13 = field_21_reserved13;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be zero and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public int getReserved14()
|
||||||
|
{
|
||||||
|
return field_22_reserved14;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value MUST be zero and MUST be ignored.
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public void setReserved14( int field_22_reserved14 )
|
||||||
|
{
|
||||||
|
this.field_22_reserved14 = field_22_reserved14;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // END OF CLASS
|
@ -98,53 +98,6 @@ public final class TestHWPFRangeParts extends TestCase {
|
|||||||
docAscii = HWPFTestDataSamples.openSampleFile("ThreeColHeadFoot.doc");
|
docAscii = HWPFTestDataSamples.openSampleFile("ThreeColHeadFoot.doc");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Note - this test runs several times, to ensure that things
|
|
||||||
* don't get broken as we write out and read back in again
|
|
||||||
* TODO - Make this work with 3+ runs
|
|
||||||
*/
|
|
||||||
public void testBasics() {
|
|
||||||
HWPFDocument doc = docAscii;
|
|
||||||
for(int run=0; run<3; run++) {
|
|
||||||
// First check the start and end bits
|
|
||||||
assertEquals(
|
|
||||||
0,
|
|
||||||
doc._cpSplit.getMainDocumentStart()
|
|
||||||
);
|
|
||||||
assertEquals(
|
|
||||||
a_page_1.length() +
|
|
||||||
2 + // page break
|
|
||||||
a_page_2.length(),
|
|
||||||
doc._cpSplit.getMainDocumentEnd()
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
238,
|
|
||||||
doc._cpSplit.getFootnoteStart()
|
|
||||||
);
|
|
||||||
assertEquals(
|
|
||||||
238,
|
|
||||||
doc._cpSplit.getFootnoteEnd()
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
238,
|
|
||||||
doc._cpSplit.getHeaderStoryStart()
|
|
||||||
);
|
|
||||||
assertEquals(
|
|
||||||
238 + headerDef.length() + a_header.length() +
|
|
||||||
footerDef.length() + a_footer.length() + endHeaderFooter.length(),
|
|
||||||
doc._cpSplit.getHeaderStoryEnd()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Write out and read back in again, ready for
|
|
||||||
// the next run of the test
|
|
||||||
// TODO run more than once
|
|
||||||
if(run < 1)
|
|
||||||
doc = HWPFTestDataSamples.writeOutAndReadBack(doc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note - this test runs several times, to ensure that things
|
* Note - this test runs several times, to ensure that things
|
||||||
* don't get broken as we write out and read back in again
|
* don't get broken as we write out and read back in again
|
||||||
@ -196,53 +149,6 @@ public final class TestHWPFRangeParts extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Note - this test runs several times, to ensure that things
|
|
||||||
* don't get broken as we write out and read back in again
|
|
||||||
*/
|
|
||||||
public void testBasicsUnicode() {
|
|
||||||
HWPFDocument doc = docUnicode;
|
|
||||||
for(int run=0; run<3; run++) {
|
|
||||||
// First check the start and end bits
|
|
||||||
assertEquals(
|
|
||||||
0,
|
|
||||||
doc._cpSplit.getMainDocumentStart()
|
|
||||||
);
|
|
||||||
assertEquals(
|
|
||||||
u_page_1.length() +
|
|
||||||
2 + // page break
|
|
||||||
u_page_2.length(),
|
|
||||||
doc._cpSplit.getMainDocumentEnd()
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
408,
|
|
||||||
doc._cpSplit.getFootnoteStart()
|
|
||||||
);
|
|
||||||
assertEquals(
|
|
||||||
408,
|
|
||||||
doc._cpSplit.getFootnoteEnd()
|
|
||||||
);
|
|
||||||
|
|
||||||
assertEquals(
|
|
||||||
408,
|
|
||||||
doc._cpSplit.getHeaderStoryStart()
|
|
||||||
);
|
|
||||||
// TODO - fix this one
|
|
||||||
assertEquals(
|
|
||||||
408 + headerDef.length() + u_header.length() +
|
|
||||||
footerDef.length() + u_footer.length() + endHeaderFooter.length(),
|
|
||||||
doc._cpSplit.getHeaderStoryEnd()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Write out and read back in again, ready for
|
|
||||||
// the next run of the test
|
|
||||||
// TODO run more than once
|
|
||||||
if(run < 1)
|
|
||||||
doc = HWPFTestDataSamples.writeOutAndReadBack(doc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testContentsUnicode() {
|
public void testContentsUnicode() {
|
||||||
Range r;
|
Range r;
|
||||||
|
|
||||||
|
@ -38,15 +38,13 @@ public final class TestSectionTable
|
|||||||
byte[] tableStream = _hWPFDocFixture._tableStream;
|
byte[] tableStream = _hWPFDocFixture._tableStream;
|
||||||
int fcMin = fib.getFibBase().getFcMin();
|
int fcMin = fib.getFibBase().getFcMin();
|
||||||
|
|
||||||
CPSplitCalculator cps = new CPSplitCalculator(fib);
|
|
||||||
|
|
||||||
ComplexFileTable cft = new ComplexFileTable(mainStream, tableStream, fib.getFcClx(), fcMin);
|
ComplexFileTable cft = new ComplexFileTable(mainStream, tableStream, fib.getFcClx(), fcMin);
|
||||||
TextPieceTable tpt = cft.getTextPieceTable();
|
TextPieceTable tpt = cft.getTextPieceTable();
|
||||||
|
|
||||||
SectionTable sectionTable = new SectionTable(mainStream, tableStream,
|
SectionTable sectionTable = new SectionTable(mainStream, tableStream,
|
||||||
fib.getFcPlcfsed(),
|
fib.getFcPlcfsed(),
|
||||||
fib.getLcbPlcfsed(),
|
fib.getLcbPlcfsed(),
|
||||||
fcMin, tpt, cps);
|
fcMin, tpt, fib.getSubdocumentTextStreamLength( SubdocumentType.MAIN ));
|
||||||
HWPFFileSystem fileSys = new HWPFFileSystem();
|
HWPFFileSystem fileSys = new HWPFFileSystem();
|
||||||
|
|
||||||
sectionTable.writeTo(fileSys, 0);
|
sectionTable.writeTo(fileSys, 0);
|
||||||
@ -58,7 +56,7 @@ public final class TestSectionTable
|
|||||||
|
|
||||||
SectionTable newSectionTable = new SectionTable(
|
SectionTable newSectionTable = new SectionTable(
|
||||||
newMainStream, newTableStream, 0,
|
newMainStream, newTableStream, 0,
|
||||||
newTableStream.length, 0, tpt, cps);
|
newTableStream.length, 0, tpt, fib.getSubdocumentTextStreamLength( SubdocumentType.MAIN ));
|
||||||
|
|
||||||
ArrayList oldSections = sectionTable.getSections();
|
ArrayList oldSections = sectionTable.getSections();
|
||||||
ArrayList newSections = newSectionTable.getSections();
|
ArrayList newSections = newSectionTable.getSections();
|
||||||
|
@ -190,7 +190,6 @@ public final class TestRangeProperties extends TestCase {
|
|||||||
|
|
||||||
// Check that the last paragraph ends where it should do
|
// Check that the last paragraph ends where it should do
|
||||||
assertEquals(531, u.getOverallRange().text().length());
|
assertEquals(531, u.getOverallRange().text().length());
|
||||||
assertEquals(530, u.getCPSplitCalculator().getHeaderTextboxEnd());
|
|
||||||
PAPX pLast = pDefs.get(34);
|
PAPX pLast = pDefs.get(34);
|
||||||
// assertEquals(530, pLast.getEnd());
|
// assertEquals(530, pLast.getEnd());
|
||||||
|
|
||||||
|
82
src/types/definitions/FibRgLw97_type.xml
Normal file
82
src/types/definitions/FibRgLw97_type.xml
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?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="FibRgLw97" package="org.apache.poi.hwpf.model.types">
|
||||||
|
<suffix>AbstractType</suffix>
|
||||||
|
<description>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
|
||||||
|
</description>
|
||||||
|
<author>Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
|
||||||
|
Specification [*.doc] and [MS-DOC] - v20110608 Word (.doc) Binary File Format
|
||||||
|
</author>
|
||||||
|
<fields>
|
||||||
|
<field type="int" size="4" name="cbMac"
|
||||||
|
description="Specifies the count of bytes of those written to the WordDocument stream of the file that have any meaning. All bytes in the WordDocument stream at offset cbMac and greater MUST be ignored."/>
|
||||||
|
|
||||||
|
<field type="int" size="4" name="reserved1" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved2" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
|
||||||
|
<field type="int" size="4" name="ccpText"
|
||||||
|
description="A signed integer that specifies the count of CPs in the main document. This value MUST be zero, 1, or greater"/>
|
||||||
|
<field type="int" size="4" name="ccpFtn"
|
||||||
|
description="A signed integer that specifies the count of CPs in the footnote subdocument. This value MUST be zero, 1, or greater"/>
|
||||||
|
<field type="int" size="4" name="ccpHdd"
|
||||||
|
description="A signed integer that specifies the count of CPs in the header subdocument. This value MUST be zero, 1, or greater"/>
|
||||||
|
|
||||||
|
<field type="int" size="4" name="reserved3" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
|
||||||
|
<field type="int" size="4" name="ccpAtn"
|
||||||
|
description="A signed integer that specifies the count of CPs in the comment subdocument. This value MUST be zero, 1, or greater"/>
|
||||||
|
<field type="int" size="4" name="ccpEdn"
|
||||||
|
description="A signed integer that specifies the count of CPs in the endnote subdocument. This value MUST be zero, 1, or greater"/>
|
||||||
|
<field type="int" size="4" name="ccpTxbx"
|
||||||
|
description="A signed integer that specifies the count of CPs in the textbox subdocument of the main document. This value MUST be zero, 1, or greater"/>
|
||||||
|
<field type="int" size="4" name="ccpHdrTxbx"
|
||||||
|
description="A signed integer that specifies the count of CPs in the textbox subdocument of the header. This value MUST be zero, 1, or greater"/>
|
||||||
|
|
||||||
|
<field type="int" size="4" name="reserved4" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved5" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
|
||||||
|
<field type="int" size="4" name="reserved6" deprecated="true"
|
||||||
|
description="This value MUST be equal or less than the number of data elements in PlcBteChpx, as specified by FibRgFcLcb97.fcPlcfBteChpx and FibRgFcLcb97.lcbPlcfBteChpx. This value MUST be ignored"/>
|
||||||
|
|
||||||
|
<field type="int" size="4" name="reserved7" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved8" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved9" deprecated="true"
|
||||||
|
description="This value MUST be less than or equal to the number of data elements in PlcBtePapx, as specified by FibRgFcLcb97.fcPlcfBtePapx and FibRgFcLcb97.lcbPlcfBtePapx. This value MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved10" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved11" deprecated="true"
|
||||||
|
description="This value is undefined and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved12" deprecated="true"
|
||||||
|
description="This value SHOULD be zero, and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved13" deprecated="true"
|
||||||
|
description="This value MUST be zero and MUST be ignored"/>
|
||||||
|
<field type="int" size="4" name="reserved14" deprecated="true"
|
||||||
|
description="This value MUST be zero and MUST be ignored"/>
|
||||||
|
</fields>
|
||||||
|
</record>
|
Loading…
Reference in New Issue
Block a user