Esempio n. 1
0
        public static bool ExtractIdentity(this CalcLocalIdentity id, out int row, out int column, out int rowCount, out int columnCount)
        {
            int num7;
            int num8;
            CalcCellIdentity  objA      = id as CalcCellIdentity;
            CalcRangeIdentity identity2 = id as CalcRangeIdentity;

            ConditionalGraph.ConditionalIdentity identity3 = id as ConditionalGraph.ConditionalIdentity;
            if (!object.ReferenceEquals(objA, null))
            {
                row      = objA.RowIndex;
                column   = objA.ColumnIndex;
                rowCount = columnCount = 1;
                return(true);
            }
            if (!object.ReferenceEquals(identity2, null))
            {
                if (identity2.IsFullRow && identity2.IsFullColumn)
                {
                    int num2;
                    int num3;
                    columnCount = num2 = -1;
                    rowCount    = num3 = num2;
                    row         = column = num3;
                }
                else if (identity2.IsFullRow)
                {
                    column   = columnCount = -1;
                    row      = identity2.RowIndex;
                    rowCount = identity2.RowCount;
                }
                else if (identity2.IsFullColumn)
                {
                    row         = rowCount = -1;
                    column      = identity2.ColumnIndex;
                    columnCount = identity2.ColumnCount;
                }
                else
                {
                    row         = identity2.RowIndex;
                    rowCount    = identity2.RowCount;
                    column      = identity2.ColumnIndex;
                    columnCount = identity2.ColumnCount;
                }
                return(true);
            }
            if (!object.ReferenceEquals(identity3, null))
            {
                return(identity3.ActualIdentity.ExtractIdentity(out row, out column, out rowCount, out columnCount));
            }
            columnCount = num7 = -2147483648;
            rowCount    = num8 = num7;
            row         = column = num8;
            return(false);
        }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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);
                 }
             }
         }
     }
 }