public static void AdjustBackColor (ISimpleContainer container)
		{
			foreach (var item in container.Items)
			{
				item.BackColor = container.BackColor;
			}
		}
        public override ExporterCollection Convert(BaseReportItem parent, BaseReportItem item)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            ISimpleContainer simpleContainer = item as ISimpleContainer;

            this.parent = parent;

            simpleContainer.Parent = parent;

            PrintHelper.AdjustParent(parent as ISimpleContainer, simpleContainer.Items);
            if (PrintHelper.IsTextOnlyRow(simpleContainer))
            {
                ExporterCollection myList = new ExporterCollection();

                ConvertContainer(myList, simpleContainer, parent.Location.X,
                                 new Point(base.SectionBounds.DetailArea.X, base.SectionBounds.DetailArea.Y));

                return(myList);
            }
            else
            {
                return(this.ConvertDataRow(simpleContainer));
            }
        }
Beispiel #3
0
        public Rectangle Layout(Graphics graphics, ISimpleContainer container)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            if (container.Items == null)
            {
                return(Rectangle.Empty);
            }

            Rectangle desiredContainerRectangle = new Rectangle(container.Location, container.Size);

            System.Collections.Generic.IEnumerable <BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;

            if (canGrowShrinkCollection.Count() > 0)
            {
                Rectangle surroundingRec = FindSurroundingRectangle(graphics, canGrowShrinkCollection);
                desiredContainerRectangle = new Rectangle(container.Location.X,
                                                          container.Location.Y,
                                                          container.Size.Width,
                                                          surroundingRec.Size.Height);
            }
            return(desiredContainerRectangle);
        }
Beispiel #4
0
        public Rectangle Layout(Graphics graphics, ISimpleContainer container)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            BaseReportItem containerItem = container as BaseReportItem;
//			container.Items.SortByLocation();
            Rectangle desiredContainerRectangle = new Rectangle(containerItem.Location, containerItem.Size);

            System.Collections.Generic.IEnumerable <BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;

            if (canGrowShrinkCollection.Count() > 0)
            {
                int       extend         = containerItem.Size.Height - canGrowShrinkCollection.First().Size.Height;
                Rectangle surroundingRec = FindSurroundingRectangle(graphics, canGrowShrinkCollection);

                if (surroundingRec.Height > desiredContainerRectangle.Height)
                {
                    desiredContainerRectangle = new Rectangle(containerItem.Location.X,
                                                              containerItem.Location.Y,
                                                              containerItem.Size.Width,
                                                              surroundingRec.Size.Height + extend);
                }
            }

            return(desiredContainerRectangle);
        }
Beispiel #5
0
 public static void AdjustBackColor(ISimpleContainer container)
 {
     foreach (var item in container.Items)
     {
         item.BackColor = container.BackColor;
     }
 }
Beispiel #6
0
		public Rectangle Layout(Graphics graphics,ISimpleContainer container)
		{
			if (graphics == null) {
				throw new ArgumentNullException("graphics");
			}
			if (container == null) {
				throw new ArgumentNullException("container");
			}
			
			if (container.Items == null)
			{
				return Rectangle.Empty;
			}
			
			Rectangle desiredContainerRectangle = new Rectangle (container.Location,container.Size);
			
			System.Collections.Generic.IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;
			
			if (canGrowShrinkCollection.Count() > 0 ) {
				Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection);
				desiredContainerRectangle = new Rectangle(container.Location.X,
				                                          container.Location.Y,
				                                          container.Size.Width,
				                                          surroundingRec.Size.Height);
				
			}
			return desiredContainerRectangle;
		}
Beispiel #7
0
		public static void SetLayoutForRow (Graphics graphics, ILayouter layouter,ISimpleContainer row)
		{
			Rectangle textRect = layouter.Layout(graphics,row);
			if (textRect.Height > row.Size.Height) {
				row.Size = new Size(row.Size.Width,textRect.Height);
			}
		}
Beispiel #8
0
        public static ExportContainer ConvertToContainer(ISimpleContainer container, Point offset)
        {
            if (container == null)
            {
                throw new ArgumentNullException("item");
            }

            PrintHelper.AdjustParent(container, container.Items);
            IExportColumnBuilder lineBuilder = container as IExportColumnBuilder;

            if (lineBuilder != null)
            {
                ExportContainer lineItem = (ExportContainer)lineBuilder.CreateExportColumn();

                lineItem.StyleDecorator.Location = new Point(offset.X + lineItem.StyleDecorator.Location.X,
                                                             offset.Y);

                lineItem.StyleDecorator.DisplayRectangle = new Rectangle(lineItem.StyleDecorator.Location,
                                                                         lineItem.StyleDecorator.Size);

                StandardPrinter.AdjustBackColor(container);
                return(lineItem);
            }

            return(null);
        }
Beispiel #9
0
        public static Point ConvertContainer(ExporterCollection myList, ISimpleContainer container, int leftPos, Point curPos)
        {
            ExporterCollection ml = BaseConverter.ConvertItems(container, curPos);

            myList.AddRange(ml);
            return(new Point(leftPos, curPos.Y + container.Size.Height));
        }
