Exemplo n.º 1
0
        internal float RunTextCalcHeight(Report rpt, Graphics g, Row row, PageTextHtml pth)
        {               // normally only called when CanGrow is true
            Size s = Size.Empty;

            if (IsHidden(rpt, row))
            {
                return(0);
            }

            object o = Evaluate(rpt, row);

            TypeCode tc    = _Value.GetTypeCode();
            int      width = this.WidthCalc(rpt, g);

            if (this.Style != null)
            {
                width -= (Style.EvalPaddingLeftPx(rpt, row) + Style.EvalPaddingRightPx(rpt, row));

                if (this.IsHtml(rpt, row))
                {
                    if (pth == null)
                    {
                        pth = new PageTextHtml(o == null? "": o.ToString());
                        SetPagePositionAndStyle(rpt, pth, row);
                    }
                    pth.Build(g);
                    s.Height = RSize.PixelsFromPoints(pth.TotalHeight);
                }
                else
                {
                    s = Style.MeasureString(rpt, g, o, tc, row, width);
                }
            }
            else                // call the class static method
            {
                s = Style.MeasureStringDefaults(rpt, g, o, tc, row, width);
            }

            TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(rpt, this);

            tbr.RunHeight = RSize.PointsFromPixels(g, s.Height);
            if (Style != null)
            {
                tbr.RunHeight += (Style.EvalPaddingBottom(rpt, row) + Style.EvalPaddingTop(rpt, row));
            }
            return(tbr.RunHeight);
        }
Exemplo n.º 2
0
        internal int RunCount(Report rpt)
        {
            TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(rpt, this);

            return(tbr.RunCount);
        }
Exemplo n.º 3
0
        override internal void RunPage(Pages pgs, Row row)
        {
            Report         r   = pgs.Report;
            TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(r, this);

            tbr.RunCount++;                     // Increment the run count

            bool bHidden = IsHidden(r, row);

            SetPagePositionBegin(pgs);

            string t;

            if (bHidden)
            {
                t = "";
            }
            else
            {
                t = RunText(r, row);    // get the text
            }
            bool bDup = RunTextIsDuplicate(tbr, t, pgs.CurrentPage);

            if (bDup)
            {
                if (!(this.IsTableOrMatrixCell(r)))                     // don't put out anything if not in Table or Matrix
                {
                    bHidden = true;
                }
                t = "";                         // still need to put out the cell
            }
            PageText     pt;
            PageTextHtml pth = null;

            if (IsHtml(r, row))
            {
                pt = pth = new PageTextHtml(t);
            }
            else
            {
                pt = new PageText(t);
            }
            SetPagePositionAndStyle(r, pt, row);
            if (this.CanGrow && tbr.RunHeight == 0)             // when textbox is in a DataRegion this will already be called
            {
                this.RunTextCalcHeight(r, pgs.G, row, pt is PageTextHtml? pt as PageTextHtml: null);
            }
            pt.H = Math.Max(pt.H, tbr.RunHeight);                       // reset height
            if (pt.SI.BackgroundImage != null)
            {
                pt.SI.BackgroundImage.H = pt.H;                         //   and in the background image
            }
            pt.CanGrow = this.CanGrow;

            // check TextAlign: if General then correct based on data type
            if (pt.SI.TextAlign == TextAlignEnum.General)
            {
                if (DataType.IsNumeric(this.Value.GetTypeCode()))
                {
                    pt.SI.TextAlign = TextAlignEnum.Right;
                }
            }

            // Hidden objects don't affect the current page?
            if (!bHidden)
            {
                // Force page break if it doesn't fit on a page
                if (this.IsInBody &&                                             // Only force page when object directly in body
                    pgs.CurrentPage.YOffset + pt.Y + pt.H >= pgs.BottomOfPage && // running off end of page
                    !pgs.CurrentPage.IsEmpty())                                  // if page is already empty don't force new
                {                                                                // force page break if it doesn't fit on the page
                    pgs.NextOrNew();
                    pgs.CurrentPage.YOffset = OwnerReport.TopOfPage;
                    if (this.YParents != null)
                    {
                        pt.Y = 0;
                    }
                }

                Page p = pgs.CurrentPage;
                RecordPageReference(r, p, row);                 // save information for late page header/footer references
                p.AddObject(pt);
                if (!bDup)
                {
                    tbr.PreviousText = t;       // previous text displayed
                    tbr.PreviousPage = p;       //  page previous text was shown on
                }
            }

            SetPagePositionEnd(pgs, pt.Y + pt.H);
            if (pth != null)
            {
                pth.Reset();
            }
            if (this.CanGrow && !Value.IsConstant())
            {
                tbr.RunHeight = 0;                                                      // need to recalculate
            }
        }
Exemplo n.º 4
0
        internal void ResetPrevious(Report rpt)
        {
            TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(rpt, this);

            ResetPrevious(tbr);
        }