public void AddAttributes(IRichTextAttributes istyleClass, StringRange range) { var end = range.End; var styleClass = (RichTextAttributes)istyleClass; for (var i = range.Location; i < end; i++) { var c = classes[i]; if (c.Class1 == null) { c.Class1 = styleClass; } else if (c.Class2 == null) { c.Class2 = styleClass; } else if (c.Class3 == null) { c.Class3 = styleClass; } else if (c.Class4 == null) { c.Class4 = styleClass; } else { throw new Exception("Too much style"); } classes[i] = c; } }
public bool Intersects (StringRange other) { if (other.Location >= Location + Length) return false; if (Location >= other.Location + other.Length) return false; return true; }
public bool Contains (StringRange other) { var end = Location + Length; var oend = other.Location + other.Length; return Location <= other.Location && other.Location < end && Location <= oend && oend < end; }
public bool Contains(StringRange other) { var end = Location + Length; var oend = other.Location + other.Length; return (Location <= other.Location && other.Location < end && Location <= oend && oend < end); }
public void AddAttributes(IRichTextAttributes styleClass, StringRange range) { if (range.Length == 0) { return; } var starts = spans [range.Location]; // // If there already an identical span // Span span = null; if (starts != null) { foreach (var s in starts) { if (s.Range.Length == range.Length) { span = s; break; } } if (span != null) { span.AddClass(styleClass.ClassName); return; } } // // If not, we need to insert it // span = new Span(range, styleClass.ClassName); span.Url = styleClass.Link; if (starts == null) { starts = new List <Span> (); spans [range.Location] = starts; starts.Add(span); return; } // // Insert it before shorter spans // var i = 0; while (i < starts.Count && starts [i].Range.Length >= range.Length) { i++; } starts.Insert(i, span); }
public bool Intersects(StringRange other) { if (other.Location >= Location + Length) { return(false); } if (Location >= other.Location + other.Length) { return(false); } return(true); }
public void AddAttributes (IRichTextAttributes istyleClass, StringRange range) { var end = range.End; var styleClass = (RichTextAttributes)istyleClass; for (var i = range.Location; i < end; i++) { var c = classes[i]; if (c.Class1 == null) c.Class1 = styleClass; else if (c.Class2 == null) c.Class2 = styleClass; else if (c.Class3 == null) c.Class3 = styleClass; else if (c.Class4 == null) c.Class4 = styleClass; else throw new Exception ("Too much style"); classes[i] = c; } }
public static void AddAttributes(this NativeNSMutableAttributedString s, NativeCTStringAttributes a, StringRange r) { s.AddAttributes(a, new NSRange(r.Location, r.Length)); }
public static NSRange ToNSRange(this StringRange r) { return(new NSRange(r.Location, r.Length)); }
public void AddAttributes(IRichTextAttributes styleClass, StringRange range) { var attrs = ((NativeStringAttributesWrapper)styleClass).Attributes; s.AddAttributes(attrs, new NSRange(range.Location, range.Length)); }
public void AddAttributes (IRichTextAttributes styleClass, StringRange range) { if (range.Length == 0) return; var starts = spans [range.Location]; // // If there already an identical span // Span span = null; if (starts != null) { foreach (var s in starts) { if (s.Range.Length == range.Length) { span = s; break; } } if (span != null) { span.AddClass (styleClass.ClassName); return; } } // // If not, we need to insert it // span = new Span (range, styleClass.ClassName); span.Url = styleClass.Link; if (starts == null) { starts = new List<Span> (); spans [range.Location] = starts; starts.Add (span); return; } // // Insert it before shorter spans // var i = 0; while (i < starts.Count && starts [i].Range.Length >= range.Length) { i++; } starts.Insert (i, span); }
public Span(StringRange range, string className) { Range = range; Classes = className; }
public StringReplacement (string text, StringRange range) { Text = text; Range = range; }
public StringReplacement(string text, StringRange range) { Text = text; Range = range; }