Beispiel #10
0
        protected Point RenderItems(ReportPageEventArgs rpea)
        {
            base.SinglePage.IDataNavigator = this.dataNavigator;
            base.CurrentRow = this.dataNavigator.CurrentRow;
            ISimpleContainer container    = null;
            bool             hasContainer = false;

            foreach (BaseReportItem item in this.CurrentSection.Items)
            {
                container = item as ISimpleContainer;
                if (container != null)
                {
                    hasContainer = true;
                    break;
                }
            }
            if (hasContainer)
            {
                return(DoContainerControl(this.CurrentSection, container, rpea));
            }
            else
            {
                return(base.RenderSection(rpea));
            }
        }
Beispiel #11
0
        protected ExporterCollection ConvertItems(ISimpleContainer row, Point offset)
        {
            IExportColumnBuilder exportLineBuilder = row as IExportColumnBuilder;

            if (exportLineBuilder != null)
            {
                ExportContainer lineItem       = this.exportItemsConverter.ConvertToContainer(offset, row);
                BaseReportItem  baseReportItem = row as BaseReportItem;

                this.exportItemsConverter.ParentRectangle = new Rectangle(baseReportItem.Location, baseReportItem.Size);
                if (baseReportItem.BackColor != GlobalValues.DefaultBackColor)
                {
                    foreach (BaseReportItem i in row.Items)
                    {
                        i.BackColor = baseReportItem.BackColor;
                    }
                }

                ExporterCollection list = this.exportItemsConverter.ConvertSimpleItems(offset, row.Items);

                lineItem.Items.AddRange(list);

                ExporterCollection containerList = new ExporterCollection();
                containerList.Add(lineItem);
                return(containerList);
            }
            return(null);
        }
Beispiel #12
0
		public Rectangle Layout(Graphics graphics,ISimpleContainer container)
		{
			if (graphics == null) {
				throw new ArgumentNullException("graphics");
			}
			
			if (container == null) {
				throw new ArgumentNullException("container");
			}
			
			BaseReportItem containerItem = container as BaseReportItem;
//			container.Items.SortByLocation();
			Rectangle desiredContainerRectangle = new Rectangle (containerItem.Location,containerItem.Size);
			
			System.Collections.Generic.IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;
			
			if (canGrowShrinkCollection.Count() > 0 ) {
				int extend = containerItem.Size.Height - canGrowShrinkCollection.First().Size.Height;
				Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection);
				
				if (surroundingRec.Height > desiredContainerRectangle.Height) {
					desiredContainerRectangle = new Rectangle(containerItem.Location.X,
					                                          containerItem  .Location.Y,
					                                          containerItem .Size.Width,
					                                          surroundingRec.Size.Height + extend);
				}
			}
			
			return desiredContainerRectangle;
		}
		protected  ExporterCollection ConvertItems (ISimpleContainer row,Point offset)		                                          
		{

			IExportColumnBuilder exportLineBuilder = row as IExportColumnBuilder;

			if (exportLineBuilder != null) {

				ExportContainer lineItem = this.exportItemsConverter.ConvertToContainer(offset,row);
				BaseReportItem baseReportItem = row as BaseReportItem;

				this.exportItemsConverter.ParentRectangle = new Rectangle(baseReportItem.Location,baseReportItem.Size);
				if (baseReportItem.BackColor != GlobalValues.DefaultBackColor) {
					foreach (BaseReportItem i in row.Items) {
						i.BackColor = baseReportItem.BackColor;
					}
				}
				
				ExporterCollection list = this.exportItemsConverter.ConvertSimpleItems(offset,row.Items);
					
				lineItem.Items.AddRange(list);
				
				ExporterCollection containerList = new ExporterCollection();
				containerList.Add (lineItem);
				return containerList;
			}
			return null;
		}
Beispiel #14
0
 private static void AdjustParentInternal(ReportItemCollection items, ISimpleContainer parent)
 {
     foreach (BaseReportItem item in items)
     {
         item.Parent = parent as BaseReportItem;
     }
 }
        public MainWindow(ISimpleContainer container)
        {
            InitializeComponent();
            if (container == null)
            {
                container = new SimpleContainer();
            }

            _config    = container.GetConfiguration();
            _timer     = container.GetTimerClockUserControl(Dispatcher);
            _stopwatch = container.GetStopwatchClockUserControl(Dispatcher);

            DataContext = _timer;
            TimerContentCtrl.Content     = _timer;
            StopwatchContentCtrl.Content = _stopwatch;

            RoutedCommand tabRightHotKeyCommand = new RoutedCommand();

            tabRightHotKeyCommand.InputGestures.Add(new KeyGesture(Key.Right, ModifierKeys.Alt));
            CommandBindings.Add(new CommandBinding(tabRightHotKeyCommand, TabRightHotKey));

            RoutedCommand tabLeftHotKeyCommand = new RoutedCommand();

            tabLeftHotKeyCommand.InputGestures.Add(new KeyGesture(Key.Left, ModifierKeys.Alt));
            CommandBindings.Add(new CommandBinding(tabLeftHotKeyCommand, TabLeftHotKey));

            RoutedCommand enterHotKeyCommand = new RoutedCommand();

            enterHotKeyCommand.InputGestures.Add(new KeyGesture(Key.Enter, ModifierKeys.Shift));
            CommandBindings.Add(new CommandBinding(enterHotKeyCommand, ShiftEnterHotKey));

            RegisterEvents();
        }
        public static ISimpleContainer RegisterMethod <T>(this ISimpleContainer container, Func <ISimpleContainer, T> method)
        {
            var key          = new TypeRegistrationKey(typeof(T), null);
            var registration = new TypeRegistration(key, typeof(T), new SingletonLifetime(), c => method.Invoke(c));

            return(container.Register(registration));
        }
