示例#1
0
 public void Init()
 {
     this.fontStretch             = FontStretch.Normal;
     this.fontStyle               = Windows.UI.Text.FontStyle.Normal;
     this.fontWeight              = FontWeights.Normal;
     this.leftBorder              = null;
     this.topBorder               = null;
     this.rightBorder             = null;
     this.bottomBorder            = null;
     this.horizontalBorder        = null;
     this.verticalBorder          = null;
     this.background              = null;
     this.foreground              = null;
     this.backgroundThemeColor    = null;
     this.foregroundThemeColor    = null;
     this.fontStretchSet          = false;
     this.fontStyleSet            = false;
     this.fontWeightSet           = false;
     this.leftBorderSet           = false;
     this.topBorderSet            = false;
     this.rightBorderSet          = false;
     this.bottomBorderSet         = false;
     this.horizontalBorderSet     = false;
     this.verticalBorderSet       = false;
     this.backgroundSet           = false;
     this.foregroundSet           = false;
     this.backgroundThemeColorSet = false;
     this.foregroundThemeColorSet = false;
 }
示例#2
0
 public static SharpDX.DirectWrite.FontStyle ToDxFontStyle(this Windows.UI.Text.FontStyle fontStyle)
 {
     var result = SharpDX.DirectWrite.FontStyle.Normal;
     if ((fontStyle & Windows.UI.Text.FontStyle.Oblique) > 0)
         result = SharpDX.DirectWrite.FontStyle.Oblique;
     if ((fontStyle & Windows.UI.Text.FontStyle.Italic) > 0)
         result |= SharpDX.DirectWrite.FontStyle.Italic;
     return result;
 }
示例#3
0
        public static FontStyle Convert(wut.FontStyle fontStyle, wut.FontWeight fontWeight)
        {
            var style = FontStyle.None;

            if (fontStyle == wut.FontStyle.Italic)
            {
                style |= FontStyle.Italic;
            }
            if (fontStyle == wut.FontStyle.Oblique)
            {
                style |= FontStyle.Italic;
            }
            if (ReferenceEquals(fontWeight, wut.FontWeights.Bold))
            {
                style |= FontStyle.Bold;
            }
            return(style);
        }
示例#4
0
 void Init()
 {
     this._fontTheme                 = null;
     this._fontFamily                = null;
     this._fontSize                  = -1.0;
     this._fontStretch               = Windows.UI.Text.FontStretch.Normal;
     this._fontStyle                 = Windows.UI.Text.FontStyle.Normal;
     this._fontWeight                = FontWeights.Normal;
     this._fill                      = null;
     this._fillThemeColor            = null;
     this._foreground                = null;
     this._foregroundThemeColor      = null;
     this._strokeThickness           = 1.0;
     this._stroke                    = null;
     this._strokeDashType            = Dt.Cells.Data.StrokeDashType.None;
     this._strokeThemeColor          = null;
     this._cornerRadius              = -1.0;
     this._themeContext              = null;
     this._cornerRadiusSet           = false;
     this._fillSet                   = false;
     this._fillThemeColorSet         = false;
     this._fontFamilySet             = false;
     this._fontSizeSet               = false;
     this._fontStretchSet            = false;
     this._fontStyleSet              = false;
     this._fontThemeSet              = false;
     this._fontWeightSet             = false;
     this._foregroundSet             = false;
     this._foregroundThemeColorSet   = false;
     this._strokeDashTypeSet         = false;
     this._strokeSet                 = false;
     this._strokeThemeColorSet       = false;
     this._strokeThicknessSet        = false;
     this._formatter                 = null;
     this._formatterSet              = false;
     this._lineCapType               = PenLineCap.Flat;
     this._lineCapTypeSet            = false;
     this._lineJoinType              = PenLineJoin.Round;
     this._lineJoinTypeSet           = false;
     this._lineBeginArrowSettings    = null;
     this._lineBeginArrowSettingsSet = false;
     this._lineEndArrowSettings      = null;
     this._lineEndArrowSettingsSet   = false;
 }
