DesignerEvents.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using FastReport.Data;
  6. namespace FastReport.Design
  7. {
  8. /// <summary>
  9. /// Provides a data for the designer ReportLoaded event.
  10. /// </summary>
  11. public class ReportLoadedEventArgs
  12. {
  13. /// <summary>
  14. /// The current report.
  15. /// </summary>
  16. public Report Report { get; }
  17. internal ReportLoadedEventArgs(Report report)
  18. {
  19. this.Report = report;
  20. }
  21. }
  22. /// <summary>
  23. /// Represents the method that will handle the designer ReportLoaded event.
  24. /// </summary>
  25. /// <param name="sender">The source of the event.</param>
  26. /// <param name="e">The event data.</param>
  27. public delegate void ReportLoadedEventHandler(object sender, ReportLoadedEventArgs e);
  28. /// <summary>
  29. /// Provides a data for the designer ObjectInserted event.
  30. /// </summary>
  31. public class ObjectInsertedEventArgs
  32. {
  33. /// <summary>
  34. /// Gets the inserted object.
  35. /// </summary>
  36. public Base Object { get; }
  37. /// <summary>
  38. /// Gets the source where the object is inserted from.
  39. /// </summary>
  40. public InsertFrom InsertSource { get; }
  41. internal ObjectInsertedEventArgs(Base obj, InsertFrom source)
  42. {
  43. Object = obj;
  44. InsertSource = source;
  45. }
  46. }
  47. /// <summary>
  48. /// Represents the method that will handle the designer ObjectInserted event.
  49. /// </summary>
  50. /// <param name="sender">The source of the event.</param>
  51. /// <param name="e">The event data.</param>
  52. public delegate void ObjectInsertedEventHandler(object sender, ObjectInsertedEventArgs e);
  53. /// <summary>
  54. /// Provides a data for the designer's custom dialog events.
  55. /// </summary>
  56. public class OpenSaveDialogEventArgs
  57. {
  58. /// <summary>
  59. /// Gets or sets a file name.
  60. /// </summary>
  61. /// <remarks>
  62. /// This property contains the location of a report. If you work with files (like the
  63. /// standard "Open" and "Save" dialogs do), treat this property as a file name.
  64. /// </remarks>
  65. public string FileName { get; set; }
  66. /// <summary>
  67. /// Gets or sets a value indicating that the dialog was cancelled.
  68. /// </summary>
  69. /// <remarks>
  70. /// This property is used to tell the designer that the user was cancelled the dialog.
  71. /// </remarks>
  72. public bool Cancel { get; set; }
  73. /// <summary>
  74. /// Gets or sets the custom data that is shared across events.
  75. /// </summary>
  76. /// <remarks>
  77. /// You may set the Data in the OpenDialog event and use it later in the OpenReport event.
  78. /// </remarks>
  79. public object Data { get; set; }
  80. /// <summary>
  81. /// Gets a report designer.
  82. /// </summary>
  83. public Designer Designer { get; }
  84. internal bool IsPlugin { get; set; }
  85. internal OpenSaveDialogEventArgs(Designer designer)
  86. {
  87. this.Designer = designer;
  88. FileName = "";
  89. }
  90. }
  91. /// <summary>
  92. /// Represents the method that will handle the designer's custom dialogs event.
  93. /// </summary>
  94. /// <param name="sender">The source of the event.</param>
  95. /// <param name="e">The event data.</param>
  96. public delegate void OpenSaveDialogEventHandler(object sender, OpenSaveDialogEventArgs e);
  97. /// <summary>
  98. /// Provides a data for the designer's custom dialog events.
  99. /// </summary>
  100. public class OpenSaveReportEventArgs
  101. {
  102. /// <summary>
  103. /// Gets a report.
  104. /// </summary>
  105. /// <remarks>
  106. /// Use this report in the load/save operations.
  107. /// </remarks>
  108. public Report Report { get; }
  109. /// <summary>
  110. /// Gets a file name.
  111. /// </summary>
  112. /// <remarks>
  113. /// This property contains the location of a report that was selected by the user in the
  114. /// open/save dialogs. If you work with files (like the standard "Open" and "Save" dialogs do),
  115. /// treat this property as a file name.
  116. /// </remarks>
  117. public string FileName { get; } = "";
  118. /// <summary>
  119. /// Gets the custom data that was set in the OpenDialog event.
  120. /// </summary>
  121. public object Data { get; }
  122. internal bool IsPlugin { get; }
  123. internal OpenSaveReportEventArgs(Report report, string fileName, object data, bool isPlugin)
  124. {
  125. this.Report = report;
  126. this.FileName = fileName;
  127. this.Data = data;
  128. this.IsPlugin = isPlugin;
  129. }
  130. }
  131. /// <summary>
  132. /// Represents the method that will handle the designer's custom dialogs event.
  133. /// </summary>
  134. /// <param name="sender">The source of the event.</param>
  135. /// <param name="e">The event data.</param>
  136. public delegate void OpenSaveReportEventHandler(object sender, OpenSaveReportEventArgs e);
  137. /// <summary>
  138. /// Provides data for the FilterConnectionTables event.
  139. /// </summary>
  140. public class FilterConnectionTablesEventArgs
  141. {
  142. /// <summary>
  143. /// Gets the Connection object.
  144. /// </summary>
  145. public DataConnectionBase Connection { get; }
  146. /// <summary>
  147. /// Gets the table name.
  148. /// </summary>
  149. public string TableName { get; }
  150. /// <summary>
  151. /// Gets or sets a value that indicates whether this table should be skipped.
  152. /// </summary>
  153. public bool Skip { get; set; }
  154. internal FilterConnectionTablesEventArgs(DataConnectionBase connection, string tableName)
  155. {
  156. this.Connection = connection;
  157. this.TableName = tableName;
  158. }
  159. }
  160. /// <summary>
  161. /// Represents the method that will handle the FilterConnectionTables event.
  162. /// </summary>
  163. /// <param name="sender">The source of the event.</param>
  164. /// <param name="e">The event data.</param>
  165. public delegate void FilterConnectionTablesEventHandler(object sender, FilterConnectionTablesEventArgs e);
  166. /// <summary>
  167. /// Provides data for the CustomQueryBuilder event.
  168. /// </summary>
  169. public class CustomQueryBuilderEventArgs
  170. {
  171. /// <summary>
  172. /// Gets the Connection object.
  173. /// </summary>
  174. public DataConnectionBase Connection { get; }
  175. /// <summary>
  176. /// Gets or sets the query text.
  177. /// </summary>
  178. public string SQL { get; set; }
  179. /// <summary>
  180. /// Gets or sets the query parameters.
  181. /// </summary>
  182. public CommandParameterCollection Parameters { get; set; }
  183. internal CustomQueryBuilderEventArgs(DataConnectionBase connection, string sql)
  184. {
  185. this.Connection = connection;
  186. SQL = sql;
  187. }
  188. internal CustomQueryBuilderEventArgs(DataConnectionBase connection, string sql, CommandParameterCollection parameters) : this(connection, sql)
  189. {
  190. this.Parameters = parameters;
  191. }
  192. }
  193. /// <summary>
  194. /// Represents the method that will handle the CustomQueryBuilder event.
  195. /// </summary>
  196. /// <param name="sender">The source of the event.</param>
  197. /// <param name="e">The event data.</param>
  198. public delegate void CustomQueryBuilderEventHandler(object sender, CustomQueryBuilderEventArgs e);
  199. }