Beispiel #17
0
        protected void PrepareContainerForConverting(BaseSection section, ISimpleContainer simpleContainer)
        {
            Console.WriteLine("\tPrepareContainerForConverting");

            FireSectionRendering(section);
            LayoutRow(simpleContainer);
        }
        public static ISimpleContainer Register(this ISimpleContainer container, Type from, Type mapTo, string name, ILifetime lifetime)
        {
            var key = new TypeRegistrationKey(from, name);

            container.Register(new TypeRegistration(key, mapTo, lifetime));
            return(container);
        }
Beispiel #19
0
 private void RegisterEssentialServices(ISimpleContainer container)
 {
     container
     .RegisterInstance <IServiceProvider>(container)
     .RegisterSingleton <ILogManager, LogManager>()
     .RegisterMethod(this.CreateHttpServer)
     .RegisterMethod(this.CreateHttpHandler);
 }
Beispiel #20
0
        protected Point BaseConvert(ExporterCollection myList, ISimpleContainer container, int leftPos, Point curPos)
        {
            container.Location = new Point(leftPos, container.Location.Y);
            ExporterCollection ml = this.ConvertItems(container, curPos);

            myList.AddRange(ml);
            return(new Point(leftPos, curPos.Y + container.Size.Height + (3 * GlobalValues.GapBetweenContainer)));
        }
Beispiel #21
0
        private Point RenderSectionWithSimpleContainer(BaseSection section,
                                                       ISimpleContainer container,
                                                       Point offset,
                                                       ReportPageEventArgs rpea)

        {
            Point currentPosition = new Point(section.Location.X + container.Location.X, offset.Y);

//			if (section.VisibleInReport)
//			{

            //Always set section.size to it's original value

            section.Size = this.SectionBounds.DetailSectionRectangle.Size;

            Size containerSize = new Size(section.Items[0].Size.Width, section.Items[0].Size.Height);

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

            section.Render(rpea);

            PrintHelper.AdjustParent(section, section.Items);

            foreach (BaseReportItem item in section.Items)
            {
                ISimpleContainer con = item as ISimpleContainer;
                if (con != null)
                {
                    Rectangle r = StandardPrinter.RenderContainer(container, Evaluator, offset, rpea);
                    currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);
                }

                else
                {
                    item.SectionOffset = section.SectionOffset;
                    Point saveLocation = item.Location;
                    item.Render(rpea);

                    item.Location = saveLocation;

                    ISimpleContainer cont = item as ISimpleContainer;

                    Rectangle r = StandardPrinter.RenderContainer(cont, Evaluator, currentPosition, rpea);
                    currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);

                    item.Location = saveLocation;

                    rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, section.SectionOffset + section.Size.Height);
                }

                section.Items[0].Size = containerSize;
                return(currentPosition);
            }

            return(currentPosition);
//			}
//			return currentPosition;
        }
Beispiel #22
0
        public Management()
        {
            services = new SimpleContainer();
            services.Register <ManagementQuery>();
            services.Singleton(new ManagementSchema(new FuncDependencyResolver(services.Get)));
            schema = services.Get <ManagementSchema>();

            executer = new DocumentExecuter(new GraphQLDocumentBuilder(), new DocumentValidator(), new ComplexityAnalyzer());
        }
		private static bool CheckPageBreakAfterGroupChange(ISimpleContainer container)
		{
            var groupedRows = container.Items.FindGroupHeader();
			if (groupedRows.Count > 0) {
				var groupedRow = groupedRows[0];
				return groupedRow.PageBreakOnGroupChange;
			}
			return false;
		}
		protected void FireRowRendering (ISimpleContainer detailRow,IDataNavigator currentNavigator)
		{
			BaseRowItem row = detailRow as BaseRowItem;
			if (row == null) {
				throw new ArgumentException("row");
			}
			RowRenderEventArgs rrea = new RowRenderEventArgs(row,currentNavigator.Current);
			EventHelper.Raise<RowRenderEventArgs>(RowRendering,this,rrea);
		}
		public static void SetLayoutForRow (Graphics graphics, ILayouter layouter,ISimpleContainer row)
		{
			BaseReportItem item = row as BaseReportItem;
			int extend = item.Size.Height - row.Items[0].Size.Height;
			Rectangle textRect = layouter.Layout(graphics,row);
			if (textRect.Height > item.Size.Height) {
				item.Size = new Size(item.Size.Width,textRect.Height + extend );
			}
		}
		public static void AdjustBackColor (ISimpleContainer container, Color defaultColor)
		{
			if (container.BackColor != defaultColor) {
				foreach (var item in container.Items)
				{
					item.BackColor = defaultColor;
				}
			}
		}
