latest updates

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353175 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Said Ryan Ackley 2003-06-28 15:56:46 +00:00
parent c9e41cd25a
commit 164d79f83a
3 changed files with 36 additions and 9 deletions

View File

@ -145,7 +145,7 @@ public class CHPFormattedDiskPage extends FormattedDiskPage
{ {
byte[] buf = new byte[512]; byte[] buf = new byte[512];
int size = _chpxList.size(); int size = _chpxList.size();
int grpprlOffset = 0; int grpprlOffset = 511;
int offsetOffset = 0; int offsetOffset = 0;
int fcOffset = 0; int fcOffset = 0;
@ -185,7 +185,7 @@ public class CHPFormattedDiskPage extends FormattedDiskPage
buf[511] = (byte)index; buf[511] = (byte)index;
offsetOffset = (FC_SIZE * index) + FC_SIZE; offsetOffset = (FC_SIZE * index) + FC_SIZE;
grpprlOffset = offsetOffset + index + (grpprlOffset % 2); //grpprlOffset = offsetOffset + index + (grpprlOffset % 2);
CHPX chpx = null; CHPX chpx = null;
for (int x = 0; x < index; x++) for (int x = 0; x < index; x++)
@ -194,10 +194,13 @@ public class CHPFormattedDiskPage extends FormattedDiskPage
byte[] grpprl = chpx.getGrpprl(); byte[] grpprl = chpx.getGrpprl();
LittleEndian.putInt(buf, fcOffset, chpx.getStart() + fcMin); LittleEndian.putInt(buf, fcOffset, chpx.getStart() + fcMin);
grpprlOffset -= (1 + grpprl.length);
grpprlOffset -= (grpprlOffset % 2);
buf[offsetOffset] = (byte)(grpprlOffset/2); buf[offsetOffset] = (byte)(grpprlOffset/2);
System.arraycopy(grpprl, 0, buf, grpprlOffset, grpprl.length); buf[grpprlOffset] = (byte)grpprl.length;
System.arraycopy(grpprl, 0, buf, grpprlOffset + 1, grpprl.length);
grpprlOffset += grpprl.length + (grpprl.length % 2);
offsetOffset += 1; offsetOffset += 1;
fcOffset += FC_SIZE; fcOffset += FC_SIZE;
} }

View File

@ -194,7 +194,7 @@ public class PAPFormattedDiskPage extends FormattedDiskPage
buf[511] = (byte)index; buf[511] = (byte)index;
bxOffset = (FC_SIZE * index) + FC_SIZE; bxOffset = (FC_SIZE * index) + FC_SIZE;
grpprlOffset = bxOffset + (BX_SIZE * index) + (grpprlOffset % 2); grpprlOffset = 511;
PAPX papx = null; PAPX papx = null;
for (int x = 0; x < index; x++) for (int x = 0; x < index; x++)
@ -203,6 +203,7 @@ public class PAPFormattedDiskPage extends FormattedDiskPage
byte[] phe = papx.getParagraphHeight().toByteArray(); byte[] phe = papx.getParagraphHeight().toByteArray();
byte[] grpprl = papx.getGrpprl(); byte[] grpprl = papx.getGrpprl();
grpprlOffset -= (grpprl.length + (2 - grpprl.length % 2));
LittleEndian.putInt(buf, fcOffset, papx.getStart() + fcMin); LittleEndian.putInt(buf, fcOffset, papx.getStart() + fcMin);
buf[bxOffset] = (byte)(grpprlOffset/2); buf[bxOffset] = (byte)(grpprlOffset/2);
System.arraycopy(phe, 0, buf, bxOffset + 1, phe.length); System.arraycopy(phe, 0, buf, bxOffset + 1, phe.length);
@ -210,16 +211,17 @@ public class PAPFormattedDiskPage extends FormattedDiskPage
// refer to the section on PAPX in the spec. Places a size on the front // refer to the section on PAPX in the spec. Places a size on the front
// of the PAPX. Has to do with how the grpprl stays on word // of the PAPX. Has to do with how the grpprl stays on word
// boundaries. // boundaries.
int copyOffset = grpprlOffset;
if ((grpprl.length % 2) > 0) if ((grpprl.length % 2) > 0)
{ {
buf[grpprlOffset++] = (byte)((grpprl.length + 1)/2); buf[copyOffset++] = (byte)((grpprl.length + 1)/2);
} }
else else
{ {
buf[++grpprlOffset] = (byte)((grpprl.length)/2); buf[++copyOffset] = (byte)((grpprl.length)/2);
grpprlOffset++; copyOffset++;
} }
System.arraycopy(grpprl, 0, buf, grpprlOffset, grpprl.length); System.arraycopy(grpprl, 0, buf, copyOffset, grpprl.length);
bxOffset += BX_SIZE; bxOffset += BX_SIZE;
fcOffset += FC_SIZE; fcOffset += FC_SIZE;

View File

@ -99,6 +99,28 @@ public class PropertyNode implements Comparable
{ {
return _buf; return _buf;
} }
public boolean equals(Object o)
{
if (((PropertyNode)o).getStart() == _cpStart &&
((PropertyNode)o).getEnd() == _cpEnd)
{
byte[] testBuf = ((PropertyNode)o).getBuf();
if (testBuf.length == _buf.length)
{
for (int x = 0; x < _buf.length; x++)
{
if (testBuf[x] != _buf[x])
{
return false;
}
}
return true;
}
}
return false;
}
/** /**
* Used for sorting in collections. * Used for sorting in collections.
*/ */