Constructors Summary |
---|
public Slide(Slide slide, Notes notes, org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet atomSet, int slideIdentifier, int slideNumber)Constructs a Slide from the Slide record, and the SlideAtomsSet
containing the text.
Initialises TextRuns, to provide easier access to the text
super(slide, slideIdentifier);
_notes = notes;
_atomSet = atomSet;
_slideNo = slideNumber;
// Grab the TextRuns from the PPDrawing
TextRun[] _otherRuns = findTextRuns(getPPDrawing());
// For the text coming in from the SlideAtomsSet:
// Build up TextRuns from pairs of TextHeaderAtom and
// one of TextBytesAtom or TextCharsAtom
Vector textRuns = new Vector();
if(_atomSet != null) {
findTextRuns(_atomSet.getSlideRecords(),textRuns);
} else {
// No text on the slide, must just be pictures
}
// Build an array, more useful than a vector
_runs = new TextRun[textRuns.size()+_otherRuns.length];
// Grab text from SlideListWithTexts entries
int i=0;
for(i=0; i<textRuns.size(); i++) {
_runs[i] = (TextRun)textRuns.get(i);
_runs[i].setSheet(this);
}
// Grab text from slide's PPDrawing
for(int k=0; k<_otherRuns.length; i++, k++) {
_runs[i] = _otherRuns[k];
_runs[i].setSheet(this);
}
|
public Slide(int sheetNumber, int sheetRefId, int slideNumber)Create a new Slide instance
super(new org.apache.poi.hslf.record.Slide(), sheetNumber);
_slideNo = slideNumber;
getSheetContainer().setSheetId(sheetRefId);
|
Methods Summary |
---|
public org.apache.poi.hslf.model.TextBox | addTitle()Create a TextBox object that represents the slide's title.
Placeholder pl = new Placeholder();
pl.setShapeType(ShapeTypes.Rectangle);
pl.getTextRun().setRunType(TextHeaderAtom.TITLE_TYPE);
pl.setText("Click to edit title");
pl.setAnchor(new java.awt.Rectangle(54, 48, 612, 90));
addShape(pl);
return pl;
|
public boolean | getFollowMasterBackground()Whether this slide follows master sheet background
SlideAtom sa = getSlideRecord().getSlideAtom();
return sa.getFollowMasterBackground();
|
public org.apache.poi.hslf.model.MasterSheet | getMasterSheet()Returns master sheet associated with this slide.
It can be either SlideMaster or TitleMaster objects.
SlideMaster[] master = getSlideShow().getSlidesMasters();
SlideAtom sa = getSlideRecord().getSlideAtom();
int masterId = sa.getMasterID();
MasterSheet sheet = null;
for (int i = 0; i < master.length; i++) {
if (masterId == master[i]._getSheetNumber()) {
sheet = master[i];
break;
}
}
if (sheet == null){
TitleMaster[] titleMaster = getSlideShow().getTitleMasters();
if(titleMaster != null) for (int i = 0; i < titleMaster.length; i++) {
if (masterId == titleMaster[i]._getSheetNumber()) {
sheet = titleMaster[i];
break;
}
}
}
return sheet;
|
public org.apache.poi.hslf.model.Notes | getNotesSheet()Returns the Notes Sheet for this slide, or null if there isn't one return _notes;
|
protected org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet | getSlideAtomsSet() return _atomSet;
|
public int | getSlideNumber()Returns the (public facing) page number of this slide return _slideNo;
|
public org.apache.poi.hslf.record.Slide | getSlideRecord()Returns the underlying slide record
return (org.apache.poi.hslf.record.Slide)getSheetContainer();
|
public org.apache.poi.hslf.model.TextRun[] | getTextRuns()Returns an array of all the TextRuns found return _runs;
|
public java.lang.String | getTitle()Return title of this slide or null if the slide does not have title.
The title is a run of text of type TextHeaderAtom.CENTER_TITLE_TYPE or
TextHeaderAtom.TITLE_TYPE
TextRun[] txt = getTextRuns();
for (int i = 0; i < txt.length; i++) {
int type = txt[i].getRunType();
if (type == TextHeaderAtom.CENTER_TITLE_TYPE ||
type == TextHeaderAtom.TITLE_TYPE ){
String title = txt[i].getText();
return title;
}
}
return null;
|
public void | setFollowMasterBackground(boolean flag)Sets whether this slide follows master background
SlideAtom sa = getSlideRecord().getSlideAtom();
sa.setFollowMasterBackground(flag);
|
public void | setMasterSheet(org.apache.poi.hslf.model.MasterSheet master)Change Master of this slide.
SlideAtom sa = getSlideRecord().getSlideAtom();
int sheetNo = master._getSheetNumber();
sa.setMasterID(sheetNo);
|
public void | setNotes(org.apache.poi.hslf.model.Notes notes)Sets the Notes that are associated with this. Updates the
references in the records to point to the new ID
_notes = notes;
// Update the Slide Atom's ID of where to point to
SlideAtom sa = getSlideRecord().getSlideAtom();
if(notes == null) {
// Set to 0
sa.setNotesID(0);
} else {
// Set to the value from the notes' sheet id
sa.setNotesID(notes._getSheetNumber());
}
|
public void | setSlideNumber(int newSlideNumber)Changes the Slide's (external facing) page number.
_slideNo = newSlideNumber;
|