Beispiel #27
0
        public static void SetLayoutForRow(Graphics graphics, ILayouter layouter, ISimpleContainer row)
        {
            Rectangle textRect = layouter.Layout(graphics, row);

            if (textRect.Height > row.Size.Height)
            {
                row.Size = new Size(row.Size.Width, textRect.Height + 5);
            }
        }
Beispiel #28
0
		protected void FireRowRendering (ISimpleContainer detailRow,IDataNavigator currentNavigator)
		{
			BaseRowItem row = detailRow as BaseRowItem;
			if (row == null) {
				throw new ArgumentException("row");
			}
			RowRenderEventArgs rrea = new RowRenderEventArgs(row,currentNavigator.Current);
			EventHelper.Raise<RowRenderEventArgs>(RowRendering,this,rrea);
		}
Beispiel #29
0
        private static void AdjustBackColor(ISimpleContainer container)
        {
            BaseReportItem parent = container as BaseReportItem;

            foreach (BaseReportItem item in container.Items)
            {
                item.BackColor = parent.BackColor;
            }
        }
Beispiel #30
0
        protected ExporterCollection ConvertSection(BaseSection section, int dataRow)
        {
//			bool debugItemadded = false;

            FireSectionRenderEvent(section, dataRow);

            PrintHelper.AdjustParent((BaseSection)section, section.Items);

            ExporterCollection list = new ExporterCollection();

            if (section.DrawBorder == true)
            {
                section.Items.Insert(0, CreateDebugItem(section));
//				debugItemadded = true;
            }

            if (section.Items.Count > 0)
            {
                Point offset = new Point(section.Location.X, section.SectionOffset);
                foreach (IReportItem item in section.Items)
                {
                    ISimpleContainer container = item as ISimpleContainer;
                    if (container != null)
                    {
                        ExportContainer exportContainer = this.exportItemsConverter.ConvertToContainer(offset, container);

                        AdjustBackColor(container);

                        ExporterCollection clist = this.exportItemsConverter.ConvertSimpleItems(offset, container.Items);
                        exportContainer.Items.AddRange(clist);
                        list.Add(exportContainer);
                    }
                    else
                    {
                        this.exportItemsConverter.ParentRectangle = new Rectangle(section.Location, section.Size);

                        Rectangle desiredRectangle = layouter.Layout(this.graphics, section);
                        Rectangle sectionRectangle = new Rectangle(0, 0, section.Size.Width, section.Size.Height);

                        if (!sectionRectangle.Contains(desiredRectangle))
                        {
                            section.Size = new Size(section.Size.Width, desiredRectangle.Size.Height);
                        }

                        list = this.exportItemsConverter.ConvertSimpleItems(offset, section.Items);

//						if (debugItemadded) {
//							BaseExportColumn debugColumn = list[0];
//							debugColumn.StyleDecorator.Location = section.Location;
//							debugColumn.StyleDecorator.Size = section.Size;
//						}
                    }
                }
            }
            return(list);
        }
 public static ISimpleContainer AddMvc(this ISimpleContainer container)
 {
     if (container == null)
     {
         throw new ArgumentNullException(nameof(container));
     }
     container.RegisterSingleton <IActionDiscovery, AppDomainActionDiscovery>();
     container.RegisterSingleton <IRouter, MvcSimpleRouter>();
     return(container);
 }
Beispiel #32
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;
        }
Beispiel #33
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;
		}
Beispiel #34
0
        void CheckForPageBreak(BaseSection section, ISimpleContainer container, ISimpleContainer headerRow, ExporterCollection exporterCollection)
        {
            var pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)container, base.CurrentPosition);

            if (PrintHelper.IsPageFull(pageBreakRect, base.SectionBounds))
            {
                base.CurrentPosition = ForcePageBreak(exporterCollection, section);
                base.CurrentPosition = ConvertStandardRow(exporterCollection, headerRow);
            }
        }
Beispiel #35
0
 public static void AdjustBackColor(ISimpleContainer container, Color defaultColor)
 {
     if (container.BackColor != defaultColor)
     {
         foreach (var item in container.Items)
         {
             item.BackColor = defaultColor;
         }
     }
 }
		protected void ConvertGroupFooter (ISimpleContainer container,ExporterCollection exporterCollection)
		{
            var footers = container.Items.FindGroupFooter();
			if (footers.Count > 0) {				
				Size rowSize = footers[0].Size;
				CurrentPosition = ConvertStandardRow(exporterCollection,(ISimpleContainer)footers[0]);
				FireGroupFooterRendering(footers[0]);
				footers[0].Size = rowSize;
			}
		}
        public static ISimpleContainer RegisterInstance(this ISimpleContainer container, Type type, string name, object instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }
            var key = new TypeRegistrationKey(type, name);

            container.Register(new TypeRegistration(key, instance));
            return(container);
        }
