internal void TranslatedObjectsToBand(BandBase band)
 {
     // Avoid compilation errors
 }
Exemplo n.º 2
0
        internal void AddToPreparedPages(BandBase band)
        {
            bool isReportSummary = band is ReportSummaryBand;

            // check if band is service band (e.g. page header/footer/overlay).
            BandBase mainBand = band;

            // for child bands, check its parent band.
            if (band is ChildBand)
            {
                mainBand = (band as ChildBand).GetTopParentBand;
            }
            bool isPageBand   = mainBand is PageHeaderBand || mainBand is PageFooterBand || mainBand is OverlayBand;
            bool isColumnBand = mainBand is ColumnHeaderBand || mainBand is ColumnFooterBand;

            // check if we have enough space for a band.
            bool checkFreeSpace = !isPageBand && !isColumnBand && band.FlagCheckFreeSpace;

            if (checkFreeSpace && FreeSpace < band.Height)
            {
                // we don't have enough space. What should we do?
                // - if band can break, break it
                // - if band cannot break, check the band height:
                //   - it's the first row of a band and is bigger than page: break it immediately.
                //   - in other case, add a new page/column and tell the band that it must break next time.
                if (band.CanBreak || band.FlagMustBreak || (band.AbsRowNo == 1 && band.Height > PageHeight - PageFooterHeight))
                {
                    // since we don't show the column footer band in the EndLastPage, do it here.
                    if (isReportSummary)
                    {
                        ShowReprintFooters();
                        ShowBand(page.ColumnFooter);
                    }
                    BreakBand(band);
                    return;
                }
                else
                {
                    EndColumn();
                    band.FlagMustBreak = true;
                    AddToPreparedPages(band);
                    band.FlagMustBreak = false;
                    return;
                }
            }
            else
            {
                // since we don't show the column footer band in the EndLastPage, do it here.
                if (isReportSummary)
                {
                    if ((band as ReportSummaryBand).KeepWithData)
                    {
                        EndKeep();
                    }
                    ShowReprintFooters(false);
                    ShowBand(page.ColumnFooter);
                }
            }

            // check if we have a child band with FillUnusedSpace flag
            if (band.Child != null && band.Child.FillUnusedSpace)
            {
                // if we reprint a data/group footer, do not include the band height into calculation:
                // it is already counted in FreeSpace
                float bandHeight = band.Height;
                if (band.Repeated)
                {
                    bandHeight = 0;
                }
                while (FreeSpace - bandHeight - band.Child.Height > 0)
                {
                    float saveCurY = CurY;
                    ShowBand(band.Child);
                    // nothing was printed, break to avoid an endless loop
                    if (CurY == saveCurY)
                    {
                        break;
                    }
                }
            }

            // adjust the band location
            if (band is PageFooterBand && !UnlimitedHeight)
            {
                CurY = PageHeight - GetBandHeightWithChildren(band);
            }
            if (!isPageBand)
            {
                band.Left += originX + CurX;
            }
            if (band.PrintOnBottom)
            {
                CurY = PageHeight - PageFooterHeight - ColumnFooterHeight;
                // if PrintOnBottom is applied to a band like DataFooter, print it with all its child bands
                // if PrintOnBottom is applied to a child band, print this band only.
                if (band is ChildBand)
                {
                    CurY -= band.Height;
                }
                else
                {
                    CurY -= GetBandHeightWithChildren(band);
                }
            }
            band.Top = CurY;

            // shift the band and decrease its width when printing hierarchy
            float saveLeft  = band.Left;
            float saveWidth = band.Width;

            if (!isPageBand && !isColumnBand)
            {
                band.Left  += hierarchyIndent;
                band.Width -= hierarchyIndent;
            }

            // add outline
            AddBandOutline(band);

            // add bookmarks
            band.AddBookmarks();

            // put the band to prepared pages. Do not put page bands twice
            // (this may happen when we render a subreport, or append a report to another one).
            bool bandAdded         = true;
            bool bandAlreadyExists = false;

            if (isPageBand)
            {
                if (band is ChildBand)
                {
                    bandAlreadyExists = PreparedPages.ContainsBand(band.Name);
                }
                else
                {
                    bandAlreadyExists = PreparedPages.ContainsBand(band.GetType());
                }
            }

            if (!bandAlreadyExists)
            {
                bandAdded = PreparedPages.AddBand(band);
            }

            // shift CurY
            if (bandAdded && !(mainBand is OverlayBand))
            {
                CurY += band.Height;
            }

            // set left&width back
            band.Left  = saveLeft;
            band.Width = saveWidth;
        }
 private void TranslateObjects(BandBase parentBand)
 {
     // Avoid compilation errors
 }
