Return-Path: Delivered-To: apmail-jakarta-poi-dev-archive@www.apache.org Received: (qmail 20335 invoked from network); 12 Mar 2004 12:34:34 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 12 Mar 2004 12:34:34 -0000 Received: (qmail 90981 invoked by uid 500); 12 Mar 2004 12:34:32 -0000 Delivered-To: apmail-jakarta-poi-dev-archive@jakarta.apache.org Received: (qmail 90797 invoked by uid 500); 12 Mar 2004 12:34:31 -0000 Mailing-List: contact poi-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "POI Developers List" Reply-To: "POI Developers List" Delivered-To: mailing list poi-dev@jakarta.apache.org Received: (qmail 90780 invoked by uid 500); 12 Mar 2004 12:34:31 -0000 Received: (qmail 90776 invoked from network); 12 Mar 2004 12:34:31 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 12 Mar 2004 12:34:31 -0000 Received: (qmail 20307 invoked by uid 1477); 12 Mar 2004 12:34:32 -0000 Date: 12 Mar 2004 12:34:32 -0000 Message-ID: <20040312123432.20306.qmail@minotaur.apache.org> From: sackley@apache.org To: jakarta-poi-cvs@apache.org Subject: cvs commit: jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model PAPBinTable.java PAPFormattedDiskPage.java PAPX.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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