private static Writer.Data.ComplexStyles CopyStyles(ComplexStyles styles)
        {
            if (styles == null)
            {
                return(null);
            }
            var styls = new Writer.Data.ComplexStyles {
                Title = styles.Title
            };

            foreach (var news in styles.Styles.Select(CopyComplexStyle))
            {
                styls.Styles.Add(news);
            }
            return(styls);
        }
Exemplo n.º 2
0
        //private void LoadDefaultStyle(SerializationInfo info)
        //{
        //    try
        //    {
        //        var styleStr = info.GetString("DefaultStyle");

        //        DefaultStyle = new ComplexStyleConverter().ConvertFrom(styleStr) as ComplexStyle ?? new ComplexStyle();

        //    }
        //    catch {DefaultStyle = new ComplexStyle(); }
        //}

        private void LoadComplexStyle(SerializationInfo info)
        {
            try
            {
                var styleStr = info.GetString("ComplexStyles");

                Styles       = new ComplexStylesConverter().ConvertFrom(styleStr) as ComplexStyles ?? new ComplexStyles();
                Styles.Title = COMPLEX_STYLE_TITLE;
            }
            catch
            {
                Styles = new ComplexStyles {
                    Title = COMPLEX_STYLE_TITLE
                };
            }
        }
Exemplo n.º 3
0
 public TextFile()
 {
     //ScrollOffset = -1d;
     IncFontWhenPrinting = 0;
     Watermark           = new Watermark {
         Size = new Size(1, 1), Opacity = 1d
     };
     PageCountElement = new PageCountElement
     {
         FontFamily     = new FontFamily("Arial"),
         ForgroundBrush = Brushes.Black,
         UseLeadingZero = false
     };
     SpellCheckEnabled             = true;
     Styles                        = new ComplexStyles();
     OpeningQuote                  = ClosingQuote = "\u0022";
     SingleOpeningQuote            = SingleClosingQuote = "\u0027";
     ReadOnly                      = false;
     Characters                    = new ObservableCollection <Character>();
     Characters.CollectionChanged += CharactersCollectionChanged;
 }