コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dt.Cells.Data.PdfExporter.PageState" /> class.
 /// </summary>
 /// <param name="hPageIndex">Index of the horizontal page.</param>
 /// <param name="vPageIndex">Index of the vertical page.</param>
 /// <param name="pageIndex">Index of the page.</param>
 /// <param name="pageBlock">The page block.</param>
 public PageState(int hPageIndex, int vPageIndex, int pageIndex, GcPageBlock pageBlock)
 {
     this.hPageIndex = hPageIndex;
     this.vPageIndex = vPageIndex;
     this.pageIndex  = pageIndex;
     this.pageBlock  = pageBlock;
 }
コード例 #2
0
        /// <summary>
        /// Exports the page.
        /// </summary>
        /// <param name="state">The state.</param>
        /// <param name="doc">The document.</param>
        /// <param name="page">The page.</param>
        void ExportPage(ExporterState state, PdfDocument doc, GcPageBlock page)
        {
            PdfPage page2 = doc.Pages.AddNewPage(this.context.GetDot((float)page.Width), this.context.GetDot((float)page.Height));

            if (this.settings.PageDuration >= 0)
            {
                page2.PageDuration = this.settings.PageDuration;
            }
            if (this.settings.PageTransition != PageTransitionType.Default)
            {
                page2.PageTransition.TransitionType = this.settings.PageTransition;
            }
            state.CurrentPage = page2;
            PdfContent content = page2.AddNewContent();

            content.Filters.Enqueue(PdfFilter.FlateFilter);
            PdfGraphics pdfGraphics = content.Graphics;
            Graphics    g           = new Graphics(this.context, this, pdfGraphics);

            if (state.BlackAndWhite)
            {
                g.GrayMode = true;
            }
            g.SaveState();
            g.Scale((double)this.context.GetForce(), (double)-this.context.GetForce());
            g.Translate(0.0, -page.Height);
            new GcPaintHelper().Paint(page, g, state);
            g.RestoreState();
        }
コード例 #3
0
        /// <summary>
        /// Creates the new page.
        /// </summary>
        /// <returns></returns>
        public GcPageBlock CreateNewPage()
        {
            GcPageBlock block = new GcPageBlock();

            Windows.Foundation.Size pageSize = Utilities.GetPageSize(this.Report.PaperSize, this.Report.Orientation);
            block.X      = 0.0;
            block.Y      = 0.0;
            block.Width  = pageSize.Width;
            block.Height = pageSize.Height;
            GcPageRectangles rectangles = new GcPageRectangles {
                CropRectangle = this.pageRects.CropRectangle
            };

            block.Rectangles = rectangles;
            return(block);
        }
