Example #1
0
        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;
            }
        }
Example #2
0
		public bool Intersects (StringRange other)
		{
			if (other.Location >= Location + Length)
				return false;
			if (Location >= other.Location + other.Length)
				return false;
			return true;
		}
Example #3
0
		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;
		}
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
 public bool Intersects(StringRange other)
 {
     if (other.Location >= Location + Length)
     {
         return(false);
     }
     if (Location >= other.Location + other.Length)
     {
         return(false);
     }
     return(true);
 }
Example #7
0
		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));
        }
Example #11
0
		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);
		}
Example #12
0
			public Span(StringRange range, string className)
			{
				Range = range;
				Classes = className;
			}
Example #13
0
 public Span(StringRange range, string className)
 {
     Range   = range;
     Classes = className;
 }
Example #14
0
		public StringReplacement (string text, StringRange range)
		{
			Text = text;
			Range = range;
		}
Example #15
0
 public StringReplacement(string text, StringRange range)
 {
     Text  = text;
     Range = range;
 }