Style _Style; // Defines the border and background style // properties for the marker(s). public Marker(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Type=MarkerTypeEnum.None; _Size=null; _Style=null; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Type": _Type = MarkerType.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "Size": _Size = new RSize(r, xNodeLoop); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; default: break; } } }
TitlePositionEnum _Position; // The position of the title; Default: center public Title(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Caption=null; _Style=null; _Position=TitlePositionEnum.Center; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Caption": _Caption = new Expression(r, this, xNodeLoop, ExpressionType.String); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; case "Position": _Position = TitlePosition.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; default: // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown Title element '" + xNodeLoop.Name + "' ignored."); break; } } }
Style _Style; // Line style properties for the gridlines and tickmarks public ChartGridLines(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _ShowGridLines=true; _Style=null; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "ShowGridLines": _ShowGridLines = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; default: // TODO // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown ChartGridLines element '" + xNodeLoop.Name + "' ignored."); break; } } }
Style _Style; // border and background properties for series legend itmes and data points // when dynamic exprs are evaluated per group instance public SeriesGrouping(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _DynamicSeries=null; _StaticSeries=null; _Style=null; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "DynamicSeries": _DynamicSeries = new DynamicSeries(r, this, xNodeLoop); break; case "StaticSeries": _StaticSeries = new StaticSeries(r, this, xNodeLoop); break; case "Style": _Style = new Style(OwnerReport, this, xNodeLoop); OwnerReport.rl.LogError(4, "Style element in SeriesGrouping is currently ignored."); // TODO break; default: // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown SeriesGrouping element '" + xNodeLoop.Name + "' ignored."); break; } } }
DataElementOutputEnum _DataElementOutput; // Indicates whether the data point should // appear in a data rendering. public DataPoint(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _DataValues=null; _DataLabel=null; _Action=null; _Style=null; _Marker=null; _DataElementName=null; _DataElementOutput=DataElementOutputEnum.Output; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "DataValues": _DataValues = new DataValues(r, this, xNodeLoop); break; case "DataLabel": _DataLabel = new DataLabel(r, this, xNodeLoop); break; case "Action": _Action = new Action(r, this, xNodeLoop); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; case "Marker": _Marker = new Marker(r, this, xNodeLoop); break; case "DataElementName": _DataElementName = xNodeLoop.InnerText; break; case "DataElementOutput": _DataElementOutput = Oranikle.Report.Engine.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; default: // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown DataPoint element '" + xNodeLoop.Name + "' ignored."); break; } } if (_DataValues == null) OwnerReport.rl.LogError(8, "DataPoint requires the DataValues element."); }
Style _Style; // Defines borders and background for the plot area public PlotArea(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Style=null; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Style": _Style = new Style(r, this, xNodeLoop); break; default: // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown PlotArea element '" + xNodeLoop.Name + "' ignored."); break; } } }
Style _Style; // Style information for the page footer public PageFooter(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Height=null; _PrintOnFirstPage=false; _PrintOnLastPage=false; _ReportItems=null; _Style=null; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Height": _Height = new RSize(r, xNodeLoop); break; case "PrintOnFirstPage": _PrintOnFirstPage = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "PrintOnLastPage": _PrintOnLastPage = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "ReportItems": _ReportItems = new ReportItems(r, this, xNodeLoop); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; default: // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown PageFooter element '" + xNodeLoop.Name + "' ignored."); break; } } if (_Height == null) OwnerReport.rl.LogError(8, "PageFooter Height is required."); }
int _Rotation; // Angle of rotation of the label text public DataLabel(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Style=null; _Value=null; _Visible=false; _Position=DataLabelPositionEnum.Auto; _Rotation=0; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Style": _Style = new Style(r, this, xNodeLoop); break; case "Value": _Value = new Expression(r, this, xNodeLoop, ExpressionType.Variant); break; case "Visible": _Visible = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "Position": _Position = DataLabelPosition.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "Rotation": _Rotation = XmlUtil.Integer(xNodeLoop.InnerText); break; default: break; } } }
bool _InsidePlotArea; //Boolean If true, draw legend inside plot area, otherwise // draw outside plot area (default). public Legend(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Visible=false; _Style=null; _Position=LegendPositionEnum.RightTop; _Layout=LegendLayoutEnum.Column; _InsidePlotArea=false; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Visible": _Visible = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; case "Position": _Position = LegendPosition.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "Layout": _Layout = LegendLayout.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "InsidePlotArea": _InsidePlotArea = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; default: break; } } }
private string CssPrefix(Style s, ReportLink rl) { string cssPrefix=null; ReportLink p; if (rl is Table || rl is Matrix || rl is Rectangle) { cssPrefix = "table#"; } else if (rl is Body) { cssPrefix = "body#"; } else if (rl is Line) { cssPrefix = "table#"; } else if (rl is List) { cssPrefix = ""; } else if (rl is Subreport) { cssPrefix = ""; } else if (rl is Chart) { cssPrefix = ""; } if (cssPrefix != null) return cssPrefix; // now find what the style applies to for (p=rl.Parent; p != null; p=p.Parent) { if (p is TableCell) { bool bHead = false; ReportLink p2; for (p2=p.Parent; p2 != null; p2=p2.Parent) { Type t2 = p2.GetType(); if (t2 == typeof(Header)) { if (p2.Parent is Table) bHead=true; break; } } if (bHead) cssPrefix = "th#"; else cssPrefix = "td#"; break; } else if (p is RowGrouping || p is MatrixCell || p is ColumnGrouping || p is Corner) { cssPrefix = "td#"; break; } } return cssPrefix == null? "": cssPrefix; }
private string CssAdd(Style s, ReportLink rl, Row row, bool bForceRelative, float h, float w) { string css; string prefix = CssPrefix(s, rl); if (_Asp && prefix == "table#") bForceRelative = true; if (s != null) css = prefix + "{" + CssPosition(rl, row, bForceRelative, h, w) + s.GetCSS(this.r, row, true) + "}"; else if (rl is Table || rl is Matrix) css = prefix + "{" + CssPosition(rl, row, bForceRelative, h, w) + "border-collapse:collapse;}"; else css = prefix + "{" + CssPosition(rl, row, bForceRelative, h, w) + "}"; CssCacheEntry2 cce = (CssCacheEntry2) _styles[css]; if (cce == null) { string name = prefix + this.Prefix + "css" + cssId++.ToString(); cce = new CssCacheEntry2(css, name); _styles.Add(cce.Css, cce); } int i = cce.Name.IndexOf('#'); if (i > 0) return cce.Name.Substring(i+1); else return cce.Name; }
private string CssAdd(Style s, ReportLink rl, Row row, bool bForceRelative) { return CssAdd(s, rl, row, bForceRelative, float.MinValue, float.MinValue); }
private string CssAdd(Style s, ReportLink rl, Row row) { return CssAdd(s, rl, row, false, float.MinValue, float.MinValue); }
//15052008WRP - Draw category month labels protected void DrawCategoryLabel(Report rpt, Graphics g, string t, Style a, System.Drawing.Rectangle rect) { if (t == null) return; Row r = FirstChartRow(rpt); if (a != null) { a.DrawString(rpt, g, t, t.GetTypeCode(), r, rect); a.DrawBorder(rpt, g, r, rect); } else Style.DrawStringDefaults(g, t, rect); return; }
bool _CanOmit=false; // When display values don't fit, is it OK to drop some from display public Axis(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Visible =false; _Style = null; _Title = null; _Title2 = null;// 20022008 AJM GJL _Margin = false; _MajorTickMarks = AxisTickMarksEnum.None; _MinorTickMarks = AxisTickMarksEnum.None; _MajorGridLines = null; _MinorGridLines = null; _MajorInterval = null; _MinorInterval =null; _Reverse = false; _CrossAt = 0; _Interlaced = false; _Scalar=false; _Min=null; _Max=null; _LogScale=false; _Month = false; //12052008 WP // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Visible": _Visible = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; case "Title": _Title = new Title(r, this, xNodeLoop); break; // 20022008 AJM GJL - Second Y axis case "Title2": case "fyi:Title2": _Title2 = new Title(r, this, xNodeLoop); break; case "Margin": _Margin = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "MajorTickMarks": _MajorTickMarks = AxisTickMarks.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "MinorTickMarks": _MinorTickMarks = AxisTickMarks.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "MajorGridLines": _MajorGridLines = new ChartGridLines(r, this, xNodeLoop); break; case "MinorGridLines": _MinorGridLines = new ChartGridLines(r, this, xNodeLoop); break; case "MajorInterval": _MajorInterval = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.Integer); OwnerReport.rl.LogError(4, "Axis element MajorInterval is currently ignored."); break; case "MinorInterval": _MinorInterval = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.Integer); OwnerReport.rl.LogError(4, "Axis element MinorInterval is currently ignored."); break; case "Reverse": _Reverse = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "CrossAt": _CrossAt = XmlUtil.Integer(xNodeLoop.InnerText); break; case "Interlaced": _Interlaced = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "Scalar": _Scalar = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "Min": _Min = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.Integer); break; case "Max": _Max = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.Integer); break; case "LogScale": _LogScale = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "Month": case "fyi:Month": _Month = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; case "fyi:CanOmit": _CanOmit = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl); break; default: // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown Axis element '" + xNodeLoop.Name + "' ignored."); break; } } }
// Format a string; passed a style but style may be null; static public string GetFormatedString(Report rpt, Style s, Row row, object o, TypeCode tc) { string t = null; if (o == null) return ""; try { if (s != null && s.Format != null) { string format = s.Format.EvaluateString(rpt, row); if (format != null && format.Length > 0) { switch (tc) { case TypeCode.DateTime: t = ((DateTime)o).ToString(format); break; case TypeCode.Int16: t = ((short)o).ToString(format); break; case TypeCode.UInt16: t = ((ushort)o).ToString(format); break; case TypeCode.Int32: t = ((int)o).ToString(format); break; case TypeCode.UInt32: t = ((uint)o).ToString(format); break; case TypeCode.Int64: t = ((long)o).ToString(format); break; case TypeCode.UInt64: t = ((ulong)o).ToString(format); break; case TypeCode.String: t = (string)o; break; case TypeCode.Decimal: t = ((decimal)o).ToString(format); break; case TypeCode.Single: t = ((float)o).ToString(format); break; case TypeCode.Double: t = ((double)o).ToString(format); break; default: t = o.ToString(); break; } } else t = o.ToString(); // No format provided } else { // No style provided t = o.ToString(); } } catch { t = o.ToString(); // probably type mismatch from expectation } return t; }
//15052008WRP - Measure category title size protected Size DrawCategoryTitleMeasure(Report rpt, Graphics g, string t, Style a) { Size size = Size.Empty; Row r = FirstChartRow(rpt); if (t == null || t == "") return size; if (a != null) size = a.MeasureString(rpt, g, t, t.GetTypeCode(), r, int.MaxValue); else size = Style.MeasureStringDefaults(rpt, g, t, t.GetTypeCode(), r, int.MaxValue); return size; }
public bool ReportItemElement(XmlNode xNodeLoop) { switch (xNodeLoop.Name) { case "Style": _Style = new Style(OwnerReport, this, xNodeLoop); break; case "Action": _Action = new Action(OwnerReport, this, xNodeLoop); break; case "Top": _Top = new RSize(OwnerReport, xNodeLoop); break; case "Left": _Left = new RSize(OwnerReport, xNodeLoop); break; case "Height": _Height = new RSize(OwnerReport, xNodeLoop); break; case "Width": _Width = new RSize(OwnerReport, xNodeLoop); break; case "ZIndex": _ZIndex = XmlUtil.Integer(xNodeLoop.InnerText); break; case "Visibility": _Visibility = new Visibility(OwnerReport, this, xNodeLoop); break; case "ToolTip": _ToolTip = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.String); break; case "Label": _Label = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.Variant); break; case "LinkToChild": _LinkToChild = xNodeLoop.InnerText; break; case "Bookmark": _Bookmark = new Expression(OwnerReport, this, xNodeLoop, ExpressionType.String); break; case "RepeatWith": _RepeatWith = xNodeLoop.InnerText; break; case "Custom": _Custom = new Custom(OwnerReport, this, xNodeLoop); break; case "DataElementName": _DataElementName = xNodeLoop.InnerText; break; case "DataElementOutput": _DataElementOutput = Oranikle.Report.Engine.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "rd:DefaultName": break; // MS tag: we don't use but don't want to generate a warning default: return false; // Not a report item element } return true; }
bool _InMatrix; // true if reportitem is in a matrix public ReportItem(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _Name=null; _Style=null; _Action=null; _Top=null; _Left=null; _Height=null; _Width=null; _ZIndex=0; _Visibility=null; _ToolTip=null; _Label=null; _LinkToChild=null; _Bookmark=null; _RepeatWith=null; _Custom=null; _DataElementName=null; _DataElementOutput=DataElementOutputEnum.Auto; // Run thru the attributes foreach(XmlAttribute xAttr in xNode.Attributes) { switch (xAttr.Name) { case "Name": _Name = new Name(xAttr.Value); break; } } }