Exemplo n.º 1
0
 protected internal virtual void OnChildViewPrinting(ChildViewPrintingEventArgs e)
 {
     if (this.ChildViewPrinting == null)
     {
         return;
     }
     this.ChildViewPrinting((object)this, e);
 }
Exemplo n.º 2
0
 protected virtual void OnChildViewPrinting(object sender, ChildViewPrintingEventArgs e)
 {
     this.GridView.OnChildViewPrinting(sender, e);
     if (this.ChildViewPrinting == null)
     {
         return;
     }
     this.ChildViewPrinting((object)this, e);
 }
Exemplo n.º 3
0
 private void renderer_ChildViewPrinting(object sender, ChildViewPrintingEventArgs e)
 {
     this.OnChildViewPrinting(sender, e);
 }
Exemplo n.º 4
0
        public virtual int GetNumberOfPages(Rectangle drawArea)
        {
            TableViewRowLayoutBase rowLayout = (this.grid.ViewDefinition as TableViewDefinition).CreateRowLayout() as TableViewRowLayoutBase;

            rowLayout.Context = GridLayoutContext.Printer;
            rowLayout.Initialize(this.grid.TableElement);
            if (this.GridView.PrintStyle.FitWidthMode == PrintFitWidthMode.FitPageWidth)
            {
                rowLayout.MeasureRow(new SizeF((float)drawArea.Width, (float)drawArea.Height));
            }
            else
            {
                rowLayout.MeasureRow((SizeF)this.GridView.Size);
            }
            int height = drawArea.Height;

            if (this.PrintHeaderOnEachPage && !this.PrintHierarchy)
            {
                height -= rowLayout.GetRowHeight((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow);
            }
            int num1 = 0;
            int num2 = 1;

            this.traverser.Reset();
            this.traverser.ProcessHiddenRows = this.PrintHiddenRows;
            this.traverser.ProcessHierarchy  = this.PrintHierarchy;
            while (this.traverser.MoveNext())
            {
                if (this.traverser.Current is GridViewDataRowInfo || this.traverser.Current is GridViewTableHeaderRowInfo && (this.PrintHierarchy || !this.PrintHeaderOnEachPage) || (this.traverser.Current is GridViewGroupRowInfo && this.PrintGrouping || this.traverser.Current is GridViewSummaryRowInfo && this.PrintSummaries))
                {
                    GridViewHierarchyRowInfo current = this.traverser.Current as GridViewHierarchyRowInfo;
                    if (current != null && current.Views.Count > 0)
                    {
                        switch (this.printSettings.ChildViewPrintMode)
                        {
                        case ChildViewPrintMode.PrintFirstView:
                            current.ActiveView = current.Views[0];
                            break;

                        case ChildViewPrintMode.SelectViewToPrint:
                            ChildViewPrintingEventArgs e = new ChildViewPrintingEventArgs(current.Views.IndexOf(current.ActiveView), current);
                            this.OnChildViewPrinting((object)this, e);
                            current.ActiveView = current.Views[e.ActiveViewIndex];
                            break;
                        }
                    }
                    int num3 = !this.GridView.AutoSizeRows ? rowLayout.GetRowHeight(this.traverser.Current) + this.grid.TableElement.RowSpacing : this.PrintRenderer.GetDataRowHeight(this.traverser.Current, rowLayout);
                    if (num1 + num3 < height)
                    {
                        num1 += num3;
                    }
                    else
                    {
                        ++num2;
                        num1 = num3;
                    }
                }
            }
            this.traverser.Reset();
            TableViewDefinitionPrintRenderer printRenderer = this.PrintRenderer as TableViewDefinitionPrintRenderer;

            if (printRenderer != null && printRenderer.PrintPages.Count > 0 && !this.PrintHierarchy)
            {
                return(num2 * printRenderer.PrintPages.Count);
            }
            return(num2);
        }
Exemplo n.º 5
0
        public override void DrawPage(
            PrintGridTraverser traverser,
            Rectangle drawArea,
            Graphics graphics,
            GridPrintSettings settings,
            int pageNumber)
        {
            bool flag1  = this.currentPage != pageNumber;
            int  height = drawArea.Height;
            int  x      = drawArea.X;
            int  y      = drawArea.Y;
            TableViewRowLayout rowLayout = this.GetRowLayout((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, settings.FitWidthMode, settings.HierarchyIndent, drawArea);

            rowLayout.IgnoreColumnVisibility = settings.PrintHiddenColumns;
            int num1 = 0;

            foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns)
            {
                if (renderColumn is GridViewRowHeaderColumn || renderColumn is GridViewIndentColumn)
                {
                    num1 += rowLayout.GetColumnWidth(renderColumn);
                }
            }
            int num2 = (int)rowLayout.DesiredSize.Width - num1;

            if (settings.FitWidthMode == PrintFitWidthMode.NoFitCentered)
            {
                x += (drawArea.Width - num2) / 2;
            }
            if ((this.GridView.ShowColumnHeaders && this.firstPage && pageNumber == 1 || settings.PrintHeaderOnEachPage) && !settings.PrintHierarchy)
            {
                this.PrintRow((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, rowLayout, settings, x, y, graphics, drawArea);
                int num3 = this.GetDataRowHeight((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, (TableViewRowLayoutBase)rowLayout) + this.GridView.TableElement.RowSpacing;
                y      += num3;
                height -= num3;
            }
            this.firstPage = false;
            int             num4 = y;
            GridViewRowInfo row  = (GridViewRowInfo)null;

            if (this.PrintPages.Count > 0 && !settings.PrintHierarchy)
            {
                row = traverser.Current;
            }
            bool flag2 = true;

            while (traverser.MoveNext())
            {
                if (traverser.Current is GridViewDataRowInfo || traverser.Current is GridViewGroupRowInfo || traverser.Current is GridViewSummaryRowInfo || traverser.Current is GridViewTableHeaderRowInfo && settings.PrintHierarchy)
                {
                    GridViewHierarchyRowInfo current = traverser.Current as GridViewHierarchyRowInfo;
                    if (current != null && current.Views.Count > 0)
                    {
                        switch (settings.ChildViewPrintMode)
                        {
                        case ChildViewPrintMode.PrintFirstView:
                            current.ActiveView = current.Views[0];
                            break;

                        case ChildViewPrintMode.SelectViewToPrint:
                            ChildViewPrintingEventArgs e = new ChildViewPrintingEventArgs(current.Views.IndexOf(current.ActiveView), current);
                            this.OnChildViewPrinting(e);
                            current.ActiveView = current.Views[e.ActiveViewIndex];
                            break;
                        }
                    }
                    rowLayout = this.GetRowLayout(traverser.Current, settings.FitWidthMode, settings.HierarchyIndent, drawArea);
                    int num3 = !(traverser.Current is GridViewGroupRowInfo) ? this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) : this.GetRowSize(traverser.Current, rowLayout).Height;
                    if ((y + num3 >= drawArea.Bottom || num4 + num3 >= drawArea.Bottom) && !flag2)
                    {
                        traverser.MovePrevious();
                        num4 = y;
                        bool flag3 = this.currentPage != pageNumber;
                        ++this.currentPage;
                        if (!flag3)
                        {
                            break;
                        }
                    }
                    else
                    {
                        if (traverser.Current is GridViewGroupRowInfo)
                        {
                            if (settings.PrintGrouping)
                            {
                                if (this.currentPage == pageNumber)
                                {
                                    this.PrintRowWideCell(traverser.Current, rowLayout, settings, x, y, graphics);
                                    y += num3 + this.GridView.TableElement.RowSpacing;
                                }
                                else
                                {
                                    num4 += num3 + this.GridView.TableElement.RowSpacing;
                                }
                            }
                        }
                        else if (!(traverser.Current is GridViewSummaryRowInfo) || settings.PrintSummaries)
                        {
                            if (this.currentPage == pageNumber)
                            {
                                this.PrintRow(traverser.Current, rowLayout, settings, x, y, graphics, drawArea);
                                y += num3 + this.GridView.TableElement.RowSpacing;
                            }
                            else
                            {
                                num4 += num3 + this.GridView.TableElement.RowSpacing;
                            }
                        }
                        else
                        {
                            continue;
                        }
                        if (height < num3 && flag2)
                        {
                            ++this.currentPage;
                            break;
                        }
                        flag2 = false;
                    }
                }
            }
            if (this.PrintPages.Count <= 0 || settings.PrintHierarchy)
            {
                return;
            }
            if (y + this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) < drawArea.Bottom || num4 + this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) < drawArea.Bottom)
            {
                ++this.currentPage;
            }
            ++this.CurrentPrintPage;
            this.CurrentPrintPage %= this.PrintPages.Count;
            if (this.CurrentPrintPage <= 0)
            {
                return;
            }
            if (row == null)
            {
                traverser.Reset();
            }
            else
            {
                traverser.GoToRow(row);
            }
        }