public void NextOrNew()
		{
			if (_currentPage == this.LastPage)
				AddPage(new Page(PageCount+1));
			else
			{
				_currentPage = _pages[_currentPage.PageNumber];  
				_currentPage.SetEmpty();			
			}
		}
 public DMPPage(Page page, Report report)
 {
     Content = new List<DMPLine>();
     ContentControls = new List<DMPControl>();
     SetPageFrame(report.ReportDefinition.PageHeight.Points, report.ReportDefinition.PageWidth.Points);
     SetPageContentControls(page);
     //ControlsToContent();
 }
			public Page OutputPage;	// the previous outputed row
			public WorkClass()
			{
				OutputRow = null;
				OutputPage = null;
			}
		public void RunPage(IPresent ip)
		{
			Pages pgs = new Pages(ip.Report());
			try
			{
				Page p = new Page(1);				// kick it off with a new page
				pgs.AddPage(p);

				// Create all the pages
				_Body.RunPage(pgs);

 				if (pgs.LastPage.IsEmpty()&& pgs.PageCount > 1)	// get rid of extraneous pages which
					pgs.RemoveLastPage();			//   can be caused by region page break at end

				// Now create the headers and footers for all the pages (as needed)
				if (_PageHeader != null)
					_PageHeader.RunPage(pgs);
				if (_PageFooter != null)
					_PageFooter.RunPage(pgs);

                pgs.SortPageItems();             // Handle ZIndex ordering of pages

				ip.RunPages(pgs);
			}
			finally
			{
				pgs.CleanUp();		// always want to make sure we clean this up since 
				if (_DataSourcesDefn != null)
					_DataSourcesDefn.CleanUp(pgs.Report);	// ensure datasets are cleaned up
			}

			return;
		}
		/// <summary>
		/// Build the Pages for this report.
		/// </summary>
		/// <returns></returns>
		public Pages BuildPages()
		{
			PageNumber = 1;		// reset page numbers
			TotalPages = 1;

			Pages pgs = new Pages(this);
			pgs.PageHeight = _Report.PageHeight.Points;
			pgs.PageWidth = _Report.PageWidth.Points;
			try
			{
				Page p = new Page(1);				// kick it off with a new page
				pgs.AddPage(p);

				// Create all the pages
				_Report.Body.RunPage(pgs);

				if (pgs.LastPage.IsEmpty() && pgs.PageCount > 1) // get rid of extraneous pages which
					pgs.RemoveLastPage();			//   can be caused by region page break at end

				// Now create the headers and footers for all the pages (as needed)
				if (_Report.PageHeader != null)
					_Report.PageHeader.RunPage(pgs);
				if (_Report.PageFooter != null)
					_Report.PageFooter.RunPage(pgs);
				// clear out any runtime clutter
				foreach (Page pg in pgs)
					pg.ResetPageExpressions();

                pgs.SortPageItems();             // Handle ZIndex ordering of pages
			}
			catch (Exception e)
			{
				rl.LogError(8, "Exception running report\r\n" + e.Message + "\r\n" + e.StackTrace);
			}
			finally
			{
				pgs.CleanUp();		// always want to make sure we clean this up since 
                _Cache = new RCache();
			}

			return pgs;
		}
			public Page CurrentPage;		// the page this reportitem was last put on; 
			public WorkClass()
			{
				MC=null;
				BottomPosition=float.NaN;
				CurrentPage=null;
			}
		public 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;
		}
		public void AddPage(Page p)
		{
			_pages.Add(p);
			_currentPage = p;
		}
		// routine to determine if text is considered to be a duplicate;
		//  ie: same as previous text and on same page
		private bool RunTextIsDuplicate(TextboxRuntime tbr, string t, Page p)
		{
			if (this._HideDuplicates == null)
				return false;
			if (t == tbr.PreviousText && p == tbr.PreviousPage)
				return true;

			return false;
		}
		public void RecordPageReference(Report rpt, Page p, Row r)
		{
			if (_ExprReferences == null)
				return;
			foreach (string refr in _ExprReferences)
			{
				p.AddPageExpressionRow(rpt, refr, r);
			}
		}