Search in sources :

Example 1 with PositionTrackingVisitor

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));
                }
            }
        }
    }
}
Also used : PositionTrackingVisitor(org.apache.poi.hssf.record.aggregates.RecordAggregate.PositionTrackingVisitor) UncalcedRecord(org.apache.poi.hssf.record.UncalcedRecord) RecordBase(org.apache.poi.hssf.record.RecordBase) CustomViewSettingsRecordAggregate(org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate) RecordAggregate(org.apache.poi.hssf.record.aggregates.RecordAggregate) ChartSubstreamRecordAggregate(org.apache.poi.hssf.record.aggregates.ChartSubstreamRecordAggregate) BOFRecord(org.apache.poi.hssf.record.BOFRecord)

Aggregations

BOFRecord (org.apache.poi.hssf.record.BOFRecord)1 RecordBase (org.apache.poi.hssf.record.RecordBase)1 UncalcedRecord (org.apache.poi.hssf.record.UncalcedRecord)1 ChartSubstreamRecordAggregate (org.apache.poi.hssf.record.aggregates.ChartSubstreamRecordAggregate)1 CustomViewSettingsRecordAggregate (org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate)1 RecordAggregate (org.apache.poi.hssf.record.aggregates.RecordAggregate)1 PositionTrackingVisitor (org.apache.poi.hssf.record.aggregates.RecordAggregate.PositionTrackingVisitor)1