Exemplo n.º 4
0
 /// <summary>
 /// Shows band at the current position.
 /// </summary>
 /// <param name="band">Band to show.</param>
 /// <remarks>
 /// After the band is shown, the current position is advanced by the band's height.
 /// </remarks>
 public void ShowBand(BandBase band)
 {
     ShowBand(band, true);
 }
Exemplo n.º 5
0
 private void ProcessTotals(BandBase band)
 {
     Report.Dictionary.Totals.ProcessBand(band);
 }
Exemplo n.º 6
0
 private void SetDefaults(BandBase band)
 {
     band.CreateUniqueName();
     band.Height = band.GetPreferredSize().Height;
 }
Exemplo n.º 7
0
        public void Undo()
        {
            //			if(oldValue == null) return;

            if (oldcomponent == null)
            {
                return;
            }

            object component = null;

            if (oldcomponent is Control && componentName != null)
            {
                component = report.GetControl(oldcomponent as Control, componentName);
                // report.DestroyComponent(oldcomponent as Control);
                //component = oldcomponent;
            }

            if (component == null)
            {
                component = oldcomponent;
            }

            report.OnComponentChanging(component, member);
            if (component is PictureBox && PropName == "Image" && oldImagePath != null)
            {
                PictureBox pictureBox = component as PictureBox;
                newImagePath = report.GetPropertyValue(pictureBox.Name, "Image");

                SetPictureBoxImage(component as PictureBox, oldImagePath);
                //report.Edit_Info("Name", pictureBox.Name, "Image", oldImagePath);
                return;
            }

            Type         t     = component.GetType();
            PropertyInfo pInfo = t.GetProperty(member.Name);

            try
            {
                pInfo.SetValue(component, oldValue, null);
                //control.Location = new Point(control.Location.X, base2.Top + control.垂直位置);
                //component.
                if (component is CustomControl)
                {
                    ((CustomControl)component).Cs.Remove();
                    BandBase base2 = report.FindBandPosY(((CustomControl)component).Location.Y);
                    ((CustomControl)component).Band = base2;
                    ((CustomControl)component).垂直位置 = ((CustomControl)component).Location.Y - ((CustomControl)component).Band.Top;
                }

                if (component is BandDesigner)
                {
                    report.CurrentBandControl = (BandDesigner)component;
                    report.CurrentBand        = (BandBase)((BandDesigner)component).Tag;

                    report.ArrangeAreaDesigner();
                    report.SetRulers();
                    report.ArrangeBands();
                    report.BandControlPaint(this, null);
                }


                WriteXmlProperty(component, oldValue);
            }
            catch {}
            report.OnComponentChanged(component, member, newValue, oldValue);
        }
