Exemplo n.º 1
0
        protected void createListLayout(float groupHeaderHeight, float itemHeight,
                                        float groupFooterHeight,
                                        float afterGroupHeight, float newPageTopOffset, RectangleF contentBounds,
                                        float masterGroupHeaderHeight, float afterMasterGroupHeight)
        {
            float minHeight = masterGroupHeaderHeight + groupHeaderHeight + itemHeight;

            if (minHeight > contentBounds.Height)
            {
                throw new SmallPageSizeException();
            }

            int   pageNum = firstPageNum;
            float y       = StartY;

            listLayout = new Dictionary <int, List <ReportGroupPart> >();

            ReportGrupa gr = null;
            ReportGrupa prevGrupa;

            for (int i = 0; i < groups.Count; i++)
            {
                prevGrupa = gr;
                gr        = groups[i];

                int recNum = gr.Start;
                int endRec = gr.Start + gr.Count;

                while (recNum < endRec)
                {
                    bool newPage = false;
                    if (recNum == gr.Start && shouldStartOnNewPage(gr, prevGrupa) ||
                        (y + minHeight > contentBounds.Bottom))
                    {
                        newPage = true;
                        pageNum++;
                        y = contentBounds.Y + newPageTopOffset;
                    }

                    float groupPartY = y;

                    bool masterGroupHeader = false;
                    bool groupHeader       = false;
                    if (recNum == gr.Start)
                    {
                        if (masterGroupHeaderHeight != 0f)
                        {
                            if (prevGrupa == null ||
                                !object.ReferenceEquals(gr.MasterGrupa, prevGrupa.MasterGrupa))
                            {
                                if (prevGrupa != null && !newPage)
                                {
                                    y         += afterMasterGroupHeight;
                                    groupPartY = y;
                                }
                                masterGroupHeader = true;
                                y += masterGroupHeaderHeight;
                            }
                        }

                        groupHeader = true;
                        y          += groupHeaderHeight;
                    }
                    else if (newPage)
                    {
                        if (startNewPageWithGroupHeader)
                        {
                            groupHeader = true;
                            y          += groupHeaderHeight;
                        }
                    }

                    int numItems;
                    if (y + (endRec - recNum) * itemHeight <= contentBounds.Bottom)
                    {
                        numItems = endRec - recNum;
                    }
                    else
                    {
                        numItems = (int)Math.Floor((contentBounds.Bottom - y) / itemHeight);
                    }

                    bool            groupFooter = recNum + numItems >= endRec;
                    ReportGroupPart part        = new ReportGroupPart(pageNum, i, recNum,
                                                                      numItems, groupPartY, groupHeader, masterGroupHeader, groupFooter);

                    List <ReportGroupPart> partList;
                    if (listLayout.ContainsKey(pageNum))
                    {
                        partList = listLayout[pageNum];
                    }
                    else
                    {
                        partList = new List <ReportGroupPart>();
                        listLayout.Add(pageNum, partList);
                    }
                    partList.Add(part);

                    y      += numItems * itemHeight;
                    recNum += numItems;
                }
                y += groupFooterHeight;
                y += afterGroupHeight;
            }
            this.lastPageNum = pageNum;
            this.endY        = y;
        }
Exemplo n.º 2
0
        protected void createListLayout(float groupHeaderHeight, float itemHeight, 
            float groupFooterHeight,
            float afterGroupHeight, float newPageTopOffset, RectangleF contentBounds,
            float masterGroupHeaderHeight, float afterMasterGroupHeight)
        {
            float minHeight = masterGroupHeaderHeight + groupHeaderHeight + itemHeight;
            if (minHeight > contentBounds.Height)
                throw new SmallPageSizeException();

            int pageNum = firstPageNum;
            float y = StartY;

            listLayout = new Dictionary<int, List<ReportGroupPart>>();

            ReportGrupa gr = null;
            ReportGrupa prevGrupa;

            for (int i = 0; i < groups.Count; i++)
            {
                prevGrupa = gr;
                gr = groups[i];

                int recNum = gr.Start;
                int endRec = gr.Start + gr.Count;

                while (recNum < endRec)
                {
                    bool newPage = false;
                    if (recNum == gr.Start && shouldStartOnNewPage(gr, prevGrupa)
                        || (y + minHeight > contentBounds.Bottom))
                    {
                        newPage = true;
                        pageNum++;
                        y = contentBounds.Y + newPageTopOffset;
                    }

                    float groupPartY = y;

                    bool masterGroupHeader = false;
                    bool groupHeader = false;
                    if (recNum == gr.Start)
                    {
                        if (masterGroupHeaderHeight != 0f)
                        {
                            if (prevGrupa == null
                                || !object.ReferenceEquals(gr.MasterGrupa, prevGrupa.MasterGrupa))
                            {
                                if (prevGrupa != null && !newPage)
                                {
                                    y += afterMasterGroupHeight;
                                    groupPartY = y;
                                }
                                masterGroupHeader = true;
                                y += masterGroupHeaderHeight;
                            }
                        }

                        groupHeader = true;
                        y += groupHeaderHeight;
                    }
                    else if (newPage)
                    {
                        if (startNewPageWithGroupHeader)
                        {
                            groupHeader = true;
                            y += groupHeaderHeight;
                        }
                    }

                    int numItems;
                    if (y + (endRec - recNum) * itemHeight <= contentBounds.Bottom)
                        numItems = endRec - recNum;
                    else
                        numItems = (int)Math.Floor((contentBounds.Bottom - y) / itemHeight);

                    bool groupFooter = recNum + numItems >= endRec;
                    ReportGroupPart part = new ReportGroupPart(pageNum, i, recNum,
                        numItems, groupPartY, groupHeader, masterGroupHeader, groupFooter);

                    List<ReportGroupPart> partList;
                    if (listLayout.ContainsKey(pageNum))
                    {
                        partList = listLayout[pageNum];
                    }
                    else
                    {
                        partList = new List<ReportGroupPart>();
                        listLayout.Add(pageNum, partList);
                    }
                    partList.Add(part);

                    y += numItems * itemHeight;
                    recNum += numItems;
                }
                y += groupFooterHeight;
                y += afterGroupHeight;
            }
            this.lastPageNum = pageNum;
            this.endY = y;
        }