package org.apache.poi.xssf.usermodel;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Vector;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.util.Internal;
public class XSSFMap {
-
private CTMap ctMap;
-
private MapInfo mapInfo;
-
public XSSFMap(CTMap ctMap, MapInfo mapInfo) {
this.ctMap = ctMap;
this.mapInfo = mapInfo;
return ctMap;
}
-
@Internal
public CTSchema getCTSchema() {
String schemaId = ctMap.getSchemaID();
* @return the list of Single Xml Cells that provide a map rule to this mapping.
*/
public List<XSSFSingleXmlCell> getRelatedSingleXMLCell() {
- List<XSSFSingleXmlCell> relatedSimpleXmlCells = new Vector<XSSFSingleXmlCell>();
+ List<XSSFSingleXmlCell> relatedSimpleXmlCells = new ArrayList<XSSFSingleXmlCell>();
int sheetNumber = mapInfo.getWorkbook().getNumberOfSheets();
for (int i = 0; i < sheetNumber; i++) {
*/
public List<XSSFTable> getRelatedTables() {
- List<XSSFTable> tables = new Vector<XSSFTable>();
+ List<XSSFTable> tables = new ArrayList<XSSFTable>();
int sheetNumber = mapInfo.getWorkbook().getNumberOfSheets();
for (int i = 0; i < sheetNumber; i++) {
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.Vector;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
public List<XSSFXmlColumnPr> getXmlColumnPrs() {
if(xmlColumnPr==null){
- xmlColumnPr = new Vector<XSSFXmlColumnPr>();
- for(CTTableColumn column:ctTable.getTableColumns().getTableColumnList()){
- if(column.getXmlColumnPr()!=null){
+ xmlColumnPr = new ArrayList<XSSFXmlColumnPr>();
+ for (CTTableColumn column:ctTable.getTableColumns().getTableColumnList()){
+ if (column.getXmlColumnPr()!=null){
XSSFXmlColumnPr columnPr = new XSSFXmlColumnPr(this,column,column.getXmlColumnPr());
xmlColumnPr.add(columnPr);
}
package org.apache.poi.hslf.extractor;
-import java.io.*;
-import java.util.Vector;
-
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-import org.apache.poi.poifs.filesystem.DocumentEntry;
-import org.apache.poi.util.LittleEndian;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.poi.hslf.model.TextRun;
import org.apache.poi.hslf.record.CString;
import org.apache.poi.hslf.record.Record;
import org.apache.poi.hslf.record.RecordTypes;
import org.apache.poi.hslf.record.StyleTextPropAtom;
-import org.apache.poi.hslf.record.TextHeaderAtom;
import org.apache.poi.hslf.record.TextBytesAtom;
import org.apache.poi.hslf.record.TextCharsAtom;
-import org.apache.poi.hslf.model.TextRun;
+import org.apache.poi.hslf.record.TextHeaderAtom;
+import org.apache.poi.poifs.filesystem.DocumentEntry;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.util.LittleEndian;
/**
* This class will get all the text from a Powerpoint Document, including
*/
public String getTextAsString() {
StringBuffer ret = new StringBuffer();
- Vector<String> textV = getTextAsVector();
+ List<String> textV = getTextAsVector();
for(String text : textV) {
ret.append(text);
if(! text.endsWith("\n")) {
}
/**
- * Fetches the ALL the text of the powerpoint file, in a vector of
+ * Fetches the ALL the text of the powerpoint file, in a List of
* strings, one per text record
*/
- public Vector<String> getTextAsVector() {
- Vector<String> textV = new Vector<String>();
+ public List<String> getTextAsVector() {
+ List<String> textV = new ArrayList<String>();
// Set to the start of the file
int walkPos = 0;
* If it is a text record, grabs out the text. Whatever happens, returns
* the position of the next record, or -1 if no more.
*/
- public int findTextRecords(int startPos, Vector<String> textV) {
+ public int findTextRecords(int startPos, List<String> textV) {
// Grab the length, and the first option byte
// Note that the length doesn't include the 8 byte atom header
int len = (int)LittleEndian.getUInt(pptContents,startPos+4);
package org.apache.poi.hslf.record;
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.POILogger;
-
-import org.apache.poi.ddf.*;
-import org.apache.poi.hslf.model.ShapeTypes;
-
import java.io.IOException;
import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Vector;
-import java.util.Iterator;
+
+import org.apache.poi.ddf.DefaultEscherRecordFactory;
+import org.apache.poi.ddf.EscherBoolProperty;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherDgRecord;
+import org.apache.poi.ddf.EscherOptRecord;
+import org.apache.poi.ddf.EscherProperties;
+import org.apache.poi.ddf.EscherRGBProperty;
+import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.ddf.EscherSimpleProperty;
+import org.apache.poi.ddf.EscherSpRecord;
+import org.apache.poi.ddf.EscherSpgrRecord;
+import org.apache.poi.ddf.EscherTextboxRecord;
+import org.apache.poi.ddf.UnknownEscherRecord;
+import org.apache.poi.hslf.model.ShapeTypes;
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogger;
/**
* These are actually wrappers onto Escher drawings. Make use of
* (msofbtClientTextbox) records.
* Also provides easy access to the EscherTextboxRecords, so that their
* text may be extracted and used in Sheets
- *
- * @author Nick Burch
*/
// For now, pretending to be an atom. Might not always be, but that
// Build up a tree of Escher records contained within
final DefaultEscherRecordFactory erf = new DefaultEscherRecordFactory();
- final Vector<EscherRecord> escherChildren = new Vector<EscherRecord>();
+ final List<EscherRecord> escherChildren = new ArrayList<EscherRecord>();
findEscherChildren(erf, contents, 8, len-8, escherChildren);
this.childRecords = (EscherRecord[]) escherChildren.toArray(new EscherRecord[escherChildren.size()]);
this.textboxWrappers = findInDgContainer((EscherContainerRecord) this.childRecords[0]);
} else {
// Find and EscherTextboxRecord's, and wrap them up
- final Vector<EscherTextboxWrapper> textboxes = new Vector<EscherTextboxWrapper>();
+ final List<EscherTextboxWrapper> textboxes = new ArrayList<EscherTextboxWrapper>();
findEscherTextboxRecord(childRecords, textboxes);
this.textboxWrappers = (EscherTextboxWrapper[]) textboxes.toArray(new EscherTextboxWrapper[textboxes.size()]);
}
/**
* Tree walking way of finding Escher Child Records
*/
- private void findEscherChildren(DefaultEscherRecordFactory erf, byte[] source, int startPos, int lenToGo, Vector<EscherRecord> found) {
+ private void findEscherChildren(DefaultEscherRecordFactory erf, byte[] source, int startPos, int lenToGo, List<EscherRecord> found) {
int escherBytes = LittleEndian.getInt( source, startPos + 4 ) + 8;
/**
* Look for EscherTextboxRecords
*/
- private void findEscherTextboxRecord(EscherRecord[] toSearch, Vector<EscherTextboxWrapper> found) {
+ private void findEscherTextboxRecord(EscherRecord[] toSearch, List<EscherTextboxWrapper> found) {
for(int i=0; i<toSearch.length; i++) {
if(toSearch[i] instanceof EscherTextboxRecord) {
EscherTextboxRecord tbr = (EscherTextboxRecord)toSearch[i];
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.poi.util.LittleEndian;
// Group our children together into SlideAtomsSets
// That way, model layer code can just grab the sets to use,
// without having to try to match the children together
- Vector<SlideAtomsSet> sets = new Vector<SlideAtomsSet>();
+ List<SlideAtomsSet> sets = new ArrayList<SlideAtomsSet>();
for(int i=0; i<_children.length; i++) {
if(_children[i] instanceof SlidePersistAtom) {
// Find where the next SlidePersistAtom is
}
}
- // Turn the vector into an array
+ // Turn the list into an array
slideAtomsSets = sets.toArray( new SlideAtomsSet[sets.size()] );
}
package org.apache.poi.hslf.extractor;
+import java.util.List;
+
import junit.framework.TestCase;
-import java.util.Vector;
import org.apache.poi.POIDataSamples;
public void testReadAsVector() {
// Extract the text from the file as a vector
- Vector foundTextV = te.getTextAsVector();
+ List<String> foundTextV = te.getTextAsVector();
// Ensure they match
assertEquals(allTheText.length,foundTextV.size());