continue;
}
if (rec.getSid() == ColumnInfoRecord.sid) {
RecordStream rs = new RecordStream(inRecs, k);
retval._columnInfos = new ColumnInfoRecordsAggregate(rs);
k += rs.getCountRead()-1;
records.add(retval._columnInfos);
continue;
}
if ( rec.getSid() == DVALRecord.sid) {
RecordStream rs = new RecordStream(inRecs, k);
retval._dataValidityTable = new DataValidityTable(rs);
k += rs.getCountRead() - 1; // TODO - convert this method result to be zero based
records.add(retval._dataValidityTable);
continue;
}
// TODO construct RowRecordsAggregate from RecordStream
if ((rec.getSid() == RowRecord.sid || rec.isValue()) && bofEofNestingLevel == 1 ) {
//only add the aggregate once
if (retval._rowsAggregate != null) {
throw new RuntimeException("row/cell records found in the wrong place");
}
RowBlocksReader rbr = new RowBlocksReader(inRecs, k);
retval._mergedCellsTable.addRecords(rbr.getLooseMergedCells());
retval._rowsAggregate = new RowRecordsAggregate(rbr.getPlainRecordStream(), rbr.getSharedFormulaManager());
records.add(retval._rowsAggregate); //only add the aggregate once
k += rbr.getTotalNumberOfRecords() - 1;
continue;
}
if (PageSettingsBlock.isComponentRecord(rec.getSid())) {
RecordStream rs = new RecordStream(inRecs, k);
PageSettingsBlock psb = new PageSettingsBlock(rs);
if (bofEofNestingLevel == 1) {
if (retval._psBlock == null) {
retval._psBlock = psb;
} else {
// more than one 'Page Settings Block' at nesting level 1 ?
// apparently this happens in about 15 test sample files
}
}
records.add(psb);
k += rs.getCountRead()-1;
continue;
}
if (rec.getSid() == MergeCellsRecord.sid) {
// when the MergedCellsTable is found in the right place, we expect those records to be contiguous
RecordStream rs = new RecordStream(inRecs, k);
retval._mergedCellsTable.read(rs);
k += rs.getCountRead()-1;
continue;
}
if (rec.getSid() == UncalcedRecord.sid) {
// don't add UncalcedRecord to the list
retval._isUncalced = true; // this flag is enough
continue;
}
if (rec.getSid() == BOFRecord.sid)
{
bofEofNestingLevel++;
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "Hit BOF record. Nesting increased to " + bofEofNestingLevel);
}
else if (rec.getSid() == EOFRecord.sid)
{
--bofEofNestingLevel;
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "Hit EOF record. Nesting decreased to " + bofEofNestingLevel);
if (bofEofNestingLevel == 0) {
records.add(rec);
retval.eofLoc = k;
break;
}
}
else if (rec.getSid() == DimensionsRecord.sid)
{
// Make a columns aggregate if one hasn't ready been created.
if (retval._columnInfos == null)
{
retval._columnInfos = new ColumnInfoRecordsAggregate();
records.add(retval._columnInfos);
}
retval._dimensions = ( DimensionsRecord ) rec;
retval.dimsloc = records.size();