Ejemplo n.º 1
0
 public void ClearDefaultWithout(ComplexStyle sty)
 {
     foreach (var complexStyle in Styles.Styles.Where(elem => !ComplexStyle.Equals(elem, sty) && elem.IsDefault))
     {
         complexStyle.IsDefault = false;
     }
 }
Ejemplo n.º 2
0
        public static bool Equals(ComplexStyle style1, ComplexStyle style2)
        {
            if (style1 == null && style2 == null)
            {
                return(true);
            }
            if (style1 == null || style2 == null)
            {
                return(false);
            }

            return(style1.Equals(style2));
        }
        public static bool IsStyle(this  TextElement text, ComplexStyle style, double defaultSize, out TextPointer position)
        {
            position = null;
            var run = text as Run;

            if (run != null && string.IsNullOrEmpty(run.Text))
            {
                return(false);
            }
            var range = new TextRange(text.ContentStart, text.ContentEnd);
            var sty   = GetCurrentStyle(range, defaultSize);

            position = text.ContentStart;
            return(ComplexStyle.Equals(sty, style));
        }
        public static void CollectStyles(this TextElement text, ref List <ComplexStyle> styles, double defaultSize)
        {
            var run = text as Run;

            if (run != null && string.IsNullOrEmpty(run.Text))
            {
                return;
            }
            var range = new TextRange(text.ContentStart, text.ContentEnd);
            var style = GetCurrentStyle(range, defaultSize);

            if (!styles.Any(elem => ComplexStyle.Equals(elem, style)))
            {
                styles.Add(style);
            }
        }