コード例 #1
0
 private bool GetExternalImage(Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext, string path, out byte[] imageData, out string mimeType)
 {
     imageData = null;
     mimeType  = null;
     try
     {
         if (!renderingContext.OdpContext.TopLevelContext.ReportContext.IsSupportedProtocol(path, protocolRestriction: true))
         {
             renderingContext.OdpContext.ErrorContext.Register(ProcessingErrorCode.rsUnsupportedProtocol, Severity.Error, m_image.ObjectType, m_image.ObjectName, m_image.ImageDataPropertyName, path, "http://, https://, ftp://, file:, mailto:, or news:");
         }
         else
         {
             renderingContext.OdpContext.GetResource(path, out imageData, out mimeType, out bool registerInvalidSizeWarning);
             if (imageData != null && !Microsoft.ReportingServices.ReportPublishing.Validator.ValidateMimeType(mimeType))
             {
                 renderingContext.OdpContext.ErrorContext.Register(ProcessingErrorCode.rsInvalidMIMEType, Severity.Warning, m_image.ObjectType, m_image.ObjectName, "MIMEType", mimeType);
                 mimeType  = null;
                 imageData = null;
             }
             if (registerInvalidSizeWarning)
             {
                 renderingContext.OdpContext.ErrorContext.Register(ProcessingErrorCode.rsSandboxingExternalResourceExceedsMaximumSize, Severity.Warning, m_image.ObjectType, m_image.ObjectName, m_image.ImageDataPropertyName);
             }
         }
     }
     catch (Exception ex)
     {
         renderingContext.OdpContext.ErrorContext.Register(ProcessingErrorCode.rsInvalidImageReference, Severity.Warning, m_image.ObjectType, m_image.ObjectName, m_image.ImageDataPropertyName, ex.Message);
         return(false);
     }
     return(true);
 }
コード例 #2
0
 internal Stream GetTileData(string url, out string mimeType, Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext)
 {
     if (renderingContext.OdpContext.OdpMetadata.TryGetExternalImage(url, out ImageInfo imageInfo))
     {
         return(renderingContext.OdpContext.ChunkFactory.GetChunk(imageInfo.StreamName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Image, ChunkMode.Open, out mimeType));
     }
     mimeType = null;
     return(null);
 }
コード例 #3
0
 private void UpdateEventInfo(Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext odpRenderingContext, RenderingContext rc, ref bool eventInfoChanged)
 {
     UpdateEventInfoInSnapshot();
     eventInfoChanged |= odpRenderingContext.EventInfoChanged;
     if (eventInfoChanged)
     {
         rc.EventInfo = odpRenderingContext.EventInfo;
     }
 }
コード例 #4
0
        internal void SetTileData(string url, byte[] data, string mimeType, Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext)
        {
            string    text      = Guid.NewGuid().ToString("N");
            ImageInfo imageInfo = new ImageInfo(text, "");

            renderingContext.OdpContext.OdpMetadata.AddExternalImage(url, imageInfo);
            using (Stream stream = renderingContext.OdpContext.ChunkFactory.CreateChunk(text, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Image, mimeType))
            {
                stream.Write(data, 0, data.Length);
            }
        }
コード例 #5
0
 public bool ComputeDeepHidden(Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext, ToggleCascadeDirection direction)
 {
     if (!CanUseCachedVisibilityData(m_hasCachedDeepHiddenValue))
     {
         bool hidden = ComputeHidden(renderingContext, direction);
         if (!m_hasCachedDeepHiddenValue)
         {
             m_hasCachedDeepHiddenValue = true;
             m_cachedDeepHiddenValue    = Visibility.ComputeDeepHidden(hidden, this, direction, renderingContext);
         }
     }
     return(m_cachedDeepHiddenValue);
 }
コード例 #6
0
 public bool ComputeHidden(Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext, ToggleCascadeDirection direction)
 {
     if (!CanUseCachedVisibilityData(m_hasCachedHiddenValue))
     {
         UpdateVisibilityDataCacheFlag(ref m_hasCachedHiddenValue);
         m_cachedHiddenValue = Visibility.ComputeHidden(this, renderingContext, direction, out bool valueIsDeep);
         if (valueIsDeep)
         {
             m_hasCachedDeepHiddenValue = true;
             m_cachedDeepHiddenValue    = m_cachedHiddenValue;
         }
     }
     return(m_cachedHiddenValue);
 }
