Esempio n. 1
0
        public Stream CreateStream(string name, string extension, Encoding encoding, string mimeType, bool willSeek, StreamOper operation)
        {
            StreamOper streamOper = operation;

            if (streamOper == StreamOper.CreateAndRegister)
            {
                streamOper = StreamOper.CreateOnly;
            }
            Stream stream = m_createAndRegisterStream(name, extension, encoding, mimeType, willSeek, streamOper);

            if (stream == null)
            {
                return(null);
            }
            MHTMLStream mHTMLStream = new MHTMLStream(stream);

            mHTMLStream.m_name    = name;
            mHTMLStream.extension = extension;
            mHTMLStream.encoding  = encoding;
            mHTMLStream.mimeType  = mimeType;
            mHTMLStream.willSeek  = willSeek;
            if (StreamOper.CreateOnly != operation)
            {
                m_streams.Add(mHTMLStream);
            }
            return(mHTMLStream.m_stream);
        }
 public override void Render(HtmlTextWriter outputWriter)
 {
     m_encoding   = outputWriter.Encoding;
     m_mainStream = Utility.CreateBufferedStream(outputWriter);
     if (!m_onlyVisibleStyles)
     {
         string    styleStreamName = HTML5Renderer.GetStyleStreamName(m_rplReport.ReportName, m_pageNum);
         Stream    stream          = m_createAndRegisterStreamCallback(styleStreamName, "css", Encoding.UTF8, "text/css", willSeek: false, StreamOper.CreateAndRegister);
         ROMReport rOMReport       = m_report as ROMReport;
         if (rOMReport != null)
         {
             HTMLStyleRenderer hTMLStyleRenderer = new HTMLStyleRenderer(rOMReport.Report, m_createAndRegisterStreamCallback, m_deviceInfo, this);
             hTMLStyleRenderer.Render(stream);
         }
         stream.Flush();
         m_styleStream = stream;
     }
     else if (!m_useInlineStyle)
     {
         string     styleStreamName2 = HTML5Renderer.GetStyleStreamName(m_rplReport.ReportName, m_pageNum);
         StreamOper operation        = StreamOper.CreateOnly;
         if (m_deviceInfo.StyleStream)
         {
             operation = StreamOper.CreateAndRegister;
         }
         Stream stream2 = m_createAndRegisterStreamCallback(styleStreamName2, "css", Encoding.UTF8, "text/css", willSeek: false, operation);
         m_styleStream = new BufferedStream(stream2);
     }
     if (!m_deviceInfo.HTMLFragment)
     {
         WriteStream(HTMLElements.HtmlStandardsDocType);
         Stream mainStream = m_mainStream;
         Stream stream3    = m_mainStream = new BufferedStream(m_createAndRegisterStreamCallback("BODY", "html", null, null, willSeek: true, StreamOper.CreateOnly));
         RenderHtmlBody();
         RenderSecondaryStreamSpanTagsForJavascriptFunctions();
         WriteStream(HTMLElements.m_closeBody);
         m_mainStream = mainStream;
         stream3.Flush();
         WriteStream(HTMLElements.m_openHtml);
         WriteStreamLineBreak();
         WriteStream(HTMLElements.m_openHead);
         WriteStream(HTMLElements.m_openTitle);
         WriteStream(HttpUtility.HtmlEncode(m_rplReport.ReportName));
         WriteStream(HTMLElements.m_closeTitle);
         WriteStreamLineBreak();
         WriteStreamCR("<META http-equiv=\"Content-Type\" content=\"text/html; charset=" + outputWriter.Encoding.BodyName + "\"/>");
         WriteStreamCR("<META http-equiv=\"Content-Style-Type\" content=\"text/css\"/>");
         WriteStreamCR("<META http-equiv=\"Content-Script-Type\" content=\"text/javascript\"/>");
         if (!m_isMHTML)
         {
             WriteStreamCR(HTMLElements.EdgeContentType);
         }
         RenderHead();
         RenderFinalScript();
         WriteStream(HTMLElements.m_closeHead);
         WriteStream(HTMLElements.m_openBody);
         if (m_deviceInfo.AllowScript)
         {
             StringBuilder stringBuilder = new StringBuilder();
             if (base.NeedResizeImages)
             {
                 stringBuilder.Append(m_deviceInfo.JavascriptPrefixId);
                 stringBuilder.Append("ResizeImages();");
             }
             if (m_deviceInfo.NavigationId != null)
             {
                 stringBuilder.Append(m_deviceInfo.JavascriptPrefixId);
                 stringBuilder.Append("GoToBookmark(");
                 stringBuilder.Append(m_deviceInfo.NavigationId);
                 stringBuilder.Append(");");
             }
             if (m_report.SortItem != null)
             {
                 stringBuilder.Append(m_deviceInfo.JavascriptPrefixId);
                 stringBuilder.Append("GoToSortItem();");
             }
             if (m_report.ShowHideToggle != null)
             {
                 stringBuilder.Append(m_deviceInfo.JavascriptPrefixId);
                 stringBuilder.Append("GoToShowHideToggle();");
             }
             if (m_emitImageConsolidationScaling)
             {
                 stringBuilder.Append("Microsoft_ReportingServices_HTMLRenderer_ScaleImageConsolidation('");
                 stringBuilder.Append(m_deviceInfo.HtmlPrefixId);
                 stringBuilder.Append("');");
                 stringBuilder.Append("Microsoft_ReportingServices_HTMLRenderer_ScaleImageForFit('");
                 stringBuilder.Append(m_deviceInfo.HtmlPrefixId);
                 stringBuilder.Append("');");
             }
             bool hasFixedHeader = HasFixedHeader;
             if (m_deviceInfo.IsBrowserGeckoEngine && hasFixedHeader)
             {
                 stringBuilder.Append(m_deviceInfo.JavascriptPrefixId + "CreateFixedHeaders();");
             }
             if (m_needsCanGrowFalseScript)
             {
                 stringBuilder.Append("Microsoft_ReportingServices_HTMLRenderer_GrowTablixTextBoxes();");
             }
             if (m_needsFitVertTextScript)
             {
                 stringBuilder.Append("Microsoft_ReportingServices_HTMLRenderer_FitVertText('");
                 stringBuilder.Append(m_deviceInfo.HtmlPrefixId);
                 stringBuilder.Append("'");
                 stringBuilder.Append(",");
                 stringBuilder.Append("'");
                 stringBuilder.Append(m_deviceInfo.HtmlPrefixId);
                 stringBuilder.Append("oReportDiv");
                 stringBuilder.Append("');");
             }
             if (m_needsGrowRectangleScript)
             {
                 stringBuilder.Append("Microsoft_ReportingServices_HTMLRenderer_GrowRectangles('");
                 stringBuilder.Append(m_deviceInfo.HtmlPrefixId);
                 stringBuilder.Append("'");
                 stringBuilder.Append(",");
                 stringBuilder.Append("'");
                 stringBuilder.Append(m_deviceInfo.HtmlPrefixId);
                 stringBuilder.Append("oReportDiv");
                 stringBuilder.Append("');");
             }
             if (stringBuilder.Length > 0)
             {
                 WriteStream(string.Concat(" onload=\"", stringBuilder, "\""));
             }
             if (hasFixedHeader && !m_isMHTML && m_hasOnePage)
             {
                 WriteStream(" onscroll=\"" + m_deviceInfo.JavascriptPrefixId + "CreateFixedHeaders()\"");
                 WriteStream(" onresize=\"" + m_deviceInfo.JavascriptPrefixId + "CreateFixedHeaders()\" ");
             }
         }
         RenderBodyTagStyle();
         WriteStream(HTMLElements.m_closeBracket);
         m_mainStream.Flush();
         stream3.Seek(0L, SeekOrigin.Begin);
         Utility.CopyStream(stream3, m_mainStream);
         stream3.Close();
         stream3 = null;
         WriteStream(HTMLElements.m_closeHtml);
         m_mainStream.Flush();
     }
     else
     {
         Stream mainStream2 = m_mainStream;
         Stream stream4     = m_mainStream = new BufferedStream(m_createAndRegisterStreamCallback("BODY", "html", null, null, willSeek: true, StreamOper.CreateOnly));
         RenderHtmlBody();
         RenderFinalScript();
         stream4.Flush();
         m_mainStream = mainStream2;
         RenderHead();
         stream4.Seek(0L, SeekOrigin.Begin);
         Utility.CopyStream(stream4, m_mainStream);
         m_mainStream.Flush();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 创建打印页面的内容流
 /// </summary>
 /// <param name="name"></param>
 /// <param name="extension"></param>
 /// <param name="encoding"></param>
 /// <param name="mimeType"></param>
 /// <param name="useChunking"></param>
 /// <param name="operation"></param>
 /// <returns></returns>
 private Stream CreateStreamEMFPrintOnly(string name, string extension, Encoding encoding, string mimeType, bool useChunking, StreamOper operation)
 {
     return(this._fileManagerWrapper.CreatePage(operation == StreamOper.CreateAndRegister));
 }
Esempio n. 4
0
        public Stream StreamCallback(string name, string extension, Encoding encoding, string mimeType, bool useChunking, StreamOper operation)
        {
            if (operation == StreamOper.RegisterOnly)
            {
                return(null);
            }
            if (this.m_allowOnlyTemporaryStreams && operation != StreamOper.CreateOnly)
            {
                throw new InvalidOperationException("Only temporary streams are allowed by this StreamHandler");
            }
            if ((operation == StreamOper.CreateAndRegister || operation == StreamOper.CreateForPersistedStreams) && this.m_createStreamCallback != null)
            {
                return(this.m_createStreamCallback(name, extension, encoding, mimeType, useChunking, operation));
            }
            MemoryStream memoryStream = new MemoryStream();

            this.m_streams.Add(memoryStream);
            return(memoryStream);
        }
 private Stream CreateMemoryStream(string aName, string aExtension, Encoding aEncoding, string aMimeType, bool aWillSeek, StreamOper aOper)
 {
     return(new MemoryStream());
 }
        public Stream StreamCallback(string name, string extension, Encoding encoding, string mimeType, bool useChunking, StreamOper operation)
        {
            int num;

            switch (operation)
            {
            case StreamOper.RegisterOnly:
                return(null);

            case StreamOper.CreateAndRegister:
                if (this.m_mainStream == null)
                {
                    num = ((!this.m_mainStreamDetached) ? 1 : 0);
                    break;
                }
                goto default;

            default:
                num = 0;
                break;
            }
            bool flag = (byte)num != 0;
            CreateStreamDelegate createStreamDelegate = flag ? this.m_createMainStreamDelegate : new CreateStreamDelegate(StreamCache.DefaultCreateStreamDelegate);
            CachedStream         cachedStream         = new CachedStream(createStreamDelegate(), encoding, mimeType, extension);

            if (operation == StreamOper.CreateAndRegister)
            {
                if (flag)
                {
                    this.m_mainStream = cachedStream;
                }
                else
                {
                    this.m_secondaryStreams.Add(name, cachedStream);
                }
            }
            return(cachedStream.Stream);
        }
Esempio n. 7
0
        public Stream StreamCallback(string name, string extension, Encoding encoding, string mimeType, bool useChunking, StreamOper operation)
        {
            if (operation == StreamOper.RegisterOnly)
            {
                return(null);
            }
            bool         flag         = operation == StreamOper.CreateAndRegister && m_mainStream == null && !m_mainStreamDetached;
            CachedStream cachedStream = new CachedStream((flag ? m_createMainStreamDelegate : new CreateStreamDelegate(DefaultCreateStreamDelegate))(), encoding, mimeType, extension);

            if (operation == StreamOper.CreateAndRegister)
            {
                if (flag)
                {
                    m_mainStream = cachedStream;
                }
                else
                {
                    m_secondaryStreams.Add(name, cachedStream);
                }
            }
            return(cachedStream.Stream);
        }
        public static HtmlTextWriter CreateWriter(string streamName, string mimeType, CreateAndRegisterStream createStreamCallback, StreamOper streamOper)
        {
            Stream         stream         = createStreamCallback(streamName, "html", Encoding.UTF8, mimeType, willSeek: false, streamOper);
            HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));

            htmlTextWriter.NewLine = null;
            return(htmlTextWriter);
        }