Example #1
0
        public static IBaseExportColumn ConvertLineItem(BaseReportItem item, Point offset)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

//			if (item.VisibleInReport == true) {

            var columnBuilder          = item as IExportColumnBuilder;
            IBaseExportColumn lineItem = null;

            if (columnBuilder != null)
            {
                lineItem = columnBuilder.CreateExportColumn();
                lineItem.StyleDecorator.Location = new Point(offset.X + lineItem.StyleDecorator.Location.X,
                                                             lineItem.StyleDecorator.Location.Y + offset.Y);

                lineItem.StyleDecorator.DisplayRectangle = new Rectangle(lineItem.StyleDecorator.Location,
                                                                         lineItem.StyleDecorator.Size);
            }
            return(lineItem);
//			} else
//			{
//				return null;
//			}
        }
 private static void ShouldDrawBorder(BaseSection section, ExporterCollection list)
 {
     if (section.DrawBorder == true)
     {
         BaseRectangleItem br  = BasePager.CreateDebugItem(section);
         IBaseExportColumn bec = br.CreateExportColumn();
         bec.StyleDecorator.Location = section.Location;
         list.Insert(0, (BaseExportColumn)bec);
     }
 }
Example #3
0
        protected ExporterCollection ConvertSection(BaseSection section, int dataRow)
        {
            Point currentBottom = Point.Empty;
            bool  isContainer   = false;

            PrepareSection(section, dataRow);

            var convertedSection = new ExporterCollection();

            Offset = SectionBounds.Offset;

            if (section.Items.Count > 0)
            {
                Rectangle desiredRectangle = LayoutHelper.CalculateSectionLayout(this.Graphics, section);
                LayoutHelper.FixSectionLayout(desiredRectangle, section);
                section.Items.SortByLocation();
                GapList gapCalculator = new GapList();
                gapCalculator.CalculateGapList(section);

                int i = 0;

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

                    if (simpleContainer != null)
                    {
                        isContainer = true;
                        Offset      = new Point(Offset.X, Offset.Y + gapCalculator.GapBetweenItems[i]);
                        var containerSize = simpleContainer.Size;

                        EvaluationHelper.EvaluateReportItems(EvaluatorFacade, simpleContainer.Items);

                        var layouter = (ILayouter)ServiceContainer.GetService(typeof(ILayouter));
                        LayoutHelper.SetLayoutForRow(Graphics, layouter, simpleContainer);

                        section.MeasureOverride(section.Size);

                        Offset = BaseConverter.ConvertContainer(convertedSection, simpleContainer, Offset.X, Offset);
                        simpleContainer.Size = containerSize;
                    }
                    else
                    {
                        IBaseExportColumn converteditem = null;
                        if (isContainer)
                        {
                            item.Location = new Point(item.Location.X, Offset.Y + gapCalculator.GapBetweenItems[i]);
                            converteditem = ExportHelper.ConvertLineItem(item, new Point(item.Location.X, gapCalculator.GapBetweenItems[i]));
                            isContainer   = false;
                        }
                        else
                        {
                            converteditem = ExportHelper.ConvertLineItem(item, Offset);
                        }

                        if (converteditem.StyleDecorator.DisplayRectangle.Bottom > currentBottom.Y)
                        {
                            currentBottom = new Point(converteditem.StyleDecorator.Location.X, converteditem.StyleDecorator.DisplayRectangle.Bottom);
                        }
                        convertedSection.Add((BaseExportColumn)converteditem);
                    }
                    i++;
                }
                Offset = new Point(Offset.X, Offset.Y + gapCalculator.LastGap);

                if (currentBottom.Y > Offset.Y)
                {
                    Offset = new Point(Offset.X, currentBottom.Y);
                }
            }
            SectionBounds.Offset = Offset;
            return(convertedSection);
        }