示例#5
0
 internal void CopyFromInternal(object o, bool clone)
 {
     if ((o is FloatingObjectStyleInfo) && !object.ReferenceEquals(o, this))
     {
         FloatingObjectStyleInfo info = (FloatingObjectStyleInfo)o;
         this._fontTheme      = info._fontTheme;
         this._fontThemeSet   = info._fontThemeSet;
         this._fontFamily     = info._fontFamily;
         this._fontFamilySet  = info._fontFamilySet;
         this._fontSize       = info._fontSize;
         this._fontSizeSet    = info._fontSizeSet;
         this._fontStretch    = info._fontStretch;
         this._fontStretchSet = info._fontStretchSet;
         this._fontStyle      = info._fontStyle;
         this._fontStyleSet   = info._fontStyleSet;
         this._fontWeight     = info._fontWeight;
         this._fontWeightSet  = info._fontWeightSet;
         if (info._fillSet)
         {
             ICloneable cloneable = info._fill as ICloneable;
             if (cloneable != null)
             {
                 this._fill = cloneable.Clone() as Brush;
             }
             else
             {
                 this._fill = info._fill;
             }
             this._fillSet = true;
         }
         else
         {
             this._fill    = null;
             this._fillSet = false;
         }
         if (info._foregroundSet)
         {
             ICloneable cloneable2 = info._foreground as ICloneable;
             if (cloneable2 != null)
             {
                 this._foreground = cloneable2.Clone() as Brush;
             }
             else
             {
                 this._foreground = info._foreground;
             }
             this._foregroundSet = true;
         }
         else
         {
             this._foreground    = null;
             this._foregroundSet = false;
         }
         this._fillThemeColor          = info._fillThemeColor;
         this._fillThemeColorSet       = info._fillThemeColorSet;
         this._foregroundThemeColor    = info._foregroundThemeColor;
         this._foregroundThemeColorSet = info._foregroundThemeColorSet;
         if (info._strokeSet)
         {
             ICloneable cloneable3 = info._stroke as ICloneable;
             if (cloneable3 != null)
             {
                 this._stroke = cloneable3.Clone() as Brush;
             }
             else
             {
                 this._stroke = info._stroke;
             }
             this._strokeSet = true;
         }
         else
         {
             this._stroke    = null;
             this._strokeSet = false;
         }
         this._strokeDashType      = info._strokeDashType;
         this._strokeDashTypeSet   = info._strokeDashTypeSet;
         this._strokeThemeColor    = info._strokeThemeColor;
         this._strokeThemeColorSet = info._strokeThemeColorSet;
         this._strokeThickness     = info._strokeThickness;
         this._strokeThicknessSet  = info._strokeThicknessSet;
         this._cornerRadius        = info._cornerRadius;
         this._cornerRadiusSet     = info._cornerRadiusSet;
         this._themeContext        = info._themeContext;
         if (info._formatterSet)
         {
             ICloneable cloneable4 = info._formatter as ICloneable;
             if (cloneable4 != null)
             {
                 this._formatter = cloneable4.Clone() as IFormatter;
             }
             else
             {
                 this._formatter = info._formatter;
             }
             this._formatterSet = true;
         }
         else
         {
             this._formatter    = null;
             this._formatterSet = false;
         }
         this._lineCapType               = info._lineCapType;
         this._lineCapTypeSet            = info._lineCapTypeSet;
         this._lineJoinType              = info.LineJoinType;
         this._lineJoinTypeSet           = info._lineJoinTypeSet;
         this._lineBeginArrowSettings    = info._lineBeginArrowSettings;
         this._lineBeginArrowSettingsSet = info._lineBeginArrowSettingsSet;
         this._lineEndArrowSettings      = info._lineEndArrowSettings;
         this._lineEndArrowSettingsSet   = info._lineEndArrowSettingsSet;
     }
 }
