private void DrawBorder(PageItem pi, Graphics g, RectangleF r) { if (r.Height <= 0 || r.Width <= 0) // no bounding box to use { return; } StyleInfo si = pi.SI; DrawLine(si.BColorTop, si.BStyleTop, si.BWidthTop, g, r.X, r.Y, r.Right, r.Y); DrawLine(si.BColorRight, si.BStyleRight, si.BWidthRight, g, r.Right, r.Y, r.Right, r.Bottom); DrawLine(si.BColorLeft, si.BStyleLeft, si.BWidthLeft, g, r.X, r.Y, r.X, r.Bottom); DrawLine(si.BColorBottom, si.BStyleBottom, si.BWidthBottom, g, r.X, r.Bottom, r.Right, r.Bottom); return; }
private void AddObjectInternal(PageItem pi) { pi.Page = this; pi.ItemNumber = _items.Count; if (_items.Count == 0) { _lastZIndex = pi.ZIndex; } else if (_lastZIndex != pi.ZIndex) { _needSort = true; } // adjust the page item locations pi.X += _xOffset; pi.Y += _yOffset; if (pi is PageLine) { PageLine pl = pi as PageLine; pl.X2 += _xOffset; pl.Y2 += _yOffset; } else if (pi is PagePolygon) { PagePolygon pp = pi as PagePolygon; for (int i = 0; i < pp.Points.Length; i++) { pp.Points[i].X += _xOffset; pp.Points[i].Y += _yOffset; } } else if (pi is PageCurve) { PageCurve pc = pi as PageCurve; for (int i = 0; i < pc.Points.Length; i++) { pc.Points[i].X += _xOffset; pc.Points[i].Y += _yOffset; } } }
private void AddObjectInternal(PageItem pi) { pi.ItemNumber = _items.Count; if (_items.Count == 0) { _lastZIndex = pi.ZIndex; } else if (_lastZIndex != pi.ZIndex) { _needSort = true; } // adjust the page item locations pi.X += _xOffset; pi.Y += _yOffset; if (pi is PageLine) { PageLine pl = pi as PageLine; pl.X2 += _xOffset; pl.Y2 += _yOffset; } }
private void tbFind_TextChanged(object sender, EventArgs e) { lStatus.Text = ""; position = null; // reset position when edit changes?? todo not really _Viewer.HighlightText = tbFind.Text; ckHighlightAll.Enabled = bFindNext.Enabled = bFindPrevious.Enabled = tbFind.Text.Length > 0; if (tbFind.Text.Length > 0) FindNext(); }
private static int ComparePageItemByPageXY(PageItem pi1, PageItem pi2) { if (pi1.Page.Count != pi2.Page.Count) return pi1.Page.Count - pi2.Page.Count; if (pi1.Y != pi2.Y) { return Convert.ToInt32((pi1.Y - pi2.Y) * 1000); } return Convert.ToInt32((pi1.X - pi2.X) * 1000); }
/// <summary> /// Draw- simple draw of an entire page. Useful when printing or creating an image. /// </summary> /// <param name="g"></param> /// <param name="page"></param> /// <param name="clipRectangle"></param> public void Draw(Graphics g, int page, System.Drawing.Rectangle clipRectangle, bool drawBackground, PointF pageOffset) { DpiX = g.DpiX; // this can change (e.g. printing graphics context) DpiY = g.DpiY; _HighlightText = null; _HighlightItem = null; _HighlightAll = false; _HighlightCaseSensitive = false; // g.InterpolationMode = InterpolationMode.HighQualityBilinear; // try to unfuzz charts g.PageUnit = GraphicsUnit.Pixel; g.ScaleTransform(1, 1); if (!pageOffset.IsEmpty) // used when correcting for non-printable area on paper { g.TranslateTransform(pageOffset.X, pageOffset.Y); } _left = 0; _top = 0; _hScroll = 0; _vScroll = 0; RectangleF r = new RectangleF(clipRectangle.X, clipRectangle.Y, clipRectangle.Width, clipRectangle.Height); if (drawBackground) g.FillRectangle(Brushes.White, PixelsX(_left), PixelsY(_top), PixelsX(_pgs.PageWidth), PixelsY(_pgs.PageHeight)); ProcessPage(g, _pgs[page], r, false); }
internal HitListEntry(RectangleF r, PageItem pitem) { rect = r; pi = pitem; poly = null; }
internal void SetPagePositionAndStyle(Report rpt, PageItem pi, Row row) { WorkClass wc = GetWC(rpt); pi.X = GetOffsetCalc(rpt) + LeftCalc(rpt); if (this._TC != null) { // must be part of a table Table t = _TC.OwnerTable; int colindex = _TC.ColIndex; // Calculate width: add up all columns within the column span float width=0; TableColumn tc; for (int ci=colindex; ci < colindex + _TC.ColSpan; ci++) { tc = (TableColumn) (t.TableColumns.Items[ci]); width += tc.Width.Points; } pi.W = width; pi.Y = 0; TableRow tr = (TableRow) (_TC.Parent.Parent); pi.H = tr.HeightCalc(rpt); // this is a cached item; note tr.HeightOfRow must already be called on row } else if (wc.MC != null) { // must be part of a matrix pi.W = wc.MC.Width; pi.Y = 0; pi.H = wc.MC.Height; } else if (pi is PageLine) { // don't really handle if line is part of table??? TODO PageLine pl = (PageLine) pi; if (Top != null) pl.Y = this.Gap(rpt); // y will get adjusted when pageitem added to page float y2 = pl.Y; if (Height != null) y2 += Height.Points; pl.Y2 = y2; pl.X2 = pl.X; if (Width != null) pl.X2 += Width.Points; } else { // not part of a table or matrix if (Top != null) pi.Y = this.Gap(rpt); // y will get adjusted when pageitem added to page if (Height != null) pi.H = Height.Points; else pi.H = this.HeightOrOwnerHeight; if (Width != null) pi.W = Width.Points; else pi.W = this.WidthOrOwnerWidth(rpt); } if (Style != null) pi.SI = Style.GetStyleInfo(rpt, row); else pi.SI = new StyleInfo(); // this will just default everything pi.ZIndex = this.ZIndex; // retain the zindex of the object // Catch any action needed if (this._Action != null) { pi.BookmarkLink = _Action.BookmarkLinkValue(rpt, row); pi.HyperLink = _Action.HyperLinkValue(rpt, row); } if (this._Bookmark != null) pi.Bookmark = _Bookmark.EvaluateString(rpt, row); if (this._ToolTip != null) pi.Tooltip = _ToolTip.EvaluateString(rpt, row); }
public void AddObject(PageItem pi) { AddObjectInternal(pi); _items.Add(pi); }
private void AddObjectInternal(PageItem pi) { pi.ItemNumber = _items.Count; if (_items.Count == 0) _lastZIndex = pi.ZIndex; else if (_lastZIndex != pi.ZIndex) _needSort = true; // adjust the page item locations pi.X += _xOffset; pi.Y += _yOffset; if (pi is PageLine) { PageLine pl = pi as PageLine; pl.X2 += _xOffset; pl.Y2 += _yOffset; } }
/// <summary> /// Find locates the next string after the passed location. Use ScrollToPageItem to then /// reposition the Viewer on that item /// </summary> /// <param name="search">Text to search for</param> /// <param name="position">PageItem after which to start search. null starts at beginning</param> /// <param name="options">Multiple options can be or'ed together.</param> /// <returns>null if not found</returns> public PageItem Find(string search, PageItem position, RdlViewerFinds options) { LoadPageIfNeeded(); if (_pgs == null || _pgs.Count == 0) // no report nothing to find return null; // initialize the loop direction and starting point int increment; int sPage; int sItem; if (((options & RdlViewerFinds.Backward) == RdlViewerFinds.Backward)) { // set to backward direction increment = -1; // go backwards sPage = _pgs.PageCount - 1; // start at last page sItem = _pgs[sPage].Count - 1; // start at bottom of last page } else { // set to forward direction increment = 1; sPage = 0; sItem = 0; } bool bFirst = true; if (position != null) { sPage = position.Page.PageNumber - 1; // start on same page as current sItem = position.ItemNumber + increment; // but on the item after/before the current one } if (!((options & RdlViewerFinds.MatchCase) == RdlViewerFinds.MatchCase)) search = search.ToLower(); // should use Culture!!! todo PageItem found = null; for (int pi = sPage; pi < _pgs.Count && found == null && pi >= 0; pi = pi + increment) { Page p = _pgs[pi]; if (bFirst) // The first time sItem is already set bFirst = false; else { if (increment < 0) // we're going backwards? sItem = p.Count - 1; // yes, start at bottom of page else sItem = 0; // no, start at top of page } for (int pii = sItem; pii < p.Count && found == null && pii >= 0; pii = pii + increment) { PageText pt = p[pii] as PageText; if (pt == null) continue; if ((options & RdlViewerFinds.MatchCase) == RdlViewerFinds.MatchCase) { if (pt.Text.Contains(search)) found = pt; } else { if (pt.Text.ToLower().Contains(search)) found = pt; } } } return found; }
public void ScrollToPageItem(PageItem pi) { LoadPageIfNeeded(); if (_pgs == null || _pgs.PageCount <= 0) // nothing to scroll to return; int sPage = 0; int sItem = 0; int itemVerticalOffset = 0; int itemHorzOffset = 0; int height = 0; int width = 0; if (pi != null) { sPage = pi.Page.PageNumber - 1; sItem = pi.ItemNumber; RectangleF rect = new RectangleF(PixelsX(pi.X + _leftMargin), PixelsY(pi.Y), PixelsX(pi.W), PixelsY(pi.H)); itemVerticalOffset = (int)(rect.Top); itemHorzOffset = (int)rect.Left; width = (int)rect.Width; height = (int)(rect.Height); } // set the vertical scroll int scroll = (int)((double)_vScroll.Maximum * sPage / _pgs.PageCount) + itemVerticalOffset; // do we need to scroll vertically? if (!(_vScroll.Value <= scroll && _vScroll.Value + _DrawPanel.Height / this.Zoom >= scroll + height)) { // item isn't on visible part of window; force scroll _vScroll.Value = Math.Min(scroll, Math.Max(0, _vScroll.Maximum - _DrawPanel.Height)); SetScrollControlsV(); ScrollEventArgs sa = new ScrollEventArgs(ScrollEventType.ThumbPosition, _vScroll.Maximum + 1); // position is intentionally wrong VerticalScroll(_vScroll, sa); } // set the horizontal scroll scroll = itemHorzOffset; // do we need to scroll horizontally? if (!(_hScroll.Value <= scroll && _hScroll.Value + _DrawPanel.Width / this.Zoom >= scroll + width)) { // item isn't on visible part of window; force scroll _hScroll.Value = Math.Min(scroll, Math.Max(0, _hScroll.Maximum - _DrawPanel.Width)); SetScrollControlsH(); ScrollEventArgs sa = new ScrollEventArgs(ScrollEventType.ThumbPosition, _hScroll.Maximum + 1); // position is intentionally wrong HorizontalScroll(_hScroll, sa); } }
internal void SetPagePositionAndStyle(Report rpt, PageItem pi, Row row) { WorkClass wc = GetWC(rpt); pi.X = GetOffsetCalc(rpt) + LeftCalc(rpt); if (this._TC != null) { // must be part of a table Table t = _TC.OwnerTable; int colindex = _TC.ColIndex; // Calculate width: add up all columns within the column span float width = 0; TableColumn tc; for (int ci = colindex; ci < colindex + _TC.ColSpan; ci++) { tc = (TableColumn)(t.TableColumns.Items[ci]); width += tc.Width.Points; } pi.W = width; pi.Y = 0; TableRow tr = (TableRow)(_TC.Parent.Parent); pi.H = tr.HeightCalc(rpt); // this is a cached item; note tr.HeightOfRow must already be called on row } else if (wc.MC != null) { // must be part of a matrix pi.W = wc.MC.Width; pi.Y = 0; pi.H = wc.MC.Height; } else if (pi is PageLine) { // don't really handle if line is part of table??? TODO PageLine pl = (PageLine)pi; if (Top != null) { pl.Y = this.Gap(rpt); // y will get adjusted when pageitem added to page } float y2 = pl.Y; if (Height != null) { y2 += Height.Points; } pl.Y2 = y2; pl.X2 = pl.X; if (Width != null) { pl.X2 += Width.Points; } } else { // not part of a table or matrix if (Top != null) { pi.Y = this.Gap(rpt); // y will get adjusted when pageitem added to page } if (Height != null) { pi.H = Height.Points; } else { pi.H = this.HeightOrOwnerHeight; } if (Width != null) { pi.W = Width.Points; } else { pi.W = this.WidthOrOwnerWidth(rpt); } } if (Style != null) { pi.SI = Style.GetStyleInfo(rpt, row); } else { pi.SI = new StyleInfo(); // this will just default everything } pi.ZIndex = this.ZIndex; // retain the zindex of the object // Catch any action needed if (this._Action != null) { pi.BookmarkLink = _Action.BookmarkLinkValue(rpt, row); pi.HyperLink = _Action.HyperLinkValue(rpt, row); } if (this._ToolTip != null) { pi.Tooltip = _ToolTip.EvaluateString(rpt, row); } }
public void FindNext() { if (_Viewer == null) throw new ApplicationException(Strings.RdlViewerFind_ErrorA_PropertyMustSetPriorFindNext); if (tbFind.Text.Length == 0) // must have something to find return; RdlViewerFinds findOptions = ckMatchCase.Checked ? RdlViewerFinds.MatchCase : RdlViewerFinds.None; bool begin = position == null; position = _Viewer.Find(tbFind.Text, position, findOptions); if (position == null) { if (!begin) // if we didn't start from beginning already; try from beginning position = _Viewer.Find(tbFind.Text, position, findOptions); lStatus.Text = position == null ? Strings.RdlViewerFind_FindNext_Phrase_not_found : Strings.RdlViewerFind_FindNext_Reached_end_of_report; _Viewer.HighlightPageItem = position; if (position != null) _Viewer.ScrollToPageItem(position); } else { lStatus.Text = ""; _Viewer.HighlightPageItem = position; _Viewer.ScrollToPageItem(position); } }
private void DrawBorder(PageItem pi, Cairo.Context g, Cairo.Rectangle r) { if (r.Height <= 0 || r.Width <= 0) // no bounding box to use return; double right = r.X + r.Width; double bottom = r.Y + r.Height; StyleInfo si = pi.SI; DrawLine(si.BColorTop.ToCairoColor(), si.BStyleTop, si.BWidthTop, g, r.X, r.Y, right, r.Y); DrawLine(si.BColorRight.ToCairoColor(), si.BStyleRight, si.BWidthRight, g, right, r.Y, right, bottom); DrawLine(si.BColorLeft.ToCairoColor(), si.BStyleLeft, si.BWidthLeft, g, r.X, r.Y, r.X, bottom); DrawLine(si.BColorBottom.ToCairoColor(), si.BStyleBottom, si.BWidthBottom, g, r.X, bottom, right, bottom); //if (si.) { // g.DrawRoundedRectangle (r, 8, si.BColorTop.ToCairoColor (), 1); //} }
public void FindNext() { if (_Viewer == null) throw new ApplicationException("Viewer property must be set prior to issuing FindNext."); if (tbFind.Text.Length == 0) // must have something to find return; RdlViewerFinds findOptions = ckMatchCase.Checked ? RdlViewerFinds.MatchCase : RdlViewerFinds.None; bool begin = position == null; position = _Viewer.Find(tbFind.Text, position, findOptions); if (position == null) { if (!begin) // if we didn't start from beginning already; try from beginning position = _Viewer.Find(tbFind.Text, position, findOptions); lStatus.Text = position == null ? "Phrase not found" : "Reached end of report, continued from top"; _Viewer.HighlightPageItem = position; if (position != null) _Viewer.ScrollToPageItem(position); } else { lStatus.Text = ""; _Viewer.HighlightPageItem = position; _Viewer.ScrollToPageItem(position); } }
public void InsertObject(PageItem pi) { AddObjectInternal(pi); _items.Insert(0, pi); }
private string GetName(PageItem pi) { _UniqueName++; return string.Format("n{0}", _UniqueName); }
private void DrawBorder(PageItem pi, StringBuilder sb, Rectangle r) { if (r.Height <= 0 || r.Width <= 0) // no bounding box to use return; StyleInfo si = pi.SI; DrawLine(si.BColorTop, si.BStyleTop, PixelsX(si.BWidthTop), sb, r.X, r.Y, r.Right, r.Y); DrawLine(si.BColorRight, si.BStyleRight, PixelsX(si.BWidthRight), sb, r.Right, r.Y, r.Right, r.Bottom); DrawLine(si.BColorLeft, si.BStyleLeft, PixelsX(si.BWidthLeft), sb, r.X, r.Y, r.X, r.Bottom); DrawLine(si.BColorBottom, si.BStyleBottom, PixelsX(si.BWidthBottom), sb, r.X, r.Bottom, r.Right, r.Bottom); return; }
private void DrawBorder(PageItem pi, Xwt.Drawing.Context g, Xwt.Rectangle r) { if (r.Height <= 0 || r.Width <= 0) // no bounding box to use return; double right = r.X + r.Width; double bottom = r.Y + r.Height; StyleInfo si = pi.SI; Xwt.Drawing.Color ec = XwtColor.SystemColorToXwtColor(si.BackgroundGradientEndColor); DrawLine(XwtColor.SystemColorToXwtColor(si.BColorTop), si.BStyleTop, si.BWidthTop, g, r.X, r.Y, right, r.Y); DrawLine(XwtColor.SystemColorToXwtColor(si.BColorRight), si.BStyleRight, si.BWidthRight, g, right, r.Y, right, bottom); DrawLine(XwtColor.SystemColorToXwtColor(si.BColorLeft), si.BStyleLeft, si.BWidthLeft, g, r.X, r.Y, r.X, bottom); DrawLine(XwtColor.SystemColorToXwtColor(si.BColorBottom), si.BStyleBottom, si.BWidthBottom, g, r.X, bottom, right, bottom); }
internal HitListEntry(PagePolygon pp, float x, float y, PageDrawing pd) { pi = pp; poly = new PointF[pp.Points.Length]; for (int i = 0; i < pp.Points.Length; i++) { poly[i].X = pd.PixelsX(pp.Points[i].X + x); poly[i].Y = pd.PixelsY(pp.Points[i].Y + y); } rect = RectangleF.Empty; }
private void AddObjectInternal(PageItem pi) { pi.Page = this; pi.ItemNumber = _items.Count; if (_items.Count == 0) _lastZIndex = pi.ZIndex; else if (_lastZIndex != pi.ZIndex) _needSort = true; // adjust the page item locations pi.X += _xOffset; pi.Y += _yOffset; if (pi is PageLine) { PageLine pl = pi as PageLine; pl.X2 += _xOffset; pl.Y2 += _yOffset; } else if (pi is PagePolygon) { PagePolygon pp = pi as PagePolygon; for (int i = 0; i < pp.Points.Length; i++ ) { pp.Points[i].X += _xOffset; pp.Points[i].Y += _yOffset; } } else if (pi is PageCurve) { PageCurve pc = pi as PageCurve; for (int i = 0; i < pc.Points.Length; i++) { pc.Points[i].X += _xOffset; pc.Points[i].Y += _yOffset; } } }
/// <summary> /// Draw: accounting for scrolling and zoom factors /// </summary> /// <param name="g"></param> /// <param name="zoom"></param> /// <param name="leftOffset"></param> /// <param name="pageGap"></param> /// <param name="hScroll"></param> /// <param name="vScroll"></param> /// <param name="clipRectangle"></param> public void Draw(Graphics g, float zoom, float leftOffset, float pageGap, float hScroll, float vScroll, System.Drawing.Rectangle clipRectangle, PageItem highLightItem, string highLight, bool highLightCaseSensitive, bool highLightAll) { // init for mouse handling _HitList.Clear(); // remove all items from list _LastZoom = zoom; _HighlightItem = highLightItem; _HighlightText = highLight; _HighlightCaseSensitive = highLightCaseSensitive; _HighlightAll = highLightAll; if (_pgs == null) { // No pages; means nothing to draw g.FillRectangle(Brushes.White, clipRectangle); return; } g.PageUnit = GraphicsUnit.Pixel; g.ScaleTransform(zoom, zoom); DpiX = g.DpiX; DpiY = g.DpiY; // Zoom affects how much will show on the screen. Adjust our perceived clipping rectangle // to account for it. RectangleF r; r = new RectangleF((clipRectangle.X) / zoom, (clipRectangle.Y) / zoom, (clipRectangle.Width) / zoom, (clipRectangle.Height) / zoom); // Calculate the top of the page int fpage = (int)(vScroll / (_pgs.PageHeight + pageGap)); int lpage = (int)((vScroll + r.Height) / (_pgs.PageHeight + pageGap)) + 1; if (fpage >= _pgs.PageCount) return; if (lpage >= _pgs.PageCount) lpage = _pgs.PageCount - 1; _hScroll = hScroll; _left = leftOffset; _top = pageGap; // Loop thru the visible pages for (int p = fpage; p <= lpage; p++) { _vScroll = vScroll - p * (_pgs.PageHeight + pageGap); System.Drawing.Rectangle pr = new System.Drawing.Rectangle((int)PixelsX(_left - _hScroll), (int)PixelsY(_top - _vScroll), (int)PixelsX(_pgs.PageWidth), (int)PixelsY(_pgs.PageHeight)); g.FillRectangle(Brushes.White, pr); ProcessPage(g, _pgs[p], r, true); // Draw the page outline using (Pen pn = new Pen(Brushes.Black, 1)) { int z3 = Math.Min((int)(3f / zoom), 3); if (z3 <= 0) z3 = 1; int z4 = Math.Min((int)(4f / zoom), 4); if (z4 <= 0) z4 = 1; g.DrawRectangle(pn, pr); // outline of page g.FillRectangle(Brushes.Black, pr.X + pr.Width, pr.Y + z3, z3, pr.Height); // right side of page g.FillRectangle(Brushes.Black, pr.X + z3, pr.Y + pr.Height, pr.Width, z4); // bottom of page } } }
private void RdlViewerFind_VisibleChanged(object sender, EventArgs e) { lStatus.Text = ""; if (this.Visible) { _Viewer.HighlightText = tbFind.Text; tbFind.Focus(); FindNext(); // and go find the contents of the textbox } else { // turn off any highlighting when find control not visible _Viewer.HighlightPageItem = position = null; _Viewer.HighlightText = null; _Viewer.HighlightAll = false; ckHighlightAll.Checked = false; } }
private void DrawBorder(PageItem pi, Graphics g, RectangleF r) { if (pi.GetType().Name.Equals("PagePie")) return; if (r.Height <= 0 || r.Width <= 0) // no bounding box to use return; StyleInfo si = pi.SI; DrawLine(si.BColorTop, si.BStyleTop, si.BWidthTop, g, r.X, r.Y, r.Right, r.Y); DrawLine(si.BColorRight, si.BStyleRight, si.BWidthRight, g, r.Right, r.Y, r.Right, r.Bottom); DrawLine(si.BColorLeft, si.BStyleLeft, si.BWidthLeft, g, r.X, r.Y, r.X, r.Bottom); DrawLine(si.BColorBottom, si.BStyleBottom, si.BWidthBottom, g, r.X, r.Bottom, r.Right, r.Bottom); return; }
public void AddObject(PageItem pi) { // adjust the page item locations pi.X += _xOffset; pi.Y += _yOffset; if (pi is PageLine) { PageLine pl = pi as PageLine; pl.X2 += _xOffset; pl.Y2 += _yOffset; } _items.Add(pi); }