コード例 #4
0
        /// <summary>
        /// Generates the pages.
        /// </summary>
        /// <param name="context">The context</param>
        /// <param name="continuePage">If set to <c>true</c>, [continue page]</param>
        /// <param name="offset">The offset</param>
        /// <param name="pageHeaderOffset">The page header offset</param>
        /// <returns></returns>
        internal virtual bool GeneratePages(GcReportContext context, bool continuePage, ref double offset, ref double pageHeaderOffset)
        {
            int num;
            GcPageHeaderSection pageHeader = context.PageHeader;
            GcPageFooterSection pageFooter = context.PageFooter;

            GcSection.GcSectionCache pageHeaderCache = context.PageHeaderCache;
            GcSection.GcSectionCache pageFooterCache = context.PageFooterCache;
            List <int> horizontalPageBreaks          = this.GetHorizontalPageBreaks();

            GcSection.GcSectionCache cache   = base.GetCache(context);
            Windows.Foundation.Size  allSize = base.GetAllSize(cache);
            PaperCutter cutter = new PaperCutter((int)context.PageRects.CropRectangle.Height, (int)allSize.Height, (IEnumerable <int>)horizontalPageBreaks);
            bool        flag   = this is IGcAllowAppendixSection;

            if (flag)
            {
                if (pageHeader != null)
                {
                    cutter.MaxLength -= (int)pageHeader.GetAllSize(pageHeaderCache).Height;
                }
                if (pageFooter != null)
                {
                    cutter.MaxLength -= (int)pageFooter.GetAllSize(pageFooterCache).Height;
                }
            }
            if (this.PageBreakBefore || (offset >= cutter.MaxLength))
            {
                continuePage = false;
            }
            if (!continuePage)
            {
                offset           = 0.0;
                pageHeaderOffset = 0.0;
            }
            List <GcPageBlock> list2 = (continuePage && (context.Pages.Count > 0)) ? context.Pages[context.Pages.Count - 1] : new List <GcPageBlock>();

            if (continuePage)
            {
                cutter.AddBreakIfFirst((int)(cutter.MaxLength - offset));
            }
            object buildInControlState = this.CreateBuildInControlState(context);
            double num2       = offset;
            bool   horizontal = false;
            int    num3       = 0;

            while (cutter.Next(out num) || this.HasMorePage(buildInControlState, horizontal))
            {
                int        num6;
                List <int> verticalPageBreaks = this.GetVerticalPageBreaks();
                int        width = (int)allSize.Width;
                if (flag)
                {
                    width = Math.Max(width, context.PageHeaderFooterMaxWidth);
                }
                PaperCutter cutter2 = new PaperCutter((int)context.PageRects.CropRectangle.Width, width, (IEnumerable <int>)verticalPageBreaks);
                int         num5    = 0;
                while (cutter2.Next(out num6) || this.HasMorePage(buildInControlState, horizontal))
                {
                    if (num5 >= list2.Count)
                    {
                        list2.Add(context.CreateNewPage());
                    }
                    GcPageBlock block  = list2[num5];
                    int         x      = cutter2.Current - num6;
                    int         y      = cutter.Current - num;
                    int         height = 0;
                    if (flag)
                    {
                        if ((pageHeader != null) && (block.PageHeader == null))
                        {
                            height = (int)pageHeader.GetAllSize(pageHeaderCache).Height;
                        }
                        if (pageFooter != null)
                        {
                            num3 = (int)pageFooter.GetAllSize(pageFooterCache).Height;
                        }
                        if ((height + num3) >= num)
                        {
                            num3 = 0;
                        }
                        if ((height + num3) >= num)
                        {
                            height = 0;
                        }
                    }
                    else if ((pageFooter != null) && (block.PageFooter != null))
                    {
                        num3 = (int)pageFooter.GetAllSize(pageFooterCache).Height;
                        if ((height + num3) >= num)
                        {
                            num3 = 0;
                        }
                    }
                    GcRangeBlock block2 = base.GetRange(context, x, y, num6, num, cache, buildInControlState, horizontal, continuePage);
                    if (flag)
                    {
                        if (((pageHeader != null) && (block.PageHeader == null)) && (height > 0))
                        {
                            block.PageHeader = pageHeader.GetRange(context, pageHeader.HorizontalExtend ? x : 0, 0, (int)context.PageRects.PageHeaderRectangle.Width, (int)context.PageRects.PageHeaderRectangle.Height, pageHeaderCache, buildInControlState, horizontal, continuePage);
                            if (continuePage)
                            {
                                GcRangeBlock block1 = block.PageHeader;
                                block1.Y += pageHeaderOffset;
                            }
                        }
                        if (((pageFooter != null) && (block.PageFooter == null)) && (num3 > 0))
                        {
                            block.PageFooter   = pageFooter.GetRange(context, pageFooter.HorizontalExtend ? x : 0, 0, (int)context.PageRects.PageFooterRectangle.Width, (int)context.PageRects.PageFooterRectangle.Height, pageFooterCache, buildInControlState, horizontal, continuePage);
                            block.PageFooter.Y = ((int)context.PageRects.CropRectangle.Height) - num3;
                        }
                    }
                    if ((context.TopMargin != null) && (block.TopMargin == null))
                    {
                        block.TopMargin   = context.TopMargin.GetRange(context, context.TopMargin.HorizontalExtend ? x : 0, 0, (int)context.PageRects.TopMarginRectangle.Width, (int)context.PageRects.TopMarginRectangle.Height, context.TopMarginCache, buildInControlState, horizontal, continuePage);
                        block.TopMargin.X = context.PageRects.TopMarginRectangle.X;
                        block.TopMargin.Y = context.PageRects.TopMarginRectangle.Y;
                    }
                    if ((context.BottomMargin != null) && (block.BottomMargin == null))
                    {
                        block.BottomMargin   = context.BottomMargin.GetRange(context, context.BottomMargin.HorizontalExtend ? x : 0, 0, (int)context.PageRects.BottomMarginRectangle.Width, (int)context.PageRects.BottomMarginRectangle.Height, context.BottomMarginCache, buildInControlState, horizontal, continuePage);
                        block.BottomMargin.X = context.PageRects.BottomMarginRectangle.X;
                        block.BottomMargin.Y = context.PageRects.BottomMarginRectangle.Y;
                    }
                    block2.Y += height;
                    if (continuePage)
                    {
                        block2.Y += num2;
                    }
                    if ((!flag && (pageFooter != null)) && (block.PageFooter != null))
                    {
                        block.PageFooter.Y = block2.Y;
                        block2.Y          += num3;
                    }
                    block.Blocks.Add(block2);
                    if (!horizontal)
                    {
                        offset = (num2 + block2.Height) + height;
                    }
                    num5++;
                    horizontal = true;
                }
                pageHeaderOffset = 0.0;
                num2             = 0.0;
                horizontal       = false;
                continuePage     = false;
                if (!context.Pages.Contains(list2))
                {
                    context.Pages.Add(list2);
                }
                list2 = new List <GcPageBlock>();
            }
            continuePage = !this.PageBreakAfter;
            if (continuePage && (offset >= (context.PageRects.CropRectangle.Height - num3)))
            {
                continuePage = !continuePage;
            }
            if (!continuePage)
            {
                offset = 0.0;
            }
            pageHeaderOffset = flag ? 0.0 : offset;
            return(continuePage);
        }