Exemple #1
0
 public BaseConverter(IDataNavigator dataNavigator, ExporterPage singlePage,
                      IExportItemsConverter exportItemsConverter, ILayouter layouter)
 {
     if (dataNavigator == null)
     {
         throw new ArgumentNullException("dataNavigator");
     }
     if (singlePage == null)
     {
         throw new ArgumentNullException("singlePage");
     }
     if (exportItemsConverter == null)
     {
         throw new ArgumentNullException("exportItemsConverter");
     }
     if (layouter == null)
     {
         throw new ArgumentNullException("layouter");
     }
     this.singlePage           = singlePage;
     this.dataNavigator        = dataNavigator;
     this.sectionBounds        = this.singlePage.SectionBounds;
     this.exportItemsConverter = exportItemsConverter;
     this.layouter             = layouter;
 }
Exemple #2
0
 public static bool IsPageFull(Rectangle rectangle, SectionBounds bounds)
 {
     if (rectangle.Bottom > bounds.PageFooterRectangle.Top)
     {
         return(true);
     }
     return(false);
 }
		public static ExporterPage CreateInstance (SectionBounds sectionBounds,int pageNumber)
		{
			if (sectionBounds == null) {
				throw new ArgumentNullException("sectionBounds");
			}
			ExporterPage instance = new ExporterPage(sectionBounds,pageNumber);
			return instance;
		}
Exemple #4
0
        ISinglePage CreateSinglePage(IReportModel model, int pageNumber)
        {
            Size defaultSectionSize = new Size(727, 60);
            var  s = new SectionBounds(model.ReportSettings, true);

            SinglePage sp = new SinglePage(s, 0);

            sp.CalculatePageBounds(model);
            return(sp);
        }
        public static ExporterPage CreateInstance(SectionBounds sectionBounds, int pageNumber)
        {
            if (sectionBounds == null)
            {
                throw new ArgumentNullException("sectionBounds");
            }
            ExporterPage instance = new ExporterPage(sectionBounds, pageNumber);

            return(instance);
        }
Exemple #6
0
        public static SinglePage CreateSinglePage()
        {
            SectionBounds sb = new SectionBounds(new ReportSettings(), false);
            SinglePage    p  = new SinglePage(sb, 15);

            p.TotalPages     = 25;
            p.ReportName     = "SharpTestReport.srd";
            p.ReportFileName = @"c:\testreports\SharpTestReport.srd";
            p.ExecutionTime  = new DateTime(2009, 12, 24, 23, 59, 59);
            return(p);
        }
		public static SinglePage CreateSinglePage ()
		{
			SectionBounds sb = new SectionBounds(new ReportSettings(),false);
			SinglePage p = new SinglePage(sb,15);
		
			p.TotalPages = 25;
			p.ReportName = "SharpTestReport.srd";
			p.ReportFileName =@"c:\testreports\SharpTestReport.srd";
			p.ExecutionTime = new DateTime(2009,12,24,23,59,59);
		
			return p;
		}
Exemple #8
0
        public void DetailEnds()
        {
            SectionBounds sectionBounds = new SectionBounds(new ReportSettings(), true);
            BaseSection   baseSection   = new BaseSection();

            baseSection.Location = new Point(50, 50);
            baseSection.Size     = new Size(727, 60);
            sectionBounds.MeasurePageFooter(baseSection);
            Point p = new Point(sectionBounds.PageFooterRectangle.Left, sectionBounds.PageFooterRectangle.Top - sectionBounds.Gap);

            Assert.AreEqual(p, sectionBounds.DetailEnds);
        }
Exemple #9
0
		protected ExporterPage InitNewPage ()
		{
			bool firstPage;
			this.ReportModel.ReportSettings.LeftMargin = this.reportModel.ReportSettings.LeftMargin;
			if (this.Pages.Count == 0) {
				firstPage = true;
			} else {
				firstPage = false;
			}
			SectionBounds sectionBounds  = new SectionBounds (this.reportModel.ReportSettings,firstPage);
			ExporterPage sp = ExporterPage.CreateInstance(sectionBounds,this.pages.Count + 1);
			return sp;
		}