Exemplo n.º 8
0
        private void BreakBand(BandBase band)
        {
            BandBase cloneBand = Activator.CreateInstance(band.GetType()) as BandBase;

            cloneBand.Assign(band);
            cloneBand.FlagMustBreak = band.FlagMustBreak;

            // clone band objects:
            // - remove bands, convert them to Text objects if necessary
            // - skip subreports
            foreach (Base c in band.Objects)
            {
                if (c is BandBase)
                {
                    BandBase b = c as BandBase;
                    if (b.HasBorder || b.HasFill)
                    {
                        TextObject textObj = new TextObject();
                        textObj.Bounds = b.Bounds;
                        textObj.Border = b.Border.Clone();
                        textObj.Fill   = b.Fill.Clone();
                        cloneBand.Objects.Add(textObj);
                    }

                    foreach (ReportComponentBase obj in b.Objects)
                    {
                        if (!(obj is BandBase))
                        {
                            ReportComponentBase cloneObj = Activator.CreateInstance(obj.GetType()) as ReportComponentBase;
                            cloneObj.AssignAll(obj);
                            cloneObj.Anchor = AnchorStyles.Left | AnchorStyles.Top;
                            cloneObj.Dock   = DockStyle.None;
                            cloneObj.Left   = obj.AbsLeft;
                            cloneObj.Top    = obj.AbsTop;
                            if (cloneObj is TextObject)
                            {
                                (cloneObj as TextObject).Highlight.Clear();
                            }
                            cloneBand.Objects.Add(cloneObj);
                        }
                    }
                }
                else if (!(c is SubreportObject))
                {
                    Base cloneObj = Activator.CreateInstance(c.GetType()) as Base;
                    cloneObj.AssignAll(c);
                    cloneBand.Objects.Add(cloneObj);
                }
            }

            BandBase breakTo = Activator.CreateInstance(band.GetType()) as BandBase;

            breakTo.Assign(band);
            breakTo.Child             = null;
            breakTo.CanGrow           = true;
            breakTo.StartNewPage      = false;
            breakTo.BeforePrintEvent  = "";
            breakTo.BeforeLayoutEvent = "";
            breakTo.AfterPrintEvent   = "";
            breakTo.AfterLayoutEvent  = "";
            // breakTo must be breaked because it will print on a new page.
            breakTo.FlagMustBreak = true;

            // to allow clone and breaked bands to access Report
            cloneBand.SetReport(Report);
            breakTo.SetReport(Report);

            try
            {
                cloneBand.Height = FreeSpace;
                if (cloneBand.Break(breakTo))
                {
                    AddToPreparedPages(cloneBand);
                    EndColumn();
                    ShowBand(breakTo, false);
                }
                else
                {
                    if (cloneBand.FlagMustBreak)
                    {
                        // show band as is
                        breakTo.FlagCheckFreeSpace = false;
                        AddToPreparedPages(breakTo);
                    }
                    else
                    {
                        EndColumn();
                        ShowBand(breakTo, false);
                    }
                }
            }
            finally
            {
                cloneBand.Dispose();
                breakTo.Dispose();
            }
        }
Exemplo n.º 9
0
        internal void GeneratePages(object sender, EventArgs e)
        {
            isFirstRow = false;
            if (Skip)
            {
                Skip = false;
                return;
            }


            // check if band contains several tables
            if (sender is BandBase)
            {
                BandBase senderBand = sender as BandBase;
                isFirstRow = senderBand.IsFirstRow;
                SortedList <float, TableBase> tables = new SortedList <float, TableBase>();
                foreach (Base obj in senderBand.Objects)
                {
                    TableBase table = obj as TableBase;
                    if (table != null && table.ResultTable != null)
                    {
                        try
                        {
                            tables.Add(table.Left, table);
                        }
                        catch (ArgumentException)
                        {
                            throw new ArgumentException(Res.Get("Messages,MatrixLayoutError"));
                        }
                    }
                }

                // render tables side-by-side
                if (tables.Count > 1)
                {
                    ReportEngine    engine = Report.Engine;
                    TableLayoutInfo info   = new TableLayoutInfo();
                    info.startPage = engine.CurPage;
                    info.tableSize = new Size(1, 1);
                    info.startX    = tables.Values[0].Left;

                    int   firstTableHeight = 0;
                    int   startPage        = info.startPage;
                    float firstTableCurY   = 0;
                    float saveCurY         = engine.CurY;

                    for (int i = 0; i < tables.Count; i++)
                    {
                        TableBase table = tables.Values[i];

                        // do not allow table to render itself in the band.AfterPrint event
                        table.ResultTable.Skip = true;
                        // render using the down-then-across mode
                        table.Layout = TableLayout.DownThenAcross;

                        engine.CurPage = info.startPage + (info.tableSize.Width - 1) * info.tableSize.Height;
                        engine.CurY    = saveCurY;
                        float addLeft = 0;
                        if (i > 0)
                        {
                            addLeft = table.Left - tables.Values[i - 1].Right;
                        }
                        table.ResultTable.Left = info.startX + addLeft;

                        // calculate cells' bounds
                        table.ResultTable.CalcBounds();
                        // generate pages
                        Report.PreparedPages.AddPageAction = AddPageAction.WriteOver;
                        info = table.ResultTable.GeneratePagesDownThenAcross();

                        if (i == 0)
                        {
                            firstTableHeight = info.tableSize.Height;
                            firstTableCurY   = engine.CurY;
                        }
                    }

                    engine.CurPage = startPage + firstTableHeight - 1;
                    engine.CurY    = firstTableCurY;

                    Skip = false;
                    return;
                }
            }

            // calculate cells' bounds
            CalcBounds();

            if (Report.Engine.UnlimitedHeight || Report.Engine.UnlimitedWidth)
            {
                if (!Report.Engine.UnlimitedWidth)
                {
                    GeneratePagesWrapped();
                }
                else if (!Report.Engine.UnlimitedHeight)
                {
                    GeneratePagesDownThenAcross();
                }
                else
                {
                    GeneratePagesAcrossThenDown();
                }
            }
            else if (Layout == TableLayout.AcrossThenDown)
            {
                GeneratePagesAcrossThenDown();
            }
            else if (Layout == TableLayout.DownThenAcross)
            {
                GeneratePagesDownThenAcross();
            }
            else
            {
                GeneratePagesWrapped();
            }
        }
