internal ReportDoubleProperty(Microsoft.ReportingServices.ReportProcessing.ExpressionInfo expressionInfo) : base(expressionInfo?.IsExpression ?? false, expressionInfo?.OriginalText) { if (expressionInfo != null && !expressionInfo.IsExpression && !double.TryParse(expressionInfo.Value, out m_value)) { m_value = 0.0; } }
internal ReportStringProperty(Microsoft.ReportingServices.ReportProcessing.ExpressionInfo expression, string formulaText) : base(expression?.IsExpression ?? false, (expression == null) ? null : ((expression.IsExpression && expression.OriginalText == null) ? formulaText : expression.OriginalText)) { if (expression != null && !expression.IsExpression) { m_value = expression.Value; } }
internal ReportBoolProperty(Microsoft.ReportingServices.ReportProcessing.ExpressionInfo expression) : base(expression?.IsExpression ?? false, expression?.OriginalText) { if (expression != null && !expression.IsExpression) { m_value = expression.BoolValue; } }
internal CustomProperty(RenderingContext renderingContext, Microsoft.ReportingServices.ReportProcessing.ExpressionInfo nameExpr, Microsoft.ReportingServices.ReportProcessing.ExpressionInfo valueExpr, string name, object value, TypeCode typeCode) { m_name = new ReportStringProperty(nameExpr); m_value = new ReportVariantProperty(valueExpr); if (nameExpr.IsExpression || valueExpr.IsExpression) { m_instance = new CustomPropertyInstance(this, name, value, typeCode); } m_renderingContext = renderingContext; }
internal void Initialize(InitializationContext context) { context.ExprHostBuilder.SortingStart(); if (m_sortExpressions != null) { for (int i = 0; i < m_sortExpressions.Count; i++) { ExpressionInfo expressionInfo = m_sortExpressions[i]; expressionInfo.Initialize("SortExpression", context); context.ExprHostBuilder.SortingExpression(expressionInfo); } } context.ExprHostBuilder.SortingEnd(); }
internal static bool ValidateLanguage(ExpressionInfo language, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(language != null); if (ExpressionInfo.Types.Constant == language.Type) { CultureInfo culture = null; if (!Validator.ValidateLanguage(language.Value, out culture)) { errorContext.Register(ProcessingErrorCode.rsInvalidLanguage, Severity.Error, objectType, objectName, propertyName, language.Value); return(false); } } return(true); }
private static bool ValidateColor(ExpressionInfo color, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(color != null); if (ExpressionInfo.Types.Constant == color.Type) { if (!Validator.ValidateColor(color.Value, out string newColor, objectType == ObjectType.Chart)) { errorContext.Register(ProcessingErrorCode.rsInvalidColor, Severity.Error, objectType, objectName, propertyName, color.Value); return(false); } color.Value = newColor; } return(true); }
internal void Parse(string name, List <string> defaultValues, string type, string nullable, string prompt, string promptUser, string allowBlank, string multiValue, string usedInQuery, bool hidden, ErrorContext errorContext, CultureInfo language) { base.Parse(name, defaultValues, type, nullable, prompt, promptUser, allowBlank, multiValue, usedInQuery, hidden, errorContext, language); if (hidden) { m_prompt = ""; } else if (prompt == null) { m_prompt = name + ":"; } else { m_prompt = prompt; } if (m_validValuesValueExpressions == null || DataType.Boolean == base.DataType) { return; } int num = m_validValuesValueExpressions.Count - 1; while (true) { if (num < 0) { return; } ExpressionInfo expressionInfo = m_validValuesValueExpressions[num]; if (expressionInfo == null && base.MultiValue) { m_validValuesValueExpressions.RemoveAt(num); } else if (expressionInfo != null && ExpressionInfo.Types.Constant == expressionInfo.Type) { if (!ParameterBase.CastFromString(expressionInfo.Value, out object newValue, base.DataType, language)) { if (errorContext == null) { break; } errorContext.Register(ProcessingErrorCode.rsParameterPropertyTypeMismatch, Severity.Error, base.ParameterObjectType, name, "ValidValue"); } else { ValidateValue(newValue, errorContext, base.ParameterObjectType, "ValidValue"); } } num--; }
private static bool ValidateBorderStyle(ExpressionInfo borderStyle, ObjectType objectType, string objectName, string propertyName, ErrorContext errorContext) { Global.Tracer.Assert(borderStyle != null); if (ExpressionInfo.Types.Constant == borderStyle.Type) { if (!Validator.ValidateBorderStyle(borderStyle.Value, out string borderStyleForLine)) { errorContext.Register(ProcessingErrorCode.rsInvalidBorderStyle, Severity.Error, objectType, objectName, propertyName, borderStyle.Value); return(false); } if (ObjectType.Line == objectType) { borderStyle.Value = borderStyleForLine; } } return(true); }
private void ProcessAggregateParams(ExpressionInfo expression, ExpressionParser.ExpressionContext context) { if (expression.Aggregates != null) { for (int num = expression.Aggregates.Count - 1; num >= 0; num--) { ProcessAggregateParam(expression.Aggregates[num], context); } } if (expression.RunningValues != null) { for (int num2 = expression.RunningValues.Count - 1; num2 >= 0; num2--) { ProcessAggregateParam(expression.RunningValues[num2], context); } } }
private void ProcessExpression(ExpressionInfo expression, ExpressionParser.ExpressionContext context) { if (expression.Type == ExpressionInfo.Types.Expression) { RegisterExpression(new ExprCompileTimeInfo(expression, context)); ProcessAggregateParams(expression, context); } else if (expression.Type == ExpressionInfo.Types.Aggregate) { ProcessAggregateParams(expression, context); } else if (expression.Type == ExpressionInfo.Types.Field && context.Location == LocationFlags.None) { if (m_reportLevelFieldReferences == null) { m_reportLevelFieldReferences = new ArrayList(); } m_reportLevelFieldReferences.Add(new ExprCompileTimeInfo(expression, context)); } }
internal void Initialize(InitializationContext context) { context.ExprHostBuilder.FilterStart(); if (m_expression != null) { m_expression.Initialize("FilterExpression", context); context.ExprHostBuilder.FilterExpression(m_expression); } if (m_values != null) { for (int i = 0; i < m_values.Count; i++) { ExpressionInfo expressionInfo = m_values[i]; Global.Tracer.Assert(expressionInfo != null); expressionInfo.Initialize("FilterValue", context); context.ExprHostBuilder.FilterValue(expressionInfo); } } m_exprHostID = context.ExprHostBuilder.FilterEnd(); }
internal void AddAttribute(string name, ExpressionInfo expressionInfo) { AttributeInfo attributeInfo = new AttributeInfo(); attributeInfo.IsExpression = (ExpressionInfo.Types.Constant != expressionInfo.Type); if (attributeInfo.IsExpression) { if (m_expressionList == null) { m_expressionList = new ExpressionInfoList(); } attributeInfo.IntValue = m_expressionList.Add(expressionInfo); } else { attributeInfo.Value = expressionInfo.Value; attributeInfo.BoolValue = expressionInfo.BoolValue; attributeInfo.IntValue = expressionInfo.IntValue; } Global.Tracer.Assert(m_styleAttributes != null); m_styleAttributes.Add(name, attributeInfo); }
internal int[] GetGroupExpressionFieldIndices() { if (m_groupExpressionFieldIndices == null) { Global.Tracer.Assert(m_groupExpressions != null && 0 < m_groupExpressions.Count); m_groupExpressionFieldIndices = new int[m_groupExpressions.Count]; for (int i = 0; i < m_groupExpressions.Count; i++) { m_groupExpressionFieldIndices[i] = -2; ExpressionInfo expressionInfo = m_groupExpressions[i]; if (expressionInfo.Type == ExpressionInfo.Types.Field) { m_groupExpressionFieldIndices[i] = expressionInfo.IntValue; } else if (expressionInfo.Type == ExpressionInfo.Types.Constant) { m_groupExpressionFieldIndices[i] = -1; } } } return(m_groupExpressionFieldIndices); }
internal void SetExprHosts(ReportExprHost reportExprHost, ObjectModelImpl reportObjectModel) { Global.Tracer.Assert(reportExprHost != null && reportObjectModel != null); if (!m_exprHostInitialized) { for (int i = 0; i < m_expressions.Length; i++) { ExpressionInfo expressionInfo = m_expressions[i]; if (expressionInfo.ExprHostID >= 0) { if (m_expressionHosts == null) { m_expressionHosts = new AggregateParamExprHost[m_expressions.Length]; } AggregateParamExprHost aggregateParamExprHost = reportExprHost.AggregateParamHostsRemotable[expressionInfo.ExprHostID]; aggregateParamExprHost.SetReportObjectModel(reportObjectModel); m_expressionHosts[i] = aggregateParamExprHost; } } m_exprHostInitialized = true; m_exprHostReportObjectModel = reportObjectModel; } else { if (m_exprHostReportObjectModel == reportObjectModel || m_expressionHosts == null) { return; } for (int j = 0; j < m_expressionHosts.Length; j++) { if (m_expressionHosts[j] != null) { m_expressionHosts[j].SetReportObjectModel(reportObjectModel); } } m_exprHostReportObjectModel = reportObjectModel; } }
internal void Initialize(InitializationContext context) { context.ExprHostBuilder.ReportParameterStart(base.Name); if (m_defaultExpressions != null) { for (int num = m_defaultExpressions.Count - 1; num >= 0; num--) { context.ExprHostBuilder.ReportParameterDefaultValue(m_defaultExpressions[num]); } } if (m_validValuesValueExpressions != null) { context.ExprHostBuilder.ReportParameterValidValuesStart(); for (int num2 = m_validValuesValueExpressions.Count - 1; num2 >= 0; num2--) { ExpressionInfo expressionInfo = m_validValuesValueExpressions[num2]; if (expressionInfo != null) { context.ExprHostBuilder.ReportParameterValidValue(expressionInfo); } } context.ExprHostBuilder.ReportParameterValidValuesEnd(); } if (m_validValuesLabelExpressions != null) { context.ExprHostBuilder.ReportParameterValidValueLabelsStart(); for (int num3 = m_validValuesLabelExpressions.Count - 1; num3 >= 0; num3--) { ExpressionInfo expressionInfo2 = m_validValuesLabelExpressions[num3]; if (expressionInfo2 != null) { context.ExprHostBuilder.ReportParameterValidValueLabel(expressionInfo2); } } context.ExprHostBuilder.ReportParameterValidValueLabelsEnd(); } ExprHostID = context.ExprHostBuilder.ReportParameterEnd(); }
internal ChartHeadingInstanceInfo(ReportProcessing.ProcessingContext pc, int headingCellIndex, ChartHeading chartHeadingDef, int labelIndex, VariantList groupExpressionValues) { m_headingCellIndex = headingCellIndex; if (chartHeadingDef.ChartGroupExpression) { if (groupExpressionValues == null || DBNull.Value == groupExpressionValues[0]) { m_groupExpressionValue = null; } else { m_groupExpressionValue = groupExpressionValues[0]; } } if (chartHeadingDef.Labels != null) { ExpressionInfo expressionInfo = chartHeadingDef.Labels[labelIndex]; if (expressionInfo != null) { if (chartHeadingDef.Grouping != null) { m_headingLabel = pc.ReportRuntime.EvaluateChartDynamicHeadingLabelExpression(chartHeadingDef, expressionInfo, chartHeadingDef.DataRegionDef.Name); } else { m_headingLabel = pc.ReportRuntime.EvaluateChartStaticHeadingLabelExpression(chartHeadingDef, expressionInfo, chartHeadingDef.DataRegionDef.Name); } } } if (chartHeadingDef.Grouping == null) { m_staticGroupingIndex = labelIndex; } else if (chartHeadingDef.Grouping.CustomProperties != null) { m_customPropertyInstances = chartHeadingDef.Grouping.CustomProperties.EvaluateExpressions(chartHeadingDef.DataRegionDef.ObjectType, chartHeadingDef.DataRegionDef.Name, chartHeadingDef.Grouping.Name + ".", pc); } }
private void CalculateOWCFlags(MatrixHeading heading) { if (heading == null) { return; } if (heading.Grouping == null) { m_staticHeadingCount++; if (m_staticHeadingCount > 1) { m_useOWC = false; return; } if (heading.SubHeading != null) { m_useOWC = false; return; } if (heading.ReportItems != null) { for (int i = 0; i < heading.ReportItems.Count; i++) { DetectIllegalReportItems(heading.ReportItems[i]); if (IsFinish()) { return; } TextBox textBox = FindNotAlwaysHiddenTextBox(heading.ReportItems[i]); if (IsFinish()) { return; } if (textBox == null) { m_useOWC = false; return; } } } } else { ExpressionInfo expressionInfo = null; if (heading.Grouping.GroupExpressions != null) { if (heading.Grouping.GroupExpressions.Count != 1) { m_useOWC = false; return; } expressionInfo = heading.Grouping.GroupExpressions[0]; } DetectIllegalReportItems(heading.ReportItem); if (IsFinish()) { return; } TextBox textBox2 = FindNotAlwaysHiddenTextBox(heading.ReportItem); if (IsFinish()) { return; } if (textBox2 == null) { m_useOWC = false; return; } Global.Tracer.Assert(expressionInfo != null); Global.Tracer.Assert(textBox2.Value != null); if (expressionInfo.OriginalText != textBox2.Value.OriginalText) { m_owcGroupExpression.Add(true); } else { m_owcGroupExpression.Add(false); } } CalculateOWCFlags(heading.SubHeading); }
internal void Initialize(InitializationContext context) { Global.Tracer.Assert(m_styleAttributes != null); IDictionaryEnumerator enumerator = m_styleAttributes.GetEnumerator(); while (enumerator.MoveNext()) { string text = (string)enumerator.Key; AttributeInfo attributeInfo = (AttributeInfo)enumerator.Value; Global.Tracer.Assert(text != null); Global.Tracer.Assert(attributeInfo != null); if (attributeInfo.IsExpression) { string name = text; switch (text) { case "BorderColorLeft": case "BorderColorRight": case "BorderColorTop": case "BorderColorBottom": text = "BorderColor"; break; case "BorderStyleLeft": case "BorderStyleRight": case "BorderStyleTop": case "BorderStyleBottom": text = "BorderStyle"; break; case "BorderWidthLeft": case "BorderWidthRight": case "BorderWidthTop": case "BorderWidthBottom": text = "BorderWidth"; break; } Global.Tracer.Assert(m_expressionList != null); ExpressionInfo expressionInfo = m_expressionList[attributeInfo.IntValue]; expressionInfo.Initialize(text, context); context.ExprHostBuilder.StyleAttribute(name, expressionInfo); } } AttributeInfo attributeInfo2 = m_styleAttributes["BackgroundImageSource"]; if (attributeInfo2 != null) { Global.Tracer.Assert(!attributeInfo2.IsExpression); Image.SourceType intValue = (Image.SourceType)attributeInfo2.IntValue; if (Image.SourceType.Embedded == intValue) { AttributeInfo attributeInfo3 = m_styleAttributes["BackgroundImageValue"]; Global.Tracer.Assert(attributeInfo3 != null); PublishingValidator.ValidateEmbeddedImageName(attributeInfo3, context.EmbeddedImages, context.ObjectType, context.ObjectName, "BackgroundImageValue", context.ErrorContext); } else if (intValue == Image.SourceType.External) { AttributeInfo attributeInfo4 = m_styleAttributes["BackgroundImageValue"]; Global.Tracer.Assert(attributeInfo4 != null); if (!attributeInfo4.IsExpression) { context.ImageStreamNames[attributeInfo4.Value] = new ImageInfo(context.ObjectName, null); } } } context.CheckInternationalSettings(m_styleAttributes); }
private static void ValidateBackgroundImage(ExpressionInfo backgroundImageSource, ExpressionInfo backgroundImageValue, ExpressionInfo backgroundImageMIMEType, Style style, ObjectType objectType, string objectName, ErrorContext errorContext) { if (backgroundImageSource == null) { return; } bool flag = true; Global.Tracer.Assert(ExpressionInfo.Types.Constant == backgroundImageSource.Type); Image.SourceType intValue = (Image.SourceType)backgroundImageSource.IntValue; Global.Tracer.Assert(backgroundImageValue != null); if (Image.SourceType.Database == intValue && ExpressionInfo.Types.Constant == backgroundImageValue.Type) { errorContext.Register(ProcessingErrorCode.rsBinaryConstant, Severity.Error, objectType, objectName, "BackgroundImageValue"); flag = false; } if (Image.SourceType.Database == intValue && !ValidateMimeType(backgroundImageMIMEType, objectType, objectName, "BackgroundImageMIMEType", errorContext)) { flag = false; } if (flag) { style.AddAttribute("BackgroundImageSource", backgroundImageSource); style.AddAttribute("BackgroundImageValue", backgroundImageValue); if (Image.SourceType.Database == intValue) { style.AddAttribute("BackgroundImageMIMEType", backgroundImageMIMEType); } } }
internal abstract void ConvertField2ComplexExpr(ref ExpressionInfo expression);
internal static Style ValidateAndCreateStyle(StringList names, ExpressionInfoList values, ObjectType objectType, string objectName, ErrorContext errorContext) { Style style = new Style(ConstructionPhase.Publishing); Global.Tracer.Assert(names != null); Global.Tracer.Assert(values != null); Global.Tracer.Assert(names.Count == values.Count); ExpressionInfo backgroundImageSource = null; ExpressionInfo backgroundImageValue = null; ExpressionInfo backgroundImageMIMEType = null; for (int i = 0; i < names.Count; i++) { switch (names[i]) { case "BackgroundImageSource": backgroundImageSource = values[i]; break; case "BackgroundImageValue": backgroundImageValue = values[i]; break; case "BackgroundImageMIMEType": backgroundImageMIMEType = values[i]; break; case "BackgroundRepeat": if (ValidateBackgroundRepeat(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "BorderColor": case "BorderColorLeft": case "BorderColorRight": case "BorderColorTop": case "BorderColorBottom": if (ValidateColor(values[i], objectType, objectName, "BorderColor", errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "BorderStyle": case "BorderStyleLeft": case "BorderStyleRight": case "BorderStyleTop": case "BorderStyleBottom": if (ValidateBorderStyle(values[i], objectType, objectName, "BorderStyle", errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "BorderWidth": case "BorderWidthLeft": case "BorderWidthRight": case "BorderWidthTop": case "BorderWidthBottom": if (ValidateSize(values[i], Validator.BorderWidthMin, Validator.BorderWidthMax, objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "BackgroundColor": case "BackgroundGradientEndColor": if (ValidateColor(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "BackgroundGradientType": if (ValidateBackgroundGradientType(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "FontStyle": if (ValidateFontStyle(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "FontFamily": style.AddAttribute(names[i], values[i]); break; case "FontSize": if (ValidateSize(values[i], Validator.FontSizeMin, Validator.FontSizeMax, objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "FontWeight": if (ValidateFontWeight(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "Format": style.AddAttribute(names[i], values[i]); break; case "TextDecoration": if (ValidateTextDecoration(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "TextAlign": if (ValidateTextAlign(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "VerticalAlign": if (ValidateVerticalAlign(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "Color": if (ValidateColor(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "PaddingLeft": case "PaddingRight": case "PaddingTop": case "PaddingBottom": if (ValidateSize(values[i], Validator.PaddingMin, Validator.PaddingMax, objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "LineHeight": if (ValidateSize(values[i], Validator.LineHeightMin, Validator.LineHeightMax, objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "Direction": if (ValidateDirection(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "WritingMode": if (ValidateWritingMode(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "Language": { if (ValidateSpecificLanguage(values[i], objectType, objectName, names[i], errorContext, out CultureInfo _)) { style.AddAttribute(names[i], values[i]); } break; } case "UnicodeBiDi": if (ValidateUnicodeBiDi(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "Calendar": if (ValidateCalendar(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "NumeralLanguage": if (ValidateLanguage(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; case "NumeralVariant": if (ValidateNumeralVariant(values[i], objectType, objectName, names[i], errorContext)) { style.AddAttribute(names[i], values[i]); } break; default: Global.Tracer.Assert(condition: false); break; } } ValidateBackgroundImage(backgroundImageSource, backgroundImageValue, backgroundImageMIMEType, style, objectType, objectName, errorContext); if (0 < style.StyleAttributes.Count) { return(style); } return(null); }