Example #1
0
        // Token: 0x06006FB2 RID: 28594 RVA: 0x00201C3C File Offset: 0x001FFE3C
        internal override bool Validate(ITextPointer position)
        {
            FlowDocumentView flowDocumentView = this._owner as FlowDocumentView;
            bool             result;

            if (flowDocumentView == null || flowDocumentView.Document == null)
            {
                result = base.Validate(position);
            }
            else
            {
                if (this.Validate())
                {
                    BackgroundFormatInfo  backgroundFormatInfo = flowDocumentView.Document.StructuralCache.BackgroundFormatInfo;
                    FlowDocumentFormatter bottomlessFormatter  = flowDocumentView.Document.BottomlessFormatter;
                    int num = -1;
                    while (this.IsValid && !this.Contains(position))
                    {
                        backgroundFormatInfo.BackgroundFormat(bottomlessFormatter, true);
                        this._owner.UpdateLayout();
                        if (backgroundFormatInfo.CPInterrupted <= num)
                        {
                            break;
                        }
                        num = backgroundFormatInfo.CPInterrupted;
                    }
                }
                result = (this.IsValid && this.Contains(position));
            }
            return(result);
        }
Example #2
0
        // Token: 0x06006FB3 RID: 28595 RVA: 0x00201CE0 File Offset: 0x001FFEE0
        internal override void ThrottleBackgroundTasksForUserInput()
        {
            FlowDocumentView flowDocumentView = this._owner as FlowDocumentView;

            if (flowDocumentView != null && flowDocumentView.Document != null)
            {
                flowDocumentView.Document.StructuralCache.ThrottleBackgroundFormatting();
            }
        }
Example #3
0
        /// <summary>
        /// <see cref="ITextView.ThrottleBackgroundTasksForUserInput"/>
        /// </summary>
        internal override void ThrottleBackgroundTasksForUserInput()
        {
            FlowDocumentView owner = _owner as FlowDocumentView;

            if (owner != null && owner.Document != null)
            {
                owner.Document.StructuralCache.ThrottleBackgroundFormatting();
            }
        }
Example #4
0
 // Token: 0x06006FA2 RID: 28578 RVA: 0x00201714 File Offset: 0x001FF914
 internal DocumentPageTextView(FlowDocumentView owner, ITextContainer textContainer)
 {
     Invariant.Assert(owner != null && textContainer != null);
     this._owner         = owner;
     this._page          = owner.DocumentPage;
     this._textContainer = textContainer;
     if (this._page is IServiceProvider)
     {
         this._pageTextView = (((IServiceProvider)this._page).GetService(typeof(ITextView)) as ITextView);
     }
     if (this._pageTextView != null)
     {
         this._pageTextView.Updated += this.HandlePageTextViewUpdated;
     }
 }
 /// <summary> 
 /// Constructor. 
 /// </summary>
 /// <param name="owner"> 
 /// Root of layout structure visualizing content of a page.
 /// </param>
 /// <param name="textContainer">
 /// TextContainer representing content. 
 /// </param>
 internal DocumentPageTextView(FlowDocumentView owner, ITextContainer textContainer) 
 { 
     Invariant.Assert(owner != null && textContainer != null);
     _owner = owner; 
     _page = owner.DocumentPage;
     _textContainer = textContainer;
     // Retrive inner TextView
     if (_page is IServiceProvider) 
     {
         _pageTextView = ((IServiceProvider)_page).GetService(typeof(ITextView)) as ITextView; 
     } 
     if (_pageTextView != null)
     { 
         _pageTextView.Updated += new EventHandler(HandlePageTextViewUpdated);
     }
 }
Example #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="owner">
 /// Root of layout structure visualizing content of a page.
 /// </param>
 /// <param name="textContainer">
 /// TextContainer representing content.
 /// </param>
 internal DocumentPageTextView(FlowDocumentView owner, ITextContainer textContainer)
 {
     Invariant.Assert(owner != null && textContainer != null);
     _owner         = owner;
     _page          = owner.DocumentPage;
     _textContainer = textContainer;
     // Retrive inner TextView
     if (_page is IServiceProvider)
     {
         _pageTextView = ((IServiceProvider)_page).GetService(typeof(ITextView)) as ITextView;
     }
     if (_pageTextView != null)
     {
         _pageTextView.Updated += new EventHandler(HandlePageTextViewUpdated);
     }
 }
Example #7
0
        /// <summary>
        /// <see cref="ITextView.Validate(ITextPointer)"/>
        /// </summary>
        internal override bool Validate(ITextPointer position)
        {
            FlowDocumentView owner = _owner as FlowDocumentView;
            bool             isValid;

            if (owner == null || owner.Document == null)
            {
                isValid = base.Validate(position);
            }
            else
            {
                if (Validate())
                {
                    BackgroundFormatInfo  backgroundFormatInfo = owner.Document.StructuralCache.BackgroundFormatInfo;
                    FlowDocumentFormatter formatter            = owner.Document.BottomlessFormatter;

                    int lastCPInterrupted = -1;

                    while (this.IsValid && !Contains(position))
                    {
                        backgroundFormatInfo.BackgroundFormat(formatter, true /* ignoreThrottle */);
                        _owner.UpdateLayout(); // May invalidate the view.

                        // Break if background layout is not progressing.
                        // There are some edge cases where Validate() == true, but background
                        // layout will not progress (such as collapsed text in a tree view).
                        if (backgroundFormatInfo.CPInterrupted <= lastCPInterrupted)
                        {
                            // CPInterrupted is reset to -1 when background layout finishes, so
                            // check explicitly below to see if the position is valid or not.
                            break;
                        }
                        lastCPInterrupted = backgroundFormatInfo.CPInterrupted;
                    }
                }

                isValid = this.IsValid && Contains(position);
            }

            return(isValid);
        }
Example #8
0
        // Allocates the initial render scope for this control.
        internal override FrameworkElement CreateRenderScope() 
        {
            FlowDocumentView renderScope = new FlowDocumentView(); 
            renderScope.Document = this.Document; 

            // Set a margin so that the BiDi Or Italic caret has room to render at the edges of content. 
            // Otherwise, anti-aliasing or italic causes the caret to be partially clipped.
            renderScope.Document.PagePadding = new Thickness(CaretElement.CaretPaddingWidth, 0, CaretElement.CaretPaddingWidth, 0);

            // We want current style to ignore all properties from theme style for renderScope. 
            renderScope.OverridesDefaultStyle = true;
 
            return renderScope; 
        }