예제 #1
0
 public static void SetExpression(CalcCalculationManager mgr, CalcLocalIdentity id, CalcExpression expr, bool?isArrayFormula = new bool?())
 {
     if (id is CalcCellIdentity)
     {
         mgr.SetExpression(id as CalcCellIdentity, expr, false);
     }
     if (id is CalcRangeIdentity)
     {
         if (!isArrayFormula.HasValue)
         {
             isArrayFormula = new bool?(!(expr is CalcSharedExpression));
         }
         else
         {
             CalcSharedExpression expression1 = expr as CalcSharedExpression;
         }
         mgr.SetExpression(id as CalcRangeIdentity, expr, isArrayFormula.Value);
     }
 }
예제 #2
0
        /// <summary>
        /// Gets the expression.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>A <see cref="T:Dt.CalcEngine.Expressions.CalcExpression" /> indicates the expression.</returns>
        /// <exception cref="T:System.ArgumentNullException"><paramref name="id" /> is <see langword="null" />.</exception>
        public CalcExpression GetExpression(CalcLocalIdentity id)
        {
            if (object.ReferenceEquals(id, null))
            {
                throw new ArgumentNullException("id");
            }
            CalcExpression expressionCore = this.GetExpressionCore(id);

            if (object.ReferenceEquals(expressionCore, null) && (id is CalcCellIdentity))
            {
                CalcRangeIdentity sharedFormulaRange = this.Graph.GetSharedFormulaRange(id as CalcCellIdentity);
                if (!object.ReferenceEquals(sharedFormulaRange, null))
                {
                    expressionCore = this.GetExpressionCore(sharedFormulaRange);
                    if (!object.ReferenceEquals(expressionCore, null) && !(expressionCore is CalcSharedExpression))
                    {
                        expressionCore = new CalcSharedExpression(expressionCore);
                    }
                }
            }
            return(expressionCore);
        }
예제 #3
0
 /// <summary>
 /// Sets the expression.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="expr">The exception.</param>
 /// <param name="isArrayFormula">Indicates the expression is array formula or not.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="id" /> is <see langword="null" />.</exception>
 public void SetExpression(CalcRangeIdentity id, CalcExpression expr, bool isArrayFormula = true)
 {
     if (object.ReferenceEquals(id, null))
     {
         throw new ArgumentNullException("id");
     }
     if (!isArrayFormula && !(expr is CalcSharedExpression))
     {
         expr = new CalcSharedExpression(expr);
     }
     if ((!isArrayFormula && !id.IsFullRow) && (!id.IsFullColumn && !CalcGraph.IsLargeArray(id)))
     {
         this.ExpandSharedFormula(expr, id);
     }
     else if (this.Service.IsGraphSuspended)
     {
         this._tmpFormulas[id] = new Tuple <CalcExpression, bool>(expr, isArrayFormula);
     }
     else
     {
         this.Graph.SetNode(id, expr, this.Source.GetEvaluatorContext(id), this.Source, isArrayFormula);
         this._formulas[id] = expr;
     }
 }