Beispiel #1
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 #2
0
        protected ExporterCollection ConvertSection(BaseSection section, int dataRow)
        {
            FireSectionRenderEvent(section, dataRow);

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

            ExporterCollection list = new ExporterCollection();

            if (section.Items.Count > 0)
            {
                Point offset = new Point(section.Location.X, section.SectionOffset);

                // Call layouter only once per section
                Rectangle desiredRectangle = Layouter.Layout(this.Graphics, section);
                Rectangle sectionRectangle = new Rectangle(section.Location, section.Size);
                if (!sectionRectangle.Contains(desiredRectangle))
                {
                    section.Size = new Size(section.Size.Width, desiredRectangle.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
                }

                foreach (BaseReportItem item in section.Items)
                {
                    ISimpleContainer container = item as ISimpleContainer;

                    if (container != null)
                    {
                        ExportContainer exportContainer = StandardPrinter.ConvertToContainer(container, offset);

                        StandardPrinter.AdjustBackColor(container);

                        ExporterCollection clist = StandardPrinter.ConvertPlainCollection(container.Items, offset);

                        exportContainer.Items.AddRange(clist);
                        list.Add(exportContainer);
                    }
                    else
                    {
                        list = StandardPrinter.ConvertPlainCollection(section.Items, offset);
                    }
                }
            }
            return(list);
        }
Beispiel #3
0
        protected static ExporterCollection ConvertItems(ISimpleContainer row, Point offset)
        {
            IExportColumnBuilder exportLineBuilder = row as IExportColumnBuilder;

            if (exportLineBuilder != null)
            {
                ExportContainer lineItem = StandardPrinter.ConvertToContainer(row, offset);

                StandardPrinter.AdjustBackColor(row);
                ExporterCollection list = StandardPrinter.ConvertPlainCollection(row.Items, offset);

                lineItem.Items.AddRange(list);

                ExporterCollection containerList = new ExporterCollection();
                containerList.Add(lineItem);
                return(containerList);
            }
            return(null);
        }
        public override void Render(ReportPageEventArgs rpea)
        {
            if (rpea == null)
            {
                throw new ArgumentNullException("rpea");
            }
            Point point = this.Location;

            base.Render(rpea);

            StandardPrinter.AdjustBackColor(this);

            StandardPrinter.FillBackground(rpea.PrintPageEventArgs.Graphics, this.BaseStyleDecorator);

            StandardPrinter.DrawBorder(rpea.PrintPageEventArgs.Graphics, this.BaseStyleDecorator);

            rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, this.Location.Y + this.Size.Height);
            this.Location          = point;
            base.NotifyAfterPrint(rpea.LocationAfterDraw);
        }
        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 #6
0
        private ExporterCollection ConvertInternal(ExporterCollection exporterCollection)
        {
            BaseSection section = table.Parent as BaseSection;

            ISimpleContainer headerRow     = null;
            Point            dataAreaStart = new Point(table.Items[0].Location.X, table.Items[0].Location.Y + base.CurrentPosition.Y);

            base.CurrentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.table.Parent, this.table).Location.X,
                                             base.SectionBounds.DetailArea.Top);

            base.DefaultLeftPosition = base.CurrentPosition.X;

            this.table.Items.SortByLocation();

            // Header

            var  simpleContainer = table.Items[0] as ISimpleContainer;
            Size containerSize   = Size.Empty;

            if (simpleContainer.Items.Count > 0)
            {
                simpleContainer.Location = new Point(simpleContainer.Location.X, simpleContainer.Location.Y);
                simpleContainer.Parent   = (BaseReportItem)this.table;

                base.SaveSectionSize(section.Size);
                containerSize = simpleContainer.Size;

                if (PrintHelper.IsTextOnlyRow(simpleContainer))
                {
                    headerRow = simpleContainer;
                    base.PrepareContainerForConverting(section, headerRow);
                    base.CurrentPosition = ConvertContainer(exporterCollection, headerRow, base.DefaultLeftPosition, base.CurrentPosition);
                }

                GroupHeader row = table.Items[1] as GroupHeader;

                if (row != null)
                {
                    //grouped
                    do
                    {
                        // GetType child navigator
                        IDataNavigator childNavigator = base.DataNavigator.GetChildNavigator;

                        base.Evaluator.SinglePage.IDataNavigator = childNavigator;
                        // Convert Grouping Header

                        base.CurrentPosition = ConvertGroupHeader(exporterCollection, section, base.CurrentPosition);

                        childNavigator.Reset();
                        childNavigator.MoveNext();

                        //Convert children
                        if (childNavigator != null)
                        {
                            do
                            {
                                StandardPrinter.AdjustBackColor(simpleContainer);
                                simpleContainer = table.Items[2] as ISimpleContainer;
                                containerSize   = simpleContainer.Size;

                                FillRow(simpleContainer, childNavigator);
                                FireRowRendering(simpleContainer, childNavigator);
                                PrepareContainerForConverting(section, simpleContainer);
                                base.CurrentPosition = ConvertStandardRow(exporterCollection, simpleContainer);

                                simpleContainer.Size = containerSize;
                                CheckForPageBreak(section, simpleContainer, headerRow, exporterCollection);
                            }while (childNavigator.MoveNext());

                            // GroupFooter
                            base.ConvertGroupFooter(table, exporterCollection);
                            base.PageBreakAfterGroupChange(section, exporterCollection);

                            base.Evaluator.SinglePage.IDataNavigator = base.DataNavigator;
                        }
                    }while (base.DataNavigator.MoveNext());
                }

                else
                {
                    // No Grouping at all

                    simpleContainer = table.Items[1] as ISimpleContainer;
                    base.SaveSectionSize(section.Size);
                    containerSize = simpleContainer.Size;

                    do
                    {
                        PrintHelper.AdjustSectionLocation(section);
                        CheckForPageBreak(section, simpleContainer, headerRow, exporterCollection);

                        FillRow(simpleContainer, base.DataNavigator);
                        FireRowRendering(simpleContainer, base.DataNavigator);
                        base.PrepareContainerForConverting(section, simpleContainer);

                        base.CurrentPosition = ConvertStandardRow(exporterCollection, simpleContainer);
                        simpleContainer.Size = containerSize;
                        section.Size         = base.RestoreSectionSize;
                    }while (base.DataNavigator.MoveNext());
                    base.DataNavigator.Reset();
                    base.DataNavigator.MoveNext();
                    SectionBounds.ReportFooterRectangle = new Rectangle(SectionBounds.ReportFooterRectangle.Left,
                                                                        base.CurrentPosition.Y,
                                                                        SectionBounds.ReportFooterRectangle.Width,
                                                                        SectionBounds.ReportFooterRectangle.Height);
                }
            }
            return(exporterCollection);
        }