コード例 #7
0
        internal string GetFileStreamName(Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext, string url)
        {
            string           text        = null;
            OnDemandMetadata odpMetadata = renderingContext.OdpContext.OdpMetadata;

            if (odpMetadata.TryGetShapefile(url, out ShapefileInfo shapefileInfo))
            {
                if (shapefileInfo.ErrorOccurred)
                {
                    return(null);
                }
                text = shapefileInfo.StreamName;
            }
            else
            {
                if (!GetFileData(renderingContext, url, out byte[] data) || data == null)
コード例 #8
0
        internal static bool ComputeHidden(IVisibilityOwner visibilityOwner, Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext, ToggleCascadeDirection direction, out bool valueIsDeep)
        {
            valueIsDeep = false;
            bool       flag       = false;
            Visibility visibility = visibilityOwner.Visibility;

            if (visibility != null)
            {
                switch (GetSharedHidden(visibility))
                {
                case SharedHiddenState.Always:
                    flag = true;
                    break;

                case SharedHiddenState.Never:
                    flag = false;
                    break;

                case SharedHiddenState.Sometimes:
                    flag = visibilityOwner.ComputeStartHidden(renderingContext);
                    if (visibility.IsToggleReceiver)
                    {
                        TextBox toggleSender = visibility.ToggleSender;
                        Global.Tracer.Assert(toggleSender != null, "Missing Persisted Toggle Receiver -> Sender Link");
                        string senderUniqueName = visibilityOwner.SenderUniqueName;
                        if (senderUniqueName != null && renderingContext.IsSenderToggled(senderUniqueName))
                        {
                            flag = !flag;
                        }
                        if (!flag)
                        {
                            flag = ComputeDeepHidden(flag, visibilityOwner, direction, renderingContext);
                        }
                        valueIsDeep = true;
                    }
                    break;

                default:
                    Global.Tracer.Assert(condition: false);
                    break;
                }
            }
            return(flag);
        }
コード例 #9
0
 public bool ComputeStartHidden(Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext)
 {
     if (!CanUseCachedVisibilityData(m_hasCachedStartHiddenValue))
     {
         UpdateVisibilityDataCacheFlag(ref m_hasCachedStartHiddenValue);
         if (m_visibility == null || m_visibility.Hidden == null)
         {
             m_cachedStartHiddenValue = false;
         }
         else if (!m_visibility.Hidden.IsExpression)
         {
             m_cachedStartHiddenValue = m_visibility.Hidden.BoolValue;
         }
         else
         {
             m_cachedStartHiddenValue = EvaluateStartHidden(m_romScopeInstance, renderingContext.OdpContext);
         }
     }
     return(m_cachedStartHiddenValue);
 }
コード例 #10
0
        protected override string CalculateImageProperties(out string mimeType, out byte[] imageData, out string imageDataId, out List <string> fieldsUsedInValue, out bool isNullImage)
        {
            isNullImage = false;
            bool   errorOccured;
            string valueAsString = m_image.GetValueAsString(out fieldsUsedInValue, out errorOccured);

            if (errorOccured)
            {
                return(GetErrorImageProperties(out mimeType, out imageData, out imageDataId));
            }
            if (string.IsNullOrEmpty(valueAsString))
            {
                isNullImage = true;
                return(GetTransparentImageProperties(out mimeType, out imageData, out imageDataId));
            }
            Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext = m_reportElement.RenderingContext;
            string streamName = null;

            imageData   = null;
            imageDataId = valueAsString;
            if (base.CacheManager.TryGetExternalImage(valueAsString, out imageData, out mimeType, out streamName, out bool wasError))
            {
                if (wasError)
                {
                    imageDataId = null;
                }
            }
            else if (!GetExternalImage(renderingContext, valueAsString, out imageData, out mimeType) || imageData == null)
            {
                renderingContext.OdpContext.ErrorContext.Register(ProcessingErrorCode.rsInvalidExternalImageProperty, Severity.Warning, m_image.ObjectType, m_image.ObjectName, m_image.ImageDataPropertyName, streamName);
                base.CacheManager.AddFailedExternalImage(valueAsString);
                streamName  = null;
                imageDataId = null;
            }
            else
            {
                streamName = base.CacheManager.AddExternalImage(valueAsString, imageData, mimeType);
            }
            return(streamName);
        }
コード例 #11
0
 protected abstract Microsoft.ReportingServices.OnDemandReportRendering.Report PrepareROM(out Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext odpRenderingContext);
コード例 #12
0
        internal static bool ComputeDeepHidden(bool hidden, IVisibilityOwner visibilityOwner, ToggleCascadeDirection direction, Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext)
        {
            Visibility visibility = visibilityOwner.Visibility;

            if (hidden && (visibility == null || !visibility.IsToggleReceiver))
            {
                hidden = false;
            }
            if (!hidden && visibility != null && visibility.IsToggleReceiver)
            {
                hidden = ((!visibility.RecursiveReceiver || !(visibilityOwner is TablixMember)) ? (hidden | visibility.ToggleSender.ComputeDeepHidden(renderingContext, direction)) : (hidden | ((TablixMember)visibilityOwner).ComputeToggleSenderDeepHidden(renderingContext)));
            }
            if (!hidden && (visibility == null || !visibility.RecursiveReceiver) && visibilityOwner.ContainingDynamicVisibility != null)
            {
                hidden |= visibilityOwner.ContainingDynamicVisibility.ComputeDeepHidden(renderingContext, direction);
            }
            if (!hidden && direction != ToggleCascadeDirection.Column && visibilityOwner.ContainingDynamicRowVisibility != null)
            {
                hidden |= visibilityOwner.ContainingDynamicRowVisibility.ComputeDeepHidden(renderingContext, direction);
            }
            if (!hidden && direction != ToggleCascadeDirection.Row && visibilityOwner.ContainingDynamicColumnVisibility != null)
            {
                hidden |= visibilityOwner.ContainingDynamicColumnVisibility.ComputeDeepHidden(renderingContext, direction);
            }
            return(hidden);
        }
コード例 #13
0
 internal DataRegion(IDefinitionPath parentDefinitionPath, int indexIntoParentCollectionDef, Microsoft.ReportingServices.ReportIntermediateFormat.ReportItem reportItemDef, RenderingContext renderingContext)
     : base(null, parentDefinitionPath, indexIntoParentCollectionDef, reportItemDef, renderingContext)
 {
 }
コード例 #14
0
 internal DataRegion(IDefinitionPath parentDefinitionPath, int indexIntoParentCollectionDef, bool inSubtotal, Microsoft.ReportingServices.ReportRendering.ReportItem renderDataRegion, RenderingContext renderingContext)
     : base(parentDefinitionPath, indexIntoParentCollectionDef, inSubtotal, renderDataRegion, renderingContext)
 {
 }
コード例 #15
0
        public OnDemandProcessingResult Execute(IRenderingExtension newRenderer)
        {
            ExecutionLogContext executionLogContext = new ExecutionLogContext(m_publicProcessingContext.JobContext);

            executionLogContext.StartProcessingTimer();
            ProcessingErrorContext processingErrorContext = new ProcessingErrorContext();
            CultureInfo            currentCulture         = Thread.CurrentThread.CurrentCulture;

            try
            {
                bool                eventInfoChanged       = false;
                bool                renderingInfoChanged   = false;
                UserProfileState    userProfileState       = UserProfileState.None;
                Hashtable           renderProperties       = PublicRenderingContext.GetRenderProperties(IsSnapshotReprocessing);
                NameValueCollection reportServerParameters = FormServerParameterCollection(PublicRenderingContext.ReportContext.RSRequestParameters.CatalogParameters);
                PrepareForExecution();
                ProcessReport(processingErrorContext, executionLogContext, ref userProfileState);
                Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext odpRenderingContext = null;
                try
                {
                    Microsoft.ReportingServices.OnDemandReportRendering.Report report = PrepareROM(out odpRenderingContext);
                    executionLogContext.StartRenderingTimer();
                    renderingInfoChanged = InvokeRenderer(newRenderer, report, reportServerParameters, RenderingParameters, PublicRenderingContext.ReportContext.RSRequestParameters.BrowserCapabilities, ref renderProperties, PublicProcessingContext.CreateStreamCallback);
                    UpdateServerTotalPages(newRenderer, ref renderProperties);
                    UpdateEventInfo(odpRenderingContext, PublicRenderingContext, ref eventInfoChanged);
                }
                catch (ReportProcessing.DataCacheUnavailableException)
                {
                    throw;
                }
                catch (ReportRenderingException rex)
                {
                    ReportProcessing.HandleRenderingException(rex);
                }
                catch (RSException)
                {
                    throw;
                }
                catch (Exception ex3)
                {
                    if (AsynchronousExceptionDetection.IsStoppingException(ex3))
                    {
                        throw;
                    }
                    throw new UnhandledReportRenderingException(ex3);
                }
                finally
                {
                    FinallyBlockForProcessingAndRendering(odpRenderingContext, executionLogContext);
                }
                CleanupSuccessfulProcessing(processingErrorContext);
                return(ConstructProcessingResult(eventInfoChanged, renderProperties, processingErrorContext, userProfileState, renderingInfoChanged, executionLogContext));
            }
            catch (ReportProcessing.DataCacheUnavailableException)
            {
                throw;
            }
            catch (RSException)
            {
                CleanupForException();
                throw;
            }
            catch (Exception innerException)
            {
                CleanupForException();
                throw new ReportProcessingException(innerException, processingErrorContext.Messages);
            }
            finally
            {
                FinalCleanup();
                ReportProcessing.UpdateHostingEnvironment(processingErrorContext, PublicProcessingContext.ReportContext, executionLogContext, RunningProcessingEngine, PublicProcessingContext.JobContext);
                if (currentCulture != null)
                {
                    Thread.CurrentThread.CurrentCulture = currentCulture;
                }
            }
        }
コード例 #16
0
 private void FinallyBlockForProcessingAndRendering(Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext odpRenderingContext, ExecutionLogContext executionLogContext)
 {
     odpRenderingContext?.CloseRenderingChunkManager();
     executionLogContext.StopRenderingTimer();
 }
コード例 #17
0
ファイル: Chart.cs プロジェクト: zatuliveter/reportviewercore
 internal Chart(IDefinitionPath parentDefinitionPath, int indexIntoParentCollectionDef, bool inSubtotal, Microsoft.ReportingServices.ReportRendering.Chart renderChart, RenderingContext renderingContext)
     : base(parentDefinitionPath, indexIntoParentCollectionDef, inSubtotal, renderChart, renderingContext)
 {
     m_snapshotDataRegionType = Type.Chart;
 }
コード例 #18
0
 internal TextBoxFilteredStyle(Microsoft.ReportingServices.ReportRendering.ReportItem renderReportItem, RenderingContext renderingContext, bool useRenderStyle)
     : base(renderReportItem, renderingContext, useRenderStyle)
 {
 }
コード例 #19
0
 internal DataSet(Microsoft.ReportingServices.ReportIntermediateFormat.DataSet dataSetDef, RenderingContext renderingContext)
 {
     m_dataSetDef       = dataSetDef;
     m_renderingContext = renderingContext;
 }
コード例 #20
0
 internal StyleBaseInstance(RenderingContext context, IReportScope reportScope)
     : base(reportScope)
 {
     m_renderingContext = context;
 }
コード例 #21
0
 internal GaugePanel(IDefinitionPath parentDefinitionPath, int indexIntoParentCollectionDef, Microsoft.ReportingServices.ReportIntermediateFormat.GaugePanel reportItemDef, RenderingContext renderingContext)
     : base(parentDefinitionPath, indexIntoParentCollectionDef, reportItemDef, renderingContext)
 {
 }
コード例 #22
0
 protected override Microsoft.ReportingServices.OnDemandReportRendering.Report PrepareROM(out Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext odpRenderingContext)
 {
     odpRenderingContext = new Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext(base.PublicRenderingContext.Format, m_reportSnapshot, base.PublicProcessingContext.ChunkFactory, base.PublicRenderingContext.EventInfo);
     return(new Microsoft.ReportingServices.OnDemandReportRendering.Report(m_reportSnapshot.Report, m_reportSnapshot.ReportInstance, m_renderingContext, odpRenderingContext, base.ReportName, base.PublicRenderingContext.ReportDescription));
 }
コード例 #23
0
 protected override Microsoft.ReportingServices.OnDemandReportRendering.Report PrepareROM(out Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext odpRenderingContext)
 {
     odpRenderingContext = new Microsoft.ReportingServices.OnDemandReportRendering.RenderingContext(base.PublicRenderingContext.Format, m_odpReportSnapshot, base.PublicRenderingContext.EventInfo, m_odpContext);
     odpRenderingContext.InstanceAccessDisallowed = true;
     return(new Microsoft.ReportingServices.OnDemandReportRendering.Report(m_odpReportSnapshot.Report, odpRenderingContext, base.ReportName, base.PublicRenderingContext.ReportDescription));
 }