PageDesignerBase.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Windows.Forms;
  2. using System.ComponentModel;
  3. using FastReport.Forms;
  4. namespace FastReport.Design.PageDesigners
  5. {
  6. #if !DEBUG
  7. [DesignTimeVisible(false)]
  8. #endif
  9. internal class PageDesignerBase : Panel, IDesignerPlugin
  10. {
  11. #region Fields
  12. private Designer designer;
  13. private PageBase page;
  14. private bool locked;
  15. private bool isInsertingObject;
  16. #endregion
  17. #region Properties
  18. public PageBase Page
  19. {
  20. get { return page; }
  21. set { page = value; }
  22. }
  23. public Designer Designer
  24. {
  25. get { return designer; }
  26. }
  27. public bool Locked
  28. {
  29. get { return locked; }
  30. }
  31. public bool IsInsertingObject
  32. {
  33. get { return isInsertingObject; }
  34. set { isInsertingObject = value; }
  35. }
  36. public Report Report
  37. {
  38. get { return Page.Report; }
  39. }
  40. public string PluginName
  41. {
  42. get { return Name; }
  43. }
  44. public virtual float Zoom
  45. {
  46. get { return 1; }
  47. set { }
  48. }
  49. #endregion
  50. #region Public Methods
  51. // this method is called when the page becomes active. You may, for example, modify the main menu
  52. // in this method.
  53. public virtual void PageActivated()
  54. {
  55. }
  56. // this method is called when the page becomes inactive. You should remove items added to the main menu
  57. // in this method.
  58. public virtual void PageDeactivated()
  59. {
  60. }
  61. public virtual void FillObjects(bool resetSelection)
  62. {
  63. Designer.Objects.Clear();
  64. Designer.Objects.Add(Page.Report);
  65. Designer.Objects.Add(Page);
  66. foreach (Base b in Page.AllObjects)
  67. {
  68. Designer.Objects.Add(b);
  69. }
  70. if (resetSelection)
  71. {
  72. Designer.SelectedObjects.Clear();
  73. Designer.SelectedObjects.Add(Page);
  74. }
  75. }
  76. public virtual void Paste(ObjectCollection list, InsertFrom source)
  77. {
  78. }
  79. public virtual void CancelPaste()
  80. {
  81. }
  82. public virtual void SelectAll()
  83. {
  84. }
  85. public virtual void ZoomPageWidth()
  86. {
  87. }
  88. public virtual void ZoomWholePage()
  89. {
  90. }
  91. protected override void Dispose(bool disposing)
  92. {
  93. base.Dispose(disposing);
  94. if (disposing)
  95. SaveState();
  96. }
  97. #endregion
  98. #region IDesignerPlugin
  99. public virtual void Localize()
  100. {
  101. }
  102. public virtual void SaveState()
  103. {
  104. }
  105. public virtual void RestoreState()
  106. {
  107. }
  108. public virtual void SelectionChanged()
  109. {
  110. }
  111. public virtual void UpdateContent()
  112. {
  113. }
  114. public virtual void Lock()
  115. {
  116. locked = true;
  117. }
  118. public virtual void Unlock()
  119. {
  120. locked = false;
  121. UpdateContent();
  122. }
  123. public virtual DesignerOptionsPage GetOptionsPage()
  124. {
  125. return null;
  126. }
  127. public virtual void UpdateUIStyle()
  128. {
  129. }
  130. public virtual void UpdateDpiDependencies()
  131. {
  132. }
  133. #endregion
  134. public PageDesignerBase(Designer designer) : base()
  135. {
  136. this.designer = designer;
  137. isInsertingObject = false;
  138. }
  139. }
  140. }