Esempio n. 1
0
        // ------------------------------------------------------------------
        // Table has been structurally altered
        // ------------------------------------------------------------------
        private void TableStructureChanged(object sender, EventArgs e)
        {
            // Disconnect obsolete paragraphs.
            BaseParagraph paraInvalid = _firstChild;

            while (paraInvalid != null)
            {
                paraInvalid.Dispose();
                paraInvalid = paraInvalid.Next;
            }
            _firstChild = null;

            //
            // Since whole table content is disposed, we need
            // - to create dirty text range corresponding to the Table content
            // - notify formatter that Table's content is changed.
            //
            int charCount = Table.SymbolCount - 2;// This is equivalent to (ContentEndOffset – ContentStartOffset) but is more performant.

            if (charCount > 0)
            {
                DirtyTextRange dtr = new DirtyTextRange(Table.ContentStartOffset, charCount, charCount);
                StructuralCache.AddDirtyTextRange(dtr);
            }
            if (StructuralCache.FormattingOwner.Formatter != null)
            {
                StructuralCache.FormattingOwner.Formatter.OnContentInvalidated(true, Table.ContentStart, Table.ContentEnd);
            }
        }
        // Token: 0x060067A1 RID: 26529 RVA: 0x001D07BC File Offset: 0x001CE9BC
        internal override bool InvalidateStructure(int startPosition)
        {
            int paragraphStartCharacterPosition = base.ParagraphStartCharacterPosition;

            if (startPosition <= paragraphStartCharacterPosition + TextContainerHelper.ElementEdgeCharacterLength)
            {
                BaseParagraph baseParagraph = this._firstChild;
                while (baseParagraph != null)
                {
                    BaseParagraph baseParagraph2 = baseParagraph;
                    baseParagraph = baseParagraph.Next;
                    baseParagraph2.Dispose();
                    baseParagraph2.Next     = null;
                    baseParagraph2.Previous = null;
                }
                this._firstChild = (this._lastFetchedChild = null);
            }
            else
            {
                BaseParagraph baseParagraph = this._firstChild;
                while (baseParagraph != null)
                {
                    if (baseParagraph.ParagraphStartCharacterPosition + baseParagraph.LastFormatCch >= startPosition)
                    {
                        if (!baseParagraph.InvalidateStructure(startPosition))
                        {
                            baseParagraph = baseParagraph.Next;
                        }
                        if (baseParagraph != null)
                        {
                            if (baseParagraph.Previous != null)
                            {
                                baseParagraph.Previous.Next = null;
                                this._lastFetchedChild      = baseParagraph.Previous;
                            }
                            else
                            {
                                this._firstChild = (this._lastFetchedChild = null);
                            }
                            while (baseParagraph != null)
                            {
                                BaseParagraph baseParagraph3 = baseParagraph;
                                baseParagraph = baseParagraph.Next;
                                baseParagraph3.Dispose();
                                baseParagraph3.Next     = null;
                                baseParagraph3.Previous = null;
                            }
                            break;
                        }
                        break;
                    }
                    else
                    {
                        baseParagraph = baseParagraph.Next;
                    }
                }
            }
            return(startPosition < paragraphStartCharacterPosition + TextContainerHelper.ElementEdgeCharacterLength);
        }
 // Token: 0x06006797 RID: 26519 RVA: 0x001CF7E8 File Offset: 0x001CD9E8
 void ISegment.GetFirstPara(out int fSuccessful, out IntPtr firstParaName)
 {
     if (this._ur != null)
     {
         int cpfromElement = TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.AfterStart);
         if (this._ur.SyncPara != null && cpfromElement == this._ur.SyncPara.ParagraphStartCharacterPosition)
         {
             this._ur.SyncPara.Previous = null;
             if (this._ur.Next != null && this._ur.Next.FirstPara == this._ur.SyncPara)
             {
                 this._ur.SyncPara.SetUpdateInfo(this._ur.Next.ChangeType, false);
             }
             else
             {
                 this._ur.SyncPara.SetUpdateInfo(PTS.FSKCHANGE.fskchNone, this._ur.Next == null);
             }
             Invariant.Assert(this._firstChild == null);
             this._firstChild = this._ur.SyncPara;
             this._ur         = this._ur.Next;
         }
     }
     if (this._firstChild != null)
     {
         if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate && this._ur == null && this.NeedsUpdate() && !this._firstParaValidInUpdateMode)
         {
             if (!base.StructuralCache.CurrentFormatContext.FinitePage)
             {
                 for (BaseParagraph baseParagraph = this._firstChild; baseParagraph != null; baseParagraph = baseParagraph.Next)
                 {
                     baseParagraph.Dispose();
                 }
                 this._firstChild = null;
             }
             this._firstParaValidInUpdateMode = true;
         }
         else if (this._ur != null && this._ur.InProcessing && this._ur.FirstPara == this._firstChild)
         {
             this._firstChild.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false);
         }
     }
     if (this._firstChild == null)
     {
         ITextPointer contentStart = TextContainerHelper.GetContentStart(base.StructuralCache.TextContainer, base.Element);
         this._firstChild = this.GetParagraph(contentStart, false);
         if (this._ur != null && this._firstChild != null)
         {
             this._firstChild.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false);
         }
     }
     if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate)
     {
         this._firstParaValidInUpdateMode = true;
     }
     this._lastFetchedChild = this._firstChild;
     fSuccessful            = PTS.FromBoolean(this._firstChild != null);
     firstParaName          = ((this._firstChild != null) ? this._firstChild.Handle : IntPtr.Zero);
 }
        // Token: 0x06006AC7 RID: 27335 RVA: 0x001E901C File Offset: 0x001E721C
        public override void Dispose()
        {
            this.Table.TableStructureChanged -= this.TableStructureChanged;
            BaseParagraph baseParagraph = this._firstChild;

            while (baseParagraph != null)
            {
                BaseParagraph baseParagraph2 = baseParagraph;
                baseParagraph = baseParagraph.Next;
                baseParagraph2.Dispose();
                baseParagraph2.Next     = null;
                baseParagraph2.Previous = null;
            }
            this._firstChild = null;
            base.Dispose();
        }
        // Token: 0x06006796 RID: 26518 RVA: 0x001CF794 File Offset: 0x001CD994
        public override void Dispose()
        {
            BaseParagraph baseParagraph = this._firstChild;

            while (baseParagraph != null)
            {
                BaseParagraph baseParagraph2 = baseParagraph;
                baseParagraph = baseParagraph.Next;
                baseParagraph2.Dispose();
                baseParagraph2.Next     = null;
                baseParagraph2.Previous = null;
            }
            this._firstChild = (this._lastFetchedChild = null);
            base.Dispose();
            GC.SuppressFinalize(this);
        }
