//redraws highlights on page private void UpdateHighlightVisual(FixedPage page) { if (page != null) { HighlightVisual hv = HighlightVisual.GetHighlightVisual(page); if (hv != null) { hv.UpdateRubberbandSelection(this); } } }
// Token: 0x06002D7E RID: 11646 RVA: 0x000CCE20 File Offset: 0x000CB020 protected internal override void OnVisualParentChanged(DependencyObject oldParent) { base.OnVisualParentChanged(oldParent); if (oldParent == null) { HighlightVisual highlightVisual = HighlightVisual.GetHighlightVisual(this); AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this); if (highlightVisual == null && adornerLayer != null) { PageContent pageContent = LogicalTreeHelper.GetParent(this) as PageContent; if (pageContent != null) { FixedDocument fixedDocument = LogicalTreeHelper.GetParent(pageContent) as FixedDocument; if (fixedDocument != null && adornerLayer != null) { int zOrder = 1073741823; adornerLayer.Add(new HighlightVisual(fixedDocument, this), zOrder); } } } } }
// Token: 0x06002CE0 RID: 11488 RVA: 0x000CA4F8 File Offset: 0x000C86F8 private void OnHighlightChanged(object sender, HighlightChangedEventArgs args) { ITextContainer fixedContainer = this.FixedContainer; Highlights highlights = null; FixedDocumentSequence fixedDocumentSequence = base.Parent as FixedDocumentSequence; if (fixedDocumentSequence != null) { highlights = fixedDocumentSequence.TextContainer.Highlights; } else { highlights = this.FixedContainer.Highlights; } List <FixedPage> list = new List <FixedPage>(); foreach (FixedPage item in this._highlights.Keys) { list.Add(item); } this._highlights.Clear(); StaticTextPointer staticTextPointer = fixedContainer.CreateStaticPointerAtOffset(0); for (;;) { if (!highlights.IsContentHighlighted(staticTextPointer, LogicalDirection.Forward)) { staticTextPointer = highlights.GetNextHighlightChangePosition(staticTextPointer, LogicalDirection.Forward); if (staticTextPointer.IsNull) { break; } } object highlightValue = highlights.GetHighlightValue(staticTextPointer, LogicalDirection.Forward, typeof(TextSelection)); StaticTextPointer textPosition = staticTextPointer; FixedHighlightType fixedHighlightType = FixedHighlightType.None; Brush foregroundBrush = null; Brush backgroundBrush = null; if (highlightValue != DependencyProperty.UnsetValue) { do { staticTextPointer = highlights.GetNextHighlightChangePosition(staticTextPointer, LogicalDirection.Forward); }while (highlights.GetHighlightValue(staticTextPointer, LogicalDirection.Forward, typeof(TextSelection)) != DependencyProperty.UnsetValue); fixedHighlightType = FixedHighlightType.TextSelection; foregroundBrush = null; backgroundBrush = null; } else { AnnotationHighlightLayer.HighlightSegment highlightSegment = highlights.GetHighlightValue(textPosition, LogicalDirection.Forward, typeof(HighlightComponent)) as AnnotationHighlightLayer.HighlightSegment; if (highlightSegment != null) { staticTextPointer = highlights.GetNextHighlightChangePosition(staticTextPointer, LogicalDirection.Forward); fixedHighlightType = FixedHighlightType.AnnotationHighlight; backgroundBrush = highlightSegment.Fill; } } if (fixedHighlightType != FixedHighlightType.None) { this.FixedContainer.GetMultiHighlights((FixedTextPointer)textPosition.CreateDynamicTextPointer(LogicalDirection.Forward), (FixedTextPointer)staticTextPointer.CreateDynamicTextPointer(LogicalDirection.Forward), this._highlights, fixedHighlightType, foregroundBrush, backgroundBrush); } } ArrayList arrayList = new ArrayList(); IList ranges = args.Ranges; for (int i = 0; i < ranges.Count; i++) { TextSegment textSegment = (TextSegment)ranges[i]; int pageNumber = this.FixedContainer.GetPageNumber(textSegment.Start); int pageNumber2 = this.FixedContainer.GetPageNumber(textSegment.End); for (int j = pageNumber; j <= pageNumber2; j++) { if (arrayList.IndexOf(j) < 0) { arrayList.Add(j); } } } ICollection <FixedPage> keys = this._highlights.Keys; foreach (FixedPage fixedPage in list) { if (!keys.Contains(fixedPage)) { int indexOfPage = this.GetIndexOfPage(fixedPage); if (indexOfPage >= 0 && indexOfPage < this.PageCount && arrayList.IndexOf(indexOfPage) < 0) { arrayList.Add(indexOfPage); } } } arrayList.Sort(); foreach (object obj in arrayList) { int index = (int)obj; HighlightVisual highlightVisual = HighlightVisual.GetHighlightVisual(this.SyncGetPage(index, false)); if (highlightVisual != null) { highlightVisual.InvalidateHighlights(); } } }