public override object GetReference(CalcIdentity id) { int num; object reference = base.GetReference(id); CalcStructReferenceIndentity indentity = id as CalcStructReferenceIndentity; if (((indentity != null) && (reference is SpreadCalcReference)) && this.TryParseColumnIndex(indentity.ToString(), out num)) { return(((SpreadCalcReference)reference).Clone(this.table.DataRange.Row, this.table.DataRange.Column + num, this.table.DataRange.RowCount, 1)); } return(reference); }
public override bool IsIntersected(CalcIdentity srcId, CalcIdentity destId) { if (!object.ReferenceEquals(srcId, destId)) { int num; int num2; CalcStructReferenceIndentity indentity = srcId as CalcStructReferenceIndentity; if ((indentity != null) && this.TryParseColumnIndex(indentity.ToString(), out num)) { srcId = new CalcRangeIdentity(this.table.DataRange.Row, this.table.DataRange.Column + num, this.table.DataRange.RowCount, 1); } CalcStructReferenceIndentity indentity2 = destId as CalcStructReferenceIndentity; if ((indentity2 != null) && this.TryParseColumnIndex(indentity2.ToString(), out num2)) { destId = new CalcRangeIdentity(this.table.DataRange.Row, this.table.DataRange.Column + num2, this.table.DataRange.RowCount, 1); } } return(base.IsIntersected(srcId, destId)); }
static CalcIdentity GetActualId(CalcIdentity id) { if (id is ConditionalGraph.ConditionalIdentity) { ConditionalGraph.ConditionalIdentity identity = id as ConditionalGraph.ConditionalIdentity; if (identity.OldActualIdentity == null) { return(identity.ActualIdentity); } return(identity.OldActualIdentity); } if (!(id is ConditionalGraph.ExternalConditionalIdentity)) { return(id); } ConditionalGraph.ExternalConditionalIdentity identity2 = id as ConditionalGraph.ExternalConditionalIdentity; if (identity2.OldActualIdentity == null) { return(identity2.ActualIdentity); } return(identity2.OldActualIdentity); }
public static void Identity2Indexs(CalcIdentity id, out int startRow, out int startColumn, out int lastRow, out int lastColumn) { if (id is CalcCellIdentity) { CalcCellIdentity identity = id as CalcCellIdentity; startRow = identity.RowIndex; startColumn = identity.ColumnIndex; lastRow = identity.RowIndex; lastColumn = identity.ColumnIndex; } else if (id is CalcExternalCellIdentity) { CalcExternalCellIdentity identity2 = id as CalcExternalCellIdentity; startRow = identity2.RowIndex; startColumn = identity2.ColumnIndex; lastRow = identity2.RowIndex; lastColumn = identity2.ColumnIndex; } else if (id is CalcRangeIdentity) { CalcRangeIdentity identity3 = id as CalcRangeIdentity; if (identity3.IsFullRow) { startColumn = -1; lastColumn = -1; } else { startColumn = identity3.ColumnIndex; lastColumn = (identity3.ColumnIndex + identity3.ColumnCount) - 1; } if (identity3.IsFullColumn) { startRow = -1; lastRow = -1; } else { startRow = identity3.RowIndex; lastRow = (identity3.RowIndex + identity3.RowCount) - 1; } } else if (id is CalcExternalRangeIdentity) { CalcExternalRangeIdentity identity4 = id as CalcExternalRangeIdentity; if (identity4.IsFullRow) { startColumn = -1; lastColumn = -1; } else { startColumn = identity4.ColumnIndex; lastColumn = (identity4.ColumnIndex + identity4.ColumnCount) - 1; } if (identity4.IsFullColumn) { startRow = -1; lastRow = -1; } else { startRow = identity4.RowIndex; lastRow = (identity4.RowIndex + identity4.RowCount) - 1; } } else if (id is CalcSheetRangeIdentity) { CalcSheetRangeIdentity identity5 = id as CalcSheetRangeIdentity; if (identity5.IsFullRow) { startColumn = -1; lastColumn = -1; } else { startColumn = identity5.ColumnIndex; lastColumn = (identity5.ColumnIndex + identity5.ColumnCount) - 1; } if (identity5.IsFullColumn) { startRow = -1; lastRow = -1; } else { startRow = identity5.RowIndex; lastRow = (identity5.RowIndex + identity5.RowCount) - 1; } } else { startRow = -1; startColumn = -1; lastRow = -1; lastColumn = -1; } }
static void GetChangingIds(IFormulaOperatorSource mgr, bool row, ChangingContext context, OperatorExpressionVisistor visitor, bool updateDependents) { foreach (CalcLocalIdentity identity in mgr.GetAllLocalIdentities()) { CalcIdentity id = identity; if (identity is ConditionalGraph.ConditionalIdentity) { ConditionalGraph.ConditionalIdentity identity3 = identity as ConditionalGraph.ConditionalIdentity; id = (identity3.OldActualIdentity != null) ? identity3.OldActualIdentity : identity3.ActualIdentity; } CalcNode node = mgr.GetNode(id); if ((node == null) || (node.OwnerNode == null)) { CalcCellIdentity identity4 = id as CalcCellIdentity; CalcRangeIdentity identity5 = id as CalcRangeIdentity; CalcExpression expression = mgr.GetExpression(identity); CalcLocalIdentity identity6 = null; int oldStart = -2147483648; int oldEnd = -2147483648; int newEnd = -2147483648; if (identity4 != null) { oldStart = row ? identity4.RowIndex : identity4.ColumnIndex; } else if (identity5 != null) { if (identity5.IsFullRow && identity5.IsFullColumn) { identity6 = identity; oldStart = 0; } else if ((identity5.IsFullRow && !row) || (identity5.IsFullColumn && row)) { if (node != null) { context.InvalidateFormula(mgr, identity5); } if (((node == null) || (node.Dependents == null)) || ((node.Dependents.Count == 0) || !updateDependents)) { continue; } InvalidateNode(mgr, context, node); } else { oldStart = row ? identity5.RowIndex : identity5.ColumnIndex; oldEnd = row ? ((identity5.RowIndex + identity5.RowCount) - 1) : ((identity5.ColumnIndex + identity5.ColumnCount) - 1); } } if (oldStart != -2147483648) { if (identity6 == null) { int num2; if (identity5 != null) { visitor.GetRangeOffset(oldStart, oldEnd, out num2, out newEnd); if ((num2 == oldStart) && (newEnd == oldEnd)) { continue; } if ((num2 == -2147483648) || (newEnd == -2147483648)) { expression = null; } else if (identity5.IsFullRow && row) { identity6 = new CalcRangeIdentity(num2, (newEnd - num2) + 1, true); } else if (identity5.IsFullColumn && !row) { identity6 = new CalcRangeIdentity(num2, (newEnd - num2) + 1, false); } else if (row) { identity6 = new CalcRangeIdentity(num2, identity5.ColumnIndex, (newEnd - num2) + 1, identity5.ColumnCount); } else { identity6 = new CalcRangeIdentity(identity5.RowIndex, num2, identity5.RowCount, (newEnd - num2) + 1); } } else if (identity4 != null) { visitor.GetCellOffset(oldStart, out num2); if (num2 == oldStart) { continue; } if (num2 == -2147483648) { expression = null; } else if (identity4 != null) { identity6 = row ? new CalcCellIdentity(num2, identity4.ColumnIndex) : new CalcCellIdentity(identity4.RowIndex, num2); } } } context.ChangingIdentities[identity] = identity; if (expression != null) { identity6 = (identity is ConditionalGraph.ConditionalIdentity) ? identity : identity6; context.ChangedFormulas[identity6] = new Tuple <CalcLocalIdentity, CalcExpression>(identity, expression); } } } } }
public CalcNode GetNode(CalcIdentity id) { return(this.Manager.Graph.GetNode(id)); }