public StyleEnumerator(StyleProperties sharedProps, StyleProperties nonSharedProps) { this.m_sharedProperties = sharedProps; this.m_nonSharedProperties = nonSharedProps; this.m_total = 0; if (this.m_sharedProperties != null) { this.m_total += this.m_sharedProperties.Count; } if (this.m_nonSharedProperties != null) { this.m_total += this.m_nonSharedProperties.Count; } }
public object Clone() { StyleProperties styleProperties = (StyleProperties)base.MemberwiseClone(); if (this.m_nameMap != null) { styleProperties.m_nameMap = new Hashtable(this.m_nameMap.Count); styleProperties.m_valueCollection = new ArrayList(this.m_valueCollection.Count); IDictionaryEnumerator enumerator = this.m_nameMap.GetEnumerator(); try { while (enumerator.MoveNext()) { DictionaryEntry dictionaryEntry = (DictionaryEntry)enumerator.Current; styleProperties.m_nameMap.Add((string)dictionaryEntry.Key, dictionaryEntry.Value); object obj = this.m_valueCollection[(int)dictionaryEntry.Value]; object value = null; if (obj is string) { value = string.Copy(obj as string); } else if (obj is int) { value = (int)obj; } else if (obj is ReportSize) { value = ((ReportSize)obj).DeepClone(); } styleProperties.m_valueCollection[(int)dictionaryEntry.Value] = value; } return(styleProperties); } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } return(styleProperties); }
public void SetStyleProperty(string styleName, bool isExpression, bool needNonSharedProps, bool needSharedProps, object styleProperty) { if (isExpression) { if (needNonSharedProps) { if (this.m_nonSharedProperties == null) { this.m_nonSharedProperties = new StyleProperties(); } this.m_nonSharedProperties.Set(styleName, styleProperty); } } else if (needSharedProps) { if (this.m_sharedProperties == null) { this.m_sharedProperties = new StyleProperties(42); } this.m_sharedProperties.Set(styleName, styleProperty); } }
public void SetStyle(Style.StyleName style, object value, bool isShared) { object obj = null; bool flag = false; switch (style) { case Style.StyleName.BorderColor: case Style.StyleName.BorderColorTop: case Style.StyleName.BorderColorLeft: case Style.StyleName.BorderColorRight: case Style.StyleName.BorderColorBottom: case Style.StyleName.BackgroundColor: case Style.StyleName.Color: if (value is ReportColor) { obj = (value as ReportColor); } else if (value is string) { obj = new ReportColor(value as string); } if (obj == null) { throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "ReportColor"); } obj = ((ReportColor)obj).ToString(); flag = true; break; case Style.StyleName.BorderStyle: case Style.StyleName.BorderStyleTop: case Style.StyleName.BorderStyleLeft: case Style.StyleName.BorderStyleRight: case Style.StyleName.BorderStyleBottom: if (value != null) { obj = (value as string); if (obj == null) { throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "String"); } string text = default(string); if (!Validator.ValidateBorderStyle(obj as string, out text)) { throw new ReportRenderingException(ErrorCode.rrInvalidBorderStyle, obj); } } flag = true; break; case Style.StyleName.BorderWidth: case Style.StyleName.BorderWidthTop: case Style.StyleName.BorderWidthLeft: case Style.StyleName.BorderWidthRight: case Style.StyleName.BorderWidthBottom: case Style.StyleName.FontSize: case Style.StyleName.PaddingLeft: case Style.StyleName.PaddingRight: case Style.StyleName.PaddingTop: case Style.StyleName.PaddingBottom: case Style.StyleName.LineHeight: if (value is ReportSize) { obj = (value as ReportSize); } else if (value is string) { obj = new ReportSize(value as string); } if (obj == null) { throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "ReportSize"); } flag = true; break; case Style.StyleName.NumeralVariant: { int num = default(int); if (!int.TryParse(value as string, out num)) { throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "Int32"); } obj = num; flag = true; break; } default: if (value != null) { obj = (value as string); if (obj == null) { throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "String"); } } flag = true; break; } if (flag) { if (isShared) { if (this.m_sharedProperties == null) { this.m_sharedProperties = new StyleProperties(); } this.m_sharedProperties.Set(style.ToString(), obj); } else { if (this.m_nonSharedProperties == null) { this.m_nonSharedProperties = new StyleProperties(); } this.m_nonSharedProperties.Set(style.ToString(), obj); } } }