//----------------------------------------------------- // // ctors // //----------------------------------------------------- #region ctors /// <summary> /// Creates a new component /// </summary> /// <param name="type">owning component type </param> /// <param name="host">Dependency object to host IsActive and IsMouseOverAnchor DepenedencyProperties /// if host is null - set them on MarkedHighlightComponent itself</param> public MarkedHighlightComponent(XmlQualifiedName type, DependencyObject host) : base() { if (type == null) { throw new ArgumentNullException("type"); } _DPHost = host == null ? this : host; ClipToBounds = false; //create anchor highlight. The second parameter controls // if we want to render the entire anchor or only the Text content // This applies specificaly to tables, figures and floaters. // Currently implementation of GetTightBoundingGeometryForTextPointers does not // allow us to render the entire cell so we pass true (means content only). HighlightAnchor = new HighlightComponent(1, true, type); Children.Add(HighlightAnchor); //we will add the markers when the attached annotation is added //when we know the attachment level _leftMarker = null; _rightMarker = null; _state = 0; SetState(); }
// Token: 0x06007CC5 RID: 31941 RVA: 0x002315A0 File Offset: 0x0022F7A0 internal static void GetCargoColors(Annotation annot, ref Color?backgroundColor, ref Color?activeBackgroundColor) { Invariant.Assert(annot != null, "annotation is null"); ICollection <AnnotationResource> cargos = annot.Cargos; if (cargos != null) { foreach (AnnotationResource annotationResource in cargos) { if (annotationResource.Name == "Highlight") { ICollection contents = annotationResource.Contents; foreach (object obj in contents) { XmlElement xmlElement = (XmlElement)obj; if (xmlElement.LocalName == "Colors" && xmlElement.NamespaceURI == "http://schemas.microsoft.com/windows/annotations/2003/11/base") { if (xmlElement.Attributes["Background"] != null) { backgroundColor = new Color?(HighlightComponent.GetColor(xmlElement.Attributes["Background"].Value)); } if (xmlElement.Attributes["ActiveBackground"] != null) { activeBackgroundColor = new Color?(HighlightComponent.GetColor(xmlElement.Attributes["ActiveBackground"].Value)); } } } } } } }
// Token: 0x06007CC8 RID: 31944 RVA: 0x002317E8 File Offset: 0x0022F9E8 private void GetColors(Annotation annot, out Color backgroundColor, out Color activeBackgroundColor) { Color?color = new Color?(this._defaultBackroundColor); Color?color2 = new Color?(this._defaultActiveBackgroundColor); HighlightComponent.GetCargoColors(annot, ref color, ref color2); backgroundColor = color.Value; activeBackgroundColor = color2.Value; }
/// <summary> /// Choose an IAnnotationComponent for a given IAttachedAnnotation. Implementation in AnnotationComponentChooser knows /// about all out-of-box IAnnotationComponents. The default mapping will be stated here later. /// Subclasses can overwrite this method to return application specific mapping. /// Note: In future release this method should be made virtual. /// </summary> /// <param name="attachedAnnotation">The IAttachedAnnotation that needs an IAnnotationComponent </param> /// <returns></returns> public IAnnotationComponent ChooseAnnotationComponent(IAttachedAnnotation attachedAnnotation) { if (attachedAnnotation == null) throw new ArgumentNullException("attachedAnnotation"); IAnnotationComponent ac = null; // Text StickyNote if (attachedAnnotation.Annotation.AnnotationType == StickyNoteControl.TextSchemaName) { ac = new StickyNoteControl(StickyNoteType.Text) as IAnnotationComponent; } // Ink StickyNote else if (attachedAnnotation.Annotation.AnnotationType == StickyNoteControl.InkSchemaName) { ac = new StickyNoteControl(StickyNoteType.Ink) as IAnnotationComponent; } // Highlight else if (attachedAnnotation.Annotation.AnnotationType == HighlightComponent.TypeName) { ac = new HighlightComponent() as IAnnotationComponent; } return ac; }