IsEmpty() public method

public IsEmpty ( ) : bool
return bool
示例#1
0
        /// <summary>
        /// Prende un range che è già stato filtrato con solo le celle presenti nell'attuale range
        /// </summary>
        /// <param name="pRange"></param>
        /// <returns></returns>
        private bool InternalRemove(RangeRegion pRange)
        {
            pRange = Intersect(pRange);
            if (pRange.IsEmpty())
            {
                return(true);                //il range non è presente
            }
            pRange.m_bValidated = true;

            RangeRegionCancelEventArgs e = new RangeRegionCancelEventArgs(pRange);

            OnRemovingRange(e);             //calling this method the range can change
            if (e.Cancel)
            {
                return(false);
            }

            if (pRange.m_bValidated == false)
            {
                pRange = Intersect(pRange);
                if (pRange.IsEmpty())
                {
                    return(true);                    //il range non è presente
                }
            }

            m_RangeCollection = Exclude(pRange).m_RangeCollection;

            OnRemovedRange(e);

            m_bValidated = false;

            return(true);
        }
示例#2
0
        /// <summary>
        /// Prende un range che è già stato filtrato con solo le celle non presenti nell'attuale range
        /// </summary>
        /// <param name="pRange"></param>
        /// <returns></returns>
        private bool InternalAdd(RangeRegion pRange)
        {
            if (Contains(pRange))
            {
                return(true);
            }

            if (pRange.Contains(this))             //change all the contents with the new range
            {
                RangeRegion existingRange = new RangeRegion(this);

                m_RangeCollection.Clear();
                m_RangeCollection.AddRange(pRange.m_RangeCollection);

                pRange = pRange.Exclude(existingRange);
            }
            else
            {
                pRange = pRange.Exclude(this);
                if (pRange.IsEmpty())
                {
                    return(true);                    //il range è vuoto
                }
                pRange.m_bValidated = true;

                RangeRegionCancelEventArgs e = new RangeRegionCancelEventArgs(pRange);
                OnAddingRange(e);                 //calling this method the range can change
                if (e.Cancel)
                {
                    return(false);
                }

                if (pRange.m_bValidated == false)
                {
                    pRange = pRange.Exclude(this);
                    if (pRange.IsEmpty())
                    {
                        return(true);                        //il range è vuoto
                    }
                }

                for (int rToAdd = 0; rToAdd < pRange.m_RangeCollection.Count; rToAdd++)
                {
                    Range rangeToAdd = pRange.m_RangeCollection[rToAdd];
                    m_RangeCollection.Add(rangeToAdd);
                }
            }

            OnAddedRange(new RangeRegionCancelEventArgs(pRange));

            m_bValidated = false;

            return(true);
        }
示例#3
0
        /// <summary>
        /// Indicates if the specified range of cells is selected
        /// </summary>
        /// <param name="p_Range"></param>
        /// <returns></returns>
        public virtual bool IntersectsWith(Range p_Range)
        {
            if (p_Range.IsEmpty() || IsEmpty())
            {
                return(false);
            }

            RangeRegion range = Intersect(p_Range);

            return(!range.IsEmpty());
        }
示例#4
0
        public RangeRegion Exclude(RangeRegion pRange)
        {
            RangeRegion excludedRange = new RangeRegion(this);

            if (excludedRange.IsEmpty() == false)
            {
                for (int rToCheck = 0; rToCheck < pRange.m_RangeCollection.Count; rToCheck++)
                {
                    excludedRange = excludedRange.Exclude(pRange.m_RangeCollection[rToCheck]);
                }
            }

            return(excludedRange);
        }
