add getOverallRange() method definition to HWPFDocumentCore

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1143709 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-07 08:35:51 +00:00
parent 25f3636438
commit 0de832ba9d
4 changed files with 22 additions and 18 deletions

View File

@ -284,11 +284,6 @@ public final class HWPFDocument extends HWPFDocumentCore
return _dop; return _dop;
} }
/**
* Returns the range that covers all text in the
* file, including main text, footnotes, headers
* and comments
*/
public Range getOverallRange() { public Range getOverallRange() {
// hack to get the ending cp of the document, Have to revisit this. // hack to get the ending cp of the document, Have to revisit this.
PropertyNode p = _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1); PropertyNode p = _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1);

View File

@ -149,12 +149,18 @@ public abstract class HWPFDocumentCore extends POIDocument
} }
} }
/** /**
* Returns the range which covers the whole of the * Returns the range which covers the whole of the document, but excludes
* document, but excludes any headers and footers. * any headers and footers.
*/ */
public abstract Range getRange(); 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 abstract TextPieceTable getTextTable();
public CHPBinTable getCharacterTable() public CHPBinTable getCharacterTable()

View File

@ -109,12 +109,16 @@ public class HWPFOldDocument extends HWPFDocumentCore {
_fib.getFcMin(), tpt _fib.getFcMin(), tpt
); );
} }
public Range getRange() { public Range getOverallRange()
{
// Life is easy when we have no footers, headers or unicode! // Life is easy when we have no footers, headers or unicode!
return new Range( return new Range( 0, _fib.getFcMac() - _fib.getFcMin(), this );
0, _fib.getFcMac() - _fib.getFcMin(), this }
);
public Range getRange()
{
return getOverallRange();
} }
public TextPieceTable getTextTable() public TextPieceTable getTextTable()

View File

@ -901,8 +901,7 @@ public class Range { // TODO -instantiable superclass
} }
} }
final Range overallrange = getDocument() instanceof HWPFDocument ? ((HWPFDocument) getDocument()) final Range overallrange = getDocument().getOverallRange();
.getOverallRange() : getDocument().getRange();
int limit = _paragraphs.size(); int limit = _paragraphs.size();
for ( ; tableEndInclusive < limit - 1; tableEndInclusive++ ) for ( ; tableEndInclusive < limit - 1; tableEndInclusive++ )
{ {