You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by sa...@apache.org on 2004/03/12 13:34:32 UTC
cvs commit: jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model PAPBinTable.java PAPFormattedDiskPage.java PAPX.java
sackley 2004/03/12 04:34:32
Modified: src/scratchpad/src/org/apache/poi/hwpf/model
PAPBinTable.java PAPFormattedDiskPage.java
PAPX.java
Log:
javadocs and feature enhancements
Revision Changes Path
1.3 +5 -0 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java
Index: PAPBinTable.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PAPBinTable.java 10 Mar 2004 04:18:53 -0000 1.2
+++ PAPBinTable.java 12 Mar 2004 12:34:32 -0000 1.3
@@ -65,6 +65,11 @@
import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.util.LittleEndian;
+/**
+ * This class represents the bin table of Word document but it also serves as a
+ * holder for all of the paragraphs of document that have been loaded into
+ * memory.
+ */
public class PAPBinTable
{
ArrayList _paragraphs = new ArrayList();
1.3 +36 -2 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java
Index: PAPFormattedDiskPage.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/PAPFormattedDiskPage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PAPFormattedDiskPage.java 10 Mar 2004 04:18:53 -0000 1.2
+++ PAPFormattedDiskPage.java 12 Mar 2004 12:34:32 -0000 1.3
@@ -109,16 +109,38 @@
_dataStream = dataStream;
}
+ /**
+ * Fills the queue for writing.
+ *
+ * @param filler a List of PAPXs
+ */
public void fill(List filler)
{
_papxList.addAll(filler);
}
- public ArrayList getOverflow()
+ /**
+ * Used when writing out a Word docunment. This method is part of a sequence
+ * that is necessary because there is no easy and efficient way to
+ * determine the number PAPX's that will fit into one FKP. THe sequence is
+ * as follows:
+ *
+ * fill()
+ * toByteArray()
+ * getOverflow()
+ *
+ * @return The remaining PAPXs that didn't fit into this FKP.
+ */
+ ArrayList getOverflow()
{
return _overFlow;
}
+ /**
+ * Gets the PAPX at index.
+ * @param index The index to get the PAPX for.
+ * @return The PAPX at index.
+ */
public PAPX getPAPX(int index)
{
return (PAPX)_papxList.get(index);
@@ -148,6 +170,13 @@
return papx;
}
+ /**
+ * Creates a byte array representation of this data structure. Suitable for
+ * writing to a Word document.
+ *
+ * @param fcMin The file offset in the main stream where text begins.
+ * @return A byte array representing this data structure.
+ */
protected byte[] toByteArray(int fcMin)
{
byte[] buf = new byte[512];
@@ -250,7 +279,7 @@
// store grpprl at hugeGrpprlOffset
System.arraycopy(grpprl, 2, _dataStream, hugeGrpprlOffset + 2,
- grpprl.length - 2);
+ grpprl.length);
LittleEndian.putUShort(_dataStream, hugeGrpprlOffset, grpprl.length);
// grpprl = grpprl containing only a sprmPHugePapx2
@@ -299,6 +328,11 @@
return buf;
}
+ /**
+ * Used to get the ParagraphHeight of a PAPX at a particular index.
+ * @param index
+ * @return The ParagraphHeight
+ */
private ParagraphHeight getParagraphHeight(int index)
{
int pheOffset = _offset + 1 + (((_crun + 1) * 4) + (index * 13));
1.3 +2 -2 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java
Index: PAPX.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/PAPX.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PAPX.java 10 Mar 2004 04:18:53 -0000 1.2
+++ PAPX.java 12 Mar 2004 12:34:32 -0000 1.3
@@ -108,12 +108,12 @@
int grpprlSize = LittleEndian.getShort(datastream, hugeGrpprlOffset);
if( hugeGrpprlOffset+grpprlSize < datastream.length)
{
- byte[] hugeGrpprl = new byte[grpprlSize];
+ byte[] hugeGrpprl = new byte[grpprlSize + 2];
// copy original istd into huge Grpprl
hugeGrpprl[0] = grpprl[0]; hugeGrpprl[1] = grpprl[1];
// copy Grpprl from dataStream
System.arraycopy(datastream, hugeGrpprlOffset + 2, hugeGrpprl, 2,
- grpprlSize-2);
+ grpprlSize);
// save a pointer to where we got the huge Grpprl from
_hugeGrpprlOffset = hugeGrpprlOffset;
return new SprmBuffer(hugeGrpprl);
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org