コード例 #1
0
            public object VisitGlobalStyle(XshtdGlobalStyles globStyles, XshtdGlobalStyle style)
            {
                if (style.TypeName == null)
                {
                    throw Error(style, "Name must not be null");
                }

                if (style.TypeName.Length == 0)
                {
                    throw Error(style, "Name must not be the empty string");
                }

                if (globStyles == null)
                {
                    throw Error(globStyles, "GlobalStyles parameter must not be null");
                }

                if (def.globalStyles.TryGetValue(style.TypeName, out var globDef) == false)
                {
                    throw Error(style, "Style definition '" + style.TypeName + "' does not exist in collection of GlobalStyles.");
                }

                globDef.backgroundcolor = style.background;
                globDef.foregroundcolor = style.foreground;
                globDef.bordercolor     = style.bordercolor;
                globDef.Freeze();

                return(globDef);
            }
コード例 #2
0
            public object VisitGlobalStyle(XshtdGlobalStyles globStyles, XshtdGlobalStyle style)
            {
                if (style.TypeName != null)
                {
                    if (style.TypeName.Length == 0)
                    {
                        throw Error(style, "Name must not be the empty string");
                    }

                    if (globStyles == null)
                    {
                        throw Error(globStyles, "GlobalStyles parameter must not be null");
                    }

                    GlobalStyle globDef;
                    if (def.globalStyles.TryGetValue(style.TypeName, out globDef) == true)
                    {
                        throw Error(style, "GlobalStyle definition '" + style.TypeName + "' has duplicates.");
                    }

                    globDef = new GlobalStyle(style.TypeName);
                    globDef.backgroundcolor = style.background;
                    globDef.foregroundcolor = style.foreground;
                    globDef.bordercolor     = style.bordercolor;

                    globDef.Freeze();

                    def.globalStyles.Add(style.TypeName, new GlobalStyle(style.TypeName));
                }

                return(null);
            }
コード例 #3
0
            /// <summary>
            /// Implements the visitor for the <see cref="XshtdGlobalStyles"/> object.
            /// </summary>
            /// <param name="globStyles">the element to be visited.</param>
            /// <returns></returns>
            public object VisitGlobalStyles(XshtdGlobalStyles globStyles)
            {
                globStyles.AcceptElements(this);

                return(null);
            }
コード例 #4
0
 /// <summary>
 /// Creates a new XshtdSyntaxDefinition object.
 /// </summary>
 /// <param name="styles">Parent collection of styles in which this style occurs.</param>
 public XshtdGlobalStyle(XshtdGlobalStyles styles)
     : this()
 {
     this.styles = styles;
 }