From 0de832ba9dc9536af70180b1c24c8a20ddb5b76a Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Thu, 7 Jul 2011 08:35:51 +0000 Subject: [PATCH] add getOverallRange() method definition to HWPFDocumentCore git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1143709 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hwpf/HWPFDocument.java | 5 ----- .../org/apache/poi/hwpf/HWPFDocumentCore.java | 18 ++++++++++++------ .../org/apache/poi/hwpf/HWPFOldDocument.java | 14 +++++++++----- .../org/apache/poi/hwpf/usermodel/Range.java | 3 +-- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java index 7890e9241..db9dcde34 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java @@ -284,11 +284,6 @@ public final class HWPFDocument extends HWPFDocumentCore return _dop; } - /** - * Returns the range that covers all text in the - * file, including main text, footnotes, headers - * and comments - */ public Range getOverallRange() { // hack to get the ending cp of the document, Have to revisit this. PropertyNode p = _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1); diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java index e37aee1f2..e3bd68d8e 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocumentCore.java @@ -149,12 +149,18 @@ public abstract class HWPFDocumentCore extends POIDocument } } - /** - * Returns the range which covers the whole of the - * document, but excludes any headers and footers. - */ - public abstract Range getRange(); - + /** + * Returns the range which covers the whole of the document, but excludes + * any headers and footers. + */ + public abstract Range getRange(); + + /** + * Returns the range that covers all text in the file, including main text, + * footnotes, headers and comments + */ + public abstract Range getOverallRange(); + public abstract TextPieceTable getTextTable(); public CHPBinTable getCharacterTable() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java index 093134d2b..3bc32a13f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java @@ -109,12 +109,16 @@ public class HWPFOldDocument extends HWPFDocumentCore { _fib.getFcMin(), tpt ); } - - public Range getRange() { + + public Range getOverallRange() + { // Life is easy when we have no footers, headers or unicode! - return new Range( - 0, _fib.getFcMac() - _fib.getFcMin(), this - ); + return new Range( 0, _fib.getFcMac() - _fib.getFcMin(), this ); + } + + public Range getRange() + { + return getOverallRange(); } public TextPieceTable getTextTable() diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java index a764524d0..3ccb5b937 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java @@ -901,8 +901,7 @@ public class Range { // TODO -instantiable superclass } } - final Range overallrange = getDocument() instanceof HWPFDocument ? ((HWPFDocument) getDocument()) - .getOverallRange() : getDocument().getRange(); + final Range overallrange = getDocument().getOverallRange(); int limit = _paragraphs.size(); for ( ; tableEndInclusive < limit - 1; tableEndInclusive++ ) {