示例#5
0
        /// <summary>
        /// Indicates if the specified range of cells is selected
        /// </summary>
        /// <param name="p_Range"></param>
        /// <returns></returns>
        public virtual bool Contains(RangeRegion p_Range)
        {
            if (p_Range.IsEmpty() || IsEmpty())
            {
                return(false);
            }

            PositionCollection positions = p_Range.GetCellsPositions();

            for (int i = 0; i < positions.Count; i++)
            {
                if (Contains(positions[i]) == false)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#6
0
		/// <summary>
		/// Checks if delete is enabled, and clears values from
		/// given destination by invoking ClearValues(selRegion)
		/// </summary>
		/// <param name="selRegion"></param>
		public void PerformDelete(RangeRegion selRegion)
		{
			bool deleteEnabled = (ClipboardMode & ClipboardMode.Delete) == ClipboardMode.Delete;
			if (deleteEnabled == false || selRegion.IsEmpty() == true)
				return;
			ClearValues(selRegion);
		}
示例#7
0
		/// <summary>
		/// Checks if paste mode is enabled and writes
		/// data into grid from clipboard
		/// </summary>
		/// <param name="selRegion"></param>
		public void PerformPaste(RangeRegion selRegion)
		{
			bool pasteEnabled = (ClipboardMode & ClipboardMode.Paste) == ClipboardMode.Paste;
			if (pasteEnabled == false || selRegion.IsEmpty() == true)
				return;
			RangeData rngData = RangeData.ClipboardGetData();

			if (rngData == null)
				return;
			Range rng = selRegion[0];
			Range data = rngData.SourceRange;
			Range destinationRange = new Range(
				new Position(rng.Start.Row, rng.Start.Column),
				new Position(rng.Start.Row + (data.End.Row - data.Start.Row),
				             rng.Start.Column + (data.End.Column - data.Start.Column)));
			
			rngData.WriteData(this, rng.Start);
			
			Selection.ResetSelection(true);
			Selection.SelectRange(destinationRange, true);
		}
示例#8
0
		/// <summary>
		/// Checks if copy mode is enabled and copies data into clipboard
		/// </summary>
		/// <param name="selRegion"></param>
		public void PerformCopy(RangeRegion selRegion)
		{
			bool copyEnabled = (ClipboardMode & ClipboardMode.Copy) == ClipboardMode.Copy;
			if (copyEnabled == false || selRegion.IsEmpty() == true)
				return;
			Range rng = selRegion[0];

			RangeData data = RangeData.LoadData(this, rng, CutMode.None);
			RangeData.ClipboardSetData(data);
		}
示例#9
0
		/// <summary>
		/// Checks if cut mode is enabled, and copies
		/// data into clipaborad
		/// </summary>
		/// <param name="selRegion"></param>
		public void PerformCut(RangeRegion selRegion)
		{
			bool cutEnabled = (ClipboardMode & ClipboardMode.Cut) == ClipboardMode.Cut;
			if (cutEnabled == false || selRegion.IsEmpty() == true)
				return;
			Range rng = selRegion[0];

			RangeData data = RangeData.LoadData(this, rng, CutMode.CutImmediately);
			RangeData.ClipboardSetData(data);
		}
示例#10
0
        /// <summary>
        /// Prende un range che è già stato filtrato con solo le celle presenti nell'attuale range
        /// </summary>
        /// <param name="pRange"></param>
        /// <returns></returns>
        private bool InternalRemove(RangeRegion pRange)
        {
            pRange = Intersect(pRange);
            if (pRange.IsEmpty())
                return true; //il range non è presente
            pRange.m_bValidated = true;

            RangeRegionCancelEventArgs e = new RangeRegionCancelEventArgs(pRange);
            OnRemovingRange(e); //calling this method the range can change
            if (e.Cancel)
                return false;

            if (pRange.m_bValidated == false)
            {
                pRange = Intersect(pRange);
                if (pRange.IsEmpty())
                    return true; //il range non è presente
            }

            m_RangeCollection = Exclude(pRange).m_RangeCollection;

            OnRemovedRange(e);

            m_bValidated = false;

            return true;
        }
示例#11
0
        /// <summary>
        /// Prende un range che è già stato filtrato con solo le celle non presenti nell'attuale range
        /// </summary>
        /// <param name="pRange"></param>
        /// <returns></returns>
        private bool InternalAdd(RangeRegion pRange)
        {
            if (Contains(pRange))
                return true;

            if (pRange.Contains(this)) //change all the contents with the new range
            {
                m_RangeCollection.Clear();
                m_RangeCollection.AddRange(pRange.m_RangeCollection);

                pRange = pRange.Exclude(this);
            }
            else
            {
                pRange = pRange.Exclude(this);
                if (pRange.IsEmpty())
                    return true; //il range è vuoto
                pRange.m_bValidated = true;

                RangeRegionCancelEventArgs e = new RangeRegionCancelEventArgs(pRange);
                OnAddingRange(e); //calling this method the range can change
                if (e.Cancel)
                    return false;

                if (pRange.m_bValidated == false)
                {
                    pRange = pRange.Exclude(this);
                    if (pRange.IsEmpty())
                        return true; //il range è vuoto
                }

                for (int rToAdd = 0; rToAdd < pRange.m_RangeCollection.Count; rToAdd++)
                {
                    Range rangeToAdd = pRange.m_RangeCollection[rToAdd];
                    m_RangeCollection.Add(rangeToAdd);
                }
            }

            OnAddedRange(new RangeRegionCancelEventArgs(pRange));

            m_bValidated = false;

            return true;
        }
示例#12
0
        public RangeRegion Exclude(RangeRegion pRange)
        {
            RangeRegion excludedRange = new RangeRegion(this);
            if (excludedRange.IsEmpty() == false)
            {
                for (int rToCheck = 0; rToCheck < pRange.m_RangeCollection.Count; rToCheck++)
                {
                    excludedRange = excludedRange.Exclude( pRange.m_RangeCollection[rToCheck] );
                }
            }

            return excludedRange;
        }
示例#13
0
        /// <summary>
        /// Indicates if the specified range of cells is selected
        /// </summary>
        /// <param name="p_Range"></param>
        /// <returns></returns>
        public virtual bool Contains(RangeRegion p_Range)
        {
            if (p_Range.IsEmpty() || IsEmpty())
                return false;

            PositionCollection positions = p_Range.GetCellsPositions();
            for (int i = 0; i < positions.Count; i++)
            {
                if ( Contains(positions[i]) == false)
                    return false;
            }

            return true;
        }