Beispiel #38
0
        private static bool CheckPageBreakAfterGroupChange(ISimpleContainer container)
        {
            var groupedRows = BaseConverter.FindGroupHeader(container);

            if (groupedRows.Count > 0)
            {
                var groupedRow = groupedRows[0];
                return(groupedRow.PageBreakOnGroupChange);
            }
            return(false);
        }
Beispiel #39
0
        public static void SetLayoutForRow(Graphics graphics, ILayouter layouter, ISimpleContainer row)
        {
            BaseReportItem item     = row as BaseReportItem;
            int            extend   = item.Size.Height - row.Items[0].Size.Height;
            Rectangle      textRect = layouter.Layout(graphics, row);

            if (textRect.Height > item.Size.Height)
            {
                item.Size = new Size(item.Size.Width, textRect.Height + extend);
            }
        }
Beispiel #40
0
		public  static void AdjustParent (ISimpleContainer parent,ReportItemCollection items)
		{
			foreach (BaseReportItem item in items) {
				item.Parent = parent as BaseReportItem;
				ISimpleContainer container = item as ISimpleContainer;
				if (container != null) {
					AdjustParentInternal(container.Items,container);
				} else {
					AdjustParentInternal(items,parent as ISimpleContainer);
				}
			}
		}
        public GraphQLController()
        {
            _executer = new DocumentExecuter();

            _container = new SimpleContainer();
            _container.Singleton(new StarWarsData());
            _container.Register<StarWarsQuery>();
            _container.Register<HumanType>();
            _container.Register<DroidType>();
            _container.Register<CharacterInterface>();
            _container.Singleton(() => new StarWarsSchema(type => (GraphType) _container.Get(type)));

            _schema = _container.Get<StarWarsSchema>();
        }
		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 ExportContainer ConvertToContainer (Point offset,ISimpleContainer item) 
		{
			if (item == null) {
				throw new ArgumentNullException("item");
			}
			IExportColumnBuilder lineBuilder = item as IExportColumnBuilder;
	
			if (lineBuilder != null) {
				ExportContainer lineItem = (ExportContainer)lineBuilder.CreateExportColumn();

				lineItem.StyleDecorator.Location = new Point (lineItem.StyleDecorator.Location.X,
				                                              offset.Y);
				
				return lineItem;
			}
			return null;
		}
Beispiel #44
0
		public Rectangle Layout(Graphics graphics,ISimpleContainer container)
		{
			if (graphics == null) {
				throw new ArgumentNullException("graphics");
			}
			
			if (container == null) {
				throw new ArgumentNullException("container");
			}
			
			
			if (container.Items == null)
			{
				return Rectangle.Empty;
			}
			
//			Console.WriteLine("\tlayouter for container <{0}>",container.ToString());
			Console.WriteLine("\tLayouter for Container");
			Rectangle desiredContainerRectangle = new Rectangle (container.Location,container.Size);
			
			System.Collections.Generic.IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;
			
			if (canGrowShrinkCollection.Count() > 0 ) {
				Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection);
//				desiredContainerRectangle = new Rectangle(container.Location.X,
//				                                          container.Location.Y,
//				                                          container.Size.Width,
//				                                          surroundingRec.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
//			
				desiredContainerRectangle = new Rectangle(container.Location.X,
				                                          container.Location.Y,
				                                          container.Size.Width,
				                                          surroundingRec.Size.Height);
				
//			var r1 = new Rectangle(container.Location.X,
//				                                          container.Location.Y,
//				                                          container.Size.Width,
//				                                          surroundingRec.Size.Height);
//				                                       
//				Console.WriteLine("Diff {0} - {1} dif  {2}",desiredContainerRectangle,r1,desiredContainerRectangle.Height - r1.Height);
			}
