예제 #1
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        /// <summary>
        /// Sets current page context to be used in the cache's queries
        /// </summary>
        /// <param name="currentPage">Document page to become current in the context</param>
        /// <returns>Reference to object compatible with IDisposable to re-initialize page context</returns>
        internal IDisposable SetDocumentFormatContext(FlowDocumentPage currentPage)
        {
            if (!CheckFlags(Flags.FormattedOnce))
            {
                SetFlags(true, Flags.FormattedOnce);
                _owner.InitializeForFirstFormatting();
            }
            return(new DocumentFormatContext(this, currentPage) as IDisposable);
        }
예제 #2
0
 // Token: 0x06006A57 RID: 27223 RVA: 0x001E4404 File Offset: 0x001E2604
 internal IDisposable SetDocumentFormatContext(FlowDocumentPage currentPage)
 {
     if (!this.CheckFlags(StructuralCache.Flags.FormattedOnce))
     {
         this.SetFlags(true, StructuralCache.Flags.FormattedOnce);
         this._owner.InitializeForFirstFormatting();
     }
     return(new StructuralCache.DocumentFormatContext(this, currentPage));
 }
예제 #3
0
        //------------------------------------------------------ 
        //
        //  Internal Methods
        //
        //----------------------------------------------------- 

        #region Internal Methods 
 
        /// <summary>
        /// Sets current page context to be used in the cache's queries 
        /// </summary>
        /// <param name="currentPage">Document page to become current in the context</param>
        /// <returns>Reference to object compatible with IDisposable to re-initialize page context</returns>
        internal IDisposable SetDocumentFormatContext(FlowDocumentPage currentPage) 
        {
            if (!CheckFlags(Flags.FormattedOnce)) 
            { 
                SetFlags(true, Flags.FormattedOnce);
                _owner.InitializeForFirstFormatting(); 
            }
            return (new DocumentFormatContext(this, currentPage) as IDisposable);
        }
예제 #4
0
 // Token: 0x06008AB0 RID: 35504 RVA: 0x002576EC File Offset: 0x002558EC
 internal DocumentOperationContext(StructuralCache owner, FlowDocumentPage page)
 {
     Invariant.Assert(owner != null, "Invalid owner object.");
     Invariant.Assert(page != null, "Invalid page object.");
     Invariant.Assert(owner._currentPage == null, "Page formatting reentrancy detected. Trying to create second _DocumentPageContext for the same StructuralCache.");
     this._owner = owner;
     this._owner._currentPage = page;
     this._owner._illegalTreeChangeDetected = false;
     owner.PtsContext.Enter();
 }