Exemple #10
0
        public void MeasureReportFooterNoPageFooterCalculated()
        {
            SectionBounds sectionBounds = new SectionBounds(new ReportSettings(), true);
            BaseSection   baseSection   = new BaseSection();

            baseSection.Location = new Point(50, 50);
            baseSection.Size     = new Size(727, 60);
            sectionBounds.MeasureReportFooter(baseSection);
            Assert.AreEqual(baseSection.Size.Height, sectionBounds.ReportFooterRectangle.Size.Height);

            Assert.AreEqual(sectionBounds.MarginBounds.Width,
                            sectionBounds.ReportFooterRectangle.Width);
        }
Exemple #11
0
        public void MeasureReportHeaderForFirstPageWithEmptyItems()
        {
            SectionBounds sectionBounds = new SectionBounds(new ReportSettings(), true);
            BaseSection   baseSection   = new BaseSection();

            baseSection.Location = new Point(50, 50);
            baseSection.Size     = new Size(727, 60);
            sectionBounds.MeasureReportHeader(baseSection);
            Assert.AreEqual(0, sectionBounds.ReportHeaderRectangle.Size.Height,
                            "ItemsCollection is empty, so Size.Height should be '0'");

            Assert.AreEqual(sectionBounds.MarginBounds.Width,
                            sectionBounds.ReportHeaderRectangle.Width);
        }
Exemple #12
0
		public static bool IsRoomForFooter(SectionBounds sectionBounds,Point loc)
		{
			Rectangle r =  new Rectangle( sectionBounds.ReportFooterRectangle.Left,
			                             loc.Y,
			                             sectionBounds.ReportFooterRectangle.Width,
			                             sectionBounds.ReportFooterRectangle.Height);
			
			Rectangle s = new Rectangle (sectionBounds.ReportFooterRectangle.Left,
			                             loc.Y,
			                             
			                             sectionBounds.ReportFooterRectangle.Width,
			                             sectionBounds.PageFooterRectangle.Top - loc.Y -1);
			return s.Contains(r);
		}
Exemple #13
0
        public static bool IsRoomForFooter(SectionBounds sectionBounds, Point loc)
        {
            Rectangle r = new Rectangle(sectionBounds.ReportFooterRectangle.Left,
                                        loc.Y,
                                        sectionBounds.ReportFooterRectangle.Width,
                                        sectionBounds.ReportFooterRectangle.Height);

            Rectangle s = new Rectangle(sectionBounds.ReportFooterRectangle.Left,
                                        loc.Y,

                                        sectionBounds.ReportFooterRectangle.Width,
                                        sectionBounds.PageFooterRectangle.Top - loc.Y - 1);

            return(s.Contains(r));
        }
Exemple #14
0
        public void MeasureReportFooterPageFooterIsCalculated()
        {
            SectionBounds sectionBounds = new SectionBounds(new ReportSettings(), true);
            BaseSection   baseSection   = new BaseSection();

            baseSection.Location = new Point(50, 50);
            baseSection.Size     = new Size(727, 60);
            sectionBounds.MeasurePageFooter(baseSection);
            sectionBounds.MeasureReportFooter(baseSection);

            Assert.AreEqual(baseSection.Size.Height, sectionBounds.ReportFooterRectangle.Size.Height,
                            "ItemsCollection is empty, so Size.Height should be '0'");
            Assert.AreEqual(sectionBounds.MarginBounds.Width,
                            sectionBounds.ReportFooterRectangle.Width);
        }
Exemple #15
0
        public void CanReadMargins()
        {
            ReportSettings rs = new ReportSettings();

            rs.LeftMargin   = 20;
            rs.RightMargin  = 20;
            rs.TopMargin    = 20;
            rs.BottomMargin = 20;
            SectionBounds sb         = new SectionBounds(rs, false);
            SinglePage    singlePage = new SinglePage(sb, 15);

            Assert.AreEqual(20, sb.MarginBounds.Left);
            Assert.AreEqual(20, sb.MarginBounds.Top);
            Assert.AreEqual(827 - 40, sb.MarginBounds.Width);
            Assert.AreEqual(1169 - 40, sb.MarginBounds.Height);
        }
