Esempio n. 1
0
        public void AddStyle(Style style, bool replace)
        {
            if (replace)
            {
                styles.Remove(style.Name);
                styles.Add(style.Name, style);
            }

            else AddStyle(style);
        }
        public static Style CreateStyle(StyleInfo style, Defaults defaults)
        {
            Style tmp = new Style();
            tmp.Name = style.Name;
            tmp.Type = style.Type;
            tmp.Value = style.Value;

            if (style.Value.Equals("")) {

                String generated = GenerateValue(style);

                if (generated == null || generated.Equals("")) generated = defaults.GetDefaultStyleValue(style);

                tmp.Value = generated;
            }

            return tmp;
        }
Esempio n. 3
0
        /// <summary>
        /// Returns a list of styles possible for a given feature
        /// </summary>
        /// <param name="feature"></param>
        /// <returns></returns>
        public IEnumerable<Style> GetSupportedStyles(String feature)
        {
            XmlNodeList styles = root.SelectNodes("/docFeatures/styles/feature[@name='"+feature+"']/*");

            foreach (var node in styles)
            {
                if (!(node is XmlElement)) { throw new Exception("Xml config error"); } //TODO : Change

                XmlElement tmp = (XmlElement)node;
                Style tmpStyle = new Style();
                tmpStyle.Name = tmp.Name;
                tmpStyle.Type = styleTypesMap[ tmp.GetAttribute("type") ];

                yield return tmpStyle;
            }
        }
Esempio n. 4
0
        public void AddStyle(Style style)
        {
            if (styles.ContainsKey(style.Name)) return;

            styles.Add(style.Name,style);
        }