예제 #5
0
        /// <summary>
        /// Updates entry of BreakRecordTable with new data.
        /// </summary>
        /// <param name="pageNumber">Index of the entry to update.</param>
        /// <param name="page">DocumentPage object that has been just created.</param>
        /// <param name="brOut">Output BreakRecord for created page.</param>
        /// <param name="dependentMax">Last content position that can affect the output break record.</param>
        internal void UpdateEntry(int pageNumber, FlowDocumentPage page, PageBreakRecord brOut, TextPointer dependentMax)
        {
            ITextView             textView;
            BreakRecordTableEntry entry;
            bool isClean;

            Invariant.Assert(pageNumber >= 0 && pageNumber <= _breakRecords.Count, "The previous BreakRecord does not exist.");
            Invariant.Assert(page != null && page != DocumentPage.Missing, "Cannot update BRT with an invalid document page.");

            // Get TextView for DocumentPage. This TextView is used to access list of
            // content ranges. Those serve as optimalization in finding affeceted pages.
            textView = (ITextView)((IServiceProvider)page).GetService(typeof(ITextView));
            Invariant.Assert(textView != null, "Cannot access ITextView for FlowDocumentPage.");

            // Get current state of BreakRecordTable
            isClean = this.IsClean;

            // Add new entry into BreakRecordTable
            entry              = new BreakRecordTableEntry();
            entry.BreakRecord  = brOut;
            entry.DocumentPage = new WeakReference(page);
            entry.TextSegments = textView.TextSegments;
            entry.DependentMax = dependentMax;
            if (pageNumber == _breakRecords.Count)
            {
                _breakRecords.Add(entry);

                // Raise PaginationProgress event only if we did not have valid
                // entry for specified page number.
                _owner.OnPaginationProgress(pageNumber, 1);
            }
            else
            {
                // If old Page and/or BreakRecord are not changing, do not dispose them.
                if (_breakRecords[pageNumber].BreakRecord != null &&
                    _breakRecords[pageNumber].BreakRecord != entry.BreakRecord)
                {
                    _breakRecords[pageNumber].BreakRecord.Dispose();
                }
                if (_breakRecords[pageNumber].DocumentPage != null &&
                    _breakRecords[pageNumber].DocumentPage.Target != null &&
                    _breakRecords[pageNumber].DocumentPage.Target != entry.DocumentPage.Target)
                {
                    ((FlowDocumentPage)_breakRecords[pageNumber].DocumentPage.Target).Dispose();
                }
                _breakRecords[pageNumber] = entry;
            }

            // Raise PaginationCompleted event only if the BreakRecordTable just
            // become clean.
            if (!isClean && this.IsClean)
            {
                _owner.OnPaginationCompleted();
            }
        }
예제 #6
0
 internal ColumnResult(FlowDocumentPage page, ref PTS.FSTRACKDESCRIPTION trackDesc, Vector contentOffset) 
 {
     _page = page;
     _columnHandle = trackDesc.pfstrack;
     _layoutBox = new Rect( 
         TextDpi.FromTextDpi(trackDesc.fsrc.u),  TextDpi.FromTextDpi(trackDesc.fsrc.v),
         TextDpi.FromTextDpi(trackDesc.fsrc.du), TextDpi.FromTextDpi(trackDesc.fsrc.dv)); 
     _layoutBox.X += contentOffset.X; 
     _layoutBox.Y += contentOffset.Y;
     _columnOffset = new Vector(TextDpi.FromTextDpi(trackDesc.fsrc.u), TextDpi.FromTextDpi(trackDesc.fsrc.v)); 
     _hasTextContent = false;
 }
예제 #7
0
        // Token: 0x06006755 RID: 26453 RVA: 0x001CE01C File Offset: 0x001CC21C
        internal FlowDocumentPage GetCachedDocumentPage(int pageNumber)
        {
            FlowDocumentPage flowDocumentPage = null;

            if (pageNumber < this._breakRecords.Count)
            {
                Invariant.Assert(this._breakRecords[pageNumber] != null, "Invalid BreakRecordTable entry.");
                WeakReference documentPage = this._breakRecords[pageNumber].DocumentPage;
                if (documentPage != null)
                {
                    flowDocumentPage = (documentPage.Target as FlowDocumentPage);
                    if (flowDocumentPage != null && flowDocumentPage.IsDisposed)
                    {
                        flowDocumentPage = null;
                    }
                }
            }
            return(flowDocumentPage);
        }
예제 #8
0
        /// <summary>
        /// Retrieves cached DocumentPage for given PageNumber.
        /// </summary>
        /// <param name="pageNumber">
        /// Page index indicating which cached DocumentPage should be retrieved.
        /// </param>
        /// <returns>Cached DocumentPage for given PageNumber.</returns>
        internal FlowDocumentPage GetCachedDocumentPage(int pageNumber)
        {
            WeakReference    pageRef;
            FlowDocumentPage documentPage = null;

            if (pageNumber < _breakRecords.Count)
            {
                Invariant.Assert(_breakRecords[pageNumber] != null, "Invalid BreakRecordTable entry.");
                pageRef = _breakRecords[pageNumber].DocumentPage;
                if (pageRef != null)
                {
                    documentPage = pageRef.Target as FlowDocumentPage;
                    if (documentPage != null && documentPage.IsDisposed)
                    {
                        documentPage = null;
                    }
                }
            }
            return(documentPage);
        }