Exemple #16
0
        public void MeasurePageFooter()
        {
            var           setting       = new ReportSettings();
            SectionBounds sectionBounds = new SectionBounds(new ReportSettings(), true);
            BaseSection   baseSection   = new BaseSection();

            baseSection.Location = new Point(50, 50);
            baseSection.Size     = new Size(727, 60);
            sectionBounds.MeasurePageFooter(baseSection);
            Assert.AreEqual(baseSection.Size.Height,
                            sectionBounds.PageFooterRectangle.Size.Height);


            Assert.AreEqual(sectionBounds.MarginBounds.Width,
                            sectionBounds.PageFooterRectangle.Width);
            //int i = sectionBounds.PageSize.Height - setting.BottomMargin;
            //Assert.AreEqual(i,sectionBounds.PageFooterRectangle.Location.Y);
        }
Exemple #17
0
        protected ExporterPage InitNewPage()
        {
            bool firstPage;

            this.ReportModel.ReportSettings.LeftMargin = this.reportModel.ReportSettings.LeftMargin;
            if (this.Pages.Count == 0)
            {
                firstPage = true;
            }
            else
            {
                firstPage = false;
            }
            SectionBounds sectionBounds = new SectionBounds(this.reportModel.ReportSettings, firstPage);
            ExporterPage  sp            = ExporterPage.CreateInstance(sectionBounds, this.pages.Count + 1);

            return(sp);
        }
		public BaseConverter(IDataNavigator dataNavigator,ExporterPage singlePage,
		                     IExportItemsConverter exportItemsConverter,ILayouter layouter)
		{
			if (dataNavigator == null) {
				throw new ArgumentNullException("dataNavigator");
			}
			if (singlePage == null) {
				throw new ArgumentNullException("singlePage");
			}
			if (exportItemsConverter == null) {
				throw new ArgumentNullException("exportItemsConverter");
			}
			if (layouter == null) {
				throw new ArgumentNullException("layouter");
			}
			this.singlePage = singlePage;
			this.dataNavigator = dataNavigator;
			this.sectionBounds = this.singlePage.SectionBounds;
			this.exportItemsConverter = exportItemsConverter;
			this.layouter = layouter;
		}
        public void Calculate_Page_If_Firstpage()
        {
            Size         defSize = new Size(727, 60);
            IReportModel model   = ReportModel.Create();

            model.ReportHeader.Size     = defSize;
            model.ReportHeader.Location = new Point(50, 50);


            model.PageHeader.Size     = defSize;
            model.PageHeader.Location = new Point(50, 125);

            model.DetailSection.Size     = defSize;
            model.DetailSection.Location = new Point(50, 200);

            model.PageFooter.Size       = defSize;
            model.ReportFooter.Location = new Point(50, 275);

            model.ReportFooter.Size     = defSize;
            model.ReportFooter.Location = new Point(50, 350);

            var        s  = new SectionBounds(new ReportSettings(), true);
            SinglePage sp = new SinglePage(s, 0);

            sp.CalculatePageBounds(model);
            Console.WriteLine();
            Console.WriteLine("ReportHeader {0} - {1}", sp.SectionBounds.ReportHeaderRectangle, sp.SectionBounds.ReportHeaderRectangle.Location.Y + sp.SectionBounds.ReportHeaderRectangle.Height);
            Console.WriteLine("PageHeader {0} - {1}", sp.SectionBounds.PageHeaderRectangle, sp.SectionBounds.PageHeaderRectangle.Location.Y + sp.SectionBounds.PageHeaderRectangle.Height);
            Console.WriteLine("DetailSection {0} - {1} ", sp.SectionBounds.DetailSectionRectangle, sp.SectionBounds.DetailSectionRectangle.Location.Y + sp.SectionBounds.DetailSectionRectangle.Height);

            Console.WriteLine("\tDetailStart {0} ", sp.SectionBounds.DetailStart);
            Console.WriteLine("\tDetailEnd {0} ", sp.SectionBounds.DetailEnds);
            Console.WriteLine("\tDetailArea {0} ", sp.SectionBounds.DetailArea);
            Console.WriteLine("PageFooter {0} - {1} ", sp.SectionBounds.PageFooterRectangle, sp.SectionBounds.PageFooterRectangle.Location.Y + sp.SectionBounds.PageFooterRectangle.Height);
            Console.WriteLine("ReportFooter {0} - {1}", sp.SectionBounds.ReportFooterRectangle, sp.SectionBounds.ReportFooterRectangle.Location.Y + sp.SectionBounds.ReportFooterRectangle.Height);
            Console.WriteLine();
        }
		public void Calculate_Page_If_Firstpage ()
		{
			Size defSize = new Size (727,60);
			IReportModel model = ReportModel.Create();
			model.ReportHeader.Size = defSize;
			model.ReportHeader.Location = new Point(50,50);
			
			
			model.PageHeader.Size = defSize;
			model.PageHeader.Location = new Point(50,125);
			
			model.DetailSection.Size = defSize;
			model.DetailSection.Location = new Point(50,200);
			
			model.PageFooter.Size = defSize;
			model.ReportFooter.Location = new Point(50,275);
			
			model.ReportFooter.Size = defSize;
			model.ReportFooter.Location = new Point(50,350);
			
			var  s = new SectionBounds(new ReportSettings(),true);
			SinglePage sp = new SinglePage(s,0);
			
			sp.CalculatePageBounds(model);
			Console.WriteLine();
			Console.WriteLine("ReportHeader {0} - {1}",sp.SectionBounds.ReportHeaderRectangle,sp.SectionBounds.ReportHeaderRectangle.Location.Y + sp.SectionBounds.ReportHeaderRectangle.Height);
			Console.WriteLine("PageHeader {0} - {1}",sp.SectionBounds.PageHeaderRectangle,sp.SectionBounds.PageHeaderRectangle.Location.Y +sp.SectionBounds.PageHeaderRectangle.Height );
			Console.WriteLine("DetailSection {0} - {1} ",sp.SectionBounds.DetailSectionRectangle,sp.SectionBounds.DetailSectionRectangle.Location.Y + sp.SectionBounds.DetailSectionRectangle.Height);
			
			Console.WriteLine("\tDetailStart {0} ",sp.SectionBounds.DetailStart);
			Console.WriteLine("\tDetailEnd {0} ",sp.SectionBounds.DetailEnds);
			Console.WriteLine("\tDetailArea {0} ",sp.SectionBounds.DetailArea);
			Console.WriteLine("PageFooter {0} - {1} ",sp.SectionBounds.PageFooterRectangle,sp.SectionBounds.PageFooterRectangle.Location.Y + sp.SectionBounds.PageFooterRectangle.Height);
			Console.WriteLine("ReportFooter {0} - {1}",sp.SectionBounds.ReportFooterRectangle,sp.SectionBounds.ReportFooterRectangle.Location.Y + sp.SectionBounds.ReportFooterRectangle.Height);
	Console.WriteLine();
		}
