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);
if(lstOffset > 0 && lstSize > 0)
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

@ -167,56 +167,81 @@ public class ListTables implements HDFType
int lfolvlNum = 0;
for(int x = 0; x < lfoSize; x++)
{
for(int y = 0; y < _pllfo[x]._clfolvl; y++)
{
int offset = lfolvlOffset + (lfolvlNum * 8) + lvlOffset;
LFOLVL lfolvl = new LFOLVL();
lfolvl._iStartAt = Utils.convertBytesToInt(plflfo, offset);
lfolvl._ilvl = Utils.convertBytesToInt(plflfo, offset + 4);
lfolvl._fStartAt = StyleSheet.getFlag(lfolvl._ilvl & 0x10);
lfolvl._fFormatting = StyleSheet.getFlag(lfolvl._ilvl & 0x20);
lfolvl._ilvl = (lfolvl._ilvl & (byte)0x0f);
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++;
if(lfolvl._fFormatting)
{
offset = lfolvlOffset + (lfolvlNum * 12) + lvlOffset;
lfolvl._override = new LVL();
lvlOffset += createLVL(plflfo, offset, lfolvl._override);
}
_pllfo[x]._levels[y] = lfolvl;
else
{
for(int y = 0; y < _pllfo[x]._clfolvl; y++)
{
int offset = lfolvlOffset + (lfolvlNum * 8) + lvlOffset;
LFOLVL lfolvl = new LFOLVL();
lfolvl._iStartAt = Utils.convertBytesToInt(plflfo, offset);
lfolvl._ilvl = Utils.convertBytesToInt(plflfo, offset + 4);
lfolvl._fStartAt = StyleSheet.getFlag(lfolvl._ilvl & 0x10);
lfolvl._fFormatting = StyleSheet.getFlag(lfolvl._ilvl & 0x20);
lfolvl._ilvl = (lfolvl._ilvl & (byte)0x0f);
lfolvlNum++;
if(lfolvl._fFormatting)
{
// The size of a LFOLVL is 8 bytes.
offset = lfolvlOffset + (lfolvlNum * 8) + lvlOffset;
lfolvl._override = new LVL();
lvlOffset += createLVL(plflfo, offset, lfolvl._override);
}
_pllfo[x]._levels[y] = lfolvl;
}
}
}
}
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"/>
<field type="int" size="4" name="fcPlcfsplfcPlcfspl"/>
<!--
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"/>
<field type="int" size="4" name="rgpgdbkd"/>
<!--
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"/>
<field type="int" size="4" name="ftModified"/>
<!--
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"/>