ReportEventArgs.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using FastReport.Data;
  5. using FastReport.Export;
  6. using System.Data.Common;
  7. using System.ComponentModel;
  8. namespace FastReport
  9. {
  10. /// <summary>
  11. /// Provides data for the <see cref="FastReport.Report.LoadBaseReport"/> event.
  12. /// </summary>
  13. public class CustomLoadEventArgs : EventArgs
  14. {
  15. private string fileName;
  16. private Report report;
  17. /// <summary>
  18. /// Gets a name of the file to load the report from.
  19. /// </summary>
  20. public string FileName
  21. {
  22. get { return fileName; }
  23. }
  24. /// <summary>
  25. /// The reference to a report.
  26. /// </summary>
  27. public Report Report
  28. {
  29. get { return report; }
  30. }
  31. /// <summary>
  32. /// Initializes a new instance of the <see cref="CustomLoadEventArgs"/> class using the specified
  33. /// file name and the report.
  34. /// </summary>
  35. /// <param name="fileName">The name of the file to load the report from.</param>
  36. /// <param name="report">The report.</param>
  37. public CustomLoadEventArgs(string fileName, Report report)
  38. {
  39. this.fileName = fileName;
  40. this.report = report;
  41. }
  42. }
  43. /// <summary>
  44. /// Provides data for the <see cref="FastReport.Report.CustomCalc"/> event.
  45. /// </summary>
  46. public class CustomCalcEventArgs : EventArgs
  47. {
  48. private string expr;
  49. private object @object;
  50. private Report report;
  51. /// <summary>
  52. /// Gets an expression.
  53. /// </summary>
  54. public string Expression
  55. {
  56. get { return expr; }
  57. }
  58. /// <summary>
  59. /// Gets or sets a object.
  60. /// </summary>
  61. public object CalculatedObject
  62. {
  63. get { return @object; }
  64. set { @object = value; }
  65. }
  66. /// <summary>
  67. /// The reference to a report.
  68. /// </summary>
  69. public Report Report
  70. {
  71. get { return report; }
  72. }
  73. /// <summary>
  74. /// Initializes a new instance of the <see cref="CustomLoadEventArgs"/> class using the specified
  75. /// file name and the report.
  76. /// </summary>
  77. /// <param name="expression">The text of expression.</param>
  78. /// <param name="Object">The name of the file to load the report from.</param>
  79. /// <param name="report">The report.</param>
  80. public CustomCalcEventArgs(string expression, object Object, Report report)
  81. {
  82. expr = expression;
  83. @object = Object;
  84. this.report = report;
  85. }
  86. }
  87. /// <summary>
  88. /// Represents the method that will handle the <see cref="Report.LoadBaseReport"/> event.
  89. /// </summary>
  90. /// <param name="sender">The source of the event.</param>
  91. /// <param name="e">The event data.</param>
  92. public delegate void CustomLoadEventHandler(object sender, CustomLoadEventArgs e);
  93. /// <summary>
  94. /// Represents the method that will handle the event.
  95. /// </summary>
  96. /// <param name="sender">The source of the event.</param>
  97. /// <param name="e">The event data.</param>
  98. public delegate void CustomCalcEventHandler(object sender, CustomCalcEventArgs e);
  99. /// <summary>
  100. /// Provides data for the Progress event.
  101. /// </summary>
  102. public class ProgressEventArgs
  103. {
  104. private string message;
  105. private int progress;
  106. private int total;
  107. /// <summary>
  108. /// Gets a progress message.
  109. /// </summary>
  110. public string Message
  111. {
  112. get { return message; }
  113. }
  114. /// <summary>
  115. /// Gets the current page number.
  116. /// </summary>
  117. public int Progress
  118. {
  119. get { return progress; }
  120. }
  121. /// <summary>
  122. /// Gets the number of total pages.
  123. /// </summary>
  124. public int Total
  125. {
  126. get { return total; }
  127. }
  128. /// <summary>
  129. /// Initializes a new instance of the <see cref="ProgressEventArgs"/> class using the specified
  130. /// message, page number and total number of pages.
  131. /// </summary>
  132. /// <param name="message">The progress message.</param>
  133. /// <param name="progress">Current page number.</param>
  134. /// <param name="total">Number of total pages.</param>
  135. public ProgressEventArgs(string message, int progress, int total)
  136. {
  137. this.message = message;
  138. this.progress = progress;
  139. this.total = total;
  140. }
  141. }
  142. /// <summary>
  143. /// Represents the method that will handle the Progress event.
  144. /// </summary>
  145. /// <param name="sender">The source of the event.</param>
  146. /// <param name="e">The event data.</param>
  147. public delegate void ProgressEventHandler(object sender, ProgressEventArgs e);
  148. /// <summary>
  149. /// Provides data for the DatabaseLogin event.
  150. /// </summary>
  151. public class DatabaseLoginEventArgs
  152. {
  153. private string connectionString;
  154. private string userName;
  155. private string password;
  156. /// <summary>
  157. /// Gets or sets the connection string.
  158. /// </summary>
  159. public string ConnectionString
  160. {
  161. get { return connectionString; }
  162. set { connectionString = value; }
  163. }
  164. /// <summary>
  165. /// Gets or sets an user name.
  166. /// </summary>
  167. public string UserName
  168. {
  169. get { return userName; }
  170. set { userName = value; }
  171. }
  172. /// <summary>
  173. /// Gets or sets a password.
  174. /// </summary>
  175. public string Password
  176. {
  177. get { return password; }
  178. set { password = value; }
  179. }
  180. /// <summary>
  181. /// Initializes a new instance of the <see cref="DatabaseLoginEventArgs"/> class using the specified
  182. /// connection string.
  183. /// </summary>
  184. /// <param name="connectionString">The connection string.</param>
  185. public DatabaseLoginEventArgs(string connectionString)
  186. {
  187. this.connectionString = connectionString;
  188. userName = "";
  189. password = "";
  190. }
  191. }
  192. /// <summary>
  193. /// Represents the method that will handle the DatabaseLogin event.
  194. /// </summary>
  195. /// <param name="sender">The source of the event.</param>
  196. /// <param name="e">The event data.</param>
  197. public delegate void DatabaseLoginEventHandler(object sender, DatabaseLoginEventArgs e);
  198. /// <summary>
  199. /// Provides data for the AfterDatabaseLogin event.
  200. /// </summary>
  201. public class AfterDatabaseLoginEventArgs
  202. {
  203. private DbConnection connection;
  204. /// <summary>
  205. /// Gets the <b>DbConnection</b> object.
  206. /// </summary>
  207. public DbConnection Connection
  208. {
  209. get { return connection; }
  210. }
  211. /// <summary>
  212. /// Initializes a new instance of the <see cref="AfterDatabaseLoginEventArgs"/> class using
  213. /// the specified connection.
  214. /// </summary>
  215. /// <param name="connection">The connection object.</param>
  216. public AfterDatabaseLoginEventArgs(DbConnection connection)
  217. {
  218. this.connection = connection;
  219. }
  220. }
  221. /// <summary>
  222. /// Represents the method that will handle the AfterDatabaseLogin event.
  223. /// </summary>
  224. /// <param name="sender">The source of the event.</param>
  225. /// <param name="e">The event data.</param>
  226. public delegate void AfterDatabaseLoginEventHandler(object sender, AfterDatabaseLoginEventArgs e);
  227. /// <summary>
  228. /// Provides data for the FilterProperties event.
  229. /// </summary>
  230. public class FilterPropertiesEventArgs
  231. {
  232. private PropertyDescriptor property;
  233. private bool skip;
  234. /// <summary>
  235. /// Gets the property descriptor.
  236. /// </summary>
  237. public PropertyDescriptor Property
  238. {
  239. get { return property; }
  240. set { property = value; }
  241. }
  242. /// <summary>
  243. /// Gets or sets a value that indicates whether this property should be skipped.
  244. /// </summary>
  245. public bool Skip
  246. {
  247. get { return skip; }
  248. set { skip = value; }
  249. }
  250. internal FilterPropertiesEventArgs(PropertyDescriptor property)
  251. {
  252. this.property = property;
  253. skip = false;
  254. }
  255. }
  256. /// <summary>
  257. /// Represents the method that will handle the FilterProperties event.
  258. /// </summary>
  259. /// <param name="sender">The source of the event.</param>
  260. /// <param name="e">The event data.</param>
  261. public delegate void FilterPropertiesEventHandler(object sender, FilterPropertiesEventArgs e);
  262. /// <summary>
  263. /// Provides data for the GetPropertyKind event.
  264. /// </summary>
  265. public class GetPropertyKindEventArgs
  266. {
  267. private string propertyName;
  268. private Type propertyType;
  269. private PropertyKind propertyKind;
  270. /// <summary>
  271. /// Gets the property name.
  272. /// </summary>
  273. public string PropertyName
  274. {
  275. get { return propertyName; }
  276. }
  277. /// <summary>
  278. /// Gets the property type.
  279. /// </summary>
  280. public Type PropertyType
  281. {
  282. get { return propertyType; }
  283. }
  284. /// <summary>
  285. /// Gets or sets the kind of property.
  286. /// </summary>
  287. public PropertyKind PropertyKind
  288. {
  289. get { return propertyKind; }
  290. set { propertyKind = value; }
  291. }
  292. internal GetPropertyKindEventArgs(string propertyName, Type propertyType, PropertyKind propertyKind)
  293. {
  294. this.propertyName = propertyName;
  295. this.propertyType = propertyType;
  296. this.propertyKind = propertyKind;
  297. }
  298. }
  299. /// <summary>
  300. /// Represents the method that will handle the GetPropertyKind event.
  301. /// </summary>
  302. /// <param name="sender">The source of the event.</param>
  303. /// <param name="e">The event data.</param>
  304. public delegate void GetPropertyKindEventHandler(object sender, GetPropertyKindEventArgs e);
  305. /// <summary>
  306. /// Provides data for the GetTypeInstance event.
  307. /// </summary>
  308. public class GetTypeInstanceEventArgs
  309. {
  310. private Type type;
  311. private object instance;
  312. /// <summary>
  313. /// Gets the type.
  314. /// </summary>
  315. public Type Type
  316. {
  317. get { return type; }
  318. }
  319. /// <summary>
  320. /// Gets or sets the instance of type.
  321. /// </summary>
  322. public object Instance
  323. {
  324. get { return instance; }
  325. set { instance = value; }
  326. }
  327. internal GetTypeInstanceEventArgs(Type type)
  328. {
  329. this.type = type;
  330. }
  331. }
  332. /// <summary>
  333. /// Represents the method that will handle the GetPropertyKind event.
  334. /// </summary>
  335. /// <param name="sender">The source of the event.</param>
  336. /// <param name="e">The event data.</param>
  337. public delegate void GetTypeInstanceEventHandler(object sender, GetTypeInstanceEventArgs e);
  338. /// <summary>
  339. /// Event arguments for custom Export parameters
  340. /// </summary>
  341. public class ExportParametersEventArgs : EventArgs
  342. {
  343. /// <summary>
  344. /// Used to set custom export parameters
  345. /// </summary>
  346. public readonly ExportBase Export;
  347. public ExportParametersEventArgs(ExportBase export)
  348. {
  349. this.Export = export;
  350. }
  351. }
  352. }