records.add(condFormatting);
continue;
}
if (recSid == ColumnInfoRecord.sid) {
_columnInfos = new ColumnInfoRecordsAggregate(rs);
records.add(_columnInfos);
continue;
}
if ( recSid == DVALRecord.sid) {
_dataValidityTable = new DataValidityTable(rs);
records.add(_dataValidityTable);
continue;
}
if (RecordOrderer.isRowBlockRecord(recSid) && bofEofNestingLevel == 1 ) {
//only add the aggregate once
if (rra != null) {
throw new RuntimeException("row/cell records found in the wrong place");
}
RowBlocksReader rbr = new RowBlocksReader(rs);
_mergedCellsTable.addRecords(rbr.getLooseMergedCells());
rra = new RowRecordsAggregate(rbr.getPlainRecordStream(), rbr.getSharedFormulaManager());
records.add(rra); //only add the aggregate once
continue;
}
if (PageSettingsBlock.isComponentRecord(recSid)) {
PageSettingsBlock psb = new PageSettingsBlock(rs);
if (_psBlock == null) {
_psBlock = psb;
} else {
if (bofEofNestingLevel == 2) {
// It's normal for a chart to have its own PageSettingsBlock
// Fall through and add psb here, because chart records
// are stored loose among the sheet records.
// this latest psb does not clash with _psBlock
} else if (windowTwo != null) {
// probably 'Custom View Settings' sub-stream which is found between
// USERSVIEWBEGIN(01AA) and USERSVIEWEND(01AB)
// This happens three times in test sample file "29982.xls"
if (rs.peekNextSid() != UnknownRecord.USERSVIEWEND_01AB) {
// not quite the expected situation
throw new RuntimeException("two Page Settings Blocks found in the same sheet");
}
} else {
// Some apps write PLS, WSBOOL, <psb> but PLS is part of <psb>
// This happens in the test sample file "NoGutsRecords.xls" and "WORKBOOK_in_capitals.xls"
// In this case the first PSB is two records back
int prevPsbIx = records.size()-2;
if (_psBlock != records.get(prevPsbIx) || !(records.get(prevPsbIx+1) instanceof WSBoolRecord)) {
// not quite the expected situation
throw new RuntimeException("two Page Settings Blocks found in the same sheet");
}
records.remove(prevPsbIx); // WSBOOL will drop down one position.
psb = mergePSBs(_psBlock, psb);
_psBlock = psb;
}
}
records.add(psb);
continue;
}
if (recSid == MergeCellsRecord.sid) {
// when the MergedCellsTable is found in the right place, we expect those records to be contiguous
_mergedCellsTable.read(rs);
continue;
}
Record rec = rs.getNext();
if ( recSid == IndexRecord.sid ) {
// ignore INDEX record because it is only needed by Excel,
// and POI always re-calculates its contents
continue;
}
if (recSid == UncalcedRecord.sid) {
// don't add UncalcedRecord to the list
_isUncalced = true; // this flag is enough
continue;
}
if (recSid == BOFRecord.sid)
{
bofEofNestingLevel++;
if (log.check( POILogger.DEBUG ))
log.log(POILogger.DEBUG, "Hit BOF record. Nesting increased to " + bofEofNestingLevel);
}
else if (recSid == 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);
break;
}
}
else if (recSid == DimensionsRecord.sid)
{
// Make a columns aggregate if one hasn't ready been created.
if (_columnInfos == null)
{
_columnInfos = new ColumnInfoRecordsAggregate();
records.add(_columnInfos);
}
_dimensions = ( DimensionsRecord ) rec;
dimsloc = records.size();