ReportPage.DesignExt.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. using System;
  2. using System.Collections;
  3. using System.Windows.Forms;
  4. using System.Drawing;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Drawing.Printing;
  8. using System.Drawing.Drawing2D;
  9. using System.Drawing.Design;
  10. using FastReport.Utils;
  11. using FastReport.Design;
  12. using FastReport.Forms;
  13. using FastReport.TypeConverters;
  14. using FastReport.Design.PageDesigners.Page;
  15. using FastReport.TypeEditors;
  16. namespace FastReport
  17. {
  18. partial class ReportPage : IHasEditor
  19. {
  20. #region Properties
  21. /// <summary>
  22. /// This property is not relevant to this class.
  23. /// </summary>
  24. [Browsable(false)]
  25. public override float Left
  26. {
  27. get { return base.Left; }
  28. set { base.Left = value; }
  29. }
  30. /// <summary>
  31. /// This property is not relevant to this class.
  32. /// </summary>
  33. [Browsable(false)]
  34. public override float Top
  35. {
  36. get { return base.Top; }
  37. set { base.Top = value; }
  38. }
  39. /// <summary>
  40. /// This property is not relevant to this class.
  41. /// </summary>
  42. [Browsable(false)]
  43. public override float Width
  44. {
  45. get { return base.Width; }
  46. set { base.Width = value; }
  47. }
  48. /// <summary>
  49. /// This property is not relevant to this class.
  50. /// </summary>
  51. [Browsable(false)]
  52. public override float Height
  53. {
  54. get { return base.Height; }
  55. set { base.Height = value; }
  56. }
  57. /// <inheritdoc/>
  58. public override SizeF SnapSize
  59. {
  60. get { return new SizeF(ReportWorkspace.Grid.SnapSize, ReportWorkspace.Grid.SnapSize); }
  61. }
  62. /// <summary>
  63. /// Gets a value indicating that imperial units (inches, hundreths of inches) are used.
  64. /// </summary>
  65. [Browsable(false)]
  66. public bool IsImperialUnitsUsed
  67. {
  68. get
  69. {
  70. return ReportWorkspace.Grid.GridUnits == PageUnits.Inches ||
  71. ReportWorkspace.Grid.GridUnits == PageUnits.HundrethsOfInch;
  72. }
  73. }
  74. #endregion
  75. #region Private Methods
  76. private bool ShouldSerializeBorder()
  77. {
  78. return !Border.Equals(new Border());
  79. }
  80. private bool ShouldSerializeFill()
  81. {
  82. return !(Fill is SolidFill) || (Fill as SolidFill).Color != SystemColors.Window;
  83. }
  84. #endregion
  85. #region Public Methods
  86. /// <inheritdoc/>
  87. public override void SetDefaults()
  88. {
  89. switch (Config.ReportSettings.DefaultPaperSize)
  90. {
  91. case DefaultPaperSize.A4:
  92. PaperWidth = 210;
  93. PaperHeight = 297;
  94. break;
  95. case DefaultPaperSize.Letter:
  96. PaperWidth = 215.9f;
  97. PaperHeight = 279.4f;
  98. break;
  99. }
  100. float baseHeight = Units.Millimeters * 10;
  101. if (IsImperialUnitsUsed)
  102. baseHeight = Units.Inches * 0.4f;
  103. ReportTitle = new ReportTitleBand();
  104. ReportTitle.CreateUniqueName();
  105. ReportTitle.Height = baseHeight;
  106. PageHeader = new PageHeaderBand();
  107. PageHeader.CreateUniqueName();
  108. PageHeader.Height = baseHeight * 0.75f;
  109. DataBand data = new DataBand();
  110. Bands.Add(data);
  111. data.CreateUniqueName();
  112. data.Height = baseHeight * 2;
  113. PageFooter = new PageFooterBand();
  114. PageFooter.CreateUniqueName();
  115. PageFooter.Height = baseHeight * 0.5f;
  116. base.SetDefaults();
  117. }
  118. /// <inheritdoc/>
  119. public override void DrawSelection(FRPaintEventArgs e)
  120. {
  121. // do nothing
  122. }
  123. /// <inheritdoc/>
  124. public override void HandleMouseHover(FRMouseEventArgs e)
  125. {
  126. // do nothing
  127. }
  128. /// <inheritdoc/>
  129. public override void HandleMouseDown(FRMouseEventArgs e)
  130. {
  131. // do nothing
  132. }
  133. /// <inheritdoc/>
  134. public override void HandleMouseMove(FRMouseEventArgs e)
  135. {
  136. // do nothing
  137. }
  138. /// <inheritdoc/>
  139. public override void HandleMouseUp(FRMouseEventArgs e)
  140. {
  141. // do nothing
  142. }
  143. /// <inheritdoc/>
  144. public override Type GetPageDesignerType()
  145. {
  146. return typeof(ReportPageDesigner);
  147. }
  148. /// <inheritdoc/>
  149. public override ContextMenuBase GetContextMenu()
  150. {
  151. return new ReportPageMenu(Report.Designer);
  152. }
  153. /// <summary>
  154. /// Invokes the object's editor.
  155. /// </summary>
  156. public bool InvokeEditor()
  157. {
  158. using (PageSetupForm editor = new PageSetupForm())
  159. {
  160. editor.Page = this;
  161. return editor.ShowDialog() == DialogResult.OK;
  162. }
  163. }
  164. #endregion
  165. }
  166. }