// Token: 0x06002B79 RID: 11129 RVA: 0x000C66D0 File Offset: 0x000C48D0 internal int GetPageNumber(ContentPosition contentPosition) { if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } DynamicDocumentPaginator dynamicDocumentPaginator = null; ContentPosition contentPosition2 = null; if (contentPosition is DocumentSequenceTextPointer) { DocumentSequenceTextPointer documentSequenceTextPointer = (DocumentSequenceTextPointer)contentPosition; dynamicDocumentPaginator = this.GetPaginator(documentSequenceTextPointer.ChildBlock.DocRef); contentPosition2 = (documentSequenceTextPointer.ChildPointer as ContentPosition); } if (contentPosition2 == null) { throw new ArgumentException(SR.Get("IDPInvalidContentPosition")); } int pageNumber = dynamicDocumentPaginator.GetPageNumber(contentPosition2); int result; this._SynthesizeGlobalPageNumber(dynamicDocumentPaginator, pageNumber, out result); return(result); }
/// <summary> /// <see cref="DynamicDocumentPaginator.GetPageNumber"/> /// </summary> internal int GetPageNumber(ContentPosition contentPosition) { if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } // ContentPosition may be only created by DynamicDocumentPaginator.GetObjectPosition or // DynamicDocumentPaginator.GetPagePosition. // Because of that we are expecting one of 2 types here. DynamicDocumentPaginator childPaginator = null; ContentPosition childContentPosition = null; if (contentPosition is DocumentSequenceTextPointer) { DocumentSequenceTextPointer dsTextPointer = (DocumentSequenceTextPointer)contentPosition; #pragma warning suppress 6506 // dsTextPointer is obviously not null childPaginator = GetPaginator(dsTextPointer.ChildBlock.DocRef); childContentPosition = dsTextPointer.ChildPointer as ContentPosition; } if (childContentPosition == null) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition)); } int childPageNumber = childPaginator.GetPageNumber(childContentPosition); int pageNumber; _SynthesizeGlobalPageNumber(childPaginator, childPageNumber, out pageNumber); return(pageNumber); }
/// <summary> /// Constructor. /// </summary> /// <param name="contentPosition">The parameter passed into the GetPageNumberAsync call.</param> /// <param name="pageNumber">The first page number on which the element appears.</param> /// <param name="error">Error occurred during an asynchronous operation.</param> /// <param name="cancelled">Whether an asynchronous operation has been cancelled.</param> /// <param name="userState">Unique identifier for the asynchronous task.</param> public GetPageNumberCompletedEventArgs(ContentPosition contentPosition, int pageNumber, Exception error, bool cancelled, object userState) : base(error, cancelled, userState) { _contentPosition = contentPosition; _pageNumber = pageNumber; }
// Token: 0x06002CBF RID: 11455 RVA: 0x000C9CB4 File Offset: 0x000C7EB4 internal int GetPageNumber(ContentPosition contentPosition) { if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } FixedTextPointer fixedTextPointer = contentPosition as FixedTextPointer; if (fixedTextPointer == null) { throw new ArgumentException(SR.Get("IDPInvalidContentPosition")); } return(fixedTextPointer.FixedTextContainer.GetPageNumber(fixedTextPointer)); }
/// <summary> /// Async version of <see cref="DynamicDocumentPaginator.GetPageNumber"/> /// </summary> /// <param name="contentPosition">Content position.</param> /// <param name="userState">Unique identifier for the asynchronous task.</param> /// <exception cref="ArgumentException"> /// Throws ArgumentException if the ContentPosition does not exist within /// this element’s tree. /// </exception> public virtual void GetPageNumberAsync(ContentPosition contentPosition, object userState) { int pageNumber; // Content position cannot be null. if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } // Content position cannot be Missing. if (contentPosition == ContentPosition.Missing) { throw new ArgumentException(SR.Get(SRID.PaginatorMissingContentPosition), "contentPosition"); } pageNumber = GetPageNumber(contentPosition); OnGetPageNumberCompleted(new GetPageNumberCompletedEventArgs(contentPosition, pageNumber, null, false, userState)); }
// Token: 0x06002B7B RID: 11131 RVA: 0x000C67A8 File Offset: 0x000C49A8 internal ContentPosition GetObjectPosition(object o) { if (o == null) { throw new ArgumentNullException("o"); } foreach (DocumentReference docRef in this.References) { DynamicDocumentPaginator paginator = this.GetPaginator(docRef); if (paginator != null) { ContentPosition objectPosition = paginator.GetObjectPosition(o); if (objectPosition != ContentPosition.Missing && objectPosition is ITextPointer) { ChildDocumentBlock childBlock = new ChildDocumentBlock(this.TextContainer, docRef); return(new DocumentSequenceTextPointer(childBlock, (ITextPointer)objectPosition)); } } } return(ContentPosition.Missing); }
/// <summary> /// Async version of <see cref="DynamicDocumentPaginator.GetPageNumber"/> /// </summary> /// <param name="contentPosition">Content position.</param> /// <exception cref="ArgumentException"> /// Throws ArgumentException if the ContentPosition does not exist within /// this element's tree. /// </exception> public virtual void GetPageNumberAsync(ContentPosition contentPosition) { GetPageNumberAsync(contentPosition, null); }
internal BringIntoViewState(DocumentViewerBase source, ContentPosition contentPosition, DependencyObject targetObject, Rect targetRect) { this.Source = source; this.ContentPosition = contentPosition; this.TargetObject = targetObject; this.TargetRect = targetRect; }
/// <summary> /// Constructs a new MakeVisibleData object /// </summary> /// <param name="visual">A visual to be made visible.</param> /// <param name="contentPosition">A ContentPosition to be made visible.</param> /// <param name="rect">Any bounding rect to be made visible.</param> public MakeVisibleData(Visual visual, ContentPosition contentPosition, Rect rect) { _visual = visual; _contentPosition = contentPosition; _rect = rect; }
/// <summary> /// Returns the page number on which the ContentPosition appears. /// </summary> /// <param name="contentPosition">Content position.</param> /// <returns> /// Returns the page number on which the ContentPosition appears. /// </returns> /// <exception cref="ArgumentException"> /// Throws ArgumentException if the ContentPosition does not exist within /// this element's tree. /// </exception> public override int GetPageNumber(ContentPosition contentPosition) { TextPointer flowContentPosition; int pageNumber; // Ensure usage from just one Dispatcher object. // FlowDocumentPaginator runs its own layout, hence there is a need // to protect it from random access from other threads. _dispatcherObject.VerifyAccess(); // ContentPosition cannot be null. if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } // ContentPosition must be of appropriate type and must be part of // the content. flowContentPosition = contentPosition as TextPointer; if (flowContentPosition == null) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition), "contentPosition"); } if (flowContentPosition.TextContainer != _document.StructuralCache.TextContainer) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition), "contentPosition"); } // We are about to perform synchronous pagination, so need to check for // reentrancy. if (_document.StructuralCache.IsFormattingInProgress) { throw new InvalidOperationException(SR.Get(SRID.FlowDocumentFormattingReentrancy)); } if (_document.StructuralCache.IsContentChangeInProgress) { throw new InvalidOperationException(SR.Get(SRID.TextContainerChangingReentrancyInvalid)); } // Disable processing of the queue during blocking operations to prevent unrelated reentrancy. using (_document.Dispatcher.DisableProcessing()) { _document.StructuralCache.IsFormattingInProgress = true; // Set reentrancy flag. pageNumber = 0; try { while (!_brt.GetPageNumberForContentPosition(flowContentPosition, ref pageNumber)) { // If failed to get PageNumber and BreakRecordTable is clean, // the input ContentPosition does not belong to the content. // But according to check above, it does belong to the content. // Break and return -1 in this case if (_brt.IsClean) { pageNumber = -1; break; } // Do synchronous pagination for the next missing page number. FormatPage(pageNumber); } } finally { _document.StructuralCache.IsFormattingInProgress = false; // Clear reentrancy flag. } } return pageNumber; }
/// <summary> /// Handle the case when the position is no longer valid for the current document, conservatively returns true if /// is uknown. /// </summary> private bool IsValidContentPositionForDocument(IDocumentPaginatorSource document, ContentPosition contentPosition) { FlowDocument flowDocument = document as FlowDocument; TextPointer textPointer = contentPosition as TextPointer; if(flowDocument != null && textPointer != null) { return flowDocument.ContentStart.TextContainer == textPointer.TextContainer; } return true; }
public virtual new void GetPageNumberAsync(ContentPosition contentPosition) { }
public GetPageNumberCompletedEventArgs(ContentPosition contentPosition, int pageNumber, Exception error, bool cancelled, Object userState) : base (default(Exception), default(bool), default(Object)) { }
/// <summary> /// <see cref="DynamicDocumentPaginator.GetPageNumber"/> /// </summary> /// <exception cref="ArgumentNullException">contentPosition is NULL.</exception> /// <exception cref="ArgumentException">ContentPosition does not exist within this element?s tree.</exception> internal int GetPageNumber(ContentPosition contentPosition) { // Dispatcher.VerifyAccess(); if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } FixedTextPointer fixedTextPointer = contentPosition as FixedTextPointer; if (fixedTextPointer == null) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition)); } return fixedTextPointer.FixedTextContainer.GetPageNumber(fixedTextPointer); }
public virtual new void GetPageNumberAsync(ContentPosition contentPosition, Object userState) { }
/// <summary> /// Async version of <see cref="DynamicDocumentPaginator.GetPageNumber"/> /// </summary> /// <param name="contentPosition">Content position.</param> /// <param name="userState">Unique identifier for the asynchronous task.</param> /// <exception cref="ArgumentException"> /// Throws ArgumentException if the ContentPosition does not exist within /// this element�s tree. /// </exception> public override void GetPageNumberAsync(ContentPosition contentPosition, object userState) { // Content position cannot be null. if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } // Content position cannot be Missing. if (contentPosition == ContentPosition.Missing) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition), "contentPosition"); } // ContentPosition must be of appropriate type and must be part of // the content. TextPointer flowContentPosition = contentPosition as TextPointer; if (flowContentPosition == null) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition), "contentPosition"); } if (flowContentPosition.TextContainer != _document.StructuralCache.TextContainer) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition), "contentPosition"); } int pageNumber = 0; if(!_backgroundPagination) { pageNumber = GetPageNumber(contentPosition); OnGetPageNumberCompleted(new GetPageNumberCompletedEventArgs(contentPosition, pageNumber, null, false, userState)); } else { if(_brt.GetPageNumberForContentPosition(flowContentPosition, ref pageNumber)) { OnGetPageNumberCompleted(new GetPageNumberCompletedEventArgs(contentPosition, pageNumber, null, false, userState)); } else { _asyncRequests.Add(new GetPageNumberAsyncRequest(flowContentPosition, userState, this)); InitiateNextAsyncOperation(); } } }
public abstract int GetPageNumber(ContentPosition contentPosition);
/// <summary> /// <see cref="DynamicDocumentPaginator.GetPageNumber"/> /// </summary> internal int GetPageNumber(ContentPosition contentPosition) { if (contentPosition == null) { throw new ArgumentNullException("contentPosition"); } // ContentPosition may be only created by DynamicDocumentPaginator.GetObjectPosition or // DynamicDocumentPaginator.GetPagePosition. // Because of that we are expecting one of 2 types here. DynamicDocumentPaginator childPaginator = null; ContentPosition childContentPosition = null; if (contentPosition is DocumentSequenceTextPointer) { DocumentSequenceTextPointer dsTextPointer = (DocumentSequenceTextPointer)contentPosition; #pragma warning suppress 6506 // dsTextPointer is obviously not null childPaginator = GetPaginator(dsTextPointer.ChildBlock.DocRef); childContentPosition = dsTextPointer.ChildPointer as ContentPosition; } if (childContentPosition == null) { throw new ArgumentException(SR.Get(SRID.IDPInvalidContentPosition)); } int childPageNumber = childPaginator.GetPageNumber(childContentPosition); int pageNumber; _SynthesizeGlobalPageNumber(childPaginator, childPageNumber, out pageNumber); return pageNumber; }
/// <summary> /// <see cref="DynamicDocumentPaginator.GetPageNumber"/> /// </summary> public override int GetPageNumber(ContentPosition contentPosition) { return _document.GetPageNumber(contentPosition); }
//------------------------------------------------------------------- // // Public Methods // //------------------------------------------------------------------- #region Public Methods /// <summary> /// Returns the page number on which the ContentPosition appears. /// </summary> /// <param name="contentPosition">Content position.</param> /// <returns> /// Returns the page number on which the ContentPosition appears. /// </returns> /// <exception cref="ArgumentException"> /// Throws ArgumentException if the ContentPosition does not exist within /// this element's tree. /// </exception> public abstract int GetPageNumber(ContentPosition contentPosition);
public GetPageNumberCompletedEventArgs(ContentPosition contentPosition, int pageNumber, Exception error, bool cancelled, Object userState) : base(default(Exception), default(bool), default(Object)) { }