//			Console.WriteLine("\tContainer : {0} - DesiredContainerRectangle {1} ",container.Size,desiredContainerRectangle.Size);
			return desiredContainerRectangle;
		}
		private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer)
		{
			ExporterCollection mylist = new ExporterCollection();
			Point currentPosition = new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y);
			BaseSection section = parent as BaseSection;
			
			int defaultLeftPos = parent.Location.X;
			
			do {
				section.Location = new Point(section.Location.X,section.SectionOffset );
				section.Size = this.SectionBounds.DetailSectionRectangle.Size;
				base.SaveSize(section.Items[0].Size);
				
				base.FillAndLayoutRow(simpleContainer);
				base.FireSectionRendering(section);
				currentPosition = base.BaseConvert(mylist,simpleContainer,defaultLeftPos,currentPosition);
				
				section.Items[0].Size = base.RestoreSize;
				section.SectionOffset += section.Size.Height + 2 * base.SinglePage.SectionBounds.Gap;

				
				if (PrintHelper.IsPageFull(new Rectangle(new Point (simpleContainer.Location.X,currentPosition.Y), section.Size),base.SectionBounds)) {
					base.FirePageFull(mylist);
					section.SectionOffset = base.SinglePage.SectionBounds.PageHeaderRectangle.Location.Y;
					currentPosition = new Point(base.SectionBounds.PageHeaderRectangle.X,base.SectionBounds.PageHeaderRectangle.Y);
					mylist.Clear();
				}
				
				if (section.DrawBorder == true) {
					BaseRectangleItem br = BasePager.CreateDebugItem (section);
					BaseExportColumn bec = br.CreateExportColumn();
					bec.StyleDecorator.Location = section.Location;
					mylist.Insert(0,bec);
				}
			}
			while (base.DataNavigator.MoveNext());
			
			SectionBounds.ReportFooterRectangle =  new Rectangle(SectionBounds.ReportFooterRectangle.Left,
			                                                     section.Location.Y + section.Size.Height,
			                                                     SectionBounds.ReportFooterRectangle.Width,
			                                                     SectionBounds.ReportFooterRectangle.Height);
			return mylist;
		}
		private  Point DoContainerControl (BaseSection section,
		                                   ISimpleContainer container,
		                                   ReportPageEventArgs rpea)
		{
			Point drawPoint	= Point.Empty;
			if (section.Visible){
				
				//Always set section.size to it's original value
				
				section.Size = this.SectionBounds.DetailSectionRectangle.Size;
				Size containerSize = new Size (section.Items[0].Size.Width,section.Items[0].Size.Height);
				ISimpleContainer row =(ISimpleContainer) section.Items[0];
				PrintHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics,base.Layout,row);
				section.Render (rpea);
				
				
				foreach (BaseReportItem item in section.Items) {
					if (item.Parent == null) {
						item.Parent = section;
					}
					item.SectionOffset = section.SectionOffset;
					item.Render(rpea);
					drawPoint = new Point(item.Location.X,
					                      section.SectionOffset + section.Size.Height);
					rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height);
					
				}
				section.Items[0].Size = containerSize;
				if ((section.CanGrow == false)&& (section.CanShrink == false)) {
					return new Point(section.Location.X,section.Size.Height);
				}
				section.Items[0].Size = containerSize;
				return drawPoint;
			}
			
			return drawPoint;
		}
		public static ExportContainer ConvertToContainer (ISimpleContainer container,Point offset) 
		{
			if (container == null) {
				throw new ArgumentNullException("item");
			}
			
			PrintHelper.AdjustParent(container,container.Items);
			IExportColumnBuilder lineBuilder = container as IExportColumnBuilder;
	
			if (lineBuilder != null) {
				ExportContainer lineItem = (ExportContainer)lineBuilder.CreateExportColumn();
				
				lineItem.StyleDecorator.Location = new Point (offset.X + lineItem.StyleDecorator.Location.X,
				                                              offset.Y);
				
				lineItem.StyleDecorator.DisplayRectangle = new Rectangle(lineItem.StyleDecorator.Location,
				                                                         lineItem.StyleDecorator.Size);
				
				StandardPrinter.AdjustBackColor (container);
				return lineItem;
			}
			
			return null;
		}
Beispiel #48
0
		protected void ConvertGroupFooter (ISimpleContainer container,ExporterCollection exporterCollection)
		{
            var footers = container.Items.FindGroupFooter();
			if (footers.Count > 0) {				
				Size rowSize = footers[0].Size;
				CurrentPosition = ConvertStandardRow(exporterCollection,(ISimpleContainer)footers[0]);
				FireGroupFooterRendering(footers[0]);
				footers[0].Size = rowSize;
			}
		}
