示例#1
0
        private void RenderFooter(XGraphics graphics, int page)
        {
            FormattedHeaderFooter formattedFooter = this.formattedDocument.GetFormattedFooter(page);

            if (formattedFooter == null)
            {
                return;
            }

            Rectangle footerArea = this.formattedDocument.GetFooterArea(page);

            RenderInfo[] renderInfos = formattedFooter.GetRenderInfos();
            XUnit        topY        = footerArea.Y + footerArea.Height - RenderInfo.GetTotalHeight(renderInfos);

            FieldInfos fieldInfos = this.formattedDocument.GetFieldInfos(page);

            foreach (RenderInfo renderInfo in renderInfos)
            {
                Renderer renderer = Renderer.Create(graphics, this, renderInfo, fieldInfos);
                XUnit    savedY   = renderer.RenderInfo.LayoutInfo.ContentArea.Y;
                renderer.RenderInfo.LayoutInfo.ContentArea.Y = topY;
                renderer.Render();
                renderer.RenderInfo.LayoutInfo.ContentArea.Y = savedY;
            }
        }
 void FormatFooter(HeaderFooterPosition hfp, HeaderFooter footer)
 {
     if (footer != null && !_formattedFooters.ContainsKey(hfp))
     {
         FormattedHeaderFooter formattedHeaderFooter = new FormattedHeaderFooter(footer, _documentRenderer, _currentFieldInfos);
         formattedHeaderFooter.ContentRect = GetFooterArea(_currentSection, _currentPage);
         formattedHeaderFooter.Format(_gfx);
         _formattedFooters.Add(hfp, formattedHeaderFooter);
     }
 }
示例#3
0
 void FormatHeader(HeaderFooterPosition hfp, HeaderFooter header)
 {
     if (header != null && !this.formattedHeaders.ContainsKey(hfp))
     {
         FormattedHeaderFooter formattedHeaderFooter = new FormattedHeaderFooter(header, this.documentRenderer, this.currentFieldInfos);
         formattedHeaderFooter.ContentRect = GetHeaderArea(this.currentSection, this.currentPage);
         formattedHeaderFooter.Format(gfx);
         this.formattedHeaders.Add(hfp, formattedHeaderFooter);
     }
 }
        private void RenderHeader(XGraphics graphics, int page)
        {
            FormattedHeaderFooter formattedHeader = _formattedDocument.GetFormattedHeader(page);

            if (formattedHeader == null)
            {
                return;
            }

            Rectangle headerArea = _formattedDocument.GetHeaderArea(page);

            RenderInfo[] renderInfos = formattedHeader.GetRenderInfos();
            FieldInfos   fieldInfos  = _formattedDocument.GetFieldInfos(page);

            foreach (RenderInfo renderInfo in renderInfos)
            {
                Renderer renderer = Renderer.Create(graphics, this, renderInfo, fieldInfos);
                renderer.Render();
            }
        }
        private void RenderFooter(XGraphics graphics, int page)
        {
            FormattedHeaderFooter formattedFooter = _formattedDocument.GetFormattedFooter(page);

            if (formattedFooter == null)
            {
                return;
            }

            Rectangle footerArea = _formattedDocument.GetFooterArea(page);

            RenderInfo[] renderInfos = formattedFooter.GetRenderInfos();
#if true
#if true
            // The footer is bottom-aligned and grows with its contents. topY specifies the Y position where the footer begins.
            XUnit topY = footerArea.Y + footerArea.Height - RenderInfo.GetTotalHeight(renderInfos);
            // Hack: The purpose of "topY" is unclear, but two paragraphs in the footer will use the same topY and will be rendered at the same position.
            // offsetY specifies the offset (amount of movement) for all footer items. It's the difference between topY and the position calculated for the first item.
            XUnit offsetY  = 0;
            bool  notFirst = false;

            FieldInfos fieldInfos = _formattedDocument.GetFieldInfos(page);
            foreach (RenderInfo renderInfo in renderInfos)
            {
                Renderer renderer = Renderer.Create(graphics, this, renderInfo, fieldInfos);
                if (!notFirst)
                {
                    offsetY  = renderer.RenderInfo.LayoutInfo.ContentArea.Y - topY;
                    notFirst = true;
                }
                XUnit savedY = renderer.RenderInfo.LayoutInfo.ContentArea.Y;
                // Apply offsetY only to items that do not have an absolute position.
                if (renderer.RenderInfo.LayoutInfo.Floating != Floating.None)
                {
                    renderer.RenderInfo.LayoutInfo.ContentArea.Y -= offsetY;
                }
                renderer.Render();
                renderer.RenderInfo.LayoutInfo.ContentArea.Y = savedY;
            }
#else
            // TODO Document the purpose of "topY".
            XUnit topY = footerArea.Y + footerArea.Height - RenderInfo.GetTotalHeight(renderInfos);
            // Hack: The purpose of "topY" is unclear, but two paragraphs in the footer will use the same topY and will be rendered at the same position.
            XUnit offsetY = 0;

            FieldInfos fieldInfos = _formattedDocument.GetFieldInfos(page);
            foreach (RenderInfo renderInfo in renderInfos)
            {
                Renderer renderer = Renderer.Create(graphics, this, renderInfo, fieldInfos);
                XUnit    savedY   = renderer.RenderInfo.LayoutInfo.ContentArea.Y;
                renderer.RenderInfo.LayoutInfo.ContentArea.Y = topY + offsetY;
                renderer.Render();
                renderer.RenderInfo.LayoutInfo.ContentArea.Y = savedY;
                offsetY += renderer.RenderInfo.LayoutInfo.ContentArea.Height;
            }
#endif
#else
            XUnit topY = footerArea.Y + footerArea.Height - RenderInfo.GetTotalHeight(renderInfos);

            FieldInfos fieldInfos = _formattedDocument.GetFieldInfos(page);
            foreach (RenderInfo renderInfo in renderInfos)
            {
                Renderer renderer = Renderer.Create(graphics, this, renderInfo, fieldInfos);
                XUnit    savedY   = renderer.RenderInfo.LayoutInfo.ContentArea.Y;
                renderer.RenderInfo.LayoutInfo.ContentArea.Y = topY;
                renderer.Render();
                renderer.RenderInfo.LayoutInfo.ContentArea.Y = savedY;
            }
#endif
        }
示例#6
0
 void FormatFooter(HeaderFooterPosition hfp, HeaderFooter footer)
 {
     if (footer != null && !_formattedFooters.ContainsKey(hfp))
     {
         FormattedHeaderFooter formattedHeaderFooter = new FormattedHeaderFooter(footer, _documentRenderer, _currentFieldInfos);
         formattedHeaderFooter.ContentRect = GetFooterArea(_currentSection, _currentPage);
         formattedHeaderFooter.Format(_gfx);
         _formattedFooters.Add(hfp, formattedHeaderFooter);
     }
 }
示例#7
0
 void FormatHeader(HeaderFooterPosition hfp, HeaderFooter header)
 {
     if (header != null && !this.formattedHeaders.ContainsKey(hfp))
       {
     FormattedHeaderFooter formattedHeaderFooter = new FormattedHeaderFooter(header, this.documentRenderer, this.currentFieldInfos);
     formattedHeaderFooter.ContentRect = GetHeaderArea(this.currentSection, this.currentPage);
     formattedHeaderFooter.Format(gfx);
     this.formattedHeaders.Add(hfp, formattedHeaderFooter);
       }
 }