public AxesAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_AXES, container) { if (rs.PeekNextChartSid() == AxisRecord.sid) { AxisRecord axis = (AxisRecord)rs.GetNext(); rs.GetNext(); int sid = rs.PeekNextChartSid(); if (sid == CatSerRangeRecord.sid) { ivaxis = new IVAxisAggregate(rs, this, axis); } else if (sid == ValueRangeRecord.sid) { dvaxis = new DVAxisAggregate(rs, this, axis); } else { throw new InvalidOperationException(string.Format("Invalid record sid=0x{0:X}. Shoud be CatSerRangeRecord or ValueRangeRecord", sid)); } Debug.Assert(rs.PeekNextChartSid() == AxisRecord.sid); dvaxisSecond = new DVAxisAggregate(rs, this, null); if (rs.PeekNextChartSid() == AxisRecord.sid) { seriesAxis = new SeriesAxisAggregate(rs, this); } while (rs.PeekNextChartSid() == TextRecord.sid) { attachedLabelList.Add(new AttachedLabelAggregate(rs, this)); } if (rs.PeekNextChartSid() == PlotAreaRecord.sid) { plotArea = (PlotAreaRecord)rs.GetNext(); if (rs.PeekNextChartSid() == FrameRecord.sid) { frame = new FrameAggregate(rs, this); } } } }
public TextPropsAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_TEXTPROPS, container) { if (rs.PeekNextChartSid() == TextPropsStreamRecord.sid) { textPropsStream = (TextPropsStreamRecord)rs.GetNext(); } else { richTextStream = (RichTextStreamRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == ContinueFrt12Record.sid) { while (rs.PeekNextChartSid() == ContinueFrt12Record.sid) { continues.Add((ContinueFrt12Record)rs.GetNext()); } } }
/** * @param rs record stream with all {@link SharedFormulaRecord} * {@link ArrayRecord}, {@link TableRecord} {@link MergeCellsRecord} Records removed */ public RowRecordsAggregate(RecordStream rs, SharedValueManager svm) : this(svm) { while (rs.HasNext()) { Record rec = rs.GetNext(); switch (rec.Sid) { case RowRecord.sid: InsertRow((RowRecord)rec); continue; case DBCellRecord.sid: // end of 'Row Block'. Should only occur after cell records // ignore DBCELL records because POI generates them upon re-serialization continue; } if (rec is UnknownRecord) { // might need to keep track of where exactly these belong AddUnknownRecord((UnknownRecord)rec); while (rs.PeekNextSid() == ContinueRecord.sid) { AddUnknownRecord(rs.GetNext()); } continue; } if (rec is MulBlankRecord) { _valuesAgg.AddMultipleBlanks((MulBlankRecord)rec); continue; } if (!(rec is CellValueRecordInterface)) { throw new InvalidOperationException("Unexpected record type (" + rec.GetType().Name + ")"); } _valuesAgg.Construct((CellValueRecordInterface)rec, rs, svm); } }
/** * Reads zero or more consecutive {@link MergeCellsRecord}s * @param rs */ public void Read(RecordStream rs) { while (rs.PeekNextClass() == typeof(MergeCellsRecord)) { MergeCellsRecord mcr = (MergeCellsRecord)rs.GetNext(); int nRegions = mcr.NumAreas; for (int i = 0; i < nRegions; i++) { _mergedRegions.Add(mcr.GetAreaAt(i)); } } }
/// <summary> /// Create CFRecordsAggregate from a list of CF Records /// </summary> /// <param name="rs">list of Record objects</param> public static CFRecordsAggregate CreateCFAggregate(RecordStream rs) { Record rec = rs.GetNext(); if (rec.Sid != CFHeaderRecord.sid) { throw new InvalidOperationException("next record sid was " + rec.Sid + " instead of " + CFHeaderRecord.sid + " as expected"); } CFHeaderRecord header = (CFHeaderRecord)rec; int nRules = header.NumberOfConditionalFormats; CFRuleRecord[] rules = new CFRuleRecord[nRules]; for (int i = 0; i < rules.Length; i++) { rules[i] = (CFRuleRecord)rs.GetNext(); } return(new CFRecordsAggregate(header, rules)); }
private void ConstructValueRecord(IList records) { RowBlocksReader rbr = new RowBlocksReader(new RecordStream(records, 0)); SharedValueManager sfrh = rbr.SharedFormulaManager; RecordStream rs = rbr.PlainRecordStream; while (rs.HasNext()) { Record rec = rs.GetNext(); valueRecord.Construct((CellValueRecordInterface)rec, rs, sfrh); } }
public FrameAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_FRAME, container) { frame = (FrameRecord)rs.GetNext(); rs.GetNext();//BeginRecord lineFormat = (LineFormatRecord)rs.GetNext(); areaFormat = (AreaFormatRecord)rs.GetNext(); if (rs.PeekNextChartSid() == GelFrameRecord.sid) { gelFrame = new GelFrameAggregate(rs, this); } if (rs.PeekNextChartSid() == ShapePropsStreamRecord.sid) { shapeProps = new ShapePropsAggregate(rs, this); } Record r = rs.GetNext();//EndRecord Debug.Assert(r.GetType() == typeof(EndRecord)); }
public SeriesAxisAggregate(RecordStream rs, ChartRecordAggregate container) : base("SERIESAXIS", container) { axis = (AxisRecord)rs.GetNext(); rs.GetNext(); if (rs.PeekNextChartSid() == CatSerRangeRecord.sid) { catSerRange = (CatSerRangeRecord)rs.GetNext(); } axs = new AXSAggregate(rs, this); if (rs.PeekNextChartSid() == CrtMlFrtRecord.sid) { crtmlfrt = new CrtMlFrtAggregate(rs, this); } Record r = rs.GetNext();//EndRecord Debug.Assert(r.GetType() == typeof(EndRecord)); }
public GelFrameAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_GELFRAME, container) { gelFrame1 = (GelFrameRecord)rs.GetNext(); int sid = rs.PeekNextChartSid(); if (sid == GelFrameRecord.sid) { gelFrame2 = (GelFrameRecord)rs.GetNext(); sid = rs.PeekNextChartSid(); } if (sid == ContinueRecord.sid) { while (rs.PeekNextChartSid() == ContinueRecord.sid) { continues.Add((ContinueRecord)rs.GetNext()); } } if (rs.PeekNextChartSid() == BeginRecord.sid) { rs.GetNext(); picF = (PicFRecord)rs.GetNext(); Record r = rs.GetNext();//EndRecord Debug.Assert(r.GetType() == typeof(EndRecord)); } }
public AXSAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_AXS, container) { if (rs.PeekNextChartSid() == IFmtRecordRecord.sid) { ifmt = (IFmtRecordRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == TickRecord.sid) { tick = (TickRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == FontXRecord.sid) { fontx = (FontXRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == AxisLineRecord.sid) { while (rs.PeekNextChartSid() == AxisLineRecord.sid) { axisLines.Add((AxisLineRecord)rs.GetNext()); lineFormats.Add((LineFormatRecord)rs.GetNext()); } } if (rs.PeekNextChartSid() == AreaFormatRecord.sid) { areaFormat = (AreaFormatRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == GelFrameRecord.sid) { gelFrame = new GelFrameAggregate(rs, this); } if (rs.PeekNextChartSid() == ShapePropsStreamRecord.sid) { while (rs.PeekNextChartSid() == ShapePropsStreamRecord.sid) { shapes.Add(new ShapePropsAggregate(rs, this)); } } if (rs.PeekNextChartSid() == TextPropsStreamRecord.sid) { textProps = (TextPropsStreamRecord)rs.GetNext(); while (rs.PeekNextChartSid() == ContinueFrt12Record.sid) { continues.Add((ContinueFrt12Record)rs.GetNext()); } } }
public CustomViewSettingsRecordAggregate(RecordStream rs) { _begin = rs.GetNext(); if (_begin.Sid != UserSViewBegin.sid) { throw new InvalidOperationException("Bad begin record"); } List <RecordBase> temp = new List <RecordBase>(); while (rs.PeekNextSid() != UserSViewEnd.sid) { if (PageSettingsBlock.IsComponentRecord(rs.PeekNextSid())) { if (_psBlock != null) { if (rs.PeekNextSid() == HeaderFooterRecord.sid) { // test samples: 45538_classic_Footer.xls, 45538_classic_Header.xls _psBlock.AddLateHeaderFooter((HeaderFooterRecord)rs.GetNext()); continue; } throw new InvalidOperationException( "Found more than one PageSettingsBlock in chart sub-stream, had sid: " + rs.PeekNextSid()); } _psBlock = new PageSettingsBlock(rs); temp.Add(_psBlock); continue; } temp.Add(rs.GetNext()); } _recs = temp; _end = rs.GetNext(); // no need to save EOF in field if (_end.Sid != UserSViewEnd.sid) { throw new InvalidOperationException("Bad custom view Settings end record"); } }
public FontListAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_FONTLIST, container) { frtFontList = (FrtFontListRecord)rs.GetNext(); startObject = (ChartStartObjectRecord)rs.GetNext(); FontRecord f = null; FbiRecord fbi = null; while (rs.PeekNextChartSid() == FontRecord.sid) { f = (FontRecord)rs.GetNext(); if (rs.PeekNextChartSid() == FbiRecord.sid) { fbi = (FbiRecord)rs.GetNext(); } else { fbi = null; } dicFonts.Add(f, fbi); } endObject = (ChartEndObjectRecord)rs.GetNext(); }
public void Construct(CellValueRecordInterface rec, RecordStream rs, SharedValueManager sfh) { if (rec is FormulaRecord) { FormulaRecord formulaRec = (FormulaRecord)rec; // read optional cached text value StringRecord cachedText = null; Type nextClass = rs.PeekNextClass(); if (nextClass == typeof(StringRecord)) { cachedText = (StringRecord)rs.GetNext(); } else { cachedText = null; } InsertCell(new FormulaRecordAggregate(formulaRec, cachedText, sfh)); } else { InsertCell(rec); } }
/// <summary> /// Initializes a new instance of the <see cref="ColumnInfoRecordsAggregate"/> class. /// </summary> /// <param name="rs">The rs.</param> public ColumnInfoRecordsAggregate(RecordStream rs) : this() { bool isInOrder = true; ColumnInfoRecord cirPrev = null; while (rs.PeekNextClass() == typeof(ColumnInfoRecord)) { ColumnInfoRecord cir = (ColumnInfoRecord)rs.GetNext(); records.Add(cir); if (cirPrev != null && CIRComparator.CompareColInfos(cirPrev, cir) > 0) { isInOrder = false; } cirPrev = cir; } if (records.Count < 1) { throw new InvalidOperationException("No column info records found"); } if (!isInOrder) { records.Sort(CIRComparator.instance); } }
private bool ReadARecord(RecordStream rs) { switch (rs.PeekNextSid()) { case HorizontalPageBreakRecord.sid: _rowBreaksRecord = (PageBreakRecord)rs.GetNext(); _rowRecords.Add(_rowBreaksRecord); break; case VerticalPageBreakRecord.sid: _columnBreaksRecord = (PageBreakRecord)rs.GetNext(); _rowRecords.Add(_columnBreaksRecord); break; case HeaderRecord.sid: header = (HeaderRecord)rs.GetNext(); _rowRecords.Add(header); break; case FooterRecord.sid: footer = (FooterRecord)rs.GetNext(); _rowRecords.Add(footer); break; case HCenterRecord.sid: _hCenter = (HCenterRecord)rs.GetNext(); _rowRecords.Add(_hCenter); break; case VCenterRecord.sid: _vCenter = (VCenterRecord)rs.GetNext(); _rowRecords.Add(_vCenter); break; case LeftMarginRecord.sid: _leftMargin = (LeftMarginRecord)rs.GetNext(); _rowRecords.Add(_leftMargin); break; case RightMarginRecord.sid: _rightMargin = (RightMarginRecord)rs.GetNext(); _rowRecords.Add(_rightMargin); break; case TopMarginRecord.sid: _topMargin = (TopMarginRecord)rs.GetNext(); _rowRecords.Add(_topMargin); break; case BottomMarginRecord.sid: _bottomMargin = (BottomMarginRecord)rs.GetNext(); _rowRecords.Add(_bottomMargin); break; case 0x004D: // PLS _pls = rs.GetNext(); _rowRecords.Add(_pls); break; case PrintSetupRecord.sid: printSetup = (PrintSetupRecord)rs.GetNext(); _rowRecords.Add(printSetup); break; case 0x00E9: // BITMAP _bitmap = rs.GetNext(); _rowRecords.Add(_bitmap); break; default: // all other record types are not part of the PageSettingsBlock return(false); } return(true); }
public AttachedLabelAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_ATTACHEDLABEL, container) { ChartSheetAggregate cs = GetContainer <ChartSheetAggregate>(ChartRecordAggregate.RuleName_CHARTSHEET); _isFirst = cs.AttachLabelCount == 0; cs.AttachLabelCount++; text = (TextRecord)rs.GetNext(); rs.GetNext();//BeginRecord pos = (PosRecord)rs.GetNext(); if (rs.PeekNextChartSid() == FontXRecord.sid) { fontX = (FontXRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == AlRunsRecord.sid) { alRuns = (AlRunsRecord)rs.GetNext(); } brai = (BRAIRecord)rs.GetNext(); if (rs.PeekNextChartSid() == SeriesTextRecord.sid) { seriesText = (SeriesTextRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == FrameRecord.sid) { frame = new FrameAggregate(rs, this); } if (rs.PeekNextChartSid() == ObjectLinkRecord.sid) { objectLink = (ObjectLinkRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == DataLabExtContentsRecord.sid) { dataLab = (DataLabExtContentsRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == CrtLayout12Record.sid) { crtLayout = (CrtLayout12Record)rs.GetNext(); } if (rs.PeekNextChartSid() == TextPropsStreamRecord.sid) { textProps = new TextPropsAggregate(rs, this); } if (rs.PeekNextChartSid() == CrtMlFrtRecord.sid) { crtMlFrt = new CrtMlFrtAggregate(rs, this); } Record r = rs.GetNext();//EndRecord Debug.Assert(r.GetType() == typeof(EndRecord)); }
private bool ReadARecord(RecordStream rs) { switch (rs.PeekNextSid()) { case HorizontalPageBreakRecord.sid: CheckNotPresent(_rowBreaksRecord); _rowBreaksRecord = (PageBreakRecord)rs.GetNext(); break; case VerticalPageBreakRecord.sid: CheckNotPresent(_columnBreaksRecord); _columnBreaksRecord = (PageBreakRecord)rs.GetNext(); break; case HeaderRecord.sid: CheckNotPresent(header); header = (HeaderRecord)rs.GetNext(); break; case FooterRecord.sid: CheckNotPresent(footer); footer = (FooterRecord)rs.GetNext(); break; case HCenterRecord.sid: CheckNotPresent(_hCenter); _hCenter = (HCenterRecord)rs.GetNext(); break; case VCenterRecord.sid: CheckNotPresent(_vCenter); _vCenter = (VCenterRecord)rs.GetNext(); break; case LeftMarginRecord.sid: CheckNotPresent(_leftMargin); _leftMargin = (LeftMarginRecord)rs.GetNext(); break; case RightMarginRecord.sid: CheckNotPresent(_rightMargin); _rightMargin = (RightMarginRecord)rs.GetNext(); break; case TopMarginRecord.sid: CheckNotPresent(_topMargin); _topMargin = (TopMarginRecord)rs.GetNext(); break; case BottomMarginRecord.sid: CheckNotPresent(_bottomMargin); _bottomMargin = (BottomMarginRecord)rs.GetNext(); break; case UnknownRecord.PLS_004D: // PLS _plsRecords.Add(new PLSAggregate(rs)); break; case PrintSetupRecord.sid: CheckNotPresent(printSetup); printSetup = (PrintSetupRecord)rs.GetNext(); break; case UnknownRecord.BITMAP_00E9: // BITMAP CheckNotPresent(_bitmap); _bitmap = rs.GetNext(); break; case UnknownRecord.PRINTSIZE_0033: CheckNotPresent(_printSize); _printSize = rs.GetNext(); break; case HeaderFooterRecord.sid: HeaderFooterRecord hf = (HeaderFooterRecord)rs.GetNext(); if (hf.IsCurrentSheet) { _headerFooter = hf; } else { _sviewHeaderFooters.Add(hf); } break; default: // all other record types are not part of the PageSettingsBlock return(false); } return(true); }
public ChartFormatsAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_CHARTFOMATS, container) { Debug.Assert(rs.PeekNextChartSid() == ChartRecord.sid); chart = (ChartRecord)rs.GetNext(); rs.GetNext(); while (rs.PeekNextChartSid() == FrtFontListRecord.sid) { fontList.Add(new FontListAggregate(rs, this)); } Debug.Assert(rs.PeekNextChartSid() == SCLRecord.sid); scl = (SCLRecord)rs.GetNext(); plotGrowth = (PlotGrowthRecord)rs.GetNext(); if (rs.PeekNextChartSid() == FrameRecord.sid) { frame = new FrameAggregate(rs, this); } while (rs.PeekNextChartSid() == SeriesRecord.sid) { seriesFormatList.Add(new SeriesFormatAggregate(rs, this)); } while (rs.PeekNextChartSid() == DataFormatRecord.sid) { ssList.Add(new SSAggregate(rs, this)); } Debug.Assert(rs.PeekNextChartSid() == ShtPropsRecord.sid); shtProps = (ShtPropsRecord)rs.GetNext(); while (rs.PeekNextChartSid() == DefaultTextRecord.sid || rs.PeekNextChartSid() == DataLabExtRecord.sid) { dftTextList.Add(new DFTTextAggregate(rs, this)); } Debug.Assert(rs.PeekNextChartSid() == AxesUsedRecord.sid); axesUsed = (AxesUsedRecord)rs.GetNext(); Debug.Assert(rs.PeekNextChartSid() == AxisParentRecord.sid); axisParent1 = new AxisParentAggregate(rs, this); if (rs.PeekNextChartSid() == AxisParentRecord.sid) { axisParent2 = new AxisParentAggregate(rs, this); } if (rs.PeekNextChartSid() == CrtLayout12ARecord.sid) { crt12A = (CrtLayout12ARecord)rs.GetNext(); } if (rs.PeekNextChartSid() == DatRecord.sid) { dat = new DatAggregate(rs, container); } if (rs.PeekNextChartSid() == TextRecord.sid) { while (rs.PeekNextChartSid() == TextRecord.sid) { attachedLabelList.Add(new AttachedLabelAggregate(rs, this)); } } if (rs.PeekNextChartSid() == CrtMlFrtRecord.sid) { crtMlFrt = new CrtMlFrtAggregate(rs, container); } while (rs.PeekNextChartSid() == DataLabExtRecord.sid || rs.PeekNextChartSid() == TextRecord.sid) { cfalList.Add(new ChartFormatsAttachedLabelAggregate(rs, this)); } if (rs.PeekNextChartSid() == TextPropsStreamRecord.sid) { textProps = new TextPropsAggregate(rs, container); } while (rs.PeekNextChartSid() == CrtMlFrtRecord.sid) { mlfrtList.Add(new CrtMlFrtAggregate(rs, container)); } Record r = rs.GetNext();//EndRecord Debug.Assert(r.GetType() == typeof(EndRecord)); }
public CRTAggregate(RecordStream rs, ChartRecordAggregate container) : base(RuleName_CRT, container) { chartForamt = (ChartFormatRecord)rs.GetNext(); rs.GetNext(); chartTypeRecord = rs.GetNext(); if (rs.PeekNextChartSid() == BopPopCustomRecord.sid) { bopPopCustom = (BopPopCustomRecord)rs.GetNext(); } crtLink = (CrtLinkRecord)rs.GetNext(); if (rs.PeekNextChartSid() == SeriesListRecord.sid) { seriesList = (SeriesListRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == Chart3dRecord.sid) { chart3d = (Chart3dRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == LegendRecord.sid) { ld = new LDAggregate(rs, this); } if (rs.PeekNextChartSid() == DropBarRecord.sid) { dropBar1 = new DropBarAggregate(rs, this); dropBar2 = new DropBarAggregate(rs, this); } while (rs.PeekNextChartSid() == CrtLineRecord.sid) { dicLines.Add((CrtLineRecord)rs.GetNext(), (LineFormatRecord)rs.GetNext()); } if (rs.PeekNextChartSid() == DataLabExtRecord.sid || rs.PeekNextChartSid() == DefaultTextRecord.sid) { dft1 = new DFTTextAggregate(rs, this); if (rs.PeekNextChartSid() == DataLabExtRecord.sid || rs.PeekNextChartSid() == DefaultTextRecord.sid) { dft2 = new DFTTextAggregate(rs, this); } } if (rs.PeekNextChartSid() == DataLabExtContentsRecord.sid) { dataLabExtContents = (DataLabExtContentsRecord)rs.GetNext(); } if (rs.PeekNextChartSid() == DataFormatRecord.sid) { ss = new SSAggregate(rs, this); } while (rs.PeekNextChartSid() == ShapePropsStreamRecord.sid) { shapeList.Add(new ShapePropsAggregate(rs, this)); } rs.GetNext(); }