SlideListWithTextpublic class SlideListWithText extends RecordContainer These are tricky beasts. They contain the text of potentially
many (normal) slides. They are made up of several sets of
- SlidePersistAtom
- TextHeaderAtom
- TextBytesAtom / TextCharsAtom
- StyleTextPropAtom (optional)
- TextSpecInfoAtom (optional)
- InteractiveInfo (optional)
- TxInteractiveInfoAtom (optional)
and then the next SlidePersistAtom.
Eventually, Slides will find the blocks that interest them from all
the SlideListWithText entries, and refere to them
For now, we scan through looking for interesting bits, then creating
the helpful Sheet from model for them |
Fields Summary |
---|
private byte[] | _header | private static long | _type | private SlideAtomsSet[] | slideAtomsSets |
Constructors Summary |
---|
protected SlideListWithText(byte[] source, int start, int len)Create a new holder for slide records
// Grab the header
_header = new byte[8];
System.arraycopy(source,start,_header,0,8);
// Find our children
_children = Record.findChildRecords(source,start+8,len-8);
// 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 sets = new Vector();
for(int i=0; i<_children.length; i++) {
if(_children[i] instanceof SlidePersistAtom) {
// Find where the next SlidePersistAtom is
int endPos = i+1;
while(endPos < _children.length && !(_children[endPos] instanceof SlidePersistAtom)) {
endPos += 1;
}
int clen = endPos - i - 1;
boolean emptySet = false;
if(clen == 0) { emptySet = true; }
// Create a SlideAtomsSets, not caring if they're empty
//if(emptySet) { continue; }
Record[] spaChildren = new Record[clen];
System.arraycopy(_children,i+1,spaChildren,0,clen);
SlideAtomsSet set = new SlideAtomsSet((SlidePersistAtom)_children[i],spaChildren);
sets.add(set);
// Wind on
i += clen;
}
}
// Turn the vector into an array
slideAtomsSets = new SlideAtomsSet[sets.size()];
for(int i=0; i<slideAtomsSets.length; i++) {
slideAtomsSets[i] = (SlideAtomsSet)sets.get(i);
}
| public SlideListWithText()Create a new, empty, SlideListWithText
_header = new byte[8];
LittleEndian.putUShort(_header, 0, 15);
LittleEndian.putUShort(_header, 2, (int)_type);
LittleEndian.putInt(_header, 4, 0);
// We have no children to start with
_children = new Record[0];
slideAtomsSets = new SlideAtomsSet[0];
|
Methods Summary |
---|
public void | addSlidePersistAtom(org.apache.poi.hslf.record.SlidePersistAtom spa)Add a new SlidePersistAtom, to the end of the current list,
and update the internal list of SlidePersistAtoms
// Add the new SlidePersistAtom at the end
appendChildRecord(spa);
SlideAtomsSet newSAS = new SlideAtomsSet(spa, new Record[0]);
// Update our SlideAtomsSets with this
SlideAtomsSet[] sas = new SlideAtomsSet[slideAtomsSets.length+1];
System.arraycopy(slideAtomsSets, 0, sas, 0, slideAtomsSets.length);
sas[sas.length-1] = newSAS;
slideAtomsSets = sas;
| public long | getRecordType()Return the value we were given at creation return _type;
| public org.apache.poi.hslf.record.SlideListWithText$SlideAtomsSet[] | getSlideAtomsSets()Get access to the SlideAtomsSets of the children of this record return slideAtomsSets;
| public void | repositionSlideAtomsSet(org.apache.poi.hslf.record.SlideListWithText$SlideAtomsSet toMove, int newPosition)Shifts a SlideAtomsSet to a new position.
Works by shifting the child records about, then updating
the SlideAtomSets array
// Ensure it's one of ours
int curPos = -1;
for(int i=0; i<slideAtomsSets.length; i++) {
if(slideAtomsSets[i] == toMove) { curPos = i; }
}
if(curPos == -1) {
throw new IllegalArgumentException("The supplied SlideAtomsSet didn't belong to this SlideListWithText");
}
// Ensure the newPosision is valid
if(newPosition < 0 || newPosition >= slideAtomsSets.length) {
throw new IllegalArgumentException("The new position must be between 0, and the number of SlideAtomsSets");
}
// Build the new records list
moveChildrenBefore(toMove.getSlidePersistAtom(), toMove.slideRecords.length, slideAtomsSets[newPosition].getSlidePersistAtom());
// Build the new SlideAtomsSets list
ArrayUtil.arrayMoveWithin(slideAtomsSets, curPos, newPosition, 1);
| public void | writeOut(java.io.OutputStream out)Write the contents of the record back, so it can be written
to disk
writeOut(_header[0],_header[1],_type,_children,out);
|
|