private bool HasPaddingValue(string attrName, ReportSize generalPadding, out ReportSize effectivePadding) { string value = default(string); if (this.m_currentHtmlElement.CssStyle.TryGetValue(attrName, out value)) { ReportSize reportSize = default(ReportSize); if (ReportSize.TryParse(value, out reportSize)) { effectivePadding = reportSize; return(true); } base.m_richTextLogger.RegisterInvalidSizeWarning("padding", value, this.m_currentHtmlElement.CharacterPosition); } if (generalPadding != null) { effectivePadding = generalPadding; return(true); } effectivePadding = null; return(false); }
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); } } } }
public static bool TryParse(string value, out ReportSize reportSize) { return(ReportSize.TryParse(value, false, out reportSize)); }