Move location where document is held and adjust constructors and class-hierarchy accordingly

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1679903 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2015-05-17 21:26:31 +00:00
parent cbd315d441
commit dafabdc7b9
5 changed files with 18 additions and 24 deletions

View File

@ -33,13 +33,25 @@ import org.apache.poi.poifs.filesystem.DirectoryEntry;
* @see org.apache.poi.hwpf.extractor.WordExtractor * @see org.apache.poi.hwpf.extractor.WordExtractor
*/ */
public abstract class POIOLE2TextExtractor extends POITextExtractor { public abstract class POIOLE2TextExtractor extends POITextExtractor {
/** The POIDocument that's open */
protected POIDocument document;
/** /**
* Creates a new text extractor for the given document * Creates a new text extractor for the given document
* *
* @param document The POIDocument to use in this extractor. * @param document The POIDocument to use in this extractor.
*/ */
public POIOLE2TextExtractor(POIDocument document) { public POIOLE2TextExtractor(POIDocument document) {
super(document); this.document = document;
}
/**
* Creates a new text extractor, using the same
* document as another text extractor. Normally
* only used by properties extractors.
*/
protected POIOLE2TextExtractor(POIOLE2TextExtractor otherExtractor) {
this.document = otherExtractor.document;
} }
/** /**

View File

@ -31,24 +31,6 @@ import java.io.IOException;
* @see org.apache.poi.hwpf.extractor.WordExtractor * @see org.apache.poi.hwpf.extractor.WordExtractor
*/ */
public abstract class POITextExtractor implements Closeable { public abstract class POITextExtractor implements Closeable {
/** The POIDocument that's open */
protected POIDocument document;
/**
* Creates a new text extractor for the given document
*/
public POITextExtractor(POIDocument document) {
this.document = document;
}
/**
* Creates a new text extractor, using the same
* document as another text extractor. Normally
* only used by properties extractors.
*/
protected POITextExtractor(POITextExtractor otherExtractor) {
this.document = otherExtractor.document;
}
/** /**
* Retrieves all the text from the document. * Retrieves all the text from the document.
* How cells, paragraphs etc are separated in the text * How cells, paragraphs etc are separated in the text

View File

@ -23,6 +23,7 @@ import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import org.apache.poi.POIDocument; import org.apache.poi.POIDocument;
import org.apache.poi.POIOLE2TextExtractor;
import org.apache.poi.POITextExtractor; import org.apache.poi.POITextExtractor;
import org.apache.poi.hpsf.CustomProperties; import org.apache.poi.hpsf.CustomProperties;
import org.apache.poi.hpsf.DocumentSummaryInformation; import org.apache.poi.hpsf.DocumentSummaryInformation;
@ -39,10 +40,10 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
* build in and custom, returning them in * build in and custom, returning them in
* textual form. * textual form.
*/ */
public class HPSFPropertiesExtractor extends POITextExtractor { public class HPSFPropertiesExtractor extends POIOLE2TextExtractor {
private Closeable toClose; private Closeable toClose;
public HPSFPropertiesExtractor(POITextExtractor mainExtractor) { public HPSFPropertiesExtractor(POIOLE2TextExtractor mainExtractor) {
super(mainExtractor); super(mainExtractor);
} }
public HPSFPropertiesExtractor(POIDocument doc) { public HPSFPropertiesExtractor(POIDocument doc) {

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.poi.POIDocument;
import org.apache.poi.POIOLE2TextExtractor; import org.apache.poi.POIOLE2TextExtractor;
import org.apache.poi.hpsf.DocumentSummaryInformation; import org.apache.poi.hpsf.DocumentSummaryInformation;
import org.apache.poi.hpsf.SummaryInformation; import org.apache.poi.hpsf.SummaryInformation;
@ -75,7 +76,7 @@ public class EventBasedExcelExtractor extends POIOLE2TextExtractor implements or
public EventBasedExcelExtractor( DirectoryNode dir ) public EventBasedExcelExtractor( DirectoryNode dir )
{ {
super( null ); super( (POIDocument)null );
_dir = dir; _dir = dir;
} }

View File

@ -32,8 +32,6 @@ public abstract class POIXMLTextExtractor extends POITextExtractor {
* Creates a new text extractor for the given document * Creates a new text extractor for the given document
*/ */
public POIXMLTextExtractor(POIXMLDocument document) { public POIXMLTextExtractor(POIXMLDocument document) {
super((POIDocument)null);
_document = document; _document = document;
} }