Style _Style; // Line style properties for the gridlines and tickmarks #endregion Fields #region Constructors internal 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 #endregion Fields #region Constructors // when dynamic exprs are evaluated per group instance internal 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; } } }
MarkerTypeEnum _Type; // Defines the marker type for values. Default: none #endregion Fields #region Constructors // properties for the marker(s). internal 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; } } }
Style _Style; // Defines text, border and background style #endregion Fields #region Constructors internal 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; // Defines border and background style #endregion Fields #region Constructors // appear in a data rendering. internal 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 = 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; // Style information for the page footer #endregion Fields #region Constructors internal 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."); }
Style _Style; // Default style information for the body #endregion Fields #region Constructors internal Body(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _ReportItems = null; _Height = null; _Columns = 1; _ColumnSpacing=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 "ReportItems": _ReportItems = new ReportItems(r, this, xNodeLoop); // need a class for this break; case "Height": _Height = new RSize(r, xNodeLoop); break; case "Columns": _Columns = XmlUtil.Integer(xNodeLoop.InnerText); break; case "ColumnSpacing": _ColumnSpacing = new RSize(r, xNodeLoop); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; default: // don't know this element - log it OwnerReport.rl.LogError(4, "Unknown Body element '" + xNodeLoop.Name + "' ignored."); break; } } if (_Height == null) OwnerReport.rl.LogError(8, "Body Height not specified."); }
Style _Style; // Defines borders and background for the plot area #endregion Fields #region Constructors internal 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 properties that override the style #endregion Fields #region Constructors // Default: NoOutput internal Subtotal(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p) { _ReportItems=null; _Style=null; _Position=SubtotalPositionEnum.After; _DataElementName="Total"; _DataElementOutput=DataElementOutputEnum.NoOutput; // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "ReportItems": _ReportItems = new ReportItems(r, this, xNodeLoop); break; case "Style": _Style = new Style(r, this, xNodeLoop); break; case "Position": _Position = SubtotalPosition.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; case "DataElementName": _DataElementName = xNodeLoop.InnerText; break; case "DataElementOutput": _DataElementOutput = Engine.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl); break; default: break; } } if (_ReportItems == null) OwnerReport.rl.LogError(8, "Subtotal requires the ReportItems element."); }
bool _Visible; // Whether the data label is displayed on the #endregion Fields #region Constructors internal 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 _Visible; // Specifies whether a legend is displayed. #endregion Fields #region Constructors // draw outside plot area (default). internal 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; } } }
string CssAdd(Style s, ReportLink rl, Row row, bool bForceRelative) { return CssAdd(s, rl, row, bForceRelative, float.MinValue, float.MinValue); }
bool _Visible; // Whether the axis labels are displayed. Defaults to false. #endregion Fields #region Constructors internal 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; } } }
//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; }
//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; }
internal 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 = 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; }
// Format a string; passed a style but style may be null; internal static 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; }
int _ZIndex; // Drawing order of the report item within the #endregion Fields #region Constructors internal 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; } } }
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; }
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(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) + "}"; var cce = (CssCacheEntry) _styles[css]; if (cce == null) { string name = prefix + Prefix + "css" + cssId++.ToString(); cce = new CssCacheEntry(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 void DoStyle(Style style, Row row) { if (style == null) return; StyleInfo si = style.GetStyleInfo(r, row); // tw.Write(@"\plain"); // reset current attributes // Handle the font if (!_Fonts.Contains(si.FontFamily)) _Fonts.Add(si.FontFamily); int fc = _Fonts.IndexOf(si.FontFamily); tw.Write(@"\f{0} ", fc); if (si.IsFontBold()) tw.Write(@"\b"); if (si.FontStyle== FontStyleEnum.Italic) tw.Write(@"\i"); switch (si.TextDecoration) { case TextDecorationEnum.Underline: tw.Write(@"\ul"); break; case TextDecorationEnum.LineThrough: tw.Write(@"\strike"); break; default: break; } tw.Write(@"\fs{0}", (int) Math.Round(si.FontSize * 2,0)); // font size // Handle the color int ic; if (!_Colors.Contains(si.Color)) _Colors.Add(si.Color); ic = _Colors.IndexOf(si.Color)+1; tw.Write(@"\cf{0} ", ic); }
string CssAdd(Style s, ReportLink rl, Row row) { return CssAdd(s, rl, row, false, float.MinValue, float.MinValue); }