Пример #1
0
        internal void DeleteAndNotDestroy(int index)
        {
            T r = FList[index];

            OnDelete(r, index);
            FList.RemoveAt(index);
        }
Пример #2
0
        internal void DeleteBreak(int aCol)
        {
            int Index = -1;

            if (Find(aCol, ref Index))
            {
                FList.RemoveAt(Index);
            }
        }
Пример #3
0
        internal override void Delete(int index)
        {
            T r = this[index];

            if (r != null)
            {
                r.Destroy();
            }
            OnDelete(r, index);
            FList.RemoveAt(index);
        }
Пример #4
0
        internal void CleanUnusedNames(TWorkbook Workbook)
        {
            TDeletedRanges DeletedRanges = Workbook.FindUnreferencedRanges(-1, 0);

            for (int i = DeletedRanges.Count - 1; i >= 0; i--)
            {
                if (!DeletedRanges.Referenced(i) && !this[i].HasFormulaData && CanDeleteName(i))                  //don't delete internal names, or macro names.
                {
                    FList.RemoveAt(i);
                    DeletedRanges.AddNameForDelete(i);
                }
            }

            if (DeletedRanges.NeedsUpdate)
            {
                Workbook.UpdateDeletedRanges(-1, 0, DeletedRanges);
            }
        }
Пример #5
0
        internal void DeleteName(int Index, TWorkbook Workbook)
        {
            if (Index < 0 || Index >= Count)
            {
                XlsMessages.ThrowException(XlsErr.ErrXlsIndexOutBounds, Index, "Index", 0, Count - 1);
            }

            TDeletedRanges DeletedRanges = Workbook.FindUnreferencedRanges(-1, 0);

            if (!DeletedRanges.Referenced(Index) && CanDeleteName(Index))              //don't delete internal names, or macro names.
            {
                FList.RemoveAt(Index);
                DeletedRanges.AddNameForDelete(Index);
                Workbook.UpdateDeletedRanges(-1, 0, DeletedRanges);
            }
            else
            {
                ClearName(Index);
            }
        }
Пример #6
0
        internal void DeleteCols(int DestCol, int aCount)
        {
            int Index = -1;

            Find(DestCol, ref Index);
            if (Index < RealCount() && Index >= 0 && FList[Index].GoesAfter && FList[Index].Col == DestCol)
            {
                Index++;
            }

            for (int i = RealCount() - 1; i >= Index; i--)
            {
                if (FList[i].Col < DestCol + aCount)
                {
                    FList.RemoveAt(i);
                }
                else
                {
                    FList[i].Col -= aCount;
                }
            }
        }
Пример #7
0
        internal void DeleteRows(int DestRow, int aCount)
        {
            int Index = -1;

            Find(DestRow, ref Index);
            if (Index < RealCount() && Index >= 0 && FList[Index].GoesAfter && FList[Index].Row == DestRow)
            {
                Index++;
            }

            for (int i = RealCount() - 1; i >= Index; i--)
            {
                if (FList[i].Row < DestRow + aCount)
                {
                    FList.RemoveAt(i);
                }
                else
                {
                    FList[i].Row -= aCount;
                }
            }
        }
Пример #8
0
        internal void DeleteSheets(int SheetIndex, int SheetCount, TWorkbook Workbook)
        {
            TDeletedRanges DeletedRanges = Workbook.FindUnreferencedRanges(SheetIndex, SheetCount);

            for (int i = Count - 1; i >= 0; i--)
            {
                if ((this[i].RangeSheet >= SheetIndex) && (this[i].RangeSheet < SheetIndex + SheetCount))
                {
                    /* We cannot just delete the range, or formulas referring this range would crash (or refer to the wrong name).
                     * To actually delete here, we need to first find out whether this range is used.
                     * If it is not, go through all the formulas, charts, pivot tables, etc, and update the references to
                     * ranges less than this one to one less.
                     */

                    if (!DeletedRanges.Referenced(i) && CanDeleteName(i))  //don't delete internal names, or macro names.
                    {
                        FList.RemoveAt(i);
                        DeletedRanges.AddNameForDelete(i);
                    }
                    else
                    {
                        EnsureUniqueGlobalName(i);
                        this[i].RangeSheet = -1;
                    }
                }
                else
                {
                    this[i].ArrangeInsertSheets(SheetIndex, -SheetCount);
                }
            }

            if (DeletedRanges.NeedsUpdate)
            {
                Workbook.UpdateDeletedRanges(SheetIndex, SheetCount, DeletedRanges); //Update formulas, charts, etc.
            }
        }
Пример #9
0
        public string ToIndent()
        {
            Action<Node> na;
            Action<List<Node>> nsa = null;
            const string ind = "    ";
            FList<string> inds = new FList<string>();
            StringBuilder b = new StringBuilder();

            na = delegate(Node n)
            {
                if (n.Leaf != null)
                {
                    b
                        .Append(inds.Deriv(Cty.ToLine))
                        .Append(n.Leaf)
                        .AppendLine();
                }
                else if (n.Branches != null)
                {
                    if (n != this) inds.Add(ind);
                    nsa(n.Branches);
                    if (n != this) inds.RemoveAt(inds.Count - 1);
                }
            };

            nsa = delegate(List<Node> ns)
            {
                if (ns.Count == 0) return;

                bool isPrevBranch = ns[0].Branches != null;
                na(ns[0]);
                for (int i = 1; i < ns.Count; i++)
                {
                    if (isPrevBranch && ns[i].Branches != null)
                    {
                        b
                            .Append(inds.Deriv(Cty.ToLine))
                            .Append(ind)
                            .AppendLine();
                    }
                    isPrevBranch = ns[i].Branches != null;
                    na(ns[i]);
                }
            };

            na(this);

            return b.ToString();
        }