private static void ValidateBackgroundImage(Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageSource, Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageValue, Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundImageMIMEType, Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo backgroundEmbeddingMode, Microsoft.ReportingServices.ReportIntermediateFormat.Style style, ObjectType objectType, string objectName, ErrorContext errorContext)
        {
            if (backgroundImageSource == null)
            {
                return;
            }
            bool flag = true;

            Global.Tracer.Assert(Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Constant == backgroundImageSource.Type);
            Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType intValue = (Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType)backgroundImageSource.IntValue;
            Global.Tracer.Assert(backgroundImageValue != null);
            if (Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType.Database == intValue && Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Constant == backgroundImageValue.Type)
            {
                errorContext.Register(ProcessingErrorCode.rsBinaryConstant, Severity.Error, objectType, objectName, "BackgroundImageValue");
                flag = false;
            }
            if (Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType.Database == intValue && !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 (Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType.Database == intValue)
                {
                    style.AddAttribute("BackgroundImageMIMEType", backgroundImageMIMEType);
                }
            }
        }
Example #2
0
        internal void Initialize(InitializationContext context)
        {
            Global.Tracer.Assert(m_styleAttributes != null, "(null != m_styleAttributes)");
            IDictionaryEnumerator dictionaryEnumerator = m_styleAttributes.GetEnumerator();

            while (dictionaryEnumerator.MoveNext())
            {
                string        text          = (string)dictionaryEnumerator.Key;
                AttributeInfo attributeInfo = (AttributeInfo)dictionaryEnumerator.Value;
                Global.Tracer.Assert(text != null, "(null != name)");
                Global.Tracer.Assert(attributeInfo != null, "(null != attribute)");
                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, "(null != m_expressionList)");
                    ExpressionInfo expressionInfo = m_expressionList[attributeInfo.IntValue];
                    expressionInfo.Initialize(text, context);
                    context.ExprHostBuilder.StyleAttribute(name, expressionInfo);
                }
            }
            m_styleAttributes.TryGetValue("BackgroundImageSource", out AttributeInfo value);
            if (value != null)
            {
                Global.Tracer.Assert(!value.IsExpression, "(!source.IsExpression)");
                Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType intValue = (Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType)value.IntValue;
                if (Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType.Embedded == intValue && (!m_styleAttributes.TryGetValue("EmbeddingMode", out AttributeInfo value2) || value2.IntValue != 1))
                {
                    AttributeInfo attributeInfo2 = m_styleAttributes["BackgroundImageValue"];
                    Global.Tracer.Assert(attributeInfo2 != null, "(null != embeddedImageName)");
                    Microsoft.ReportingServices.ReportPublishing.PublishingValidator.ValidateEmbeddedImageName(attributeInfo2, context.EmbeddedImages, context.ObjectType, context.ObjectName, "BackgroundImageValue", context.ErrorContext);
                }
            }
            context.CheckInternationalSettings(m_styleAttributes);
        }
Example #3
0
        public override void Deserialize(IntermediateFormatReader reader)
        {
            base.Deserialize(reader);
            reader.RegisterDeclaration(m_Declaration);
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.Source:
                    m_source = (Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType)reader.ReadEnum();
                    break;

                case MemberName.Value:
                    m_value = (ExpressionInfo)reader.ReadRIFObject();
                    break;

                case MemberName.MIMEType:
                    m_MIMEType = (ExpressionInfo)reader.ReadRIFObject();
                    break;

                case MemberName.Sizing:
                    m_sizing = (Microsoft.ReportingServices.OnDemandReportRendering.Image.Sizings)reader.ReadEnum();
                    break;

                case MemberName.Action:
                    m_action = (Action)reader.ReadRIFObject();
                    break;

                case MemberName.Tag:
                {
                    ExpressionInfo expressionInfo = (ExpressionInfo)reader.ReadRIFObject();
                    if (expressionInfo != null)
                    {
                        m_tags = new List <ExpressionInfo>(1)
                        {
                            expressionInfo
                        };
                    }
                    break;
                }

                case MemberName.Tags:
                    m_tags = reader.ReadGenericListOfRIFObjects <ExpressionInfo>();
                    break;

                case MemberName.EmbeddingMode:
                    m_embeddingMode = (Microsoft.ReportingServices.OnDemandReportRendering.Image.EmbeddingModes)reader.ReadEnum();
                    break;

                default:
                    Global.Tracer.Assert(condition: false);
                    break;
                }
            }
        }
        private void Visit(Microsoft.ReportingServices.OnDemandReportRendering.ReportItem item)
        {
            if (item == null || item.Instance == null)
            {
                return;
            }
            bool generateDocMap = m_generateDocMap;

            if (!ProcessVisibilityAndContinue(item.Visibility, item.Instance.Visibility, null))
            {
                return;
            }
            if (item is Microsoft.ReportingServices.OnDemandReportRendering.Line || item is Microsoft.ReportingServices.OnDemandReportRendering.Chart || item is Microsoft.ReportingServices.OnDemandReportRendering.GaugePanel || item is Microsoft.ReportingServices.OnDemandReportRendering.Map)
            {
                GenerateSimpleReportItemDocumentMap(item);
            }
            else if (item is Microsoft.ReportingServices.OnDemandReportRendering.TextBox)
            {
                GenerateSimpleReportItemDocumentMap(item);
                VisitStyle(item.Style);
            }
            else if (item is Microsoft.ReportingServices.OnDemandReportRendering.Image)
            {
                GenerateSimpleReportItemDocumentMap(item);
                Microsoft.ReportingServices.OnDemandReportRendering.Image            image  = item as Microsoft.ReportingServices.OnDemandReportRendering.Image;
                Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType source = image.Source;
                if (m_createSnapshot && (source == Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType.External || source == Microsoft.ReportingServices.OnDemandReportRendering.Image.SourceType.Database))
                {
                    _ = (image.Instance as Microsoft.ReportingServices.OnDemandReportRendering.ImageInstance)?.ImageData;
                }
            }
            else if (item is Microsoft.ReportingServices.OnDemandReportRendering.Rectangle)
            {
                VisitRectangle(item as Microsoft.ReportingServices.OnDemandReportRendering.Rectangle);
                VisitStyle(item.Style);
            }
            else if (!(item is Microsoft.ReportingServices.OnDemandReportRendering.CustomReportItem))
            {
                bool flag = false;
                if (m_generateDocMap)
                {
                    string documentMapLabel = item.Instance.DocumentMapLabel;
                    if (documentMapLabel != null)
                    {
                        flag = true;
                        WriteDocumentMapBeginContainer(documentMapLabel, item.Instance.UniqueName);
                    }
                }
                if (item is Microsoft.ReportingServices.OnDemandReportRendering.Tablix)
                {
                    VisitTablix(item as Microsoft.ReportingServices.OnDemandReportRendering.Tablix);
                    VisitStyle(item.Style);
                }
                else if (item is Microsoft.ReportingServices.OnDemandReportRendering.SubReport)
                {
                    VisitSubReport(item as Microsoft.ReportingServices.OnDemandReportRendering.SubReport);
                }
                else
                {
                    Global.Tracer.Assert(condition: false);
                }
                if (flag)
                {
                    WriteDocumentMapEndContainer();
                }
            }
            m_generateDocMap = generateDocMap;
        }