Exemple #1
0
        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);
        }