Exemplo n.º 10
0
 public bool AddBand(BandBase band)
 {
     return(DoAdd(band, xmlItem));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Shows band at the current position.
 /// </summary>
 /// <param name="band">Band to show.</param>
 /// <remarks>
 /// After the band is shown, the current position is advanced by the band's height.
 /// </remarks>
 public void ShowBand(BandBase band)
 {
     if (band != null)
         for (int i = 0; i < band.RepeatBandNTimes; i++)
             ShowBand(band, true);
 }
Exemplo n.º 12
0
 private static void InspectBandBase(BandBase band)
 {
     InspectBreakableComponent(band);
 }
        private void RenderOuterSubreports(BandBase parentBand)
        {
            float saveCurY    = CurY;
            float saveOriginX = originX;
            int   saveCurPage = CurPage;

            float maxY          = 0;
            int   maxPage       = CurPage;
            bool  hasSubreports = false;

            try
            {
                for (int i = 0; i < parentBand.Objects.Count; i++)
                {
                    SubreportObject subreport = parentBand.Objects[i] as SubreportObject;

                    // Apply visible expression if needed.
                    if (subreport != null && !String.IsNullOrEmpty(subreport.VisibleExpression))
                    {
                        subreport.Visible = CalcVisibleExpression(subreport.VisibleExpression);
                    }

                    if (subreport != null && subreport.Visible && !subreport.PrintOnParent)
                    {
                        hasSubreports = true;
                        // restore start position
                        CurPage = saveCurPage;
                        CurY    = saveCurY - subreport.Height;
                        originX = saveOriginX + subreport.Left;
                        // do not upload generated pages to the file cache
                        PreparedPages.CanUploadToCache = false;

                        RenderSubreport(subreport);

                        // find maxY. We will continue from maxY when all subreports finished.
                        if (CurPage == maxPage)
                        {
                            if (CurY > maxY)
                            {
                                maxY = CurY;
                            }
                        }
                        else if (CurPage > maxPage)
                        {
                            maxPage = CurPage;
                            maxY    = CurY;
                        }
                    }
                }
            }
            finally
            {
                if (hasSubreports)
                {
                    CurPage = maxPage;
                    CurY    = maxY;
                }
                originX = saveOriginX;
                PreparedPages.CanUploadToCache = true;
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Prints a band with all its child objects.
 /// </summary>
 /// <param name="band">The band to print.</param>
 /// <returns><b>true</b> if band was printed; <b>false</b> if it can't be printed
 /// on current page due to its <b>PrintOn</b> property value.</returns>
 /// <remarks>
 /// Call the <see cref="AddPage"/> method before adding a band.
 /// </remarks>
 public bool AddBand(BandBase band)
 {
     return(preparedPages[CurPage].AddBand(band));
 }