public void AddRule(FormattingRuleBase rule) { if (rule is IConditionalFormula) { this.AddConditionsByRange(rule.Ranges, new IConditionalFormula[] { rule as IConditionalFormula }); } else if (rule is ScaleRule) { this.AddScaleRuleCondition(rule as ScaleRule); } else if (rule is CellValueRule) { this.AddCellValueRuleCondtion(rule as CellValueRule); } else if (rule is IconSetRule) { this.AddIconSetRuleCondition(rule as IconSetRule); } else { IConditionalFormula[] formulaConditions = rule.FormulaConditions; if ((formulaConditions != null) && (formulaConditions.Length > 0)) { this.AddConditionsByRange(rule.Ranges, formulaConditions); } } rule.ConditionChanged += new EventHandler <ConditionChangedEventArgs>(this.rule_ConditionChanged); }
/// <summary> /// Creates a new object that is a copy of the current instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> public virtual object Clone() { FormattingRuleBase base2 = Activator.CreateInstance(base.GetType()) as FormattingRuleBase; if (this.ranges != null) { List <CellRange> list = new List <CellRange>(); foreach (CellRange range in this.ranges) { list.Add(new CellRange(range.Row, range.Column, range.RowCount, range.ColumnCount)); } base2.ranges = list.ToArray(); } base2.style = (this.style == null) ? null : new StyleInfo(this.style); return(base2); }
void rule_ConditionChanged(object sender, ConditionChangedEventArgs e) { FormattingRuleBase base2 = sender as FormattingRuleBase; if (base2 != null) { if ((e.OldConditionalFormulas != null) && (e.OldConditionalFormulas.Length > 0)) { this.RemoveConditionsByRange(base2.Ranges, e.OldConditionalFormulas); } else if ((e.NewConditionalFormulas != null) && (e.NewConditionalFormulas.Length > 0)) { this.AddConditionsByRange(base2.Ranges, e.NewConditionalFormulas); } } }
public void RemoveRule(FormattingRuleBase rule) { rule.ConditionChanged -= new EventHandler <ConditionChangedEventArgs>(this.rule_ConditionChanged); if (rule is IConditionalFormula) { this.RemoveConditionsByRange(rule.Ranges, new IConditionalFormula[] { rule as IConditionalFormula }); } else if (rule is ScaleRule) { this.RemoveScaleRuleCondition(rule as ScaleRule); } else if (rule is CellValueRule) { this.RemoveCellVauleRuleCondition(rule as CellValueRule); } else if (rule is IconSetRule) { this.RemoveIconSetRuleCondition(rule as IconSetRule); } else { this.RemoveCondition(rule.Ranges, rule.Condition); } }
public RulesChangedEventArgs(FormattingRuleBase rule, RulesChangedAction action) { this.Rule = rule; this.Action = action; }