// (Annoyingly, some powerpoint files have PersistPtrHolders
// that reference slides after the PersistPtrHolder)
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (Record record : _records) {
if(record instanceof PositionDependentRecord) {
PositionDependentRecord pdr = (PositionDependentRecord)record;
int oldPos = pdr.getLastOnDiskOffset();
int newPos = baos.size();
pdr.setLastOnDiskOffset(newPos);
if (oldPos != UNSET_OFFSET) {
// new records don't need a mapping, as they aren't in a relation yet
oldToNewPositions.put(Integer.valueOf(oldPos),Integer.valueOf(newPos));
}
}
// Dummy write out, so the position winds on properly
record.writeOut(baos);
}
baos = null;
// For now, we're only handling PositionDependentRecord's that
// happen at the top level.
// In future, we'll need the handle them everywhere, but that's
// a bit trickier
UserEditAtom usr = null;
for (Record record : _records) {
if (record instanceof PositionDependentRecord) {
// We've already figured out their new location, and
// told them that
// Tell them of the positions of the other records though
PositionDependentRecord pdr = (PositionDependentRecord)record;
pdr.updateOtherRecordReferences(oldToNewPositions);
// Grab interesting records as they come past
// this will only save the very last record of each type
RecordTypes.Type saveme = null;
int recordType = (int)record.getRecordType();