use of org.apache.poi.hssf.record.aggregates.RecordAggregate.PositionTrackingVisitor in project poi by apache.
the class InternalSheet method visitContainedRecords.
public void visitContainedRecords(RecordVisitor rv, int offset) {
PositionTrackingVisitor ptv = new PositionTrackingVisitor(rv, offset);
boolean haveSerializedIndex = false;
for (int k = 0; k < _records.size(); k++) {
RecordBase record = _records.get(k);
if (record instanceof RecordAggregate) {
RecordAggregate agg = (RecordAggregate) record;
agg.visitContainedRecords(ptv);
} else {
ptv.visitRecord((Record) record);
}
// If the BOF record was just serialized then add the IndexRecord
if (record instanceof BOFRecord) {
if (!haveSerializedIndex) {
haveSerializedIndex = true;
// and one shouldn't go in after that!
if (_isUncalced) {
ptv.visitRecord(new UncalcedRecord());
}
//remove this guard. So be safe it is left here.
if (_rowsAggregate != null) {
// find forward distance to first RowRecord
int initRecsSize = getSizeOfInitialSheetRecords(k);
int currentPos = ptv.getPosition();
ptv.visitRecord(_rowsAggregate.createIndexRecord(currentPos, initRecsSize));
}
}
}
}
}
Aggregations