Beispiel #49
0
		protected	void PrepareContainerForConverting(BaseSection section,ISimpleContainer simpleContainer)
		{
			Console.WriteLine("PrepareContainerForConverting");
			FireSectionRendering(section);
			LayoutHelper.SetLayoutForRow(Graphics,Layouter,simpleContainer);
		}
		private ExporterCollection ConvertDataRow (ISimpleContainer simpleContainer)
		{
			ExporterCollection exporterCollection = new ExporterCollection();
			base.CurrentPosition = base.SectionBounds.Offset;
			var p = base.CurrentPosition;
			BaseSection section = parent as BaseSection;
			
			DefaultLeftPosition = parent.Location.X;
			Size groupSize = Size.Empty;
			Size childSize = Size.Empty;

            if (section.Items.FindGroupHeader().Count > 0)
			{
				groupSize = section.Items[0].Size;
				childSize  = section.Items[1].Size;
			}

			do {            	
				base.SaveSectionSize(section.Size);
				PrintHelper.AdjustSectionLocation (section);
				section.Size = this.SectionBounds.DetailSectionRectangle.Size;
				
				// did we have GroupedItems at all
                if (section.Items.FindGroupHeader().Count > 0)
				{
					// GetType child navigator
					IDataNavigator childNavigator = base.DataNavigator.GetChildNavigator;
					
					base.Evaluator.SinglePage.IDataNavigator = childNavigator;
					base.CurrentPosition = ConvertGroupHeader(exporterCollection,section,base.CurrentPosition);
					section.Size = base.RestoreSectionSize;
					section.Items[0].Size = groupSize;
					section.Items[1].Size = childSize;
					
					childNavigator.Reset();
					childNavigator.MoveNext();
					
					//Convert children
					if (childNavigator != null) {
						StandardPrinter.AdjustBackColor(simpleContainer);
						do
						{							                  
							section.Size = base.RestoreSectionSize;
							section.Items[0].Size = groupSize;
							section.Items[1].Size = childSize;
						
							FillRow(simpleContainer,childNavigator);
							FireRowRendering(simpleContainer,childNavigator);
							PrepareContainerForConverting(section,simpleContainer);
							base.CurrentPosition = ConvertStandardRow(exporterCollection,simpleContainer);
							CheckForPageBreak(section,exporterCollection);
						}
						while ( childNavigator.MoveNext());

						// GroupFooter
						base.ConvertGroupFooter(section,exporterCollection);
						
						base.PageBreakAfterGroupChange(section,exporterCollection);
						
						base.Evaluator.SinglePage.IDataNavigator = base.DataNavigator;
					}
				}
				else
				{
					// No Grouping at all, the first item in section.items is the DetailRow
					Size containerSize = section.Items[0].Size;
					FillRow(simpleContainer,base.DataNavigator);
					FireRowRendering(simpleContainer,base.DataNavigator);
					Console.WriteLine("ConvertDazaRow");
					base.PrepareContainerForConverting(section,simpleContainer);
					base.CurrentPosition = ConvertStandardRow (exporterCollection,simpleContainer);
					section.Size = base.RestoreSectionSize;
					section.Items[0].Size = containerSize;
				}
				CheckForPageBreak (section,exporterCollection);
				ShouldDrawBorder (section,exporterCollection);
			}
			while (base.DataNavigator.MoveNext());
			
			SectionBounds.ReportFooterRectangle =  new Rectangle(SectionBounds.ReportFooterRectangle.Left,
			                                                     section.Location.Y + section.Size.Height,
			                                                     SectionBounds.ReportFooterRectangle.Width,
			                                                     SectionBounds.ReportFooterRectangle.Height);
		
			return exporterCollection;
		}
Beispiel #51
0
		protected  Point ConvertStandardRow(ExporterCollection mylist,ISimpleContainer simpleContainer)
		{
			Console.WriteLine("ConvertStandardRow");
			var rowSize = simpleContainer.Size;
			
			Point curPos = new Point(DefaultLeftPosition, CurrentPosition.Y);
			ExporterCollection ml = BaseConverter.ConvertItems (simpleContainer, curPos);
			EvaluationHelper.EvaluateRow(Evaluator,ml);
			
			mylist.AddRange(ml);
		
			curPos = new Point (DefaultLeftPosition,CurrentPosition.Y + simpleContainer.Size.Height + 2 * GlobalValues.GapBetweenContainer);
			simpleContainer.Size = rowSize;
			return curPos;
			
		}
Beispiel #52
0
		public static bool IsTextOnlyRow (ISimpleContainer item)
		{
			var res =  from r in item.Items where r is BaseDataItem
				select ((BaseTextItem)r);
			if (res.Count() > 0) {
				return false;	
			}
			else {
				return true;
			}
		}
Beispiel #53
0
		private Size CalculateContainerSize(ISimpleContainer container)
		{
			int h = GlobalValues.ControlMargins.Top;
			
			foreach (ICSharpCode.Reports.Core.BaseReportItem item  in container.Items)
			{
				h = h + item.Size.Height + GlobalValues.ControlMargins.Bottom;
			}
			h 	= h + 3*GlobalValues.ControlMargins.Bottom;
			
			return new Size (container.Size.Width,h);
		}
Beispiel #54
0
		public static Point ConvertContainer(ExporterCollection myList,ISimpleContainer container,int leftPos,Point curPos)
		{
			ExporterCollection ml = BaseConverter.ConvertItems (container, curPos);		
			myList.AddRange(ml);
			return new Point (leftPos,curPos.Y + container.Size.Height);
		}
Beispiel #55
0
		private static void AdjustParentInternal (ReportItemCollection items,ISimpleContainer parent)
		{
			foreach(BaseReportItem item in items) {
				item.Parent = parent as BaseReportItem;
			}
		}
Beispiel #56
0
		protected static  void FillRow (ISimpleContainer row,IDataNavigator currentNavigator)
		{
			currentNavigator.Fill(row.Items);
		}
