private void SetStyleValues(bool isParagraph)
 {
     if (this.m_currentHtmlElement.CssStyle != null)
     {
         string     text       = default(string);
         ReportSize reportSize = default(ReportSize);
         if (isParagraph && base.m_allowMultipleParagraphs)
         {
             if (this.m_currentHtmlElement.CssStyle.TryGetValue("text-align", out text))
             {
                 TextAlignments textAlign = default(TextAlignments);
                 if (RichTextStyleTranslator.TranslateTextAlign(text, out textAlign))
                 {
                     base.m_currentStyle.TextAlign = textAlign;
                 }
                 else
                 {
                     base.m_richTextLogger.RegisterInvalidValueWarning("text-align", text, this.m_currentHtmlElement.CharacterPosition);
                 }
             }
             if (this.m_currentHtmlElement.CssStyle.TryGetValue("text-indent", out text))
             {
                 if (ReportSize.TryParse(text, true, out reportSize))
                 {
                     base.m_currentParagraph.HangingIndent = reportSize;
                 }
                 else
                 {
                     base.m_richTextLogger.RegisterInvalidSizeWarning("text-indent", text, this.m_currentHtmlElement.CharacterPosition);
                 }
             }
             ReportSize generalPadding = null;
             if (this.m_currentHtmlElement.CssStyle.TryGetValue("padding", out text))
             {
                 if (ReportSize.TryParse(text, out reportSize))
                 {
                     generalPadding = reportSize;
                 }
                 else
                 {
                     base.m_richTextLogger.RegisterInvalidSizeWarning("padding", text, this.m_currentHtmlElement.CharacterPosition);
                 }
             }
             ReportSize size = default(ReportSize);
             if (this.HasPaddingValue("padding-top", generalPadding, out size))
             {
                 base.m_currentParagraph.AddSpaceBefore(size);
             }
             if (this.HasPaddingValue("padding-bottom", generalPadding, out size))
             {
                 base.m_currentParagraph.AddSpaceAfter(size);
             }
             if (this.HasPaddingValue("padding-left", generalPadding, out size))
             {
                 base.m_currentParagraph.AddLeftIndent(size);
             }
             if (this.HasPaddingValue("padding-right", generalPadding, out size))
             {
                 base.m_currentParagraph.AddRightIndent(size);
             }
         }
         if (this.m_currentHtmlElement.CssStyle.TryGetValue("font-family", out text))
         {
             base.m_currentStyle.FontFamily = text;
         }
         if (this.m_currentHtmlElement.CssStyle.TryGetValue("font-size", out text))
         {
             if (ReportSize.TryParse(text, out reportSize))
             {
                 base.m_currentStyle.FontSize = reportSize;
             }
             else
             {
                 base.m_richTextLogger.RegisterInvalidSizeWarning("font-size", text, this.m_currentHtmlElement.CharacterPosition);
             }
         }
         if (this.m_currentHtmlElement.CssStyle.TryGetValue("font-weight", out text))
         {
             FontWeights fontWeight = default(FontWeights);
             if (RichTextStyleTranslator.TranslateFontWeight(text, out fontWeight))
             {
                 base.m_currentStyle.FontWeight = fontWeight;
             }
             else
             {
                 base.m_richTextLogger.RegisterInvalidValueWarning("font-weight", text, this.m_currentHtmlElement.CharacterPosition);
             }
         }
         if (this.m_currentHtmlElement.CssStyle.TryGetValue("color", out text))
         {
             ReportColor color = default(ReportColor);
             if (ReportColor.TryParse(RichTextStyleTranslator.TranslateHtmlColor(text), out color))
             {
                 base.m_currentStyle.Color = color;
             }
             else
             {
                 base.m_richTextLogger.RegisterInvalidColorWarning("color", text, this.m_currentHtmlElement.CharacterPosition);
             }
         }
     }
 }
        private void ParseParagraphElement(HtmlElement.HtmlElementType elementType, FunctionalList <ListStyle> listStyles)
        {
            this.CloseParagraph();
            if (base.m_currentParagraph.ElementType == HtmlElement.HtmlElementType.P)
            {
                base.m_currentParagraph = base.m_currentParagraph.RemoveParagraph(HtmlElement.HtmlElementType.P);
                base.m_currentStyle     = base.m_currentStyle.RemoveStyle(HtmlElement.HtmlElementType.P);
            }
            if (elementType == HtmlElement.HtmlElementType.LI)
            {
                this.FlushPendingLI();
                if (listStyles.Count > 0)
                {
                    base.m_currentParagraph.ListStyle = listStyles.First;
                }
                else
                {
                    base.m_currentParagraph.ListStyle = ListStyle.Bulleted;
                }
            }
            else
            {
                base.m_currentStyle     = base.m_currentStyle.CreateChildStyle(elementType);
                base.m_currentParagraph = base.m_currentParagraph.CreateChildParagraph(elementType);
                switch (elementType)
                {
                case HtmlElement.HtmlElementType.H1:
                    base.m_currentStyle.FontSize   = StyleDefaults.H1FontSize;
                    base.m_currentStyle.FontWeight = FontWeights.Bold;
                    this.SetMarginTopAndBottom(StyleDefaults.H1Margin);
                    break;

                case HtmlElement.HtmlElementType.H2:
                    base.m_currentStyle.FontSize   = StyleDefaults.H2FontSize;
                    base.m_currentStyle.FontWeight = FontWeights.Bold;
                    this.SetMarginTopAndBottom(StyleDefaults.H2Margin);
                    break;

                case HtmlElement.HtmlElementType.H3:
                    base.m_currentStyle.FontSize   = StyleDefaults.H3FontSize;
                    base.m_currentStyle.FontWeight = FontWeights.Bold;
                    this.SetMarginTopAndBottom(StyleDefaults.H3Margin);
                    break;

                case HtmlElement.HtmlElementType.H4:
                    base.m_currentStyle.FontSize   = StyleDefaults.H4FontSize;
                    base.m_currentStyle.FontWeight = FontWeights.Bold;
                    this.SetMarginTopAndBottom(StyleDefaults.H4Margin);
                    break;

                case HtmlElement.HtmlElementType.H5:
                    base.m_currentStyle.FontSize   = StyleDefaults.H5FontSize;
                    base.m_currentStyle.FontWeight = FontWeights.Bold;
                    this.SetMarginTopAndBottom(StyleDefaults.H5Margin);
                    break;

                case HtmlElement.HtmlElementType.H6:
                    base.m_currentStyle.FontSize   = StyleDefaults.H6FontSize;
                    base.m_currentStyle.FontWeight = FontWeights.Bold;
                    this.SetMarginTopAndBottom(StyleDefaults.H6Margin);
                    break;

                case HtmlElement.HtmlElementType.P:
                    this.SetMarginTopAndBottom(StyleDefaults.PMargin);
                    break;
                }
                string text = default(string);
                if (!this.m_currentHtmlElement.IsEmptyElement && this.m_currentHtmlElement.HasAttributes && base.m_allowMultipleParagraphs && this.m_currentHtmlElement.Attributes.TryGetValue("align", out text))
                {
                    TextAlignments textAlign = default(TextAlignments);
                    if (RichTextStyleTranslator.TranslateTextAlign(text, out textAlign))
                    {
                        base.m_currentStyle.TextAlign = textAlign;
                    }
                    else
                    {
                        base.m_richTextLogger.RegisterInvalidValueWarning("align", text, this.m_currentHtmlElement.CharacterPosition);
                    }
                }
            }
            this.SetStyleValues(true);
        }