Example #1
0
        public void PageHeaderShouldContainOneItem()
        {
            ICSharpCode.Reports.Core.BaseSection section = this.createdReportModel.ReportHeader;
            ReportItemCollection c = section.Items;

            Assert.AreEqual(1, section.Items.Count);
            ICSharpCode.Reports.Core.BaseReportItem item = section.Items[0];
            Assert.IsNotNull(item);
        }
Example #2
0
        protected static void AdjustContainer(ISimpleContainer parent,
                                              ICSharpCode.Reports.Core.BaseReportItem item)
        {
            item.Size = new Size(parent.Size.Width - GlobalValues.ControlMargins.Left - GlobalValues.ControlMargins.Right,
                                 parent.Size.Height - GlobalValues.ControlMargins.Top - GlobalValues.ControlMargins.Bottom);

            item.Location = new Point(GlobalValues.ControlMargins.Left,
                                      GlobalValues.ControlMargins.Top);
            item.Parent = parent as BaseReportItem;
        }
		public void ReportItemFitInSection ()
		{
			MeasurementService s = new MeasurementService(this.graphics);
			Rectangle r = new Rectangle(section.Location,section.Size);
			this.section.Items.Clear();
			BaseReportItem item = new BaseReportItem();
			item.Location = new Point(10,10);
			item.Size = new Size(50,50);
			this.section.Items.Add(item);
				s.FitSectionToItems(this.section);
			Assert.AreEqual(r.Location,s.Rectangle.Location);
		}
		public  static void AdjustParent (BaseReportItem parent,ReportItemCollection items)
		{
			foreach (BaseReportItem i in items) {
				i.Parent = parent;
				ISimpleContainer ic = i as ISimpleContainer;
				if (ic != null) {
					AdjustParentInternal(ic.Items,i);
				} else {
					AdjustParentInternal(items,parent);
				}
			}
		}
		public static Rectangle DrawingAreaRelativeToParent (BaseReportItem parent,ISimpleContainer item)
		{
			if ( parent == null) {
				throw new ArgumentNullException("parent");
			}
			if (item == null) {
				throw new ArgumentNullException ("item");
			}
			BaseReportItem bri = (BaseReportItem) item;
			return new Rectangle(parent.Location.X + bri.Location.X ,
				                     bri.Location.Y + bri.SectionOffset,
				                     bri.Size.Width,bri.Size.Height);
			
		}
		public static IBaseRenderer  CreateRenderer (BaseReportItem itemToConvert,IDataNavigator dataNavigator,
		                                   ISinglePage singlePage,ILayouter layouter,BaseSection section)
		{

			Type t = itemToConvert.GetType();
			if (t.Equals(typeof(BaseTableItem))) {
				return new RenderTable(dataNavigator,Rectangle.Empty,singlePage,layouter,section);
			}
			
			if (t.Equals(typeof(BaseRowItem))) {
//				return new GroupedRowConverter (dataNavigator,singlePage,layouter);
//				Console.WriteLine("render Row");
			}
			return null;
		}
Example #7
0
        protected void AddItemsToContainer(ICSharpCode.Reports.Core.BaseSection section, ReportItemCollection items)
        {
            section.Items.Add(this.parentItem as BaseReportItem);
            ICSharpCode.Reports.Core.BaseReportItem bri = this.parentItem as ICSharpCode.Reports.Core.BaseReportItem;
            int defY   = bri.Location.Y + GlobalValues.ControlMargins.Top;
            int defX   = bri.Size.Width / items.Count;
            int startX = bri.Location.X + GlobalValues.ControlMargins.Left;

            foreach (var ir in items)
            {
                Point np = new Point(startX, defY);
                startX     += defX;
                ir.Location = np;
                this.parentItem.Items.Add(ir);
            }
        }
Example #8
0
		private void FixLayout (ICSharpCode.Reports.Core.BaseSection section,
		                        BaseReportItem item,GlobalEnums.ItemsLayout layout)
		{
			item.Size = new Size (GlobalValues.PreferedSize.Width,GlobalValues.PreferedSize.Height);
			Point p =Point.Empty;
			
			switch (layout) {
				case GlobalEnums.ItemsLayout.Left:
					p = new Point (this.ReportModel.ReportSettings.LeftMargin,
					               GlobalValues.ControlMargins.Top);
					break;
				case GlobalEnums.ItemsLayout.Center:
					p = new Point((section.Size.Width / 2) - (item.Size.Width /2),
					              GlobalValues.ControlMargins.Top);
					break;
				case GlobalEnums.ItemsLayout.Right:
					p = new Point(section.Size.Width  - item.Size.Width - GlobalValues.ControlMargins.Right,
					              GlobalValues.ControlMargins.Top);
					break;
				default:
					break;
			}
			item.Location = p;
		}
		public void RenderTable (BaseReportItem parent,SectionBounds sectionBounds,ReportPageEventArgs rpea,ILayouter layouter)
		{
			
			this.sectionBounds = sectionBounds;
			this.Parent = parent;
			this.layouter = layouter;
			this.Render (rpea);
		}
