Esempio n. 1
0
 public static SharpDX.DirectWrite.FontStretch ToDxFontStretch(this Windows.UI.Text.FontStretch fontStretch)
 {
     foreach (var stretch in Enum.GetValues(typeof(SharpDX.DirectWrite.FontStretch)).Cast<SharpDX.DirectWrite.FontStretch>())
     {
         if (((uint)stretch) == ((uint)fontStretch))
             return stretch;
     }
     return SharpDX.DirectWrite.FontStretch.Undefined;
 }
Esempio n. 2
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;
 }
Esempio n. 3
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;
     }
 }
Esempio n. 4
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;
            }
        }
Esempio n. 5
0
 public void ResetFontStretch()
 {
     this._fontStretch    = Windows.UI.Text.FontStretch.Normal;
     this._fontStretchSet = false;
     this.RaisePropertyChanged("FontStretch");
 }