// Token: 0x060062D4 RID: 25300 RVA: 0x001BBA20 File Offset: 0x001B9C20 private static IList <IAttachedAnnotation> GetSpannedAnnotationsForFixed(AnnotationService service, int startPage, int endPage) { Invariant.Assert(service != null, "Need non-null service to get spanned annotations for fixed content."); FixedPageProcessor fixedPageProcessor = service.LocatorManager.GetSubTreeProcessorForLocatorPart(FixedPageProcessor.CreateLocatorPart(0)) as FixedPageProcessor; Invariant.Assert(fixedPageProcessor != null, "FixedPageProcessor should be available if we are processing fixed content."); List <IAttachedAnnotation> result = null; List <Annotation> annotations = new List <Annotation>(); try { fixedPageProcessor.UseLogicalTree = true; for (int i = startPage; i <= endPage; i++) { ContentLocator contentLocator = new ContentLocator(); contentLocator.Parts.Add(FixedPageProcessor.CreateLocatorPart(i)); AnnotationHelper.AddRange(annotations, service.Store.GetAnnotations(contentLocator)); } result = AnnotationHelper.ResolveAnnotations(service, annotations); } finally { fixedPageProcessor.UseLogicalTree = false; } return(result); }
/// <summary>Returns an <see cref="T:System.Windows.Annotations.IAnchorInfo" /> object that provides anchoring information, such as the anchor location, about the specified annotation.</summary> /// <param name="service">The annotation service to use for this operation.</param> /// <param name="annotation">The annotation to get anchoring information for.</param> /// <returns>An <see cref="T:System.Windows.Annotations.IAnchorInfo" /> object that provides anchoring information about the specified annotation, or <see langword="null" /> if it cannot be resolved.</returns> // Token: 0x060062C1 RID: 25281 RVA: 0x001BB2D0 File Offset: 0x001B94D0 public static IAnchorInfo GetAnchorInfo(AnnotationService service, Annotation annotation) { AnnotationHelper.CheckInputs(service); if (annotation == null) { throw new ArgumentNullException("annotation"); } bool flag = true; DocumentViewerBase documentViewerBase = service.Root as DocumentViewerBase; if (documentViewerBase == null) { FlowDocumentReader flowDocumentReader = service.Root as FlowDocumentReader; if (flowDocumentReader != null) { documentViewerBase = (AnnotationHelper.GetFdrHost(flowDocumentReader) as DocumentViewerBase); } } else { flag = (documentViewerBase.Document is FlowDocument); } IList <IAttachedAnnotation> list = null; if (flag) { TextSelectionProcessor textSelectionProcessor = service.LocatorManager.GetSelectionProcessor(typeof(TextRange)) as TextSelectionProcessor; TextSelectionProcessor textSelectionProcessor2 = service.LocatorManager.GetSelectionProcessor(typeof(TextAnchor)) as TextSelectionProcessor; Invariant.Assert(textSelectionProcessor != null, "TextSelectionProcessor should be available for TextRange if we are processing flow content."); Invariant.Assert(textSelectionProcessor2 != null, "TextSelectionProcessor should be available for TextAnchor if we are processing flow content."); try { textSelectionProcessor.Clamping = false; textSelectionProcessor2.Clamping = false; list = AnnotationHelper.ResolveAnnotations(service, new Annotation[] { annotation }); goto IL_12E; } finally { textSelectionProcessor.Clamping = true; textSelectionProcessor2.Clamping = true; } } FixedPageProcessor fixedPageProcessor = service.LocatorManager.GetSubTreeProcessorForLocatorPart(FixedPageProcessor.CreateLocatorPart(0)) as FixedPageProcessor; Invariant.Assert(fixedPageProcessor != null, "FixedPageProcessor should be available if we are processing fixed content."); try { fixedPageProcessor.UseLogicalTree = true; list = AnnotationHelper.ResolveAnnotations(service, new Annotation[] { annotation }); } finally { fixedPageProcessor.UseLogicalTree = false; } IL_12E: Invariant.Assert(list != null); if (list.Count > 0) { return(list[0]); } return(null); }