From: Said Ryan Ackley Date: Tue, 1 Jul 2003 23:57:07 +0000 (+0000) Subject: latest update X-Git-Tag: PERF_BEFORE_MERGE~285 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f04fa7e22e461680bc178740b5eea1b37fd6ce31;p=poi.git latest update git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353185 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java index 1e199a9b6e..0b74c23ceb 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java @@ -94,6 +94,11 @@ public class CHPBinTable } } + public ArrayList getTextRuns() + { + return _textRuns; + } + public void writeTo(HWPFFileSystem sys, int fcMin) throws IOException { @@ -122,7 +127,6 @@ public class CHPBinTable ArrayList overflow = _textRuns; - byte[] intHolder = new byte[4]; do { PropertyNode startingProp = (PropertyNode)overflow.get(0); @@ -138,9 +142,10 @@ public class CHPBinTable int end = endingFc; if (overflow != null) { - end = ((PropertyNode)overflow.get(0)).getEnd(); + end = ((PropertyNode)overflow.get(0)).getStart(); } + byte[] intHolder = new byte[4]; LittleEndian.putInt(intHolder, pageNum++); binTable.addProperty(new PropertyNode(start, end, intHolder)); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPFormattedDiskPage.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPFormattedDiskPage.java index b453c7cffd..a906c46515 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPFormattedDiskPage.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPFormattedDiskPage.java @@ -178,7 +178,7 @@ public class CHPFormattedDiskPage extends FormattedDiskPage if (index != size) { _overFlow = new ArrayList(); - _overFlow.addAll(index, _chpxList); + _overFlow.addAll(_chpxList.subList(index, size)); } // index should equal number of CHPXs that will be in this fkp now. diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPBinTable.java index 92f954cbf9..18cb0d12ef 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPBinTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPBinTable.java @@ -126,7 +126,6 @@ public class PAPBinTable ArrayList overflow = _paragraphs; - byte[] intHolder = new byte[4]; do { PropertyNode startingProp = (PropertyNode)overflow.get(0); @@ -142,9 +141,10 @@ public class PAPBinTable int end = endingFc; if (overflow != null) { - end = ((PropertyNode)overflow.get(0)).getEnd(); + end = ((PropertyNode)overflow.get(0)).getStart(); } + byte[] intHolder = new byte[4]; LittleEndian.putInt(intHolder, pageNum++); binTable.addProperty(new PropertyNode(start, end, intHolder)); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPFormattedDiskPage.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPFormattedDiskPage.java index 2890bc0850..4887c7dabd 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPFormattedDiskPage.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPFormattedDiskPage.java @@ -187,7 +187,7 @@ public class PAPFormattedDiskPage extends FormattedDiskPage if (index != size) { _overFlow = new ArrayList(); - _overFlow.addAll(index, _papxList); + _overFlow.addAll(_papxList.subList(index, size)); } // index should equal number of papxs that will be in this fkp now. @@ -234,7 +234,7 @@ public class PAPFormattedDiskPage extends FormattedDiskPage private ParagraphHeight getParagraphHeight(int index) { - int pheOffset = 1 + (((_crun + 1) * 4) + (index * 13)); + int pheOffset = _offset + 1 + (((_crun + 1) * 4) + (index * 13)); ParagraphHeight phe = new ParagraphHeight(_fkp, pheOffset); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java index 95ddb53a7e..15b1326b6c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java @@ -82,5 +82,13 @@ public class PAPX extends PropertyNode return super.getBuf(); } + public boolean equals(Object o) + { + if (super.equals(o)) + { + return _phe.equals(((PAPX)o)._phe); + } + return false; + } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/ParagraphHeight.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/ParagraphHeight.java index 2177007f5a..11287d9425 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/ParagraphHeight.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/ParagraphHeight.java @@ -105,4 +105,11 @@ public class ParagraphHeight return buf; } + public boolean equals(Object o) + { + ParagraphHeight ph = (ParagraphHeight)o; + + return infoField == ph.infoField && reserved == ph.reserved && + dxaCol == ph.dxaCol && dymLineOrHeight == ph.dymLineOrHeight; + } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PieceDescriptor.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PieceDescriptor.java index 5826923249..3dfd2f99de 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PieceDescriptor.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PieceDescriptor.java @@ -135,4 +135,10 @@ public class PieceDescriptor return 8; } + public boolean equals(Object o) + { + PieceDescriptor pd = (PieceDescriptor)o; + + return descriptor == pd.descriptor && prm == pd.prm && unicode == pd.unicode; + } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPiece.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPiece.java index 91308c2b10..dbcb2192b0 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPiece.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPiece.java @@ -92,4 +92,14 @@ public class TextPiece extends PropertyNode implements Comparable { return _pd; } + + public boolean equals(Object o) + { + if (super.equals(o)) + { + TextPiece tp = (TextPiece)o; + return tp._usesUnicode == _usesUnicode && _pd.equals(tp._pd); + } + return false; + } } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java index 257df115f6..ddac077952 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java @@ -147,5 +147,23 @@ public class TextPieceTable } + public boolean equals(Object o) + { + TextPieceTable tpt = (TextPieceTable)o; + + int size = tpt._textPieces.size(); + if (size == _textPieces.size()) + { + for (int x = 0; x < size; x++) + { + if (!tpt._textPieces.get(x).equals(_textPieces.get(x))) + { + return false; + } + } + return true; + } + return false; + } }