using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; namespace FastReport.Data { /// /// Represents the collection of system variables. /// public class SystemVariables : ParameterCollection { internal SystemVariables(Base owner) : base(owner) { Add(new DateVariable()); Add(new PageVariable()); Add(new TotalPagesVariable()); Add(new PageNVariable()); Add(new PageNofMVariable()); Add(new RowVariable()); Add(new AbsRowVariable()); Add(new PageMacroVariable()); Add(new TotalPagesMacroVariable()); Add(new CopyNameMacroVariable()); Add(new HierarchyLevelVariable()); Add(new HierarchyRowNoVariable()); } } /// /// Represents the base class for system variables. /// public class SystemVariable : Parameter { /// /// This property is not relevant to this class. /// [Browsable(false)] public new string Expression { get { return base.Expression; } set { base.Expression = value; } } /// /// This property is not relevant to this class. /// [Browsable(false)] public new string Description { get { return base.Description; } set { base.Description = value; } } /// public override bool CanContain(Base child) { return false; } } /// /// Returns date and time of the report's start. /// public class DateVariable : SystemVariable { /// public override object Value { get { return Report.Engine.Date; } } internal DateVariable() { Name = "Date"; DataType = typeof(DateTime); } } /// /// Returns current page number. /// public class PageVariable : SystemVariable { /// public override object Value { get { return Report.Engine.PageNo; } } internal PageVariable() { Name = "Page"; DataType = typeof(int); } } /// /// Returns total number of pages in the report. To use this variable, you need /// to enable the report's double pass. /// public class TotalPagesVariable : SystemVariable { /// public override object Value { get { return Report.Engine.TotalPages; } } internal TotalPagesVariable() { Name = "TotalPages"; DataType = typeof(int); } } /// /// Returns a string containing the current page number in a form "Page N". /// public class PageNVariable : SystemVariable { /// public override object Value { get { return Report.Engine.PageN; } } internal PageNVariable() { Name = "PageN"; DataType = typeof(string); } } /// /// Returns a string containing the current page number and total pages in a form "Page N of M". /// To use this variable, you need to enable the report's double pass. /// public class PageNofMVariable : SystemVariable { /// public override object Value { get { return Report.Engine.PageNofM; } } internal PageNofMVariable() { Name = "PageNofM"; DataType = typeof(string); } } /// /// Returns data row number inside the group. This value is reset at the start of a new group. /// public class RowVariable : SystemVariable { /// public override object Value { get { return Report.Engine.RowNo; } } internal RowVariable() { Name = "Row#"; DataType = typeof(int); } } /// /// Returns absolute number of data row. This value is never reset at the start of a new group. /// public class AbsRowVariable : SystemVariable { /// public override object Value { get { return Report.Engine.AbsRowNo; } } internal AbsRowVariable() { Name = "AbsRow#"; DataType = typeof(int); } } /// /// Returns current page number. /// This variable is actually a macro. Its value is substituted when the component is viewed in /// the preview window. That means you cannot use it in an expression. /// public class PageMacroVariable : SystemVariable { /// public override object Value { get { return "[PAGE#]"; } } internal PageMacroVariable() { Name = "Page#"; DataType = typeof(int); } } /// /// Returns the number of total pages in the report. /// This variable is actually a macro. Its value is substituted when the component is viewed in /// the preview window. That means you cannot use it in an expression. /// public class TotalPagesMacroVariable : SystemVariable { /// public override object Value { get { return "[TOTALPAGES#]"; } } internal TotalPagesMacroVariable() { Name = "TotalPages#"; DataType = typeof(int); } } /// /// Returns the name of the printed copy. /// This variable is actually a macro. Its value is substituted when the component is viewed in /// the preview window. That means you cannot use it in an expression. /// public class CopyNameMacroVariable : SystemVariable { /// public override object Value { get { return "[COPYNAME#]"; } } internal CopyNameMacroVariable() { Name = "CopyName#"; DataType = typeof(string); } } /// /// Returns a level of hierarchy in the hierarchical report. /// public class HierarchyLevelVariable : SystemVariable { /// public override object Value { get { return Report.Engine.HierarchyLevel; } } internal HierarchyLevelVariable() { Name = "HierarchyLevel"; DataType = typeof(int); } } /// /// Returns the row number like "1.2.1" in the hierarchical report. /// public class HierarchyRowNoVariable : SystemVariable { /// public override object Value { get { return Report.Engine.HierarchyRowNo; } } internal HierarchyRowNoVariable() { Name = "HierarchyRow#"; DataType = typeof(string); } } }