public Formatter(AspNetCore.ReportingServices.ReportIntermediateFormat.Style styleClass, OnDemandProcessingContext context, ObjectType objectType, string objectName) { this.m_context = context; this.m_styleClass = styleClass; this.m_objectType = objectType; this.m_objectName = objectName; }
private bool StyleAttributeExpressionBased(AspNetCore.ReportingServices.ReportIntermediateFormat.Style style, string styleName) { AttributeInfo attributeInfo = default(AttributeInfo); if (style.GetAttributeInfo(styleName, out attributeInfo)) { return(attributeInfo.IsExpression); } return(false); }
public static string Format(object value, ref Formatter formatter, AspNetCore.ReportingServices.ReportIntermediateFormat.Style reportItemStyle, AspNetCore.ReportingServices.ReportIntermediateFormat.Style reportElementStyle, OnDemandProcessingContext context, ObjectType objectType, string objectName) { if (formatter == null) { formatter = new Formatter(reportItemStyle, context, objectType, objectName); } Type type = value.GetType(); TypeCode typeCode = Type.GetTypeCode(type); bool flag = false; string formatString = ""; if (reportElementStyle != null) { reportElementStyle.GetStyleAttribute(objectType, objectName, "Format", context, ref flag, out formatString); } return(formatter.FormatValue(value, formatString, typeCode)); }
public static void ValidateBorderColorNotTransparent(ObjectType objectType, string objectName, AspNetCore.ReportingServices.ReportIntermediateFormat.Style styleClass, string styleName, ErrorContext errorContext) { ReportColor reportColor = default(ReportColor); AspNetCore.ReportingServices.ReportIntermediateFormat.AttributeInfo attributeInfo = default(AspNetCore.ReportingServices.ReportIntermediateFormat.AttributeInfo); if (styleClass.GetAttributeInfo(styleName, out attributeInfo) && !attributeInfo.IsExpression && ReportColor.TryParse(attributeInfo.Value, true, out reportColor) && reportColor.ToColor().A != 255) { errorContext.Register(ProcessingErrorCode.rsInvalidColor, Severity.Error, objectType, objectName, styleName, attributeInfo.Value); } }
public static AspNetCore.ReportingServices.ReportIntermediateFormat.Style ValidateAndCreateStyle(List <StyleInformation.StyleInformationAttribute> attributes, ObjectType objectType, string objectName, bool isDynamicImageSubElement, ErrorContext errorContext, bool checkForMeDotValue, out bool meDotValueReferenced) { meDotValueReferenced = false; AspNetCore.ReportingServices.ReportIntermediateFormat.Style style = new AspNetCore.ReportingServices.ReportIntermediateFormat.Style(AspNetCore.ReportingServices.ReportIntermediateFormat.ConstructionPhase.Publishing); Global.Tracer.Assert(null != attributes); AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageSource = null; AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageValue = null; AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageMIMEType = null; AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundEmbeddingMode = null; for (int i = 0; i < attributes.Count; i++) { StyleInformation.StyleInformationAttribute styleInformationAttribute = attributes[i]; if (checkForMeDotValue && styleInformationAttribute.ValueType == AspNetCore.ReportingServices.ReportIntermediateFormat.ValueType.Constant && styleInformationAttribute.Value.MeDotValueDetected) { meDotValueReferenced = true; } switch (attributes[i].Name) { case "BackgroundImageSource": backgroundImageSource = styleInformationAttribute.Value; break; case "BackgroundImageValue": backgroundImageValue = styleInformationAttribute.Value; break; case "BackgroundImageMIMEType": backgroundImageMIMEType = styleInformationAttribute.Value; break; case "BackgroundRepeat": if (PublishingValidator.ValidateBackgroundRepeat(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "EmbeddingMode": backgroundEmbeddingMode = styleInformationAttribute.Value; break; case "Transparency": if (PublishingValidator.ValidateTransparency(styleInformationAttribute.Value, objectType, objectName, "Transparency", errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "TransparentColor": if (PublishingValidator.ValidateColor(styleInformationAttribute.Value, objectType, objectName, "TransparentColor", errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "BorderColor": case "BorderColorLeft": case "BorderColorRight": case "BorderColorTop": case "BorderColorBottom": if (PublishingValidator.ValidateColor(styleInformationAttribute.Value, objectType, objectName, "BorderColor", errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "BorderStyle": if (PublishingValidator.ValidateBorderStyle(styleInformationAttribute.Value, objectType, objectName, isDynamicImageSubElement, "BorderStyle", true, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "BorderStyleLeft": case "BorderStyleRight": case "BorderStyleTop": case "BorderStyleBottom": if (PublishingValidator.ValidateBorderStyle(styleInformationAttribute.Value, objectType, objectName, isDynamicImageSubElement, "BorderStyle", false, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "BorderWidth": case "BorderWidthLeft": case "BorderWidthRight": case "BorderWidthTop": case "BorderWidthBottom": if (PublishingValidator.ValidateSize(styleInformationAttribute.Value, Validator.BorderWidthMin, Validator.BorderWidthMax, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "BackgroundGradientEndColor": if (PublishingValidator.ValidateColor(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "BackgroundGradientType": if (PublishingValidator.ValidateBackgroundGradientType(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "FontStyle": if (PublishingValidator.ValidateFontStyle(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "FontFamily": style.AddAttribute(styleInformationAttribute); break; case "FontSize": if (PublishingValidator.ValidateSize(styleInformationAttribute.Value, Validator.FontSizeMin, Validator.FontSizeMax, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "FontWeight": if (PublishingValidator.ValidateFontWeight(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "Format": style.AddAttribute(styleInformationAttribute); break; case "TextDecoration": if (PublishingValidator.ValidateTextDecoration(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "TextAlign": if (PublishingValidator.ValidateTextAlign(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "VerticalAlign": if (PublishingValidator.ValidateVerticalAlign(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "Color": case "BackgroundColor": if (PublishingValidator.ValidateColor(styleInformationAttribute, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "PaddingLeft": case "PaddingRight": case "PaddingTop": case "PaddingBottom": if (PublishingValidator.ValidateSize(styleInformationAttribute.Value, Validator.PaddingMin, Validator.PaddingMax, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "LineHeight": if (PublishingValidator.ValidateSize(styleInformationAttribute.Value, Validator.LineHeightMin, Validator.LineHeightMax, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "Direction": if (PublishingValidator.ValidateDirection(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "WritingMode": if (PublishingValidator.ValidateWritingMode(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "Language": { CultureInfo cultureInfo = default(CultureInfo); if (PublishingValidator.ValidateSpecificLanguage(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext, out cultureInfo)) { style.AddAttribute(styleInformationAttribute); } break; } case "UnicodeBiDi": if (PublishingValidator.ValidateUnicodeBiDi(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "Calendar": if (PublishingValidator.ValidateCalendar(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "CurrencyLanguage": if (PublishingValidator.ValidateLanguage(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "NumeralLanguage": if (PublishingValidator.ValidateLanguage(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "NumeralVariant": if (PublishingValidator.ValidateNumeralVariant(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "ShadowColor": if (PublishingValidator.ValidateColor(styleInformationAttribute.Value, objectType, objectName, "ShadowColor", errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "ShadowOffset": if (PublishingValidator.ValidateSize(styleInformationAttribute.Value, Validator.NormalMin, Validator.NormalMax, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "BackgroundHatchType": if (PublishingValidator.ValidateBackgroundHatchType(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "TextEffect": if (PublishingValidator.ValidateTextEffect(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; case "Position": if (PublishingValidator.ValidatePosition(styleInformationAttribute.Value, objectType, objectName, styleInformationAttribute.Name, errorContext)) { style.AddAttribute(styleInformationAttribute); } break; default: Global.Tracer.Assert(false); break; } } PublishingValidator.ValidateBackgroundImage(backgroundImageSource, backgroundImageValue, backgroundImageMIMEType, backgroundEmbeddingMode, style, objectType, objectName, errorContext); if (0 < style.StyleAttributes.Count) { return(style); } return(null); }
private static void ValidateBackgroundImage(AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageSource, AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageValue, AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageMIMEType, AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundEmbeddingMode, AspNetCore.ReportingServices.ReportIntermediateFormat.Style style, ObjectType objectType, string objectName, ErrorContext errorContext) { if (backgroundImageSource != null) { bool flag = true; Global.Tracer.Assert(AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Constant == backgroundImageSource.Type); AspNetCore.ReportingServices.OnDemandReportRendering.Image.SourceType intValue = (AspNetCore.ReportingServices.OnDemandReportRendering.Image.SourceType)backgroundImageSource.IntValue; Global.Tracer.Assert(null != backgroundImageValue); if (AspNetCore.ReportingServices.OnDemandReportRendering.Image.SourceType.Database == intValue && AspNetCore.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Constant == backgroundImageValue.Type) { errorContext.Register(ProcessingErrorCode.rsBinaryConstant, Severity.Error, objectType, objectName, "BackgroundImageValue"); flag = false; } if (AspNetCore.ReportingServices.OnDemandReportRendering.Image.SourceType.Database == intValue && !PublishingValidator.ValidateMimeType(backgroundImageMIMEType, objectType, objectName, "BackgroundImageMIMEType", errorContext)) { flag = false; } if (flag) { style.AddAttribute("BackgroundImageSource", backgroundImageSource); style.AddAttribute("BackgroundImageValue", backgroundImageValue); if (backgroundEmbeddingMode != null) { style.AddAttribute("EmbeddingMode", backgroundEmbeddingMode); } if (AspNetCore.ReportingServices.OnDemandReportRendering.Image.SourceType.Database == intValue) { style.AddAttribute("BackgroundImageMIMEType", backgroundImageMIMEType); } } } }