The CSSStyleSheet interface is a concrete interface used to represent a CSS style sheet i.e., a style sheet whose content type is "text/css".
Inheritance: SharpVectors.Dom.Stylesheets.StyleSheet, ICssStyleSheet
Esempio n. 1
0
 /// <summary>
 /// The constructor for CssImportRule
 /// </summary>
 /// <param name="match">The Regex match that found the charset rule</param>
 /// <param name="parent">The parent rule or parent stylesheet</param>
 /// <param name="readOnly">True if this instance is readonly</param>
 /// <param name="replacedStrings">An array of strings that have been replaced in the string used for matching. These needs to be put back use the DereplaceStrings method</param>
 /// <param name="origin">The type of CssStyleSheet</param>
 internal CssImportRule(Match match, object parent, bool readOnly, string[] replacedStrings, CssStyleSheetType origin)
     : base(parent, readOnly, replacedStrings, origin)
 {
     media = new MediaList(match.Groups["importmedia"].Value);
     href = DeReplaceStrings(match.Groups["importhref"].Value);
     styleSheet = new CssStyleSheet(ResolveOwnerNode(), Href, null, match.Groups["importmedia"].Value, this, Origin);
 }
Esempio n. 2
0
        public void Init()
        {
            if(!initDone)
            {
                doc = new CssXmlDocument();
                doc.AddStyleElement("http://www.w3.org/2000/svg", "style");
                doc.Load("http://www.sharpvectors.org/tests/css_unittest_01.svg");
                cssStyleSheet = (CssStyleSheet)doc.StyleSheets[0];
                colorRules = (CssStyleDeclaration)((CssStyleRule)cssStyleSheet.CssRules[4]).Style;

                initDone = true;
            }
        }
Esempio n. 3
0
 protected CssRule(object parent, bool readOnly, string[] replacedStrings, CssStyleSheetType origin)
 {
     if(parent is CssRule)
     {
         _ParentRule = (CssRule)parent;
     }
     else if(parent is CssStyleSheet)
     {
         _ParentStyleSheet = (CssStyleSheet)parent;
     }
     else
     {
         throw new Exception("The CssRule constructor can only take a CssRule or CssStyleSheet as it's second argument " + parent.GetType());
     }
     Origin = origin;
     ReplacedStrings = replacedStrings;
     ReadOnly = readOnly;
 }
Esempio n. 4
0
 /// <summary>
 /// Sets the user stylesheet for this document
 /// </summary>
 /// <param name="href">The URI to the stylesheet</param>
 public void SetUserStyleSheet(string href)
 {
     userStyleSheet = new CssStyleSheet(null, href, String.Empty, String.Empty, null, CssStyleSheetType.User);
 }
Esempio n. 5
0
 /// <summary>
 /// The constructor for CssImportRule
 /// </summary>
 /// <param name="match">The Regex match that found the charset rule</param>
 /// <param name="parent">The parent rule or parent stylesheet</param>
 /// <param name="readOnly">True if this instance is readonly</param>
 /// <param name="replacedStrings">An array of strings that have been replaced in the string used for matching. These needs to be put back use the DereplaceStrings method</param>
 /// <param name="origin">The type of CssStyleSheet</param>
 internal CssImportRule(Match match, object parent, bool readOnly, string[] replacedStrings, CssStyleSheetType origin) : base(parent, readOnly, replacedStrings, origin)
 {
     media      = new MediaList(match.Groups["importmedia"].Value);
     href       = DeReplaceStrings(match.Groups["importhref"].Value);
     styleSheet = new CssStyleSheet(ResolveOwnerNode(), Href, null, match.Groups["importmedia"].Value, this, Origin);
 }
Esempio n. 6
0
 public void TestCssStyleSheet()
 {
     Assert.IsTrue(doc.StyleSheets[0] is CssStyleSheet);
     cssStyleSheet = (CssStyleSheet)doc.StyleSheets[0];
     Assert.IsTrue(cssStyleSheet.AbsoluteHref.AbsolutePath.EndsWith("css_unittest_01.css"), "AbsoluteHref");
     Assert.AreEqual(cssStyleSheet.Title, "Test title", "Title");
     Assert.AreEqual("text/css", cssStyleSheet.Type);
     Assert.AreEqual(false, cssStyleSheet.Disabled);
 }
Esempio n. 7
0
 /// <summary>
 /// Sets the user stylesheet for this document
 /// </summary>
 /// <param name="href">The URI to the stylesheet</param>
 public void SetUserStyleSheet(string href)
 {
     userStyleSheet = new CssStyleSheet(null, href, String.Empty, String.Empty, null, CssStyleSheetType.User);
 }
Esempio n. 8
0
 public void AddStyleSheet(string href)
 {
     _userStyleSheet = new CssStyleSheet(null, href, string.Empty, string.Empty, null, CssStyleSheetType.User);
 }
Esempio n. 9
0
 /// <summary>
 /// Sets the user agent stylesheet for this document
 /// </summary>
 /// <param name="href">The URI to the stylesheet</param>
 public void SetUserAgentStyleSheet(string href)
 {
     _userAgentStyleSheet = new CssStyleSheet(null, href, string.Empty, string.Empty,
                                              null, CssStyleSheetType.UserAgent);
 }
Esempio n. 10
0
 public void AddCssStyleSheet(CssStyleSheet ss)
 {
     styleSheets.Add(ss);
 }
 protected virtual CssStyleDeclaration getCSD(bool readOnly)
 {
     CssStyleSheet ss = new CssStyleSheet(null, "", "", "", null, CssStyleSheetType.Author);
             CssRule rule = new CssMediaRule("", ss, false, new string[0], CssStyleSheetType.Author);
             string cssText = "{length: \n23cm	 !important;foo:		bar;}";
             return new CssStyleDeclaration(ref cssText, rule, readOnly, CssStyleSheetType.Author);
 }