예제 #9
0
        // Token: 0x0600675B RID: 26459 RVA: 0x001CE224 File Offset: 0x001CC424
        internal void UpdateEntry(int pageNumber, FlowDocumentPage page, PageBreakRecord brOut, TextPointer dependentMax)
        {
            Invariant.Assert(pageNumber >= 0 && pageNumber <= this._breakRecords.Count, "The previous BreakRecord does not exist.");
            Invariant.Assert(page != null && page != DocumentPage.Missing, "Cannot update BRT with an invalid document page.");
            ITextView textView = (ITextView)((IServiceProvider)page).GetService(typeof(ITextView));

            Invariant.Assert(textView != null, "Cannot access ITextView for FlowDocumentPage.");
            bool isClean = this.IsClean;

            BreakRecordTable.BreakRecordTableEntry breakRecordTableEntry = new BreakRecordTable.BreakRecordTableEntry();
            breakRecordTableEntry.BreakRecord  = brOut;
            breakRecordTableEntry.DocumentPage = new WeakReference(page);
            breakRecordTableEntry.TextSegments = textView.TextSegments;
            breakRecordTableEntry.DependentMax = dependentMax;
            if (pageNumber == this._breakRecords.Count)
            {
                this._breakRecords.Add(breakRecordTableEntry);
                this._owner.OnPaginationProgress(pageNumber, 1);
            }
            else
            {
                if (this._breakRecords[pageNumber].BreakRecord != null && this._breakRecords[pageNumber].BreakRecord != breakRecordTableEntry.BreakRecord)
                {
                    this._breakRecords[pageNumber].BreakRecord.Dispose();
                }
                if (this._breakRecords[pageNumber].DocumentPage != null && this._breakRecords[pageNumber].DocumentPage.Target != null && this._breakRecords[pageNumber].DocumentPage.Target != breakRecordTableEntry.DocumentPage.Target)
                {
                    ((FlowDocumentPage)this._breakRecords[pageNumber].DocumentPage.Target).Dispose();
                }
                this._breakRecords[pageNumber] = breakRecordTableEntry;
            }
            if (!isClean && this.IsClean)
            {
                this._owner.OnPaginationCompleted();
            }
        }
예제 #10
0
 /// <summary> 
 /// Sets current page context to be used in the cache's queries 
 /// </summary>
 /// <param name="currentPage">Document page to become current in the context</param> 
 /// <returns>Reference to object compatible with IDisposable to re-initialize page context</returns>
 internal IDisposable SetDocumentVisualValidationContext(FlowDocumentPage currentPage)
 {
     return (new DocumentVisualValidationContext(this, currentPage) as IDisposable); 
 }
예제 #11
0
 /// <summary>
 /// Sets current page context to be used in the cache's queries 
 /// </summary> 
 /// <param name="currentPage">Document page to become current in the context</param>
 /// <returns>Reference to object compatible with IDisposable to re-initialize page context</returns> 
 internal IDisposable SetDocumentArrangeContext(FlowDocumentPage currentPage)
 {
     return (new DocumentArrangeContext(this, currentPage) as IDisposable);
 } 
