コード例 #1
0
ファイル: Image.cs プロジェクト: zatuliveter/reportviewercore
 internal override bool Initialize(InitializationContext context)
 {
     context.ObjectType = ObjectType;
     context.ObjectName = m_name;
     context.ExprHostBuilder.ImageStart(m_name);
     base.Initialize(context);
     if (m_visibility != null)
     {
         m_visibility.Initialize(context, isContainer: false, tableRowCol: false);
     }
     if (m_action != null)
     {
         m_action.Initialize(context);
     }
     if (m_value != null)
     {
         m_value.Initialize("Value", context);
         context.ExprHostBuilder.GenericValue(m_value);
         if (ExpressionInfo.Types.Constant == m_value.Type && m_source == SourceType.External && !context.ReportContext.IsSupportedProtocol(m_value.Value, protocolRestriction: true))
         {
             context.ErrorContext.Register(ProcessingErrorCode.rsUnsupportedProtocol, Severity.Error, ObjectType, m_name, "Value", m_value.Value, "http://, https://, ftp://, file:, mailto:, or news:");
         }
     }
     if (m_MIMEType != null)
     {
         m_MIMEType.Initialize("MIMEType", context);
         context.ExprHostBuilder.ImageMIMEType(m_MIMEType);
     }
     if (SourceType.Embedded == m_source)
     {
         Global.Tracer.Assert(m_value != null);
         PublishingValidator.ValidateEmbeddedImageName(m_value, context.EmbeddedImages, ObjectType, m_name, "Value", context.ErrorContext);
     }
     base.ExprHostID = context.ExprHostBuilder.ImageEnd();
     return(true);
 }
コード例 #2
0
ファイル: Style.cs プロジェクト: zatuliveter/reportviewercore
        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);
        }