示例#6
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is deserialized.</param>
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            Serializer.InitReader(reader);
            this.Reset();
            while (reader.Read())
            {
                if (reader.NodeType == ((XmlNodeType)((int)XmlNodeType.Element)))
                {
                    switch (reader.Name)
                    {
                    case "FontTheme":
                        this._fontTheme    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this._fontThemeSet = true;
                        break;

                    case "FontFamily":
                        if (!(Serializer.ReadAttribute("value", reader) == Serializer.Format(null)))
                        {
                            goto Label_0239;
                        }
                        this._fontFamily = null;
                        goto Label_0279;

                    case "FontSize":
                        this._fontSize    = (float)Serializer.DeserializeObj(typeof(float), reader);
                        this._fontSizeSet = true;
                        break;

                    case "FontStretch":
                    {
                        Windows.UI.Text.FontStretch?stretch = null;
                        string str  = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        object obj2 = Serializer.DeserializeEnum(this.FontStretch.GetType(), str);
                        if (obj2 != null)
                        {
                            stretch = new Windows.UI.Text.FontStretch?((Windows.UI.Text.FontStretch)obj2);
                        }
                        if (stretch.HasValue)
                        {
                            this._fontStretch    = stretch.Value;
                            this._fontStretchSet = true;
                        }
                        break;
                    }

                    case "FontStyle":
                    {
                        Windows.UI.Text.FontStyle?style = null;
                        string str  = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        object obj2 = Serializer.DeserializeEnum(this.FontStyle.GetType(), str);
                        if (obj2 != null)
                        {
                            style = new Windows.UI.Text.FontStyle?((Windows.UI.Text.FontStyle)obj2);
                        }
                        if (style.HasValue)
                        {
                            this._fontStyle    = style.Value;
                            this._fontStyleSet = true;
                        }
                        break;
                    }

                    case "FontWeight":
                    {
                        string result = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        Windows.UI.Text.FontWeight?weight = Serializer.FindStaticDefinationStruct <Windows.UI.Text.FontWeight>(typeof(FontWeights), result);
                        if (weight.HasValue)
                        {
                            this._fontWeight    = weight.Value;
                            this._fontWeightSet = true;
                        }
                        break;
                    }

                    case "Fill":
                        goto Label_03E3;

                    case "Foreground":
                        goto Label_0409;

                    case "FillTheme":
                        this._fillThemeColor    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this._fillThemeColorSet = true;
                        break;

                    case "ForegroundTheme":
                        this._foregroundThemeColor    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this._foregroundThemeColorSet = true;
                        break;

                    case "Formatter":
                        if (!(Serializer.ReadAttribute("value", reader) == Serializer.Format(null)))
                        {
                            goto Label_04B4;
                        }
                        this._formatter = null;
                        goto Label_04E2;

                    case "Stroke":
                        goto Label_04EE;

                    case "StrokeTheme":
                        this._strokeThemeColor    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this._strokeThemeColorSet = true;
                        break;

                    case "StrokeThickness":
                        this._strokeThickness    = (double)((double)Serializer.DeserializeObj(typeof(double), reader));
                        this._strokeThicknessSet = true;
                        break;

                    case "CornerRadius":
                        this._cornerRadius    = (double)((double)Serializer.DeserializeObj(typeof(double), reader));
                        this._cornerRadiusSet = true;
                        break;

                    case "StrokeDashes":
                        this._strokeDashType    = (Dt.Cells.Data.StrokeDashType)Serializer.DeserializeObj(typeof(Dt.Cells.Data.StrokeDashType), reader);
                        this._strokeDashTypeSet = true;
                        break;

                    case "LineCapType":
                        this._lineCapType    = (PenLineCap)Serializer.DeserializeObj(typeof(PenLineCap), reader);
                        this._lineCapTypeSet = true;
                        break;

                    case "LineJoinType":
                        this._lineJoinType    = (PenLineJoin)Serializer.DeserializeObj(typeof(PenLineJoin), reader);
                        this._lineJoinTypeSet = true;
                        break;

                    case "LineBeginArrowSettings":
                        this._lineBeginArrowSettings    = (ArrowSettings)Serializer.DeserializeObj(typeof(ArrowSettings), reader);
                        this._lineBeginArrowSettingsSet = true;
                        break;

                    case "LineEndArrowSettings":
                        this._lineEndArrowSettings    = (ArrowSettings)Serializer.DeserializeObj(typeof(ArrowSettings), reader);
                        this._lineEndArrowSettingsSet = true;
                        break;
                    }
                }
                continue;
Label_0239:
                _fontFamily = new FontFamily(Serializer.DeserializeObj(typeof(string), reader) as string);
Label_0279:
                this._fontFamilySet = true;
                continue;
Label_03E3:
                _fill         = Serializer.DeserializeObj(typeof(Brush), reader) as Brush;
                this._fillSet = true;
                continue;
Label_0409:
                _foreground         = Serializer.DeserializeObj(typeof(Brush), reader) as Brush;
                this._foregroundSet = true;
                continue;
Label_04B4:
                string str3 = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                if (str3 != null)
                {
                    this._formatter = new GeneralFormatter(str3);
                }
Label_04E2:
                this._formatterSet = true;
                continue;
Label_04EE:
                _stroke         = Serializer.DeserializeObj(typeof(Brush), reader) as Brush;
                this._strokeSet = true;
            }
        }
