PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew C. Oliver 2003-04-11 02:36:17 +00:00
parent 81230699e2
commit 98f829f916
5 changed files with 393 additions and 395 deletions

View File

@ -632,12 +632,13 @@ public class HDFObjectFactory
System.arraycopy(_tableBuffer, lfoOffset, plflfo, 0, lfoSize);
int lstOffset = _fib.getFcPlcfLst();
int lstSize = lstOffset;
//not sure if this is a mistake or what. I vaguely remember a trick like
//this
//int lstSize = LittleEndian.getInt(_header, 0x2e2);
int lstSize = _fib.getLcbPlcfLst();
if (lstOffset > 0 && lstSize > 0)
{
// The lstSize returned by _fib.getLcbPlcfLst() doesn't appear
// to take into account any LVLs. Therefore, we recalculate
// lstSize based on where the LFO section begins (because the
// LFO section immediately follows the LST section).
lstSize = lfoOffset - lstOffset;
byte[] plcflst = new byte[lstSize];
System.arraycopy(_tableBuffer, lstOffset, plcflst, 0, lstSize);

View File

@ -74,6 +74,8 @@ public class LVL
boolean _fWord6;
public byte[] _rgbxchNums = new byte[9];
public byte _ixchFollow;
public int _dxaSpace;
public int _dxaIndent;
public byte[] _chpx;
public byte[] _papx;
public char[] _xst;

View File

@ -166,6 +166,13 @@ public class ListTables implements HDFType
int lvlOffset = 0;
int lfolvlNum = 0;
for(int x = 0; x < lfoSize; x++)
{
if (_pllfo[x]._clfolvl == 0)
// If LFO._clfolvl is 0, then it appears that Word writes
// out a LFOLVL anyway - however, it's all 0xff. We need
// to skip over it.
lfolvlNum++;
else
{
for(int y = 0; y < _pllfo[x]._clfolvl; y++)
{
@ -180,7 +187,8 @@ public class ListTables implements HDFType
if(lfolvl._fFormatting)
{
offset = lfolvlOffset + (lfolvlNum * 12) + lvlOffset;
// The size of a LFOLVL is 8 bytes.
offset = lfolvlOffset + (lfolvlNum * 8) + lvlOffset;
lfolvl._override = new LVL();
lvlOffset += createLVL(plflfo, offset, lfolvl._override);
}
@ -188,35 +196,52 @@ public class ListTables implements HDFType
}
}
}
}
private int createLVL(byte[] data, int offset, LVL lvl)
{
int startingOffset = offset;
lvl._iStartAt = Utils.convertBytesToInt(data, offset);
lvl._nfc = data[offset + 4];
int code = Utils.convertBytesToInt(data, offset + 5);
offset += 4;
lvl._nfc = data[offset++];
byte code = data[offset++];
lvl._jc = (byte)(code & 0x03);
lvl._fLegal = StyleSheet.getFlag(code & 0x04);
lvl._fNoRestart = StyleSheet.getFlag(code & 0x08);
lvl._fPrev = StyleSheet.getFlag(code & 0x10);
lvl._fPrevSpace = StyleSheet.getFlag(code & 0x20);
lvl._fWord6 = StyleSheet.getFlag(code & 0x40);
System.arraycopy(data, offset + 6, lvl._rgbxchNums, 0, 9);
lvl._ixchFollow = data[offset + 15];
int chpxSize = data[offset + 24];
int papxSize = data[offset + 25];
// rgbxchNums - This array should be zero terminated unless it is full
// (all 9 levels full).
System.arraycopy(data, offset, lvl._rgbxchNums, 0, 9);
offset += 9;
lvl._ixchFollow = data[offset++];
if (lvl._fWord6)
{
lvl._dxaSpace = Utils.convertBytesToInt(data, offset);
lvl._dxaIndent = Utils.convertBytesToInt(data, offset + 4);
}
offset += 8;
int chpxSize = data[offset++];
int papxSize = data[offset++];
lvl._chpx = new byte[chpxSize];
lvl._papx = new byte[papxSize];
System.arraycopy(data, offset + 28, lvl._papx, 0, papxSize);
System.arraycopy(data, offset + 28 + papxSize, lvl._chpx, 0, chpxSize);
offset += 28 + papxSize + chpxSize;//modify offset
System.arraycopy(data, offset, lvl._chpx, 0, chpxSize);
System.arraycopy(data, offset + chpxSize, lvl._papx, 0, papxSize);
offset += papxSize + chpxSize + 2; //don't forget to skip reserved word
int xstSize = Utils.convertBytesToShort(data, offset);
offset += 2;
lvl._xst = new char[xstSize];
offset += 2;
for(int x = 0; x < xstSize; x++)
{
lvl._xst[x] = (char)Utils.convertBytesToShort(data, offset + (x * 2));
}
return 28 + papxSize + chpxSize + 2 + (xstSize * 2);
return offset + (xstSize * 2) - startingOffset;
}
}

View File

@ -247,7 +247,13 @@
<field type="int" size="4" name="lcbSttbAutoCaption"/>
<field type="int" size="4" name="fcPlcfwkb"/>
<field type="int" size="4" name="lcbPlcfwkb"/>
<!--
possible typo - was
<field type="int" size="4" name="fcPlcfsplfcPlcfspl"/>
documented as fcPlcfspl in MS Word Binary Format doc
-->
<field type="int" size="4" name="fcPlcfspl"/>
<field type="int" size="4" name="lcbPlcfspl"/>
<field type="int" size="4" name="fcPlcftxbxTxt"/>
@ -265,7 +271,12 @@
<field type="int" size="4" name="cbSttbttmbd"/>
<field type="int" size="4" name="fcUnused"/>
<field type="int" size="4" name="lcbUnused"/>
<!--
Bug - this field is meant to be an array that "overlays"
the following fields. See MS Word Binary Format doc
for details.
<field type="int" size="4" name="rgpgdbkd"/>
-->
<field type="int" size="4" name="fcPgdMother"/>
<field type="int" size="4" name="lcbPgdMother"/>
<field type="int" size="4" name="fcBkdMother"/>
@ -318,7 +329,12 @@
<field type="int" size="4" name="lcbPlcocx"/>
<field type="int" size="4" name="fcPlcfbteLvc"/>
<field type="int" size="4" name="lcbPlcfbteLvc"/>
<!--
Bug - this field is meant to "overlay" the following
two fields. See MS Word Binary Format doc
for details.
<field type="int" size="4" name="ftModified"/>
-->
<field type="int" size="4" name="dwLowDateTime"/>
<field type="int" size="4" name="dwHighDateTime"/>
<field type="int" size="4" name="fcPlcflvc"/>