* @return the created <code>Slide</code>
* @throws IOException
*/
public Slide createSlide() throws IOException {
SlideListWithText[] slwts = _documentRecord.getSlideListWithTexts();
SlideListWithText slist = null;
if(slwts.length > 1) {
// Just use the last one
slist = slwts[slwts.length - 1];
} else {
// Need to add a new one
slist = new SlideListWithText();
_documentRecord.addSlideListWithText(slist);
slwts = _documentRecord.getSlideListWithTexts();
}
// Grab the SlidePersistAtom with the highest Slide Number.
// (Will stay as null if no SlidePersistAtom exists yet in
// the slide, or only master slide's ones do)
SlidePersistAtom prev = null;
for(int i=0; i<slwts.length; i++) {
SlideAtomsSet[] sas = slwts[i].getSlideAtomsSets();
for(int j=0; j<sas.length; j++) {
SlidePersistAtom spa = sas[j].getSlidePersistAtom();
if(spa.getSlideIdentifier() < 0) {
// This is for a master slide
} else {
// Must be for a real slide
if(prev == null) { prev = spa; }
if(prev.getSlideIdentifier() < spa.getSlideIdentifier()) {
prev = spa;
}
}
}
}
// Set up a new SlidePersistAtom for this slide
SlidePersistAtom sp = new SlidePersistAtom();
// Reference is the 1-based index of the slide container in
// the PersistPtr root.
// It always starts with 3 (1 is Document, 2 is MainMaster, 3 is
// the first slide), but quicksaves etc can leave gaps
_highestSheetId++;
sp.setRefID(_highestSheetId);
// First slideId is always 256
sp.setSlideIdentifier(prev == null ? 256 : (prev.getSlideIdentifier() + 1));
// Add this new SlidePersistAtom to the SlideListWithText
slist.addSlidePersistAtom(sp);
// Create a new Slide
Slide slide = new Slide(sp.getSlideIdentifier(), sp.getRefID(), _slides.length+1);
// Add in to the list of Slides