Esempio n. 6
0
        // ------------------------------------------------------------------
        // IDisposable.Dispose
        // ------------------------------------------------------------------
        public override void Dispose()
        {
            Table.TableStructureChanged -= new System.EventHandler(TableStructureChanged);

            BaseParagraph paraChild = _firstChild;

            while (paraChild != null)
            {
                BaseParagraph para = paraChild;
                paraChild = paraChild.Next;
                para.Dispose();
                para.Next     = null;
                para.Previous = null;
            }
            _firstChild = null;

            base.Dispose();
        }
        // Token: 0x06006ADC RID: 27356 RVA: 0x001E94F0 File Offset: 0x001E76F0
        private void TableStructureChanged(object sender, EventArgs e)
        {
            for (BaseParagraph baseParagraph = this._firstChild; baseParagraph != null; baseParagraph = baseParagraph.Next)
            {
                baseParagraph.Dispose();
            }
            this._firstChild = null;
            int num = this.Table.SymbolCount - 2;

            if (num > 0)
            {
                DirtyTextRange dtr = new DirtyTextRange(this.Table.ContentStartOffset, num, num, false);
                base.StructuralCache.AddDirtyTextRange(dtr);
            }
            if (base.StructuralCache.FormattingOwner.Formatter != null)
            {
                base.StructuralCache.FormattingOwner.Formatter.OnContentInvalidated(true, this.Table.ContentStart, this.Table.ContentEnd);
            }
        }