// Token: 0x060062DB RID: 25307 RVA: 0x001BBFD4 File Offset: 0x001BA1D4 private static Annotation ProcessHighlights(AnnotationService service, ITextRange textRange, string author, Color?color, bool create) { Invariant.Assert(textRange != null, "Parameter 'textRange' is null."); IList <IAttachedAnnotation> spannedAnnotations = AnnotationHelper.GetSpannedAnnotations(service); foreach (IAttachedAnnotation attachedAnnotation in spannedAnnotations) { if (HighlightComponent.TypeName.Equals(attachedAnnotation.Annotation.AnnotationType)) { TextAnchor textAnchor = attachedAnnotation.FullyAttachedAnchor as TextAnchor; Invariant.Assert(textAnchor != null, "FullyAttachedAnchor must not be null."); TextAnchor textAnchor2 = new TextAnchor(textAnchor); textAnchor2 = TextAnchor.TrimToRelativeComplement(textAnchor2, textRange.TextSegments); if (textAnchor2 == null || textAnchor2.IsEmpty) { service.Store.DeleteAnnotation(attachedAnnotation.Annotation.Id); } else { AnnotationHelper.SetAnchor(service, attachedAnnotation.Annotation, textAnchor2); } } } if (create) { Annotation annotation = AnnotationHelper.CreateHighlight(service, textRange, author, color); service.Store.AddAnnotation(annotation); return(annotation); } return(null); }
// Token: 0x060062D7 RID: 25303 RVA: 0x001BBC34 File Offset: 0x001B9E34 private static void DeleteSpannedAnnotations(AnnotationService service, XmlQualifiedName annotationType) { AnnotationHelper.CheckInputs(service); Invariant.Assert(annotationType != null && (annotationType == HighlightComponent.TypeName || annotationType == StickyNoteControl.TextSchemaName || annotationType == StickyNoteControl.InkSchemaName), "Invalid Annotation Type"); ITextSelection textSelection = AnnotationHelper.GetTextSelection((FrameworkElement)service.Root); Invariant.Assert(textSelection != null, "TextSelection is null"); IList <IAttachedAnnotation> spannedAnnotations = AnnotationHelper.GetSpannedAnnotations(service); foreach (IAttachedAnnotation attachedAnnotation in spannedAnnotations) { if (annotationType.Equals(attachedAnnotation.Annotation.AnnotationType)) { TextAnchor textAnchor = attachedAnnotation.AttachedAnchor as TextAnchor; if (textAnchor != null && ((textSelection.Start.CompareTo(textAnchor.Start) > 0 && textSelection.Start.CompareTo(textAnchor.End) < 0) || (textSelection.End.CompareTo(textAnchor.Start) > 0 && textSelection.End.CompareTo(textAnchor.End) < 0) || (textSelection.Start.CompareTo(textAnchor.Start) <= 0 && textSelection.End.CompareTo(textAnchor.End) >= 0) || AnnotationHelper.CheckCaret(textSelection, textAnchor, annotationType))) { service.Store.DeleteAnnotation(attachedAnnotation.Annotation.Id); } } } }