List<TableGroup> _Items; // list of TableGroup entries #endregion Fields #region Constructors internal TableGroups(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { TableGroup tg; _Items = new List<TableGroup>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "TableGroup": tg = new TableGroup(r, this, xNodeLoop); break; default: tg=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown TableGroups element '" + xNodeLoop.Name + "' ignored."); break; } if (tg != null) _Items.Add(tg); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For TableGroups at least one TableGroup is required."); else _Items.TrimExcess(); }
List<GroupExpression> _Items; // list of GroupExpression #endregion Fields #region Constructors internal GroupExpressions(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { GroupExpression g; _Items = new List<GroupExpression>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "GroupExpression": g = new GroupExpression(r, this, xNodeLoop); break; default: g=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown GroupExpressions element '" + xNodeLoop.Name + "' ignored."); break; } if (g != null) _Items.Add(g); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "GroupExpressions require at least one GroupExpression be defined."); else _Items.TrimExcess(); }
string _key; // key for cache when scope is dataset we can cache the result #endregion Fields #region Constructors /// <summary> /// Aggregate function: Stdevp = (sqrt(n sum(square(x)) - square((sum(x))) / n*n) /// Stdev assumes values are a sample of the population of data. If the data /// is the entire representation then use Stdevp. /// /// Return type is decimal for decimal expressions and double for all /// other expressions. /// </summary> public FunctionAggrStdevp(List<ICacheData> dataCache, IExpr e, object scp) : base(e, scp) { _key = "aggrstdevp" + Interlocked.Increment(ref Parser.Counter).ToString(); dataCache.Add(this); }
List<SeriesGrouping> _Items; // list of SeriesGrouping #endregion Fields #region Constructors internal SeriesGroupings(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { SeriesGrouping sg; _Items = new List<SeriesGrouping>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "SeriesGrouping": sg = new SeriesGrouping(r, this, xNodeLoop); break; default: sg=null; // don't know what this is break; } if (sg != null) _Items.Add(sg); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For SeriesGroupings at least one SeriesGrouping is required."); else _Items.TrimExcess(); }
List<Filter> _Items; // list of Filter #endregion Fields #region Constructors internal Filters(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { Filter f; _Items = new List<Filter>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Filter": f = new Filter(r, this, xNodeLoop); break; default: f=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown Filters element '" + xNodeLoop.Name + "' ignored."); break; } if (f != null) _Items.Add(f); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "Filters require at least one Filter be defined."); else _Items.TrimExcess(); }
List<CodeModule> _Items; // list of code module #endregion Fields #region Constructors internal CodeModules(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Items = new List<CodeModule>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; if (xNodeLoop.Name == "CodeModule") { CodeModule cm = new CodeModule(r, this, xNodeLoop); _Items.Add(cm); } else { // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown CodeModules element '" + xNodeLoop.Name + "' ignored."); } } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For CodeModules at least one CodeModule is required."); else _Items.TrimExcess(); }
internal RowGroupings(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { RowGrouping g; _Items = new List<RowGrouping>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "RowGrouping": g = new RowGrouping(r, this, xNodeLoop); break; default: g=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown RowGroupings element '" + xNodeLoop.Name + "' ignored."); break; } if (g != null) _Items.Add(g); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For RowGroupings at least one RowGrouping is required."); else { _Items.TrimExcess(); _StaticCount = GetStaticCount(); } }
List<MatrixRow> _Items; // list of MatrixRow #endregion Fields #region Constructors internal MatrixRows(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { MatrixRow m; _Items = new List<MatrixRow>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "MatrixRow": m = new MatrixRow(r, this, xNodeLoop); break; default: m=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown MatrixRows element '" + xNodeLoop.Name + "' ignored."); break; } if (m != null) _Items.Add(m); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For MatrixRows at least one MatrixRow is required."); else _Items.TrimExcess(); }
string _key; // key used for caching value #endregion Fields #region Constructors /// <summary> /// Aggregate function: CountDistinct /// /// Return type is double /// </summary> public FunctionAggrCountDistinct(List<ICacheData> dataCache, IExpr e, object scp) : base(e, scp) { _key = "countdistinct" + Interlocked.Increment(ref Parser.Counter).ToString(); dataCache.Add(this); }
List<SortBy> _Items; // list of SortBy #endregion Fields #region Constructors internal Sorting(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { SortBy s; _Items = new List<SortBy>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "SortBy": s = new SortBy(r, this, xNodeLoop); break; default: s=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown Sorting element '" + xNodeLoop.Name + "' ignored."); break; } if (s != null) _Items.Add(s); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "Sorting requires at least one SortBy be defined."); else _Items.TrimExcess(); }
List<StaticMember> _Items; // list of StaticMember #endregion Fields #region Constructors internal StaticCategories(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { StaticMember sm; _Items = new List<StaticMember>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "StaticMember": sm = new StaticMember(r, this, xNodeLoop); break; default: sm=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown StaticCategories element '" + xNodeLoop.Name + "' ignored."); break; } if (sm != null) _Items.Add(sm); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For StaticCategories at least one StaticMember is required."); else _Items.TrimExcess(); }
List<ChartSeries> _Items; // list of chart series #endregion Fields #region Constructors internal ChartData(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { ChartSeries cs; _Items = new List<ChartSeries>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "ChartSeries": cs = new ChartSeries(r, this, xNodeLoop); break; default: cs=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown ChartData element '" + xNodeLoop.Name + "' ignored."); break; } if (cs != null) _Items.Add(cs); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For ChartData at least one ChartSeries is required."); else _Items.TrimExcess(); }
List<QueryParameter> _Items; // list of QueryParameter #endregion Fields #region Constructors internal QueryParameters(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _ContainsArray = false; QueryParameter q; _Items = new List<QueryParameter>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "QueryParameter": q = new QueryParameter(r, this, xNodeLoop); break; default: q=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown QueryParameters element '" + xNodeLoop.Name + "' ignored."); break; } if (q != null) _Items.Add(q); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For QueryParameters at least one QueryParameter is required."); else _Items.TrimExcess(); }
List<TableCell> _Items; // list of TableCell #endregion Fields #region Constructors internal TableCells(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { TableCell tc; _Items = new List<TableCell>(); // Loop thru all the child nodes int colIndex=0; // keep track of the column numbers foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "TableCell": tc = new TableCell(r, this, xNodeLoop, colIndex); colIndex += tc.ColSpan; break; default: tc=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown TableCells element '" + xNodeLoop.Name + "' ignored."); break; } if (tc != null) _Items.Add(tc); } if (_Items.Count > 0) _Items.TrimExcess(); }
List<DataValue> _Items; // list of DataValue #endregion Fields #region Constructors internal DataValues(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { DataValue dv; _Items = new List<DataValue>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "DataValue": dv = new DataValue(r, this, xNodeLoop); break; default: dv=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown DataValues element '" + xNodeLoop.Name + "' ignored."); break; } if (dv != null) _Items.Add(dv); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For DataValues at least one DataValue is required."); else _Items.TrimExcess(); }
List<SubreportParameter> _Items; // list of SubreportParameter #endregion Fields #region Constructors internal SubReportParameters(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { SubreportParameter rp; _Items = new List<SubreportParameter>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Parameter": rp = new SubreportParameter(r, this, xNodeLoop); break; default: rp=null; // don't know what this is // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown SubreportParameters element '" + xNodeLoop.Name + "' ignored."); break; } if (rp != null) _Items.Add(rp); } if (_Items.Count > 0) _Items.TrimExcess(); }
private TypeCode _tc; // type of result: decimal or double #endregion Fields #region Constructors /// <summary> /// Aggregate function: Running Max returns the highest value to date within a group /// Return type is same as input expression /// </summary> public FunctionAggrRvMax(List<ICacheData> dataCache, IExpr e, object scp) : base(e, scp) { _key = "aggrrvmax" + Interlocked.Increment(ref Parser.Counter).ToString(); // Determine the result _tc = e.GetTypeCode(); dataCache.Add(this); }
private TypeCode _tc; // type of result: decimal or double #endregion Fields #region Constructors /// <summary> /// Aggregate function: RunningValue Sum returns the sum of all values of the /// expression within the scope up to that row /// Return type is decimal for decimal expressions and double for all /// other expressions. /// </summary> public FunctionAggrRvSum(List<ICacheData> dataCache, IExpr e, object scp) : base(e, scp) { _key = "aggrrvsum" + Interlocked.Increment(ref Parser.Counter).ToString(); // Determine the result _tc = e.GetTypeCode(); if (_tc != TypeCode.Decimal) // if not decimal _tc = TypeCode.Double; // force result to double dataCache.Add(this); }
List<ReportClass> _Items; // list of report class #endregion Fields #region Constructors internal Classes(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Items = new List<ReportClass>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; if (xNodeLoop.Name == "Class") { ReportClass rc = new ReportClass(r, this, xNodeLoop); _Items.Add(rc); } } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For Classes at least one Class is required."); else _Items.TrimExcess(); }
public MemoryStreamGen(string prefix, string suffix, string extension) { Prefix = prefix; Suffix = suffix; Extension = extension; _io = new MemoryStream(); _MemoryList = new List<MemoryStream>(); _MemoryList.Add(_io); _MemoryNames = new List<string>(); // create the first name string unique = Interlocked.Increment(ref MemoryStreamGen.Counter).ToString(); string name; if (Prefix == null) name = "a" + Extension + "&unique=" + unique; else name = Prefix + Extension + "&unique=" + unique; _MemoryNames.Add(name); }
List<EmbeddedImage> _Items; // list of EmbeddedImage #endregion Fields #region Constructors internal EmbeddedImages(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Items = new List<EmbeddedImage>(); // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; if (xNodeLoop.Name == "EmbeddedImage") { EmbeddedImage ei = new EmbeddedImage(r, this, xNodeLoop); _Items.Add(ei); } else this.OwnerReport.rl.LogError(4, "Unknown Report element '" + xNodeLoop.Name + "' ignored."); } if (_Items.Count == 0) OwnerReport.rl.LogError(8, "For EmbeddedImages at least one EmbeddedImage is required."); else _Items.TrimExcess(); }
private void menuTableInsertGroup_Click(object sender, EventArgs e) { if (_DrawPanel.SelectedCount != 1) return; XmlNode cNode = _DrawPanel.SelectedList[0]; _Undo.StartUndoGroup("Insert Table Group"); XmlNode tblGroup = _DrawPanel.InsertTableGroup(cNode); if (tblGroup == null) { _Undo.EndUndoGroup(false); return; } List<XmlNode> ar = new List<XmlNode>(); // need to put this is a list for dialog to handle ar.Add(tblGroup); PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping); try { DialogResult dr = pd.ShowDialog(this); if (pd.Changed || dr == DialogResult.OK) { _Undo.EndUndoGroup(true); ReportChanged(this, new EventArgs()); _DrawPanel.Invalidate(); } else { _DrawPanel.DeleteTableGroup(tblGroup); _Undo.EndUndoGroup(false); } } finally { pd.Dispose(); } }
void BuildMethods(List<string> ar, Type ft, string prefix) { if (ft == null) return; MethodInfo[] mis = ft.GetMethods(BindingFlags.Static | BindingFlags.Public); foreach (MethodInfo mi in mis) { // Add the node to the tree string name = BuildMethodName(mi); if (name != null) ar.Add(prefix + name); } }
private void BuildContextMenus() { // EDIT MENU menuCopy = new MenuItem("&Copy", new EventHandler(this.menuCopy_Click)); menuPaste = new MenuItem("Paste", new EventHandler(this.menuPaste_Click)); menuDelete = new MenuItem("&Delete", new EventHandler(this.menuDelete_Click)); menuFSep1 = new MenuItem("-"); menuSelectAll = new MenuItem("Select &All", new EventHandler(this.menuSelectAll_Click)); menuFSep2 = new MenuItem("-"); List<MenuItem> insertItems = new List<MenuItem>(); insertItems.Add(new MenuItem("&Chart...", new EventHandler(this.menuInsertChart_Click))); insertItems.Add(new MenuItem("&Grid", new EventHandler(this.menuInsertGrid_Click))); insertItems.Add(new MenuItem("&Image", new EventHandler(this.menuInsertImage_Click))); insertItems.Add(new MenuItem("&Line", new EventHandler(this.menuInsertLine_Click))); insertItems.Add(new MenuItem("&List", new EventHandler(this.menuInsertList_Click))); insertItems.Add(new MenuItem("&Matrix...", new EventHandler(this.menuInsertMatrix_Click))); insertItems.Add(new MenuItem("&Rectangle", new EventHandler(this.menuInsertRectangle_Click))); insertItems.Add(new MenuItem("&Subreport", new EventHandler(this.menuInsertSubreport_Click))); insertItems.Add(new MenuItem("Ta&ble...", new EventHandler(this.menuInsertTable_Click))); insertItems.Add(new MenuItem("&Textbox", new EventHandler(this.menuInsertTextbox_Click))); // Now add any CustomReportItems BuildContextMenusCustom(insertItems); menuInsert = new MenuItem("&Insert"); menuInsert.MenuItems.AddRange(insertItems.ToArray()); menuProperties = new MenuItem("&Properties...", new EventHandler(this.menuProperties_Click)); // // Create chart context menu and add array of sub-menu items menuPropertiesLegend = new MenuItem("Legend...", new EventHandler(this.menuPropertiesLegend_Click)); menuPropertiesCategoryAxis = new MenuItem("Category (X) Axis...", new EventHandler(this.menuPropertiesCategoryAxis_Click)); menuPropertiesValueAxis = new MenuItem("Value (Y) Axis...", new EventHandler(this.menuPropertiesValueAxis_Click)); menuPropertiesCategoryAxisTitle = new MenuItem("Category (X) Axis Title...", new EventHandler(this.menuPropertiesCategoryAxisTitle_Click)); menuPropertiesValueAxisTitle = new MenuItem("Value (Y) Axis Title...", new EventHandler(this.menuPropertiesValueAxisTitle_Click)); menuPropertiesValueAxis2Title = new MenuItem("Value (Y) Axis (Right) Title...", new EventHandler(this.menuPropertiesValueAxis2Title_Click)); menuPropertiesChartTitle = new MenuItem("Title...", new EventHandler(this.menuPropertiesChartTitle_Click)); }
private void BuildContextMenusCustom(List<MenuItem> items) { try { string[] sa = EngineConfig.GetCustomReportTypes(); if (sa == null || sa.Length == 0) return; items.Add(new MenuItem("-")); // put a separator // Add the custom report items to the insert menu foreach (string m in sa) { MenuItem mi = new MenuItem(m+"...", new EventHandler(this.menuInsertCustomReportItem_Click)); mi.Tag = m; items.Add(mi); } } catch (Exception ex) { MessageBox.Show(string.Format("Error building CustomReportItem menus: {0}", ex.Message), "Insert", MessageBoxButtons.OK); } }
List<CustomProperty> CustomProperties(XmlNode xNode) { if (!xNode.HasChildNodes) return null; List<CustomProperty> cps = new List<CustomProperty>(xNode.ChildNodes.Count); foreach (XmlNode xNodeLoop in xNode.ChildNodes) { switch (xNodeLoop.Name) { case "CustomProperty": CustomProperty cp = CustomProperty(xNodeLoop); if (cp != null) cps.Add(cp); break; default: OwnerReport.rl.LogError(4, "Unknown CustomProperties element " + xNodeLoop.Name + " ignored."); break; } } return cps; }
internal void PositioningFinalPass(int i, List<ReportItem> items) { if (items.Count == 1 || i==0) // Nothing to do if only one item in list or 1st item in list return; int x = this.Left == null? 0: this.Left.Size; int w = PositioningWidth(this); int right = x + w; int y = (this.Top == null? 0: this.Top.Size); if (this is Line) { // normalize the width if (w < 0) { x -= w; w = -w; } } this._YParents = new List<ReportItem>(); int maxParents = 100; // heuristic to limit size of parents; otherwise processing in // extreme cases can blow up for (int ti = i-1; ti >= 0 && maxParents > 0; ti--) { ReportItem ri = items[ti]; int xw = ri.Left == null? 0: ri.Left.Size; int w2 = PositioningWidth(ri); if (ri is Line) { // normalize the width if (w2 < 0) { xw -= w2; w2 = -w2; } } if (ri.Height == null || ri.Top == null) // if position/height not specified don't use to reposition continue; if (y < ri.Top.Size + ri.Height.Size) continue; _YParents.Add(ri); // X coordinate overlap maxParents--; if (xw <= x && xw + w2 >= x + w && // if item above completely covers the report item then it will be pushed down first maxParents > 30) // and we haven't already set the maxParents. maxParents=30; // just add a few more if necessary } //foreach (ReportItem ri in items) //{ // if (ri == this) // break; // int xw = ri.Left == null ? 0 : ri.Left.Size; // int w2 = PositioningWidth(ri); // if (ri is Line) // { // normalize the width // if (w2 < 0) // { // xw -= w2; // w2 = -w2; // } // } // //if (xw > right || x > xw + w2) // this allows items to be repositioned only based on what's above them // // continue; // if (ri.Height == null || ri.Top == null) // if position/height not specified don't use to reposition // continue; // if (y < ri.Top.Size + ri.Height.Size) // continue; // _YParents.Add(ri); // X coordinate overlap //} // Reduce the overhead if (this._YParents.Count == 0) this._YParents = null; else this._YParents.TrimExcess(); return; }
private void HighlightString(Graphics g, PageText dtext, RectangleF r, Font f, StringFormat sf) { if (_HighlightText == null || _HighlightText.Length == 0) return; // nothing to highlight bool bhighlightItem = dtext == _HighlightItem || (_HighlightItem != null && dtext.HtmlParent == _HighlightItem); if (!(_HighlightAll || bhighlightItem)) return; // not highlighting all and not on current highlight item string hlt = _HighlightCaseSensitive ? _HighlightText : _HighlightText.ToLower(); string text = _HighlightCaseSensitive ? dtext.Text : dtext.Text.ToLower(); if (text.IndexOf(hlt) < 0) return; // string not in text StringFormat sf2 = null; try { // Create a CharacterRange array with the highlight location and length // Handle multiple occurences of text List<CharacterRange> rangel = new List<CharacterRange>(); int loc = text.IndexOf(hlt); int hlen = hlt.Length; int len = text.Length; while (loc >= 0) { rangel.Add(new CharacterRange(loc, hlen)); if (loc + hlen < len) // out of range of text loc = text.IndexOf(hlt, loc + hlen); else loc = -1; } if (rangel.Count <= 0) // we should have gotten one; but return; CharacterRange[] ranges = rangel.ToArray(); // Construct a new StringFormat object. sf2 = sf.Clone() as StringFormat; // Set the ranges on the StringFormat object. sf2.SetMeasurableCharacterRanges(ranges); // Get the Regions to highlight by calling the // MeasureCharacterRanges method. if (r.Width <= 0 || r.Height <= 0) { SizeF ts = g.MeasureString(dtext.Text, f); r.Height = ts.Height; r.Width = ts.Width; } Region[] charRegion = g.MeasureCharacterRanges(dtext.Text, f, r, sf2); // Fill in the region using a semi-transparent color to highlight foreach (Region rg in charRegion) { Color hl = bhighlightItem ? _HighlightItemColor : _HighlightAllColor; g.FillRegion(new SolidBrush(Color.FromArgb(50, hl)), rg); } } catch { } // if highlighting fails we don't care; need to continue finally { if (sf2 != null) sf2.Dispose(); } }
private void ApplyTopBottomFilter(Report rpt, Rows data) { if (data.Data.Count <= 0) // No data; nothing to do return; // Get the filter value and validate it FilterValue fv = this._FilterValues.Items[0]; double val = fv.Expression.EvaluateDouble(rpt, data.Data[0]); if (val <= 0) // if less than equal 0; then request results in no data { data.Data.Clear(); return; } // Calculate the row number of the affected item and do additional validation int ival; if (_FilterOperator == FilterOperatorEnum.TopN || _FilterOperator == FilterOperatorEnum.BottomN) { ival = (int) val; if (ival != val) throw new Exception(string.Format("Filter operators TopN and BottomN require an integer value got {0}.", val)); if (ival >= data.Data.Count) // includes all the data? return; ival--; // make zero based } else { if (val >= 100) // greater than 100% means all the data return; ival = (int) (data.Data.Count * (val/100)); if (ival <= 0) // if less than equal 0; then request results in no data { data.Data.Clear(); return; } if (ival >= data.Data.Count) // make sure rounding hasn't forced us past 100% return; ival--; // make zero based } // Sort the data by the FilterExpression List<RowsSortExpression> sl = new List<RowsSortExpression>(); sl.Add(new RowsSortExpression(this._FilterExpression)); data.SortBy = sl; // update the sort by data.Sort(); // sort the data // reverse the order of the data for top so that data is in the beginning if (_FilterOperator == FilterOperatorEnum.TopN || _FilterOperator == FilterOperatorEnum.TopPercent) data.Data.Reverse(); List<Row> ar = data.Data; TypeCode tc = _FilterExpression.GetTypeCode(); object o = this._FilterExpression.Evaluate(rpt, data.Data[ival]); // adjust the ival based on duplicate values ival++; while (ival < ar.Count) { object n = this._FilterExpression.Evaluate(rpt, data.Data[ival]); if (ApplyCompare(tc, o, n) != 0) break; ival++; } if (ival < ar.Count) // if less than we need to remove the rest of the rows { ar.RemoveRange(ival, ar.Count - ival); } return; }
private void menuTableProperties_Click(object sender, EventArgs e) { if (_DrawPanel.SelectedCount != 1) return; XmlNode riNode = _DrawPanel.SelectedList[0]; XmlNode table = _DrawPanel.GetTableFromReportItem(riNode); if (table == null) return; XmlNode tc = _DrawPanel.GetTableColumn(riNode); XmlNode tr = _DrawPanel.GetTableRow(riNode); List<XmlNode> ar = new List<XmlNode>(); // need to put this is a list for dialog to handle ar.Add(table); _Undo.StartUndoGroup("Table Dialog"); PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems, tc, tr); try { DialogResult dr = pd.ShowDialog(this); _Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK); if (pd.Changed || dr == DialogResult.OK) { ReportChanged(this, new EventArgs()); _DrawPanel.Invalidate(); } } finally { pd.Dispose(); } }