示例#1
0
        override internal void Run(IPresent ip, Row row)
        {
            Report rpt = ip.Report();

            base.Run(ip, row);

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

            tbr.RunCount++;                     // Increment the run count
            string t    = RunText(rpt, row);
            bool   bDup = RunTextIsDuplicate(tbr, t, null);

            if (bDup)
            {
                if (!(this.IsTableOrMatrixCell(rpt)))                   // don't put out anything if not in Table or Matrix
                {
                    return;
                }
                t = "";                         // still need to put out the cell
            }
            ip.Textbox(this, t, row);

            if (!bDup)
            {
                tbr.PreviousText = t;                   // set for next time
            }
        }
示例#2
0
        internal object LastObject   = null;            // last object calculated

        static internal TextboxRuntime GetTextboxRuntime(Report rpt, Textbox tb)
        {
            TextboxRuntime tbr = rpt.Cache.Get(tb, "txtbox") as TextboxRuntime;

            if (tbr != null)
            {
                return(tbr);
            }
            tbr = new TextboxRuntime();
            rpt.Cache.Add(tb, "txtbox", tbr);
            return(tbr);
        }
示例#3
0
        // routine to determine if text is considered to be a duplicate;
        //  ie: same as previous text and on same page
        private bool RunTextIsDuplicate(TextboxRuntime tbr, string t, Page p)
        {
            if (this._HideDuplicates == null)
            {
                return(false);
            }
            if (t == tbr.PreviousText && p == tbr.PreviousPage)
            {
                return(true);
            }

            return(false);
        }
示例#4
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);
        }
示例#5
0
        internal int RunCount(Report rpt)
        {
            TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(rpt, this);

            return(tbr.RunCount);
        }
示例#6
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
            }
        }
示例#7
0
 void ResetPrevious(TextboxRuntime tbr)
 {
     tbr.PreviousText = null;
     tbr.PreviousPage = null;
 }
示例#8
0
        internal void ResetPrevious(Report rpt)
        {
            TextboxRuntime tbr = TextboxRuntime.GetTextboxRuntime(rpt, this);

            ResetPrevious(tbr);
        }
示例#9
0
		internal object LastObject=null;	// last object calculated

		static internal TextboxRuntime GetTextboxRuntime(Report rpt, Textbox tb)
		{
			TextboxRuntime tbr = rpt.Cache.Get(tb, "txtbox") as TextboxRuntime;
			if (tbr != null)
				return tbr;
			tbr = new TextboxRuntime();
			rpt.Cache.Add(tb, "txtbox", tbr);
			return tbr;
		}
示例#10
0
		// routine to determine if text is considered to be a duplicate;
		//  ie: same as previous text and on same page
		private bool RunTextIsDuplicate(TextboxRuntime tbr, string t, Page p)
		{
			if (this._HideDuplicates == null)
				return false;
			if (t == tbr.PreviousText && p == tbr.PreviousPage)
				return true;

			return false;
		}
示例#11
0
		void ResetPrevious(TextboxRuntime tbr)
		{
			tbr.PreviousText=null;	
			tbr.PreviousPage=null;	
		}