예제 #12
0
        /// <summary>
        /// Updates entry of BreakRecordTable with new data.
        /// </summary>
        /// <param name="pageNumber">Index of the entry to update.</param>
        /// <param name="page">DocumentPage object that has been just created.</param>
        /// <param name="brOut">Output BreakRecord for created page.</param>
        /// <param name="dependentMax">Last content position that can affect the output break record.</param>
        internal void UpdateEntry(int pageNumber, FlowDocumentPage page, PageBreakRecord brOut, TextPointer dependentMax)
        {
            ITextView textView;
            BreakRecordTableEntry entry;
            bool isClean;

            Invariant.Assert(pageNumber >= 0 && pageNumber <= _breakRecords.Count, "The previous BreakRecord does not exist.");
            Invariant.Assert(page != null && page != DocumentPage.Missing, "Cannot update BRT with an invalid document page.");
            
            // Get TextView for DocumentPage. This TextView is used to access list of
            // content ranges. Those serve as optimalization in finding affeceted pages.
            textView = (ITextView)((IServiceProvider)page).GetService(typeof(ITextView));
            Invariant.Assert(textView != null, "Cannot access ITextView for FlowDocumentPage.");

            // Get current state of BreakRecordTable
            isClean = this.IsClean;

            // Add new entry into BreakRecordTable
            entry = new BreakRecordTableEntry();
            entry.BreakRecord = brOut;
            entry.DocumentPage = new WeakReference(page);
            entry.TextSegments = textView.TextSegments;
            entry.DependentMax = dependentMax;
            if (pageNumber == _breakRecords.Count)
            {
                _breakRecords.Add(entry);

                // Raise PaginationProgress event only if we did not have valid
                // entry for specified page number.
                _owner.OnPaginationProgress(pageNumber, 1);
            }
            else
            {
                // If old Page and/or BreakRecord are not changing, do not dispose them.
                if (_breakRecords[pageNumber].BreakRecord != null && 
                    _breakRecords[pageNumber].BreakRecord != entry.BreakRecord)
                {
                    _breakRecords[pageNumber].BreakRecord.Dispose();
                }
                if (_breakRecords[pageNumber].DocumentPage != null && 
                    _breakRecords[pageNumber].DocumentPage.Target != null &&
                    _breakRecords[pageNumber].DocumentPage.Target != entry.DocumentPage.Target)
                {
                    ((FlowDocumentPage)_breakRecords[pageNumber].DocumentPage.Target).Dispose();
                }
                _breakRecords[pageNumber] = entry;
            }

            // Raise PaginationCompleted event only if the BreakRecordTable just
            // become clean.
            if (!isClean && this.IsClean)
            {
                _owner.OnPaginationCompleted();
            }
        }
예제 #13
0
 // Token: 0x06006A59 RID: 27225 RVA: 0x001E4432 File Offset: 0x001E2632
 internal IDisposable SetDocumentVisualValidationContext(FlowDocumentPage currentPage)
 {
     return(new StructuralCache.DocumentVisualValidationContext(this, currentPage));
 }
예제 #14
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        // 
        //-------------------------------------------------------------------
 
        #region Constructors 

        /// <summary> 
        /// Constructor
        /// </summary>
        internal FlowDocumentFormatter(FlowDocument document)
        { 
            _document = document;
            _documentPage = new FlowDocumentPage(_document.StructuralCache); 
        } 
예제 #15
0
 /// <summary>
 /// Sets current page context to be used in the cache's queries
 /// </summary>
 /// <param name="currentPage">Document page to become current in the context</param>
 /// <returns>Reference to object compatible with IDisposable to re-initialize page context</returns>
 internal IDisposable SetDocumentArrangeContext(FlowDocumentPage currentPage)
 {
     return(new DocumentArrangeContext(this, currentPage) as IDisposable);
 }
예제 #16
0
 // Token: 0x06008AB4 RID: 35508 RVA: 0x002577D0 File Offset: 0x002559D0
 internal DocumentFormatContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 {
     this._owner._documentFormatContext = this;
 }
예제 #17
0
            /// <summary>
            /// Constructor 
            /// </summary> 
            /// <param name="owner">Associated structural cache instance</param>
            /// <param name="page">Document page to set</param> 
            internal DocumentOperationContext(StructuralCache owner, FlowDocumentPage page)
            {
                Invariant.Assert(owner != null, "Invalid owner object.");
                Invariant.Assert(page != null, "Invalid page object."); 
                Invariant.Assert(owner._currentPage == null, "Page formatting reentrancy detected. Trying to create second _DocumentPageContext for the same StructuralCache.");
 
                _owner = owner; 
                _owner._currentPage = page;
                _owner._illegalTreeChangeDetected = false; 
                owner.PtsContext.Enter();
            }
