Beispiel #1
0
        internal Page RunPageNew(Pages pgs, Page p)
        {
            if (p.IsEmpty())                                    // if the page is empty it won't help to create another one
            {
                return(p);
            }

            // Do we need a new page or have should we fill out more body columns
            Body b    = OwnerReport.Body;
            int  ccol = b.IncrCurrentColumn(pgs.Report);        // bump to next column

            float top = OwnerReport.TopOfPage;                  // calc top of page

            if (ccol < b.Columns)
            {                           // Stay on same page but move to new column
                p.XOffset =
                    ((OwnerReport.Width.Points + b.ColumnSpacing.Points) * ccol);
                p.YOffset = top;
                p.SetEmpty();                                   // consider this page empty
            }
            else
            {                           // Go to new page
                b.SetCurrentColumn(pgs.Report, 0);
                pgs.NextOrNew();
                p         = pgs.CurrentPage;
                p.YOffset = top;
                p.XOffset = 0;
            }

            return(p);
        }
		internal Page RunPageNew(Pages pgs, Page p)
		{
			if (p.IsEmpty())			// if the page is empty it won't help to create another one
				return p;

			// Do we need a new page or have should we fill out more body columns
			Body b = OwnerReport.Body;
			int ccol = b.IncrCurrentColumn(pgs.Report);	// bump to next column

			float top = OwnerReport.TopOfPage;	// calc top of page

			if (ccol < b.Columns)
			{		// Stay on same page but move to new column
				p.XOffset = 
					((OwnerReport.Width.Points + b.ColumnSpacing.Points) * ccol);
				p.YOffset = top;
				p.SetEmpty();			// consider this page empty
			}
			else
			{		// Go to new page
				b.SetCurrentColumn(pgs.Report, 0);
				pgs.NextOrNew();
				p = pgs.CurrentPage;
				p.YOffset = top;
				p.XOffset = 0;
			}

			return p;
		}
Beispiel #3
0
        private void RunPageGroups(Pages pgs, WorkClass wc, List <GroupEntry> groupEntries)
        {
            Report rpt        = pgs.Report;
            Page   p          = pgs.CurrentPage;
            float  pagebottom = OwnerReport.BottomOfPage;

//			p.YOffset += (Top == null? 0: this.Top.Points);
            p.YOffset += this.RelativeY(rpt);
            float listoffset = GetOffsetCalc(pgs.Report) + LeftCalc(pgs.Report);

            float height;
            Row   row;

            foreach (GroupEntry ge in groupEntries)
            {
                // set the group entry value
                int index;
                if (ge.Group != null)                   // groups?
                {
                    ge.Group.ResetHideDuplicates(rpt);  // reset duplicate checking
                    index = ge.Group.GetIndex(rpt);     // yes
                }
                else                                    // no; must be main dataset
                {
                    index = 0;
                }
                wc.Data.CurrentGroups[index] = ge;
                if (ge.NestedGroup.Count > 0)
                {
                    RunGroupsSetGroups(rpt, wc, ge.NestedGroup);
                }

                if (ge.Group == null)
                {                       // need to run all the rows since no group defined
                    for (int r = ge.StartRow; r <= ge.EndRow; r++)
                    {
                        row    = wc.Data.Data[r];
                        height = HeightOfList(rpt, pgs.G, row);

                        if (p.YOffset + height > pagebottom && !p.IsEmpty()) // need another page for this row?
                        {
                            p = RunPageNew(pgs, p);                          // yes; if at end this page is empty
                        }
                        float saveYoffset = p.YOffset;                       // this can be affected by other page items

                        if (_ReportItems != null)
                        {
                            _ReportItems.RunPage(pgs, row, listoffset);
                        }

                        if (p == pgs.CurrentPage) // did subitems force new page?
                        {                         // no use the height of the list
                            p.YOffset = saveYoffset + height;
                        }
                        else
                        {                        // got forced to new page; just add the padding on
                            p = pgs.CurrentPage; // set to new page
                            if (this.Style != null)
                            {
                                p.YOffset += this.Style.EvalPaddingBottom(rpt, row);
                            }
                        }
                    }
                }
                else
                {                       // need to process just whole group as a List entry
                    if (ge.Group.PageBreakAtStart && !p.IsEmpty())
                    {
                        p = RunPageNew(pgs, p);
                    }

                    // pass the first row of the group
                    row    = wc.Data.Data[ge.StartRow];
                    height = HeightOfList(rpt, pgs.G, row);

                    if (p.YOffset + height > pagebottom && !p.IsEmpty()) // need another page for this row?
                    {
                        p = RunPageNew(pgs, p);                          // yes; if at end this page is empty
                    }
                    float saveYoffset = p.YOffset;                       // this can be affected by other page items

                    if (_ReportItems != null)
                    {
                        _ReportItems.RunPage(pgs, row, listoffset);
                    }


                    if (p == pgs.CurrentPage) // did subitems force new page?
                    {                         // no use the height of the list
                        p.YOffset = saveYoffset + height;
                    }
                    else
                    {                        // got forced to new page; just add the padding on
                        p = pgs.CurrentPage; // set to new page
                        if (this.Style != null)
                        {
                            p.YOffset += this.Style.EvalPaddingBottom(rpt, row);
                        }
                    }

                    if (ge.Group.PageBreakAtEnd ||                                      // need another page for next group?
                        p.YOffset + height > pagebottom)
                    {
                        p = RunPageNew(pgs, p);                                                                 // yes; if at end empty page will be cleaned up later
                    }
                }
                RemoveWC(rpt);
            }
        }