コード例 #1
0
        public static object ValidateCustomStyle(string styleName, object styleValue, ObjectType objectType, IErrorContext errorContext)
        {
            CultureInfo cultureInfo = default(CultureInfo);

            switch (styleName)
            {
            case "BorderColor":
            case "BorderColorLeft":
            case "BorderColorRight":
            case "BorderColorTop":
            case "BorderColorBottom":
                return(ProcessingValidator.ValidateColor(styleValue as string, errorContext, objectType == ObjectType.Chart));

            case "BorderStyle":
            case "BorderStyleLeft":
            case "BorderStyleRight":
            case "BorderStyleTop":
            case "BorderStyleBottom":
                return(ProcessingValidator.ValidateBorderStyle(styleValue as string, objectType, errorContext));

            case "BorderWidth":
            case "BorderWidthLeft":
            case "BorderWidthRight":
            case "BorderWidthTop":
            case "BorderWidthBottom":
                return(ProcessingValidator.ValidateSize((styleValue as AspNetCore.ReportingServices.ReportRendering.ReportSize).ToString(), Validator.BorderWidthMin, Validator.BorderWidthMax, errorContext));

            case "Color":
            case "BackgroundColor":
            case "BackgroundGradientEndColor":
                return(ProcessingValidator.ValidateColor(styleValue as string, errorContext, objectType == ObjectType.Chart));

            case "BackgroundGradientType":
                return(ProcessingValidator.ValidateBackgroundGradientType(styleValue as string, errorContext));

            case "FontStyle":
                return(ProcessingValidator.ValidateFontStyle(styleValue as string, errorContext));

            case "FontFamily":
                return(styleValue as string);

            case "FontSize":
                return(ProcessingValidator.ValidateSize((styleValue as AspNetCore.ReportingServices.ReportRendering.ReportSize).ToString(), Validator.FontSizeMin, Validator.FontSizeMax, errorContext));

            case "FontWeight":
                return(ProcessingValidator.ValidateFontWeight(styleValue as string, errorContext));

            case "Format":
                return(styleValue as string);

            case "TextDecoration":
                return(ProcessingValidator.ValidateTextDecoration(styleValue as string, errorContext));

            case "TextAlign":
                return(ProcessingValidator.ValidateTextAlign(styleValue as string, errorContext));

            case "VerticalAlign":
                return(ProcessingValidator.ValidateVerticalAlign(styleValue as string, errorContext));

            case "PaddingLeft":
            case "PaddingRight":
            case "PaddingTop":
            case "PaddingBottom":
                return(ProcessingValidator.ValidateSize((styleValue as AspNetCore.ReportingServices.ReportRendering.ReportSize).ToString(), Validator.PaddingMin, Validator.PaddingMax, errorContext));

            case "LineHeight":
                return(ProcessingValidator.ValidateSize((styleValue as AspNetCore.ReportingServices.ReportRendering.ReportSize).ToString(), Validator.LineHeightMin, Validator.LineHeightMax, errorContext));

            case "Direction":
                return(ProcessingValidator.ValidateDirection(styleValue as string, errorContext));

            case "WritingMode":
                return(ProcessingValidator.ValidateWritingMode(styleValue as string, errorContext));

            case "Language":
                return(ProcessingValidator.ValidateSpecificLanguage(styleValue as string, errorContext, out cultureInfo));

            case "UnicodeBiDi":
                return(ProcessingValidator.ValidateUnicodeBiDi(styleValue as string, errorContext));

            case "Calendar":
                return(ProcessingValidator.ValidateCalendar(styleValue as string, errorContext));

            case "NumeralLanguage":
                return(ProcessingValidator.ValidateLanguage(styleValue as string, errorContext, out cultureInfo));

            case "NumeralVariant":
            {
                int numeralVariant = default(int);
                if (int.TryParse(styleValue as string, out numeralVariant))
                {
                    return(ProcessingValidator.ValidateNumeralVariant(numeralVariant, errorContext));
                }
                errorContext.Register(ProcessingErrorCode.rsInvalidNumeralVariant, Severity.Warning, styleValue as string);
                return(null);
            }

            default:
                Global.Tracer.Assert(false);
                break;

            case "BackgroundImageSource":
            case "BackgroundImageValue":
            case "BackgroundImageMIMEType":
            case "BackgroundRepeat":
                break;
            }
            return(null);
        }