Beispiel #1
0
        /// <summary>
        /// Begins the footer on the current document page
        /// </summary>
        public void BeginFooter(PDFPageFooter owner, Style full, PDFLayoutContext context)
        {
            PDFLayoutBlock block = new PDFLayoutBlock(this, owner, this.Engine, full, OverflowSplit.Never);

            //Take the magins away from the total bounds before initializing the regions
            PDFRect content = this.ContentBlock.TotalBounds;

            if (this.PositionOptions.Margins.IsEmpty == false)
            {
                content.Width  -= this.PositionOptions.Margins.Left + this.PositionOptions.Margins.Right;
                content.Height -= this.PositionOptions.Margins.Top + this.PositionOptions.Margins.Bottom;
            }

            block.InitRegions(content, this.ContentBlock.Position, full.CreateColumnOptions(), context);
            this._footer = block;
            //Make this block current
            this.CurrentBlock = block;
        }
Beispiel #2
0
        //
        // methods
        //

        #region public void InitPage(int index, PDFSize size, PDFThickness margthick ...)

        /// <summary>
        /// Initializes this page with the required top block size and other measurements
        /// </summary>
        /// <param name="size"></param>
        /// <param name="margthick"></param>
        /// <param name="padthick"></param>
        /// <param name="available"></param>
        /// <param name="mode"></param>
        /// <param name="cansplit"></param>
        /// <param name="colcount"></param>
        /// <param name="alley"></param>
        public virtual void InitPage(PDFSize size, PDFPositionOptions options, PDFColumnOptions columns, PDFLayoutContext context)
        {
            this.Size            = size;
            this.PositionOptions = options;

            OverflowSplit split = options.OverflowSplit;


            PDFLayoutBlock block       = new PDFLayoutBlock(this, this.Owner, this.Engine, this.FullStyle, split);
            PDFRect        totalbounds = new PDFRect(PDFPoint.Empty, this.Size);


            block.InitRegions(totalbounds, options, columns, context);

            //We need to set the bounds of the page block to the total for a page
            //(as margins are taken off from the size of the page
            // - this is different to a block where margins increase any explicit sizes).
            block.TotalBounds = totalbounds;

            this.ContentBlock = block;
            this.CurrentBlock = block;
        }
Beispiel #3
0
        /// <summary>
        /// Begins a header on a the current document page
        /// </summary>
        public void BeginHeader(PDFPageHeader owner, Style full, PDFLayoutContext context)
        {
            if (null != this.HeaderBlock)
            {
                throw RecordAndRaise.LayoutException(Errors.AlreadyAHeaderDefinedOnPage);
            }

            PDFLayoutBlock block = new PDFLayoutBlock(this, owner, this.Engine, full, OverflowSplit.Never);

            //Take the magins away from the total bounds before initializing the regions
            PDFRect content = this.ContentBlock.TotalBounds;

            if (this.PositionOptions.Margins.IsEmpty == false)
            {
                content.Width  -= this.PositionOptions.Margins.Left + this.PositionOptions.Margins.Right;
                content.Height -= this.PositionOptions.Margins.Top + this.PositionOptions.Margins.Bottom;
            }

            block.InitRegions(content, this.ContentBlock.Position, full.CreateColumnOptions(), context);
            this._header = block;
            //Make this block current
            this.CurrentBlock = block;
        }
        //
        // main override
        //

        #region protected override void DoLayoutComponent()

        /// <summary>
        /// Performs the actual layout of the list and items in it.
        /// </summary>
        protected override void DoLayoutComponent()
        {
            if (this.Context.ShouldLogDebug)
            {
                this.Context.TraceLog.Begin(TraceLevel.Debug, ListEngineLogCategory, string.Format("Starting the layout of the list {0}", this.List.ID));
            }

            this.ContinueLayout = true;

            this.CurrentBlock = this.Context.DocumentLayout.CurrentPage.LastOpenBlock();
            if (this.CurrentBlock.CurrentRegion != null && this.CurrentBlock.CurrentRegion.HasOpenItem)
            {
                this.CurrentBlock.CurrentRegion.CloseCurrentItem();
            }

            PDFPositionOptions pos = this.FullStyle.CreatePostionOptions();


            //Set up the outer container block that will hold the list and all it's items
            _listBlock = this.CurrentBlock.BeginNewContainerBlock(this.List, this, this.FullStyle, pos.PositionMode);
            PDFRect bounds = this.CurrentBlock.CurrentRegion.UnusedBounds;

            if (bounds.X > 0)
            {
                bounds.X = PDFUnit.Zero;
            }

            if (pos.Width.HasValue)
            {
                bounds.Width = pos.Width.Value;
            }
            else if (pos.Margins.IsEmpty == false)
            {
                bounds.Width -= pos.Margins.Left + pos.Margins.Right;
            }


            if (pos.Height.HasValue)
            {
                bounds.Height = pos.Height.Value;
            }
            else if (pos.Margins.IsEmpty == false)
            {
                bounds.Height -= pos.Margins.Top + pos.Margins.Bottom;
            }

            PDFColumnOptions columnOptions = new PDFColumnOptions()
            {
                AlleyWidth = PDFUnit.Zero, AutoFlow = false, ColumnCount = 1
            };

            _listBlock.InitRegions(bounds, pos, columnOptions, this.Context);

            this.OpenListNumbering();

            this.BuildListEntries(out _itemNumberWidth);
            this.LayoutListItems(pos);

            _listBlock.CurrentRegion.CloseCurrentItem();
            _listBlock.CurrentRegion.Close();
            _listBlock.Close();

            this.CurrentBlock.CurrentRegion.AddToSize(_listBlock);

            if (this.Context.ShouldLogDebug)
            {
                this.Context.TraceLog.End(TraceLevel.Debug, ListEngineLogCategory, string.Format("Completed the layout of the list {0}", this.List.ID));
            }

            this.CloseListNumbering();
        }