Beispiel #57
0
		protected  static ExporterCollection ConvertItems (ISimpleContainer row,Point offset)		                                          
		{

			IExportColumnBuilder exportLineBuilder = row as IExportColumnBuilder;

			if (exportLineBuilder != null) {
				ExportContainer exportContainer = ExportHelper.ConvertToContainer(row,offset);
				ExporterCollection list = ExportHelper.ConvertPlainCollection(row.Items,exportContainer.StyleDecorator.Location);
				exportContainer.Items.AddRange(list);
				ExporterCollection containerList = new ExporterCollection();
				containerList.Add (exportContainer);
				return containerList;
			}
			return null;
		}
Beispiel #58
0
		public void old_Render (ISimpleContainer table,ReportPageEventArgs rpea,IExpressionEvaluatorFacade evaluator)
		{
			if (this.dataNavigator.CurrentRow < 0 ) {
				this.dataNavigator.MoveNext();
			}
			this.reportPageEventArgs = rpea;
			Point saveLocation = table.Location;
			Rectangle pageBreakRect = Rectangle.Empty;
			
			Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.currentSection,table).Location.X,
			                                  this.currentSection.Location.Y);
			table.Items.SortByLocation();
			
			Size rs = Size.Empty;
			
			
			
			
			foreach (BaseRowItem row in table.Items)
			{
				rs = row.Size;
				PrintHelper.AdjustParent(table as BaseReportItem,table.Items);
				
				if (PrintHelper.IsTextOnlyRow(row) )
				{
					
					PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics,Layouter,row);
					
					Rectangle r =  StandardPrinter.RenderContainer(row,evaluator,currentPosition,ReportPageEventArgs);
					
					currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);
					
					table.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 {
						
						pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)table,currentPosition);
						
						if (PrintHelper.IsPageFull(parentRectangle,this.SectionBounds)) {
							Console.WriteLine("PageBreak - PageFull");
							table.Location = saveLocation;
							AbstractRenderer.PageBreak(ReportPageEventArgs);
							return;
						}
						
						this.dataNavigator.Fill(row.Items);
						
						PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics,Layouter,row);
						
						Rectangle r =  StandardPrinter.RenderContainer(row,evaluator,currentPosition,ReportPageEventArgs);
						
						currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);

						row.Size = rs;
					}
					while (this.dataNavigator.MoveNext());
					
				}
				
				row.Size = rs;
			}
//			base.NotifyAfterPrint (rpea.LocationAfterDraw);
		}
Beispiel #59
0
		public void Render (ISimpleContainer table,ReportPageEventArgs rpea,IExpressionEvaluatorFacade evaluator)
		{
			if (this.dataNavigator.CurrentRow < 0 ) {
				this.dataNavigator.MoveNext();
			}
			this.reportPageEventArgs = rpea;
			Point saveLocation = table.Location;
			Rectangle pageBreakRect = Rectangle.Empty;
			
			Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.currentSection,table).Location.X,
			                                  this.currentSection.Location.Y);
			table.Items.SortByLocation();
			
			Size rs = Size.Empty;
			
			
			ISimpleContainer headerRow = null;
			
			var simpleContainer = table.Items[0] as ISimpleContainer;
			
//			foreach (BaseRowItem row in table.Items)
//			{
				rs = simpleContainer.Size;
				PrintHelper.AdjustParent(table as BaseReportItem,table.Items);
				
//				if (PrintHelper.IsTextOnlyRow(simpleContainer) )
//				{
					
					PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics,Layouter,simpleContainer);
					
					var r =  StandardPrinter.RenderContainer(simpleContainer,evaluator,currentPosition,ReportPageEventArgs);
					
					currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);
					
					table.Location = saveLocation;
//				}
//				else {
				//---------------	
				simpleContainer = table.Items[1] as ISimpleContainer;
					
					int adjust = simpleContainer.Location.Y - saveLocation.Y;
					simpleContainer.Location = new Point(simpleContainer.Location.X,simpleContainer.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer);
					rs = simpleContainer.Size;
					
					do {
						
						pageBreakRect = PrintHelper.CalculatePageBreakRectangle((BaseReportItem)table,currentPosition);
						
						if (PrintHelper.IsPageFull(pageBreakRect,this.SectionBounds)) {
							Console.WriteLine("PageBreak - PageFull");
							table.Location = saveLocation;
							AbstractRenderer.PageBreak(ReportPageEventArgs);
							return;
						}
						
						this.dataNavigator.Fill(simpleContainer.Items);
						
						PrintHelper.SetLayoutForRow(ReportPageEventArgs.PrintPageEventArgs.Graphics,Layouter,simpleContainer);
						
						r =  StandardPrinter.RenderContainer(simpleContainer,evaluator,currentPosition,ReportPageEventArgs);
						
						currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);

						simpleContainer.Size = rs;
					}
					while (this.dataNavigator.MoveNext());
					//-----
//				}
		}
Beispiel #60
0
		private static bool CheckPageBreakAfterGroupChange(ISimpleContainer container)
		{
            var groupedRows = container.Items.FindGroupHeader();
			if (groupedRows.Count > 0) {
				var groupedRow = groupedRows[0];
				return groupedRow.PageBreakOnGroupChange;
			}
			return false;
		}