Beispiel #1
0
        internal string GenerateStreamName(GaugePanelInstance gaugeIntance)
        {
            StringBuilder stringBuilder = new StringBuilder("G");

            stringBuilder.Append('_');
            stringBuilder.Append(gaugeIntance.UniqueName);
            stringBuilder.Append('_');
            stringBuilder.Append(PageNumber);
            return(stringBuilder.ToString());
        }
        internal bool RegisterItem(PageItem pageItem, PageContext pageContext)
        {
            if (m_itemFound || pageItem == null)
            {
                return(false);
            }
            switch (m_eventType)
            {
            case EventType.Collect:
            {
                ReportItemInstance instance5 = pageItem.Source.Instance;
                if (pageContext.Labels != null)
                {
                    pageContext.Labels.WriteDocMapLabel(instance5);
                }
                if (pageContext.Bookmarks != null)
                {
                    pageContext.Bookmarks.WriteBookmark(instance5);
                }
                if (pageContext.PageBookmarks != null)
                {
                    pageContext.RegisterPageBookmark(instance5);
                }
                if (pageItem.ItemState != PageItem.State.OnPageHidden)
                {
                    return(false);
                }
                break;
            }

            case EventType.BookmarkNavigationEvent:
            {
                ReportItemInstance instance2 = pageItem.Source.Instance;
                if (instance2.Bookmark != null && SPBProcessing.CompareWithOrdinalComparison(m_bookmarkId, instance2.Bookmark, ignoreCase: false) == 0)
                {
                    m_itemFound = true;
                    m_itemInfo  = instance2.UniqueName;
                    return(false);
                }
                if (pageItem.ItemState != PageItem.State.OnPageHidden)
                {
                    return(false);
                }
                break;
            }

            case EventType.DrillthroughEvent:
            {
                ReportItemInstance instance        = pageItem.Source.Instance;
                TextBoxInstance    textBoxInstance = instance as TextBoxInstance;
                if (textBoxInstance != null)
                {
                    Microsoft.ReportingServices.OnDemandReportRendering.TextBox textBox = (Microsoft.ReportingServices.OnDemandReportRendering.TextBox)pageItem.Source;
                    if (!HasMatchingDrillthrough(textBox.ActionInfo))
                    {
                        foreach (ParagraphInstance paragraphInstance in textBoxInstance.ParagraphInstances)
                        {
                            foreach (TextRunInstance textRunInstance in paragraphInstance.TextRunInstances)
                            {
                                Microsoft.ReportingServices.OnDemandReportRendering.TextRun definition = textRunInstance.Definition;
                                if (HasMatchingDrillthrough(definition.ActionInfo))
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                }
                else
                {
                    ImageInstance imageInstance = instance as ImageInstance;
                    if (imageInstance != null)
                    {
                        if (!HasMatchingDrillthrough(imageInstance.ActionInfoWithDynamicImageMapAreas))
                        {
                            Microsoft.ReportingServices.OnDemandReportRendering.Image image = (Microsoft.ReportingServices.OnDemandReportRendering.Image)pageItem.Source;
                            HasMatchingDrillthrough(image.ActionInfo);
                        }
                    }
                    else
                    {
                        IDynamicImageInstance dynamicImageInstance = instance as IDynamicImageInstance;
                        if (dynamicImageInstance != null)
                        {
                            ActionInfoWithDynamicImageMapCollection actionImageMaps;
                            using (dynamicImageInstance.GetImage(DynamicImageInstance.ImageType.PNG, out actionImageMaps))
                            {
                            }
                            HasMatchingDrillthrough(actionImageMaps);
                        }
                    }
                }
                if (m_itemFound)
                {
                    return(false);
                }
                if (pageItem.ItemState != PageItem.State.OnPageHidden)
                {
                    return(false);
                }
                break;
            }

            case EventType.DocumentMapNavigationEvent:
            {
                ReportItemInstance instance3 = pageItem.Source.Instance;
                if (SPBProcessing.CompareWithOrdinalComparison(m_itemInfo, instance3.UniqueName, ignoreCase: true) == 0)
                {
                    m_itemFound = true;
                    return(false);
                }
                if (pageItem.ItemState != PageItem.State.OnPageHidden)
                {
                    return(false);
                }
                break;
            }

            case EventType.GetDocumentMap:
            {
                ReportItemInstance instance4 = pageItem.Source.Instance;
                if (pageContext.Labels != null)
                {
                    pageContext.Labels.WriteDocMapLabel(instance4);
                }
                if (pageItem.ItemState != PageItem.State.OnPageHidden)
                {
                    return(false);
                }
                break;
            }

            case EventType.FindChart:
            {
                if (pageItem.ItemState == PageItem.State.OnPageHidden)
                {
                    break;
                }
                ReportItem source2 = pageItem.Source;
                if (SPBProcessing.CompareWithOrdinalComparison(m_itemInfo, source2.Instance.UniqueName, ignoreCase: true) == 0)
                {
                    m_itemFound = true;
                    ChartInstance chartInstance2 = source2.Instance as ChartInstance;
                    if (chartInstance2 != null)
                    {
                        WriteDynamicImageStream(chartInstance2.GetImage());
                    }
                }
                break;
            }

            case EventType.FindGaugePanel:
            {
                if (pageItem.ItemState == PageItem.State.OnPageHidden)
                {
                    break;
                }
                ReportItem source3 = pageItem.Source;
                if (SPBProcessing.CompareWithOrdinalComparison(m_itemInfo, source3.Instance.UniqueName, ignoreCase: true) == 0)
                {
                    m_itemFound = true;
                    GaugePanelInstance gaugePanelInstance2 = source3.Instance as GaugePanelInstance;
                    if (gaugePanelInstance2 != null)
                    {
                        WriteDynamicImageStream(gaugePanelInstance2.GetImage());
                    }
                }
                break;
            }

            case EventType.FindMap:
            {
                if (pageItem.ItemState == PageItem.State.OnPageHidden)
                {
                    break;
                }
                ReportItem source5 = pageItem.Source;
                if (SPBProcessing.CompareWithOrdinalComparison(m_itemInfo, source5.Instance.UniqueName, ignoreCase: true) == 0)
                {
                    m_itemFound = true;
                    MapInstance mapInstance2 = source5.Instance as MapInstance;
                    if (mapInstance2 != null)
                    {
                        WriteDynamicImageStream(mapInstance2.GetImage());
                    }
                }
                break;
            }

            case EventType.FindImage:
            {
                if (pageItem.ItemState == PageItem.State.OnPageHidden)
                {
                    break;
                }
                ReportItem source4 = pageItem.Source;
                if (SPBProcessing.CompareWithOrdinalComparison(m_itemInfo, source4.Instance.UniqueName, ignoreCase: true) != 0)
                {
                    break;
                }
                m_itemFound = true;
                ImageInstance imageInstance2 = source4.Instance as ImageInstance;
                if (imageInstance2 != null)
                {
                    Stream stream3   = m_createAndRegisterStream(m_streamName, string.Empty, null, imageInstance2.MIMEType, willSeek: false, StreamOper.CreateAndRegister);
                    byte[] imageData = imageInstance2.ImageData;
                    if (stream3 != null && imageData != null && imageData.Length != 0)
                    {
                        stream3.Write(imageData, 0, imageData.Length);
                    }
                }
                break;
            }

            case EventType.ImageConsolidation:
            {
                if (pageItem.ItemState == PageItem.State.OnPageHidden)
                {
                    break;
                }
                ReportItem         source             = pageItem.Source;
                GaugePanelInstance gaugePanelInstance = source.Instance as GaugePanelInstance;
                Stream             stream             = null;
                if (gaugePanelInstance != null)
                {
                    stream = gaugePanelInstance.GetImage();
                }
                else
                {
                    ChartInstance chartInstance = source.Instance as ChartInstance;
                    if (chartInstance != null)
                    {
                        stream = chartInstance.GetImage();
                    }
                    else
                    {
                        MapInstance mapInstance = source.Instance as MapInstance;
                        if (mapInstance != null)
                        {
                            stream = mapInstance.GetImage();
                        }
                    }
                }
                if (stream != null)
                {
                    ImageConsolidation imageConsolidation = pageContext.ImageConsolidation;
                    imageConsolidation.AppendImage(stream);
                    if (imageConsolidation.CurrentOffset >= imageConsolidation.IgnoreOffsetTill + 1 && imageConsolidation.ImageInfos.Count > 0)
                    {
                        m_itemFound = true;
                    }
                }
                break;
            }

            default:
                FindTextBox(pageItem as TextBox, pageContext);
                break;
            }
            return(true);
        }