Methods Summary |
---|
public int | _getSheetNumber()Returns the (internal, SlideIdentifier based) sheet number, as used
to reference this sheet from other records.
return _sheetNo;
|
public int | _getSheetRefId()Returns the (internal, RefID based) sheet number, as used
to in PersistPtr stuff.
return _container.getSheetId();
|
public void | addShape(org.apache.poi.hslf.model.Shape shape)Add a new Shape to this Slide
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dgContainer = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
EscherContainerRecord spgr = (EscherContainerRecord) Shape.getEscherChild(dgContainer, EscherContainerRecord.SPGR_CONTAINER);
spgr.addChildRecord(shape.getSpContainer());
EscherDgRecord dg = (EscherDgRecord) Shape.getEscherChild(dgContainer, EscherDgRecord.RECORD_ID);
dg.setNumShapes(dg.getNumShapes() + 1);
int shapeId = dg.getLastMSOSPID()+1;
dg.setLastMSOSPID(shapeId);
EscherSpRecord sp = shape.getSpContainer().getChildById(EscherSpRecord.RECORD_ID);
if(sp != null) sp.setShapeId(shapeId);
shape.setSheet(this);
shape.afterInsert(this);
// If it's a TextBox, we need to tell the PPDrawing, as it has to
// track TextboxWrappers specially
if (shape instanceof TextBox) {
TextBox tbox = (TextBox) shape;
ppdrawing.addTextboxWrapper(tbox._txtbox);
}
|
protected static void | findTextRuns(org.apache.poi.hslf.record.Record[] records, java.util.Vector found)Scans through the supplied record array, looking for
a TextHeaderAtom followed by one of a TextBytesAtom or
a TextCharsAtom. Builds up TextRuns from these
// Look for a TextHeaderAtom
for (int i = 0; i < (records.length - 1); i++) {
if (records[i] instanceof TextHeaderAtom) {
TextRun trun = null;
TextHeaderAtom tha = (TextHeaderAtom) records[i];
StyleTextPropAtom stpa = null;
// Look for a subsequent StyleTextPropAtom
if (i < (records.length - 2)) {
if (records[i + 2] instanceof StyleTextPropAtom) {
stpa = (StyleTextPropAtom) records[i + 2];
}
}
// See what follows the TextHeaderAtom
if (records[i + 1] instanceof TextCharsAtom) {
TextCharsAtom tca = (TextCharsAtom) records[i + 1];
trun = new TextRun(tha, tca, stpa);
} else if (records[i + 1] instanceof TextBytesAtom) {
TextBytesAtom tba = (TextBytesAtom) records[i + 1];
trun = new TextRun(tha, tba, stpa);
} else if (records[i + 1].getRecordType() == 4001l) {
// StyleTextPropAtom - Safe to ignore
} else if (records[i + 1].getRecordType() == 4010l) {
// TextSpecInfoAtom - Safe to ignore
} else {
System.err.println("Found a TextHeaderAtom not followed by a TextBytesAtom or TextCharsAtom: Followed by " + records[i + 1].getRecordType());
continue;
}
if (trun != null) {
ArrayList lst = new ArrayList();
for (int j = i; j < records.length; j++) {
if(j > i && records[j] instanceof TextHeaderAtom) break;
lst.add(records[j]);
}
Record[] recs = new Record[lst.size()];
lst.toArray(recs);
trun._records = recs;
found.add(trun);
i++;
} else {
// Not a valid one, so skip on to next and look again
}
}
}
|
public static org.apache.poi.hslf.model.TextRun[] | findTextRuns(org.apache.poi.hslf.record.PPDrawing ppdrawing)For a given PPDrawing, grab all the TextRuns
Vector runsV = new Vector();
EscherTextboxWrapper[] wrappers = ppdrawing.getTextboxWrappers();
for (int i = 0; i < wrappers.length; i++) {
int s1 = runsV.size();
findTextRuns(wrappers[i].getChildRecords(), runsV);
int s2 = runsV.size();
if (s2 != s1){
TextRun t = (TextRun) runsV.get(runsV.size()-1);
t.setShapeId(wrappers[i].getShapeId());
}
}
TextRun[] runs = new TextRun[runsV.size()];
for (int i = 0; i < runs.length; i++) {
runs[i] = (TextRun) runsV.get(i);
}
return runs;
|
public org.apache.poi.hslf.model.Background | getBackground()Returns the background shape for this sheet.
if (_background == null) {
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dg = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
EscherContainerRecord spContainer = null;
List ch = dg.getChildRecords();
for (Iterator it = ch.iterator(); it.hasNext();) {
EscherRecord rec = (EscherRecord) it.next();
if (rec.getRecordId() == EscherContainerRecord.SP_CONTAINER) {
spContainer = (EscherContainerRecord) rec;
break;
}
}
_background = new Background(spContainer, null);
_background.setSheet(this);
}
return _background;
|
public org.apache.poi.hslf.record.ColorSchemeAtom | getColorScheme()Color scheme for this sheet.
return _container.getColorScheme();
|
public abstract org.apache.poi.hslf.model.MasterSheet | getMasterSheet()Return the master sheet .
|
protected org.apache.poi.hslf.record.PPDrawing | getPPDrawing()Fetch the PPDrawing from the underlying record
return _container.getPPDrawing();
|
public org.apache.poi.hslf.model.Shape[] | getShapes()Returns all shapes contained in this Sheet
PPDrawing ppdrawing = getPPDrawing();
EscherContainerRecord dg = (EscherContainerRecord) ppdrawing.getEscherRecords()[0];
EscherContainerRecord spgr = null;
List ch = dg.getChildRecords();
for (Iterator it = ch.iterator(); it.hasNext();) {
EscherRecord rec = (EscherRecord) it.next();
if (rec.getRecordId() == EscherContainerRecord.SPGR_CONTAINER) {
spgr = (EscherContainerRecord) rec;
break;
}
}
ch = spgr.getChildRecords();
ArrayList shapes = new ArrayList();
for (int i = 1; i < ch.size(); i++) {
EscherContainerRecord sp = (EscherContainerRecord) ch.get(i);
Shape sh = ShapeFactory.createShape(sp, null);
sh.setSheet(this);
shapes.add(sh);
}
return (Shape[]) shapes.toArray(new Shape[shapes.size()]);
|
public org.apache.poi.hslf.record.SheetContainer | getSheetContainer()Return record container for this sheet
return _container;
|
public org.apache.poi.hslf.usermodel.SlideShow | getSlideShow()Fetch the SlideShow we're attached to
return _slideShow;
|
public abstract org.apache.poi.hslf.model.TextRun[] | getTextRuns()Returns an array of all the TextRuns in the sheet.
|
public void | setSlideShow(org.apache.poi.hslf.usermodel.SlideShow ss)Set the SlideShow we're attached to.
Also passes it on to our child RichTextRuns
_slideShow = ss;
TextRun[] trs = getTextRuns();
if (trs != null) {
for (int i = 0; i < trs.length; i++) {
trs[i].supplySlideShow(_slideShow);
}
}
|