예제 #18
0
 /// <summary> 
 /// Constructor
 /// </summary> 
 /// <param name="owner">Associated structural cache instance</param>
 /// <param name="page">Document page to set</param>
 internal DocumentArrangeContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 { 
     _owner._documentArrangeContext = this;
 } 
예제 #19
0
 /// <summary>
 /// Sets current page context to be used in the cache's queries
 /// </summary>
 /// <param name="currentPage">Document page to become current in the context</param>
 /// <returns>Reference to object compatible with IDisposable to re-initialize page context</returns>
 internal IDisposable SetDocumentVisualValidationContext(FlowDocumentPage currentPage)
 {
     return(new DocumentVisualValidationContext(this, currentPage) as IDisposable);
 }
예제 #20
0
 /// <summary> 
 /// Constructor
 /// </summary> 
 /// <param name="owner">Associated structural cache instance</param> 
 /// <param name="page">Document page to set</param>
 internal DocumentVisualValidationContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page) { } 
예제 #21
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="owner">Associated structural cache instance</param>
 /// <param name="page">Document page to set</param>
 internal DocumentArrangeContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 {
     _owner._documentArrangeContext = this;
 }
예제 #22
0
 // ------------------------------------------------------------------
 // Create a visual representing a PTS page.
 // ------------------------------------------------------------------
 internal PageVisual(FlowDocumentPage owner)
 {
     _owner = new WeakReference(owner);
 }
예제 #23
0
 // ------------------------------------------------------------------
 // Create a visual representing a PTS page.
 // ------------------------------------------------------------------
 internal PageVisual(FlowDocumentPage owner)
 {
     _owner = new WeakReference(owner);
 }
예제 #24
0
        /// <summary>
        /// Format the page identified by the pageNumber parameter. 
        /// </summary> 
        private DocumentPage FormatPage(int pageNumber)
        { 
            FlowDocumentPage page;
            PageBreakRecord breakRecordIn, breakRecordOut;
            Thickness pageMargin;
            Size pageSize; 

            Invariant.Assert(_brt.HasPageBreakRecord(pageNumber), "BreakRecord for specified page number does not exist."); 
 
            breakRecordIn = _brt.GetPageBreakRecord(pageNumber);
            page = new FlowDocumentPage(_document.StructuralCache); 
            pageSize = ComputePageSize();
            pageMargin = _document.ComputePageMargin();

            breakRecordOut = page.FormatFinite(pageSize, pageMargin, breakRecordIn); 
            page.Arrange(pageSize);
 
            // NOTE: May execute external code, so it is possible to get 
            //       an exception here.
            _brt.UpdateEntry(pageNumber, page, breakRecordOut, page.DependentMax); 
            return page;
        }
예제 #25
0
 // Token: 0x06006A58 RID: 27224 RVA: 0x001E4429 File Offset: 0x001E2629
 internal IDisposable SetDocumentArrangeContext(FlowDocumentPage currentPage)
 {
     return(new StructuralCache.DocumentArrangeContext(this, currentPage));
 }
예제 #26
0
        //-------------------------------------------------------------------
        // 
        //  Constructors 
        //
        //------------------------------------------------------------------- 

        #region Constructors

        /// <summary> 
        /// Constructor.
        /// </summary> 
        /// <param name="owner"> 
        /// Root of layout structure visualizing content.
        /// </param> 
        /// <param name="textContainer">
        /// TextContainer providing content for this view.
        /// </param>
        internal TextDocumentView(FlowDocumentPage owner, ITextContainer textContainer) 
        {
            _owner = owner; 
            _textContainer = textContainer; 
        }
예제 #27
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="owner">Associated structural cache instance</param>
 /// <param name="page">Document page to set</param>
 internal DocumentVisualValidationContext(StructuralCache owner, FlowDocumentPage page) : base(owner, page)
 {
 }