protected override CalcExpression VisitCellExpression(CalcCellExpression expr, int baseRow, int baseColumn) { int num2; int num4; if (base.OffsetExternalOnly) { return(expr); } if (this._isFullBand && ((this._isRow && expr.RowRelative) || (!this._isRow && expr.ColumnRelative))) { return(expr); } CalcCellIdentity id = expr.GetId(baseRow, baseColumn) as CalcCellIdentity; int oldIndex = this._isRow ? id.RowIndex : id.ColumnIndex; this.GetCellOffset(oldIndex, out num2); int num3 = this._isRow ? baseRow : baseColumn; this.GetCellOffset(num3, out num4); if (num2 == -2147483648) { return(new CalcErrorExpression(CalcErrors.Reference)); } int row = num2 - oldIndex; if ((this._isRow && expr.RowRelative) || (!this._isRow && expr.ColumnRelative)) { row -= num4 - num3; } if (row == 0) { return(base.VisitCellExpression(expr, baseRow, baseColumn)); } if (this._isRow) { return(expr.Offset(row, 0, true, !this.OffsetAbsoluteOnly)); } return(expr.Offset(0, row, true, !this.OffsetAbsoluteOnly)); }
protected override CalcExpression VisitCellExpression(CalcCellExpression expr, int baseRow, int baseColumn) { CalcCellIdentity id = expr.GetId(baseRow, baseColumn) as CalcCellIdentity; if (!this._isCopy || !this._offsetForDependency) { if (this._offsetForDependency) { if ((((id.RowIndex + this._rowOffset) < 0) || ((id.ColumnIndex + this._columnOffset) < 0)) || (((id.RowIndex + this._rowOffset) >= this._rowCount) || ((id.ColumnIndex + this._columnOffset) >= this._columnCount))) { return(new CalcErrorExpression(CalcErrors.Reference)); } if (this.NeedMove(id.RowIndex, id.ColumnIndex, -1, -1)) { expr = expr.Offset(this._rowOffset, this._columnOffset, this._offsetForDependency, true) as CalcCellExpression; } } else if (!this._isCopy) { if (!expr.RowRelative) { this._rowOffset = 0; } if (!expr.ColumnRelative) { this._columnOffset = 0; } if (this.NeedMove(baseRow, baseColumn, -1, -1)) { expr = expr.Offset(-this._rowOffset, -this._columnOffset, false, true) as CalcCellExpression; } } if (this._convertToExternal) { return(new CalcExternalCellExpression(this._extSource, expr.Row, expr.Column, expr.RowRelative, expr.ColumnRelative)); } } return(expr); }
protected override CalcExpression VisitCellExpression(CalcCellExpression expr, int baseRow, int baseColumn) { return(expr.Offset(this._rowOffset, this._colOffset, false, true)); }