From f72abf8ae8361c5cd8d9fcf6206e6e49e81c12c1 Mon Sep 17 00:00:00 2001 From: Said Ryan Ackley Date: Tue, 1 Jul 2003 23:57:07 +0000 Subject: [PATCH] latest update git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353185 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hwpf/model/hdftypes/CHPBinTable.java | 9 +++++++-- .../model/hdftypes/CHPFormattedDiskPage.java | 2 +- .../poi/hwpf/model/hdftypes/PAPBinTable.java | 4 ++-- .../model/hdftypes/PAPFormattedDiskPage.java | 4 ++-- .../apache/poi/hwpf/model/hdftypes/PAPX.java | 8 ++++++++ .../hwpf/model/hdftypes/ParagraphHeight.java | 7 +++++++ .../hwpf/model/hdftypes/PieceDescriptor.java | 6 ++++++ .../poi/hwpf/model/hdftypes/TextPiece.java | 10 ++++++++++ .../hwpf/model/hdftypes/TextPieceTable.java | 18 ++++++++++++++++++ 9 files changed, 61 insertions(+), 7 deletions(-) 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 1e199a9b6..0b74c23ce 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 b453c7cff..a906c4651 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 92f954cbf..18cb0d12e 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 2890bc085..4887c7dab 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 95ddb53a7..15b1326b6 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 2177007f5..11287d942 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 582692324..3dfd2f99d 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 91308c2b1..dbcb2192b 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 257df115f..ddac07795 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; + } }