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(); }
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(); }
protected void WriteStartBlock(RecordVisitor rv) { //1 //A StartBlock record MUST not be written if the record is preceded by a StartObject record //but not preceded by the matching EndObject record. That is, StartBlock and EndBlock pairs //MUST not belong to any collection defined by StartObject and EndObject. if (IsInStartObject) { return; } StartBlockRecord sbr = null; //2 //If there does not exist a StartBlock record with iObjectKind equal to 0x000D without //a matching EndBlock record, then a corresponding StartBlock record with iObjectKind //equal to 0x000D MUST be written. if (blocks.Count == 0) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Sheet); blocks.Push(sbr); rv.VisitRecord(sbr); } //3 //If the chart-specific future record exists in the sequence of records that conforms to //the DAT rule, and there does not exist a StartBlock record with iObjectKind equal to 0x0006 //without a matching EndBlock record, then a corresponding StartBlock record with iObjectKind //equal to 0x0006 MUST be written. If a StartBlock record is written because of rule number 2, //then this StartBlock record MUST be written immediately after that record. if (IsInRule(RuleName_DAT) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_DatRecord)) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_DatRecord); blocks.Push(sbr); rv.VisitRecord(sbr); } //4 //If the chart-specific future record is in a series, and there does not exist a StartBlock record //with iObjectKind equal to 0x000C without a matching EndBlock record, then a corresponding StartBlock //record with iObjectKind equal to 0x000C and iObjectInstance1 equal to the number of series prior to //this series in the current Sheet MUST be written. If any StartBlock records are written because of //rule number 2 or 3, then this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_SERIESFORMAT) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_Series)) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Series, 0, GetContainer <SeriesFormatAggregate>(RuleName_SERIESFORMAT).SeriesIndex); blocks.Push(sbr); rv.VisitRecord(sbr); } //5 //If the chart-specific future record exists in the sequence of records that conforms to the SS rule, //and there does not exist a StartBlock record with iObjectKind equal to 0x000E without a matching EndBlock //record, then a corresponding StartBlock record with iObjectKind equal to 0x000E, iObjectContext equal to //the yi field of the DataFormat record in the current SS rule, and iObjectInstance1 equal to the xi field //of the DataFormat record in the current SS rule MUST be written. If any StartBlock records are written //because of rule number 2, 3, or 4, then this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_SS) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_DataFormatRecord)) { SSAggregate ss = GetContainer <SSAggregate>(RuleName_SS); sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_DataFormatRecord, ss.DataFormat.SeriesIndex, ss.DataFormat.PointNumber); blocks.Push(sbr); rv.VisitRecord(sbr); } //6 //If the chart-specific future record is in a series, and is part of a collection defined by a Begin and End //pair written immediately after a LegendException record, and there does not exist a StartBlock record with //iObjectKind equal to 0x000A without a matching EndBlock record, then a corresponding StartBlock record with //iObjectKind equal to 0x000A and iObjectInstance1 equal to the iss field of the LegendException record in //the series MUST be written. If any StartBlock records are written because of rule number 2, 3, 4, or 5, //then this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_LEGENDEXCEPTION) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_LegendException)) { SeriesFormatAggregate.LegendExceptionAggregate le = GetContainer <SeriesFormatAggregate.LegendExceptionAggregate>(RuleName_LEGENDEXCEPTION); sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_LegendException, 0, le.LegendException.LegendEntry); blocks.Push(sbr); rv.VisitRecord(sbr); } //7 //If the chart-specific future record is in an axis group. and there does not exist a StartBlock record with //iObjectKind equal to 0x0000 without a matching EndBlock record, then a corresponding StartBlock record with //iObjectKind equal to 0x0000 and iObjectInstance1 equal to the iax field of the AxisParent record of the axis //group MUST be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, or 6, then //this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_AXISPARENT) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_AxisGroup)) { AxisParentAggregate ap = GetContainer <AxisParentAggregate>(RuleName_AXISPARENT); sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AxisGroup, 0, ap.AxisParent.AxisType); blocks.Push(sbr); rv.VisitRecord(sbr); } //8 //If the chart-specific future record is in a Chart Group, and there does not exist a StartBlock record with //iObjectKind equal to 0x0005 without a matching EndBlock record, then a corresponding StartBlock record with //iObjectKind equal to 0x0005 and iObjectInstance1 equal to the iax field of the AxisParent record of the axis //group MUST be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, 6, or 7, then //this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_CRT) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_ChartGroup)) { AxisParentAggregate ap = GetContainer <AxisParentAggregate>(RuleName_AXISPARENT); sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_ChartGroup, 0, ap.AxisParent.AxisType); blocks.Push(sbr); rv.VisitRecord(sbr); } //9 //If the chart-specific future record is in an axis, and there does not exist a StartBlock record with iObjectKind //equal to 0x0004 without a matching EndBlock record, then: if (IsInRule(RuleName_AXES) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_Axis)) { //If the chart-specific future record exists in the sequence of records that conforms to the IVAXIS rule, //then a corresponding StartBlock record with iObjectKind equal to 0x0004 and iObjectInstance1 equal to //0x0000 MUST be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, 6, 7, //or 8, then this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_IVAXIS)) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Axis, 0, 0); blocks.Push(sbr); rv.VisitRecord(sbr); } //If the chart-specific future record exists in the sequence of records that conforms to the SERIESAXIS rule, //then a corresponding StartBlock record with iObjectKind equal to 0x0004 and iObjectInstance1 equal to 0x0002 //MUST be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, 6, 7, or 8, then //this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_SERIESAXIS)) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Axis, 0, 2); blocks.Push(sbr); rv.VisitRecord(sbr); } //If the chart-specific future record exists in the sequence of records that conforms to the DVAXIS rule, and //wType of the Axis record in the sequence of records that conforms to the DVAXIS rule is equal to 0, then a //corresponding StartBlock record with iObjectKind equal to 0x0004 and iObjectInstance1 equal to 0x0001 MUST //be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, 6, 7, or 8, then this //StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_DVAXIS)) { DVAxisAggregate dva = GetContainer <DVAxisAggregate>(RuleName_DVAXIS); if (dva.Axis.AxisType == AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Axis, 0, 1); } else { //If the chart-specific future record exists in the sequence of records that conforms to the DVAXIS rule, and //wType of the Axis record in the sequence of records that conforms to the DVAXIS rule is equal to 1, then a //corresponding StartBlock record with iObjectKind equal to 0x0004 and iObjectInstance1 equal to 0x0003 MUST //be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, 6, 7, or 8, then this //StartBlock record MUST be written immediately after those records. sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Axis, 0, 3); } blocks.Push(sbr); rv.VisitRecord(sbr); } } //10 //If the chart-specific future record exists in the sequence of records that conforms to the DROPBAR rule, and //there does not exist a StartBlock record with iObjectKind equal to 0x000F without a matching EndBlock record, //then a corresponding StartBlock record with iObjectKind equal to 0x000F and iObjectInstance1 equal to one less //than the number of DropBar records written prior to the chart-specific future record in the current Chart Group //MUST be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, 6, 7, 8, or 9, then //this StartBlock record MUST be written immediately after those records. if (IsInRule(RuleName_DROPBAR) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_DropBarRecord)) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_DropBarRecord); blocks.Push(sbr); rv.VisitRecord(sbr); } //11 //If the chart-specific future record is in a legend and there does not exist a StartBlock record with iObjectKind //equal to 0x0009 without a matching EndBlock record, then: if (IsInRule(RuleName_LD) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_Legend)) { if (IsInRule(RuleName_CRT)) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Legend, 1); //If the chart-specific future record is in a chart group, then a corresponding StartBlock record with iObjectKind //equal to 0x0009 and iObjectContext equal to 0x0001 MUST be written. If any StartBlock records are written because //of rule number 2, 3, 4, 5, 6, 7, 8, 9, or 10, then this StartBlock record MUST be written immediately after those //records. } else { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Legend, 0); //If the chart-specific future record is not in a chart group, then a corresponding StartBlock record with iObjectKind //equal to 0x0009 and iObjectContext equal to 0x0000 MUST be written. If any StartBlock records are written because //of rule number 2, 3, 4, 5, 6, 7, 8, 9, or 10, then this StartBlock record MUST be written immediately after those //records. } blocks.Push(sbr); rv.VisitRecord(sbr); } //12 //If the chart-specific future record is in an attached label, and there does not exist a StartBlock record with iObjectKind //equal to 0x0002 without a matching EndBlock record, then: if (IsInRule(RuleName_ATTACHEDLABEL) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord)) { if (IsInRule(RuleName_DFTTEXT)) { //If the chart-specific future record exists in the sequence of records that conforms to the DFTTEXT rule of a //chart group, and the id field of the DefaultText record in the sequence of records that conforms to the DFTTEXT //rule is greater than or equal to 0x0002, then a corresponding StartBlock record with iObjectKind equal to 0x0002, //iObjectContext equal to 0x0002, and iObjectInstance1 equal to 0xFFFF MUST be written. If any StartBlock records //are written because of rule number 2, 3, 4, 5, 6, 7, 8, 9, 10, or 11, then this StartBlock record MUST be written //immediately after those records. Else, DFTTextAggregate dft = GetContainer <DFTTextAggregate>(RuleName_DFTTEXT); if (IsInRule(RuleName_CRT) && (int)dft.DefaultText.FormatType >= 2) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord, 2, unchecked ((short)0xFFFF)); } //If the chart-specific future record exists in the sequence of records that conforms to the DFTTEXT rule of a //chart group, then a corresponding StartBlock record with iObjectKind equal to 0x0002, iObjectContext equal to //0x0002, and iObjectInstance1 equal to the id field of the DefaultText record in the sequence of records that //conforms to the DFTTEXT rule MUST be written. If any StartBlock records are written because of rule number //2, 3, 4, 5, 6, 7, 8, 9, 10, or 11, then this StartBlock record MUST be written immediately after those records. Else, else { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord, 2, (short)dft.DefaultText.FormatType); } } else { AttachedLabelAggregate ala = GetContainer <AttachedLabelAggregate>(RuleName_ATTACHEDLABEL); //If the wLinkVar1 of the ObjectLink record of the attached label is equal to 0x0003, then a corresponding //StartBlock record with iObjectKind equal to 0x0002, iObjectContext equal to 0x0004 and iObjectInstance1 //equal to 0x0000 MUST be written. If any StartBlock records are written because of rules number 2, 3, 4, //5, 6, 7, 8, 9, 10 or 11, then this StartBlock record MUST be written immediately after those records. Else, if (ala.ObjectLink.Link1 == 3) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord, 4, 0); } //If the wLinkVar1 of the ObjectLink record of the attached label is equal to 0x0002, then a corresponding //StartBlock record with iObjectKind equal to 0x0002, iObjectContext equal to 0x0004 and iObjectInstance1 //equal to 0x0001 MUST be written. If any StartBlock records are written because of rules number 2, 3, 4, //5, 6, 7, 8, 9, 10 or 11, then this StartBlock record MUST be written immediately after those records. Else, else if (ala.ObjectLink.Link1 == 2) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord, 4, 1); } //If the wLinkVar1 of the ObjectLink record of the attached label is equal to 0x0007, then a corresponding //StartBlock record with iObjectKind equal to 0x0002, iObjectContext equal to 0x0004, and iObjectInstance1 //equal to 0x0002 MUST be written. If any StartBlock records are written because of rule number 2, 3, 4, 5, //6, 7, 8, 9, 10, or 11, then this StartBlock record MUST be written immediately after those records. Else, else if (ala.ObjectLink.Link1 == 7) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord, 4, 2); } else if (ala.IsFirst) { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord, 0); } //If the chart-specific future record is in the first attached label of a chart sheet, then a corresponding //StartBlock record with iObjectKind equal to 0x0002 and iObjectContext equal to 0x0000 MUST be written. If //any StartBlock records are written because of rule number 2, 3, 4, 5, 6, 7, 8, 9, 10, or 11, then this //StartBlock record MUST be written immediately after those records. Else, else { sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_AttachedLabelRecord, 5, ala.ObjectLink.Link1, ala.ObjectLink.Link2); } //If the chart-specific future record is not in the first attached label of a chart sheet, then a corresponding //StartBlock record with iObjectKind equal to 0x0002 and iObjectContext equal to 0x0005, iObjectInstance1 //equal to wLinkVar1 of the ObjectLink record of the attached label and iObjectInstance2 equal to wLinkVar2 //of the ObjectLink record of the attached label MUST be written. If any StartBlock records are written //because of rule number 2, 3, 4, 5, 6, 7, 8, 9, 10, or 11, then this StartBlock record MUST be written //immediately after those records. } blocks.Push(sbr); rv.VisitRecord(sbr); } //13 //If the chart-specific future record exists in the sequence of records that conforms to the FRAME rule, and there //does not exist a StartBlock record with iObjectKind equal to 0x0007 without a matching EndBlock record, then: if (IsInRule(RuleName_FRAME) && !blocks.IsExistsStartBlock(StartBlockRecord.ObjectKind_Frame)) { if (IsInRule(RuleName_ATTACHEDLABEL) || IsInRule(RuleName_LD)) { //If the chart-specific future record is in an attached label or legend, then a corresponding StartBlock record //with iObjectKind equal to 0x0007, iObjectContext equal to 0x0000, and iObjectInstance1 equal to 0x0000 MUST be //written. If any StartBlock records are written because of rules number 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12, //then this StartBlock record MUST be written immediately after those records. Else, sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Frame, 0, 0); } else if (IsInRule(RuleName_AXES)) { //If the chart-specific future record exists in the sequence of records that conforms to the AXES rule, then a //corresponding StartBlock record with iObjectKind equal to 0x0007, iObjectContext equal to 0x0001, and //iObjectInstance1 equal to 0x0000 MUST be written. If any StartBlock records are written because of rule number //2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12, then this StartBlock record MUST be written immediately after //those records. Else, sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Frame, 1, 0); } else if (IsInRule(RuleName_CHARTSHEET)) { //If the chart-specific future record is in a Sheet, then a corresponding StartBlock record with iObjectKind //equal to 0x0007, iObjectContext equal to 0x0002, and iObjectInstance1 equal to 0x0000 MUST be written. If any //StartBlock records are written because of rule number 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12, then this StartBlock //record MUST be written immediately after those records. sbr = StartBlockRecord.CreateStartBlock(StartBlockRecord.ObjectKind_Frame, 2, 0); } blocks.Push(sbr); rv.VisitRecord(sbr); } }