示例#7
0
 public void ResetFontStyle()
 {
     this._fontStyle    = Windows.UI.Text.FontStyle.Normal;
     this._fontStyleSet = false;
     this.RaisePropertyChanged("FontStyle");
 }
示例#8
0
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            Serializer.InitReader(reader);
            while (reader.Read())
            {
                if (reader.NodeType == ((XmlNodeType)((int)XmlNodeType.Element)))
                {
                    switch (reader.Name)
                    {
                    case "FontStretch":
                    {
                        FontStretch?stretch = null;
                        string      str     = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        object      obj2    = Serializer.DeserializeEnum(this.FontStretch.GetType(), str);
                        if (obj2 != null)
                        {
                            stretch = new FontStretch?((FontStretch)obj2);
                        }
                        if (stretch.HasValue)
                        {
                            this.fontStretch    = stretch.Value;
                            this.fontStretchSet = true;
                        }
                        break;
                    }

                    case "FontStyle":
                    {
                        Windows.UI.Text.FontStyle?style = null;
                        string str  = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        object obj2 = Serializer.DeserializeEnum(this.FontStyle.GetType(), str);
                        if (obj2 != null)
                        {
                            style = new Windows.UI.Text.FontStyle?((Windows.UI.Text.FontStyle)obj2);
                        }
                        if (style.HasValue)
                        {
                            this.fontStyle    = style.Value;
                            this.fontStyleSet = true;
                        }
                        break;
                    }

                    case "FontWeight":
                        goto Label_0214;

                    case "LeftBorder":
                        this.leftBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.leftBorderSet = true;
                        break;

                    case "TopBorder":
                        this.topBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.topBorderSet = true;
                        break;

                    case "RightBorder":
                        this.rightBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.rightBorderSet = true;
                        break;

                    case "BottomBorder":
                        this.bottomBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.bottomBorderSet = true;
                        break;

                    case "HorizontalBorder":
                        this.horizontalBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.horizontalBorderSet = true;
                        break;

                    case "VerticalBorder":
                        this.verticalBorder    = Serializer.DeserializeObj(typeof(BorderLine), reader) as BorderLine;
                        this.verticalBorderSet = true;
                        break;

                    case "Background":
                        goto Label_033E;

                    case "Foreground":
                        goto Label_035E;

                    case "BackgroundTheme":
                        this.backgroundThemeColor    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this.backgroundThemeColorSet = true;
                        break;

                    case "ForegroundTheme":
                        this.foregroundThemeColor    = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                        this.foregroundThemeColorSet = true;
                        break;
                    }
                }
                continue;
Label_0214:
                string result = (string)(Serializer.DeserializeObj(typeof(string), reader) as string);
                FontWeight?weight = Serializer.FindStaticDefinationStruct <FontWeight>(typeof(FontWeights), result);
                if (weight.HasValue)
                {
                    this.fontWeight    = weight.Value;
                    this.fontWeightSet = true;
                }
                continue;
Label_033E:
                background         = Serializer.DeserializeObj(typeof(Brush), reader) as Brush;
                this.backgroundSet = true;
                continue;
Label_035E:
                foreground         = Serializer.DeserializeObj(typeof(Brush), reader) as Brush;
                this.foregroundSet = true;
            }
            this.OnChanged(EventArgs.Empty);
        }
示例#9
0
 public void ResetFontStyle()
 {
     this.fontStyle    = Windows.UI.Text.FontStyle.Normal;
     this.fontStyleSet = false;
     this.OnChanged(EventArgs.Empty);
 }