Exemple #21
0
        protected void InitNewPage()
        {
            bool firstPage;

            if (this.Pages.Count == 0)
            {
                firstPage = true;
            }
            else
            {
                firstPage = false;
            }

            this.ReportModel.ReportSettings.LeftMargin = this.ReportModel.ReportSettings.LeftMargin;
            var sectionBounds = new SectionBounds(this.ReportModel.ReportSettings, firstPage);

            this.SinglePage = ExporterPage.CreateInstance(sectionBounds, this.pages.Count + 1);

            if (this.EvaluatorFacade == null)
            {
                EvaluatorFacade = EvaluationHelper.CreateEvaluator(SinglePage, SinglePage.IDataNavigator);
            }
            EvaluatorFacade.SinglePage = this.SinglePage;
        }
Exemple #22
0
		public static bool IsPageFull (Rectangle rectangle,SectionBounds bounds)
		{
			if (rectangle.Bottom > bounds.PageFooterRectangle.Top) {
				return true;
			}
			return false;
		}
Exemple #23
0
 private ExporterPage(SectionBounds sectionBounds, int pageNumber) : base(sectionBounds, pageNumber)
 {
 }
Exemple #24
0
        public void Can_Read_SectionBounds()
        {
            SectionBounds sb = new SectionBounds(new ReportSettings(), false);

            Assert.IsNotNull(sb);
        }
Exemple #25
0
        public void Init()
        {
            ReportSettings rs = new ReportSettings();

            this.sectionBounds = new SectionBounds(rs, false);
        }
 public NewPageEventArgs(ExporterCollection itemsList, SectionBounds sectionBounds)
 {
     this.itemsList = itemsList;
     SectionBounds  = sectionBounds;
 }
		private ExporterPage (SectionBounds sectionBounds,int pageNumber):base(sectionBounds,pageNumber)
		{	
		}
 public void Init()
 {
     this.sectionBounds = new SectionBounds(new ReportSettings(), false);
 }
		public void Init()
		{
			this.sectionBounds = new SectionBounds(new ReportSettings(),false);
		}