Example #10
0
        protected void RenderTable(BaseReportItem parent, ITableContainer tableContainer, ReportPageEventArgs rpea)
        {
            if (rpea == null)
            {
                throw new ArgumentNullException("rpea");
            }

            Point saveLocation = tableContainer.Location;

            Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.CurrentSection, tableContainer).Location.X,
                                              this.CurrentSection.Location.Y);

            tableContainer.Items.SortByLocation();

            Size rs = Size.Empty;

            foreach (BaseRowItem row in tableContainer.Items)
            {
                if (row != null)
                {
                    rs = row.Size;
                    PrintHelper.AdjustParent(tableContainer, tableContainer.Items);

                    if (PrintHelper.IsTextOnlyRow(row))
                    {
                        LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics, base.Layout, row);

                        Rectangle r = StandardPrinter.RenderContainer(row, Evaluator, currentPosition, rpea);


                        currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);

                        tableContainer.Location = saveLocation;
                    }
                    else
                    {
                        int adjust = row.Location.Y - saveLocation.Y;
                        row.Location = new Point(row.Location.X, row.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer);
                        rs           = row.Size;

                        do
                        {
                            if (PrintHelper.IsPageFull(new Rectangle(currentPosition, row.Size), this.SectionBounds))
                            {
                                tableContainer.Location = saveLocation;
                                AbstractRenderer.PageBreak(rpea);
                                return;
                            }

                            this.dataNavigator.Fill(row.Items);

                            LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics, base.Layout, row);

                            Rectangle r = StandardPrinter.RenderContainer(row, Evaluator, currentPosition, rpea);

                            currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);

                            row.Size = rs;
                        }while (this.dataNavigator.MoveNext());
                    }
                }
                row.Size = rs;
            }
//			base.NotifyAfterPrint (rpea.LocationAfterDraw);
        }
		protected void RenderTable (BaseReportItem parent,ITableContainer tableContainer,ReportPageEventArgs rpea)
		{
			if (rpea == null) {
				throw new ArgumentNullException("rpea");
			}

			Point saveLocation = tableContainer.Location;
			
			Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.CurrentSection,tableContainer).Location.X,
			                                                                           this.CurrentSection.Location.Y);
			tableContainer.Items.SortByLocation();
			
			Size rs = Size.Empty;
			
			foreach (BaseRowItem row in tableContainer.Items)
			{
			
				if (row != null)
				{
					rs = row.Size;
					PrintHelper.AdjustParent(tableContainer,tableContainer.Items);
					
					if (PrintHelper.IsTextOnlyRow(row) )
					{
						
						LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics,base.Layout,row);
						
						Rectangle r =  StandardPrinter.RenderContainer(row,Evaluator,currentPosition,rpea);
						
						
						currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);
					
						tableContainer.Location = saveLocation;
					}
					else {
						int adjust = row.Location.Y - saveLocation.Y;
						row.Location = new Point(row.Location.X,row.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer);
						rs = row.Size;
						
						do {
							if (PrintHelper.IsPageFull(new Rectangle(currentPosition,row.Size),this.SectionBounds)) {
								tableContainer.Location = saveLocation;
								AbstractRenderer.PageBreak(rpea);
								return;
							}
							
							this.dataNavigator.Fill(row.Items);
							
							LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics,base.Layout,row);
							
							Rectangle r =  StandardPrinter.RenderContainer(row,Evaluator,currentPosition,rpea);
							
							currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);

							row.Size = rs;
						}
						while (this.dataNavigator.MoveNext());
						
					}
				}
				row.Size = rs;
			}
//			base.NotifyAfterPrint (rpea.LocationAfterDraw);
		}
Example #12
0
		protected static ICSharpCode.Reports.Core.BaseRowItem CreateRowWithTextColumns(BaseReportItem parent,ReportItemCollection items)
		{
			ReportItemCollection colDetail = AbstractLayout.HeaderColumnsFromReportItems(items);
			
			ICSharpCode.Reports.Core.BaseRowItem row = new ICSharpCode.Reports.Core.BaseRowItem();
			AdjustContainer(parent,row);
			
			int defY = parent.Location.Y + GlobalValues.ControlMargins.Top;
			int defX = row.Size.Width / colDetail.Count;
			int startX = parent.Location.X + GlobalValues.ControlMargins.Left;
			foreach (ICSharpCode.Reports.Core.BaseTextItem ir in colDetail) {
				Point np = new Point(startX,defY);
				startX += defX;
				ir.Location = np;
				ir.Parent = row;
				row.Items.Add(ir);
			}
			return row;
		}
Example #13
0
		private static void AdjustParentInternal (ReportItemCollection items,BaseReportItem parent)
		{
			foreach(BaseReportItem item in items) {
				item.Parent = parent;
			}
		}