Пример #1
0
        /// <summary>
        /// Determines whether the specified <see cref="T:Dt.CalcEngine.CalcCellIdentity" />
        /// is equal to the current <see cref="T:Dt.CalcEngine.CalcCellIdentity" />.
        /// </summary>
        /// <param name="other">
        /// The <see cref="T:Dt.CalcEngine.CalcCellIdentity" /> to compare with the
        /// current <see cref="T:Dt.CalcEngine.CalcCellIdentity" />.
        /// </param>
        /// <returns>
        /// <see langword="true" /> if the specified <see cref="T:Dt.CalcEngine.CalcCellIdentity" />
        /// is equal to the current <see cref="T:Dt.CalcEngine.CalcCellIdentity" />;
        /// otherwise, <see langword="false" />.
        /// </returns>
        protected override bool CompareTo(CalcIdentity other)
        {
            CalcSheetRangeIdentity objA = other as CalcSheetRangeIdentity;

            if (object.ReferenceEquals(objA, null))
            {
                return(false);
            }
            return(((((this.StartSource == objA.StartSource) && (this.EndSource == objA.EndSource)) && ((this.IsFullRow == objA.IsFullRow) && (this.IsFullColumn == objA.IsFullColumn))) && (((this.RowIndex == objA.RowIndex) && (this.ColumnIndex == objA.ColumnIndex)) && (this.RowCount == objA.RowCount))) && (this.ColumnCount == objA.ColumnCount));
        }
Пример #2
0
 /// <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);
 }