コード例 #1
0
 public DataValidationConditionalGraph(ICalcSource source, Dt.Cells.Data.ReferenceStyle referenceStyle, int sheetRowCount, int sheetColumnCount)
 {
     this._source           = source;
     this._referenceStyle   = referenceStyle;
     this._sheetRowCount    = sheetRowCount;
     this._sheetColumnCount = sheetColumnCount;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcRangeExpression" /> class.
 /// </summary>
 /// <param name="source">The owner of cell range.</param>
 /// <param name="startRow">Starting row coordinate of the range.</param>
 /// <param name="startColumn">Starting column coordinate of the range.</param>
 /// <param name="endRow">Ending row coordinate of the range.</param>
 /// <param name="endColumn">Ending column coordinate of the range.</param>
 /// <param name="startRowRelative">Whether the start row coordinate is relative or absolute.</param>
 /// <param name="startColumnRelative">Whether the start column coordinate is relative or absolute.</param>
 /// <param name="endRowRelative">Whether the end row coordinate is relative or absolute.</param>
 /// <param name="endColumnRelative">Whether end column coordinate is relative or absolute.</param>
 public CalcExternalRangeExpression(ICalcSource source, int startRow, int startColumn, int endRow, int endColumn, bool startRowRelative, bool startColumnRelative, bool endRowRelative, bool endColumnRelative) : base(source)
 {
     if ((startRowRelative == endRowRelative) && (startRow > endRow))
     {
         this._startRow         = endRow;
         this._endRow           = startRow;
         this._startRowRelative = endRowRelative;
         this._endRowRelative   = startRowRelative;
     }
     else
     {
         this._startRow         = startRow;
         this._endRow           = endRow;
         this._startRowRelative = startRowRelative;
         this._endRowRelative   = endRowRelative;
     }
     if ((startColumnRelative == endColumnRelative) && (startColumn > endColumn))
     {
         this._startColumn         = endColumn;
         this._endColumn           = startColumn;
         this._startColumnRelative = endColumnRelative;
         this._endColumnRelative   = startColumnRelative;
     }
     else
     {
         this._startColumn         = startColumn;
         this._endColumn           = endColumn;
         this._startColumnRelative = startColumnRelative;
         this._endColumnRelative   = endColumnRelative;
     }
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcRangeExpression" /> class.
 /// </summary>
 /// <param name="startSource">Starting owner of cell range.</param>
 /// <param name="endSource">Ending owner of cell range.</param>
 /// <param name="startRow">Starting row coordinate of the range.</param>
 /// <param name="startColumn">Starting column coordinate of the range.</param>
 /// <param name="endRow">Ending row coordinate of the range.</param>
 /// <param name="endColumn">Ending column coordinate of the range.</param>
 /// <param name="startRowRelative">Whether the start row coordinate is relative or absolute.</param>
 /// <param name="startColumnRelative">Whether the start column coordinate is relative or absolute.</param>
 /// <param name="endRowRelative">Whether the end row coordinate is relative or absolute.</param>
 /// <param name="endColumnRelative">Whether end column coordinate is relative or absolute.</param>
 public CalcSheetRangeExpression(ICalcSource startSource, ICalcSource endSource, int startRow, int startColumn, int endRow, int endColumn, bool startRowRelative, bool startColumnRelative, bool endRowRelative, bool endColumnRelative)
 {
     this._startSource = startSource;
     this._endSource   = endSource;
     if (((startRowRelative == endRowRelative) && (startRow > endRow)) && (endRow != -2147483648))
     {
         this._startRow         = endRow;
         this._endRow           = startRow;
         this._startRowRelative = endRowRelative;
         this._endRowRelative   = startRowRelative;
     }
     else
     {
         this._startRow          = startRow;
         this._endRow            = endRow;
         this._startRowRelative  = startRowRelative;
         this._endColumnRelative = endColumnRelative;
     }
     if (((startColumnRelative == endColumnRelative) && (startColumn > endColumn)) && (endColumn != -2147483648))
     {
         this._startColumn         = endColumn;
         this._endColumn           = startColumn;
         this._startColumnRelative = endColumnRelative;
         this._endColumnRelative   = startColumnRelative;
     }
     else
     {
         this._startColumn         = startColumn;
         this._endColumn           = endColumn;
         this._startColumnRelative = startColumnRelative;
         this._endRowRelative      = endRowRelative;
     }
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.CalcRangeIdentity" /> class.
 /// </summary>
 /// <param name="source">
 /// The owner which contains the cell range.
 /// </param>
 /// <param name="rowIndex">Row index of first cell in the range</param>
 /// <param name="columnIndex">Column index of first cell in the range</param>
 /// <param name="rowCount">Number of rows in the range</param>
 /// <param name="columnCount">Number of columns in the range</param>
 public CalcExternalRangeIdentity(ICalcSource source, int rowIndex, int columnIndex, int rowCount, int columnCount) : base(source)
 {
     this.RowIndex    = rowIndex;
     this.ColumnIndex = columnIndex;
     this.RowCount    = rowCount;
     this.ColumnCount = columnCount;
 }
コード例 #5
0
 public DirtyItem(CalcService service, ICalcSource source, CalcLocalIdentity id, CalcNode node)
 {
     this.Service = service;
     this.Source  = source;
     this.Id      = id;
     this.Node    = node;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcExternalCellExpression" /> class.
 /// </summary>
 /// <param name="source">The owner of cell.</param>
 /// <param name="row">Row coordinate of cell.</param>
 /// <param name="column">Column coordinate of cell.</param>
 /// <param name="rowRelative">Whether row coordinate is relative.</param>
 /// <param name="columnRelative">Whether the column coordinate is relative.</param>
 public CalcExternalCellExpression(ICalcSource source, int row, int column, bool rowRelative, bool columnRelative) : base(source)
 {
     this._row            = row;
     this._column         = column;
     this._rowRelative    = rowRelative;
     this._columnRelative = columnRelative;
 }
コード例 #7
0
ファイル: CalcNode.cs プロジェクト: Daoting/dt
 internal static CalcNode CreateTempNode(ICalcSource source, CalcIdentity id)
 {
     return(new CalcNode(source, id)
     {
         _isTempNode = true
     });
 }
コード例 #8
0
ファイル: CalcNode.cs プロジェクト: Daoting/dt
 public ReferencePredenceVisitor(ICalcSource source, int baseRow, int baseColumn)
 {
     this._source     = source;
     this._baseRow    = baseRow;
     this._BaseColumn = baseColumn;
     this.PredenceIds = new Dictionary <CalcLocalIdentity, bool>();
 }
コード例 #9
0
 static bool SameSource(ICalcSource source, CalcExpression exp)
 {
     if (exp is CalcExternalExpression)
     {
         return(source == ((CalcExternalExpression)exp).Source);
     }
     return(true);
 }
コード例 #10
0
        public void RemoveSheet(IList sources, ICalcSource replacedSource)
        {
            ICalcSource currentSource = this.Manager.Source;
            Dictionary <CalcCalculationManager, Dictionary <CalcLocalIdentity, CalcExpression> > dictionary = new Dictionary <CalcCalculationManager, Dictionary <CalcLocalIdentity, CalcExpression> >();

            foreach (object obj2 in sources)
            {
                ICalcSource source = obj2 as ICalcSource;
                if (source != null)
                {
                    CalcCalculationManager manager = this.Manager.Service.GetCalculationManager(source, null, true);
                    if (manager != null)
                    {
                        foreach (CalcLocalIdentity identity in manager.Graph.GetAllSheetRangeIdentities())
                        {
                            CalcNode node = manager.Graph.GetNode(identity);
                            if (node.Precedents != null)
                            {
                                using (List <CalcNode> .Enumerator enumerator3 = node.Precedents.GetEnumerator())
                                {
                                    while (enumerator3.MoveNext())
                                    {
                                        if (enumerator3.Current.Source == currentSource)
                                        {
                                            Dictionary <CalcLocalIdentity, CalcExpression> dictionary2;
                                            if (!dictionary.TryGetValue(manager, out dictionary2))
                                            {
                                                dictionary2         = new Dictionary <CalcLocalIdentity, CalcExpression>();
                                                dictionary[manager] = dictionary2;
                                            }
                                            dictionary2[identity] = manager.GetExpression(identity);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            RemoveSheetVisitor visitor = new RemoveSheetVisitor(currentSource, replacedSource);

            foreach (KeyValuePair <CalcCalculationManager, Dictionary <CalcLocalIdentity, CalcExpression> > pair in dictionary)
            {
                CalcCalculationManager mgr = pair.Key;
                foreach (KeyValuePair <CalcLocalIdentity, CalcExpression> pair2 in pair.Value)
                {
                    int num;
                    int num2;
                    int num3;
                    int num4;
                    mgr.ClearExpression(pair2.Key);
                    FormulaOperatorHelper.Identity2Indexs(pair2.Key, out num, out num2, out num3, out num4);
                    CalcExpression expr = visitor.Visit(pair2.Value, num, num2);
                    CalcExpressionHelper.SetExpression(mgr, pair2.Key, expr, true);
                    mgr.Invalidate(pair2.Key, false);
                }
            }
        }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcRangeExpression" /> class.
 /// </summary>
 /// <param name="source">The owner of cell range.</param>
 public CalcExternalRangeExpression(ICalcSource source) : base(source)
 {
     this._startRow     = -2147483648;
     this._endRow       = -2147483648;
     this._startColumn  = -2147483648;
     this._endColumn    = -2147483648;
     this._isFullRow    = true;
     this._isFullColumn = true;
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.CalcRangeIdentity" /> class.
 /// </summary>
 /// <param name="source">
 /// The owner which contains the cell range.
 /// </param>
 public CalcExternalRangeIdentity(ICalcSource source) : base(source)
 {
     this.RowIndex      = -1;
     this.ColumnIndex   = -1;
     this.RowCount      = -1;
     this.ColumnCount   = -1;
     this._isFullRow    = true;
     this._isFullColumn = true;
 }
コード例 #13
0
ファイル: CalcReferenceHelper.cs プロジェクト: Daoting/dt
        internal static void Id2Range(ICalcSource source, CalcIdentity Id, out int row, out int col, out int rowCount, out int colCount, out bool searchRange)
        {
            int num;
            int num2;

            colCount    = num = 1;
            rowCount    = num2 = num;
            row         = col = num2;
            searchRange = false;
            CalcCellIdentity  objA      = Id as CalcCellIdentity;
            CalcRangeIdentity identity2 = Id as CalcRangeIdentity;

            if (!object.ReferenceEquals(objA, null))
            {
                row         = objA.RowIndex;
                col         = objA.ColumnIndex;
                rowCount    = colCount = 1;
                searchRange = true;
            }
            else if (!object.ReferenceEquals(identity2, null))
            {
                if (identity2.IsFullColumn || identity2.IsFullRow)
                {
                    CalcReference reference = source.GetReference(identity2) as CalcReference;
                    row      = reference.GetRow(0);
                    col      = reference.GetColumn(0);
                    rowCount = reference.GetRowCount(0);
                    colCount = reference.GetColumnCount(0);
                }
                if (identity2.IsFullRow)
                {
                    row      = identity2.RowIndex;
                    rowCount = identity2.RowCount;
                }
                else if (identity2.IsFullColumn)
                {
                    col      = identity2.ColumnIndex;
                    colCount = identity2.ColumnCount;
                }
                else
                {
                    row      = identity2.RowIndex;
                    rowCount = identity2.RowCount;
                    col      = identity2.ColumnIndex;
                    colCount = identity2.ColumnCount;
                }
                searchRange = true;
            }
            else
            {
                int num5;
                int num6;
                colCount = num5 = 0;
                rowCount = num6 = num5;
                row      = col = num6;
            }
        }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.CalcRangeIdentity" /> class.
 /// </summary>
 /// <param name="startSource">Starting owner of cell range.</param>
 /// <param name="endSource">Ending owner of cell range.</param>
 /// <param name="rowIndex">Row index of first cell in the range</param>
 /// <param name="columnIndex">Column index of first cell in the range</param>
 /// <param name="rowCount">Number of rows in the range</param>
 /// <param name="columnCount">Number of columns in the range</param>
 public CalcSheetRangeIdentity(ICalcSource startSource, ICalcSource endSource, int rowIndex, int columnIndex, int rowCount, int columnCount)
 {
     this.StartSource = startSource;
     this.EndSource   = endSource;
     this.RowIndex    = rowIndex;
     this.ColumnIndex = columnIndex;
     this.RowCount    = rowCount;
     this.ColumnCount = columnCount;
 }
コード例 #15
0
ファイル: CalcEvaluatorContext.cs プロジェクト: Daoting/dt
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.CalcEvaluatorContext" /> class.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="arrayFormulaMode">if set to <c>true</c> [array formula mode].</param>
 /// <param name="baseRowIndex">Index of the base row.</param>
 /// <param name="baseColumnIndex">Index of the base column.</param>
 /// <param name="rowCount">The row count.</param>
 /// <param name="columnCount">The column count.</param>
 public CalcEvaluatorContext(ICalcSource source, bool arrayFormulaMode = false, int baseRowIndex = 0, int baseColumnIndex = 0, int rowCount = 1, int columnCount = 1)
 {
     this.Source           = source;
     this.ArrayFormulaMode = arrayFormulaMode;
     this.Row         = baseRowIndex;
     this.Column      = baseColumnIndex;
     this.RowCount    = rowCount;
     this.ColumnCount = columnCount;
 }
コード例 #16
0
ファイル: WorksheetCollection.cs プロジェクト: Daoting/dt
        /// <summary>
        /// Removes the worksheet from workbook.
        /// </summary>
        /// <param name="workbook">The workbook.</param>
        /// <param name="worksheet">The worksheet.</param>
        internal static void RemoveWorksheetFromWorkbook(Dt.Cells.Data.Workbook workbook, Worksheet worksheet)
        {
            int         index          = workbook.Sheets.IndexOf(worksheet);
            int         num2           = (index == (workbook.Sheets.Count - 1)) ? (workbook.Sheets.Count - 2) : (index + 1);
            ICalcSource replacedSource = (num2 == -1) ? null : ((ICalcSource)workbook.Sheets[num2]);

            workbook.Sheets[index].CalcAxial.RemoveSheet(workbook.Sheets, replacedSource);
            worksheet.Workbook = null;
        }
コード例 #17
0
ファイル: CalcEvaluatorContext.cs プロジェクト: Daoting/dt
 /// <summary>
 /// Gets the value at specified position which indicated by <paramref name="id" />.
 /// </summary>
 /// <param name="id">A <see cref="T:Dt.CalcEngine.CalcIdentity" /> indicates the identity of a address.</param>
 /// <returns>
 /// An <see cref="T:System.Object" /> indicates the value.
 /// If the <paramref name="id" /> is not recognized, return <see cref="F:Dt.CalcEngine.CalcErrors.Reference" />.
 /// </returns>
 public virtual object GetValue(CalcIdentity id)
 {
     if (id is CalcExternalIdentity)
     {
         CalcExternalIdentity identity = id as CalcExternalIdentity;
         ICalcSource          source   = identity.Source;
         if (source != null)
         {
             CalcLocalIdentity identity3;
             CalcLocalIdentity identity2 = identity.ConvertToLocal();
             if ((this.ArrayFormulaMode || (this.RowCount > 1)) || (this.ColumnCount > 1))
             {
                 identity3 = new CalcRangeIdentity(this.Row, this.Column, this.RowCount, this.ColumnCount);
             }
             else
             {
                 identity3 = new CalcCellIdentity(this.Row, this.Column);
             }
             return(source.GetEvaluatorContext(identity3).GetValue(identity2));
         }
     }
     else if ((this.Source != null) && (id is CalcLocalIdentity))
     {
         CalcRangeIdentity objA = id as CalcRangeIdentity;
         if (object.ReferenceEquals(objA, null))
         {
             return(this.Source.GetValue(id as CalcLocalIdentity));
         }
         if (objA._isFullColumn && objA._isFullRow)
         {
             return(this.Source.GetValue(new CalcCellIdentity(this.Row, this.Column)));
         }
         if (objA._isFullColumn)
         {
             return(this.Source.GetValue(new CalcCellIdentity(this.Row, objA._columnIndex)));
         }
         if (objA._isFullRow)
         {
             return(this.Source.GetValue(new CalcCellIdentity(objA._rowIndex, this.Column)));
         }
         if (((objA._rowCount == 1) && (objA._columnIndex <= this.Column)) && (this.Column < (objA._columnIndex + objA._columnCount)))
         {
             return(this.Source.GetValue(new CalcCellIdentity(objA._rowIndex, this.Column)));
         }
         if (((objA._columnCount == 1) && (objA._rowIndex <= this.Row)) && (this.Row < (objA._rowIndex + objA._rowCount)))
         {
             return(this.Source.GetValue(new CalcCellIdentity(this.Row, objA._columnIndex)));
         }
         if ((objA._rowCount == 1) && (objA._columnCount == 1))
         {
             return(this.Source.GetValue(new CalcCellIdentity(objA._rowIndex, objA._columnIndex)));
         }
         return(CalcErrors.Value);
     }
     return(CalcErrors.Reference);
 }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.CalcCalculationManager" /> class.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="source">The source.</param>
 /// <param name="storage">The storage.</param>
 internal CalcCalculationManager(CalcService service, ICalcSource source, ICalcStorage <CalcLocalIdentity, CalcExpression> storage = null)
 {
     this.Graph        = new CalcGraph(this);
     this.Evaluator    = new CalcEvaluator();
     this.Parser       = new CalcParser();
     this._formulas    = storage ?? new SimpleFormulaStorage();
     this._tmpFormulas = new Dictionary <CalcLocalIdentity, Tuple <CalcExpression, bool> >();
     this.Source       = source;
     this.Service      = service;
 }
コード例 #19
0
ファイル: SpreadCalcParserContext.cs プロジェクト: Daoting/dt
        public override string GetExternalSourceToken(ICalcSource source)
        {
            Worksheet worksheet = source as Worksheet;

            if (worksheet != null)
            {
                return(worksheet.Name);
            }
            return(base.GetExternalSourceToken(source));
        }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.CalcRangeIdentity" /> class.
 /// </summary>
 /// <param name="startSource">Starting owner of cell range.</param>
 /// <param name="endSource">Ending owner of cell range.</param>
 public CalcSheetRangeIdentity(ICalcSource startSource, ICalcSource endSource)
 {
     this.StartSource   = startSource;
     this.EndSource     = endSource;
     this.RowIndex      = -1;
     this.ColumnIndex   = -1;
     this.RowCount      = -1;
     this.ColumnCount   = -1;
     this._isFullRow    = true;
     this._isFullColumn = true;
 }
コード例 #21
0
ファイル: RemoveSheetVisitor.cs プロジェクト: Daoting/dt
        protected override CalcExpression VisitSheetRangeExpression(CalcSheetRangeExpression sheetRangeExpr, int baseRow, int baseColumn)
        {
            if ((sheetRangeExpr.StartSource == sheetRangeExpr.EndSource) && (sheetRangeExpr.StartSource == this._currentSource))
            {
                return(new CalcErrorExpression(CalcErrors.Reference));
            }
            ICalcSource newStartSource = (sheetRangeExpr.StartSource == this._currentSource) ? this._replacedSource : sheetRangeExpr.StartSource;
            ICalcSource newEndSource   = (sheetRangeExpr.EndSource == this._currentSource) ? this._replacedSource : sheetRangeExpr.EndSource;

            return(sheetRangeExpr.ResetSheetRanges(newStartSource, newEndSource));
        }
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.CalcEngine.Expressions.CalcRangeExpression" /> class.
 /// </summary>
 /// <param name="startSource">Starting owner of cell range.</param>
 /// <param name="endSource">Ending owner of cell range.</param>
 public CalcSheetRangeExpression(ICalcSource startSource, ICalcSource endSource)
 {
     this._startSource  = startSource;
     this._endSource    = endSource;
     this._startRow     = -2147483648;
     this._endRow       = -2147483648;
     this._startColumn  = -2147483648;
     this._endColumn    = -2147483648;
     this._isFullRow    = true;
     this._isFullColumn = true;
 }
コード例 #23
0
ファイル: MoveVisitor.cs プロジェクト: Daoting/dt
 public MoveVisitor(CellRange fromRange, int rowOffset, int columnOffset, int rowCount, int columnCount, bool offsetForDependency, ICalcSource extSource, bool convertToExternal, ICalcSource currentSource, bool isCopy) : base(currentSource)
 {
     this._fromRange           = fromRange;
     this._rowOffset           = rowOffset;
     this._columnOffset        = columnOffset;
     this._rowCount            = rowCount;
     this._columnCount         = columnCount;
     this._offsetForDependency = offsetForDependency;
     this._extSource           = extSource;
     this._convertToExternal   = convertToExternal;
     this._isCopy = isCopy;
 }
コード例 #24
0
        /// <summary>
        /// Gets the calculation manager.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="formulaStorage">The formula storage.</param>
        /// <param name="autoCreate">if set to <see langword="true" /> [auto create].</param>
        /// <returns></returns>
        public CalcCalculationManager GetCalculationManager(ICalcSource source, ICalcStorage <CalcLocalIdentity, CalcExpression> formulaStorage = null, bool autoCreate = true)
        {
            CalcCalculationManager manager;

            if (object.ReferenceEquals(source, null))
            {
                throw new ArgumentNullException("source");
            }
            if ((!this._calcManagers.TryGetValue(source, out manager) || object.ReferenceEquals(manager, null)) && autoCreate)
            {
                this._calcManagers[source] = manager = new CalcCalculationManager(this, source, formulaStorage);
                manager.UpdateStorage();
            }
            return(manager);
        }
コード例 #25
0
ファイル: CalcEvaluatorContext.cs プロジェクト: Daoting/dt
 /// <summary>
 /// Gets the reference at specified position which indicated by <paramref name="id" />.
 /// </summary>
 /// <param name="id">A <see cref="T:Dt.CalcEngine.CalcIdentity" /> indicates the identity of a address.</param>
 /// <returns>
 /// An <see cref="T:System.Object" /> indicates the reference.
 /// If the <paramref name="id" /> is not recognized, return <see cref="F:Dt.CalcEngine.CalcErrors.Reference" />.
 /// </returns>
 public virtual object GetReference(CalcIdentity id)
 {
     if (id is CalcExternalIdentity)
     {
         CalcExternalIdentity identity = id as CalcExternalIdentity;
         ICalcSource          source   = identity.Source;
         if (source != null)
         {
             return(source.GetReference(identity.ConvertToLocal()));
         }
     }
     else
     {
         if (id is CalcSheetRangeIdentity)
         {
             IMultiSourceProvider provider = this.Source as IMultiSourceProvider;
             if (provider == null)
             {
                 return(CalcErrors.Reference);
             }
             try
             {
                 CalcSheetRangeIdentity identity2  = id as CalcSheetRangeIdentity;
                 CalcLocalIdentity      identity3  = identity2.ConvertToLocal();
                 List <CalcReference>   references = new List <CalcReference>();
                 foreach (ICalcSource source2 in provider.GetCalcSources(identity2.StartSource, identity2.EndSource))
                 {
                     CalcReference item = source2.GetReference(identity3) as CalcReference;
                     if (item != null)
                     {
                         references.Add(item);
                     }
                 }
                 return(new SheetRangeReference(references));
             }
             catch
             {
                 return(CalcErrors.Reference);
             }
         }
         if ((this.Source != null) && (id is CalcLocalIdentity))
         {
             return(this.Source.GetReference(id as CalcLocalIdentity));
         }
     }
     return(CalcErrors.Reference);
 }
コード例 #26
0
ファイル: SheetCellRangeUtility.cs プロジェクト: Daoting/dt
 static CalcExternalRangeExpression CreateExternalRangeExpressionByCount(ICalcSource source, int row, int column, int rowCount, int columnCount, bool startRowRelative = false, bool startColumnRelative = false, bool endRowRelative = false, bool endColumnRelative = false)
 {
     new CalcCellIdentity(row, column);
     if ((rowCount == -1) && (rowCount == -1))
     {
         return(new CalcExternalRangeExpression(source));
     }
     if (columnCount == -1)
     {
         return(new CalcExternalRangeExpression(source, row, (row + rowCount) - 1, startRowRelative, endRowRelative, true));
     }
     if (rowCount == -1)
     {
         return(new CalcExternalRangeExpression(source, column, (column + columnCount) - 1, startColumnRelative, endColumnRelative, false));
     }
     return(new CalcExternalRangeExpression(source, row, column, (row + rowCount) - 1, (column + columnCount) - 1, startRowRelative, startColumnRelative, endRowRelative, endColumnRelative));
 }
コード例 #27
0
ファイル: SpreadCalcReference.cs プロジェクト: Daoting/dt
 public SpreadCalcReference(SpreadCalcReference standaloneCalcRef, ICalcSource context, int row, int column, int rowCount, int columnCount, int sheetRowCount, int sheetColumnCount)
 {
     this.standaloneCalcRef = standaloneCalcRef;
     this.context           = context;
     this.row                           = row;
     this.column                        = column;
     this.rowCount                      = rowCount;
     this.columnCount                   = columnCount;
     this.sheetRowCount                 = sheetRowCount;
     this.sheetColumnCount              = sheetColumnCount;
     standaloneCalcRef.context          = context;
     standaloneCalcRef.row              = 0;
     standaloneCalcRef.column           = 0;
     standaloneCalcRef.rowCount         = sheetRowCount;
     standaloneCalcRef.columnCount      = sheetColumnCount;
     standaloneCalcRef.sheetRowCount    = sheetRowCount;
     standaloneCalcRef.sheetColumnCount = sheetColumnCount;
 }
コード例 #28
0
ファイル: CalcRangeIdentity.cs プロジェクト: Daoting/dt
        /// <summary>
        /// Converts to external identity.
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <returns>The external identity</returns>
        public override CalcExternalIdentity ConvertToExternal(ICalcSource source)
        {
            switch (this.RangeType)
            {
            case CalcRangeType.Cell:
                return(new CalcExternalRangeIdentity(source, this.RowIndex, this.ColumnIndex, this.RowCount, this.ColumnCount));

            case CalcRangeType.Row:
                return(new CalcExternalRangeIdentity(source, this.RowIndex, this.RowCount, true));

            case CalcRangeType.Column:
                return(new CalcExternalRangeIdentity(source, this.ColumnIndex, this.ColumnCount, false));

            case CalcRangeType.Sheet:
                return(new CalcExternalRangeIdentity(source));
            }
            return(new CalcExternalRangeIdentity(source, this.RowIndex, this.ColumnIndex, this.RowCount, this.ColumnCount));
        }
コード例 #29
0
 static CalcExpression ConvertToExternal(ICalcSource extSource, CalcExpression exp)
 {
     if (exp is CalcRangeExpression)
     {
         CalcRangeExpression expression = (CalcRangeExpression)exp;
         if (expression.IsFullRow && expression.IsFullColumn)
         {
             return(new CalcExternalRangeExpression(extSource));
         }
         if (expression.IsFullRow)
         {
             return(new CalcExternalRangeExpression(extSource, expression.StartRow, expression.EndRow, expression.StartRowRelative, expression.EndRowRelative, true));
         }
         if (expression.IsFullColumn)
         {
             return(new CalcExternalRangeExpression(extSource, expression.StartColumn, expression.EndColumn, expression.StartColumnRelative, expression.EndColumnRelative, false));
         }
         return(new CalcExternalRangeExpression(extSource, expression.StartRow, expression.StartColumn, expression.EndRow, expression.EndColumn, expression.StartRowRelative, expression.StartColumnRelative, expression.EndRowRelative, expression.EndColumnRelative));
     }
     if (exp is CalcCellExpression)
     {
         CalcCellExpression expression2 = (CalcCellExpression)exp;
         return(new CalcExternalCellExpression(extSource, expression2.Row, expression2.Column, expression2.RowRelative, expression2.ColumnRelative));
     }
     if (exp is CalcExternalRangeExpression)
     {
         CalcExternalRangeExpression expression3 = (CalcExternalRangeExpression)exp;
         if (expression3.Source != extSource)
         {
             return(new CalcExternalRangeExpression(extSource, expression3.StartRow, expression3.StartColumn, expression3.EndRow, expression3.EndColumn, expression3.StartRowRelative, expression3.StartColumnRelative, expression3.EndRowRelative, expression3.EndColumnRelative));
         }
         return(exp);
     }
     if (exp is CalcExternalCellExpression)
     {
         CalcExternalCellExpression expression4 = (CalcExternalCellExpression)exp;
         if (expression4.Source != extSource)
         {
             return(new CalcExternalCellExpression(extSource, expression4.Row, expression4.Column, expression4.RowRelative, expression4.ColumnRelative));
         }
     }
     return(exp);
 }
コード例 #30
0
        /// <summary>
        /// hdt 唐忠宝增加
        /// </summary>
        /// <param name="id"></param>
        /// <param name="context"></param>
        /// <param name="node"></param>
        /// <param name="header"></param>
        /// <param name="tailItem"></param>
        private void InvalidateIntersecteds(CalcLocalIdentity id, CalcEvaluatorContext context, CalcNode node, ref DirtyItem header, ref DirtyItem tailItem)
        {
            ICalcSource source = this.Source;

            if (node == null)
            {
                node = this.Graph.GetNode(id);
            }
            if (!object.ReferenceEquals(node, null))
            {
                if (node.DirtyItem != null)
                {
                    return;
                }
                if (node.DirtyItem == null)
                {
                    node.DirtyItem = new DirtyItem(this, node);
                }
                AddDirtyItem(ref header, ref tailItem, node.DirtyItem, null);
            }
            if (id is CalcCellIdentity)
            {
                foreach (CalcNode node2 in this.EnumerateIntersectedNodesExcludeSelf(id as CalcCellIdentity))
                {
                    if (((node2.Dependents != null) && (node2.Dependents.Count > 0)) && (node2.DirtyItem == null))
                    {
                        node2.DirtyItem = new DirtyItem(this, node2);
                        AddDirtyItem(ref header, ref tailItem, node2.DirtyItem, node);
                    }
                }
            }
            else
            {
                foreach (CalcNode node3 in this.Graph.EnumerateIntersectedNodesExcludeSelf(context, id))
                {
                    if (node3.DirtyItem == null)
                    {
                        node3.DirtyItem = new DirtyItem(this, node3);
                        AddDirtyItem(ref header, ref tailItem, node3.DirtyItem, node);
                    }
                }
            }
        }