ExportStyle.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using FastReport.Format;
  2. using FastReport.Utils;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. namespace FastReport.Export
  6. {
  7. class ExportIEMStyle
  8. {
  9. #region Private fields
  10. private Font font;
  11. private VertAlign vAlign;
  12. private HorzAlign hAlign;
  13. private FillBase textFill;
  14. private FillBase fill;
  15. private FormatBase format;
  16. private Border border;
  17. private Padding padding;
  18. private float firstTabOffset;
  19. private bool underlines;
  20. private int angle;
  21. private bool rTL;
  22. private bool wordWrap;
  23. private float lineHeight;
  24. private float paragraphOffset;
  25. private float fontWidthRatio;
  26. private bool forceJustify;
  27. #endregion
  28. #region Public Properties
  29. public bool WordWrap
  30. {
  31. get { return wordWrap; }
  32. set { wordWrap = value; }
  33. }
  34. public bool RTL
  35. {
  36. get { return rTL; }
  37. set { rTL = value; }
  38. }
  39. public Font Font
  40. {
  41. get { return font; }
  42. set { font = value; }
  43. }
  44. public bool NeedDisposeFont { get; set; }
  45. public VertAlign VAlign
  46. {
  47. get { return vAlign; }
  48. set { vAlign = value; }
  49. }
  50. public HorzAlign HAlign
  51. {
  52. get { return hAlign; }
  53. set { hAlign = value; }
  54. }
  55. public FillBase TextFill
  56. {
  57. get { return textFill; }
  58. set { textFill = value; }
  59. }
  60. public Color TextColor
  61. {
  62. get { return ExportUtils.GetColorFromFill(TextFill); }
  63. }
  64. public Color FillColor
  65. {
  66. get { return ExportUtils.GetColorFromFill(Fill); }
  67. }
  68. public FillBase Fill
  69. {
  70. get { return fill; }
  71. set { fill = value; }
  72. }
  73. public FormatBase Format
  74. {
  75. get { return format; }
  76. set { format = value; }
  77. }
  78. public Border Border
  79. {
  80. get { return border; }
  81. set { border = value; }
  82. }
  83. public Padding Padding
  84. {
  85. get { return padding; }
  86. set { padding = value; }
  87. }
  88. public float FirstTabOffset
  89. {
  90. get { return firstTabOffset; }
  91. set { firstTabOffset = value; }
  92. }
  93. public bool Underlines
  94. {
  95. get { return underlines; }
  96. set { underlines = value; }
  97. }
  98. public int Angle
  99. {
  100. get { return angle; }
  101. set { angle = value; }
  102. }
  103. public float LineHeight
  104. {
  105. get { return lineHeight; }
  106. set { lineHeight = value; }
  107. }
  108. public float ParagraphOffset
  109. {
  110. get { return paragraphOffset; }
  111. set { paragraphOffset = value; }
  112. }
  113. public float FontWidthRatio
  114. {
  115. get { return fontWidthRatio; }
  116. set { fontWidthRatio = value; }
  117. }
  118. public bool ForceJustify
  119. {
  120. get { return forceJustify; }
  121. set { forceJustify = value; }
  122. }
  123. #endregion
  124. public bool Equals(ExportIEMStyle Style)
  125. {
  126. return
  127. (Style.HAlign == HAlign) ?
  128. (Style.VAlign == VAlign) ?
  129. Style.RTL == RTL ?
  130. Style.WordWrap == WordWrap ?
  131. Style.Border.Equals(Border) ?
  132. Style.TextFill.Equals(TextFill) ?
  133. Style.Fill.Equals(Fill) ?
  134. Style.Font.Equals(Font) ?
  135. Style.Format.Equals(Format) ?
  136. Style.Padding.Equals(Padding) ?
  137. (Style.FirstTabOffset == FirstTabOffset) ?
  138. (Style.Underlines == Underlines) ?
  139. (Style.Angle == Angle) ?
  140. (Style.ParagraphOffset == ParagraphOffset) ?
  141. (Style.FontWidthRatio == FontWidthRatio) ?
  142. (Style.LineHeight == LineHeight) ?
  143. (Style.ForceJustify == ForceJustify) ?
  144. true : false : false : false : false : false : false : false : false : false : false : false : false : false : false : false : false : false;
  145. }
  146. public void Assign(ExportIEMStyle Style)
  147. {
  148. Font = Style.Font;
  149. VAlign = Style.VAlign;
  150. HAlign = Style.HAlign;
  151. Format = Style.Format.Clone();
  152. TextFill = Style.TextFill.Clone();
  153. RTL = Style.RTL;
  154. WordWrap = Style.WordWrap;
  155. Fill = Style.Fill.Clone();
  156. Border = Style.Border.Clone();
  157. Padding = Style.Padding;
  158. FirstTabOffset = Style.FirstTabOffset;
  159. Underlines = Style.Underlines;
  160. Angle = Style.Angle;
  161. LineHeight = Style.LineHeight;
  162. ParagraphOffset = Style.ParagraphOffset;
  163. FontWidthRatio = Style.FontWidthRatio;
  164. ForceJustify = Style.ForceJustify;
  165. //if (Style.ParagraphFormat != null) ParagraphFormat = Style.ParagraphFormat.MultiplyScale(1); else ParagraphFormat = null;
  166. }
  167. public ExportIEMStyle()
  168. {
  169. Font = DrawUtils.DefaultFont;
  170. Format = new GeneralFormat();
  171. VAlign = VertAlign.Top;
  172. HAlign = HorzAlign.Left;
  173. TextFill = new SolidFill();
  174. Fill = new SolidFill();
  175. (Fill as SolidFill).Color = Color.Transparent;
  176. Border = new Border();
  177. Padding = new Padding();
  178. }
  179. }
  180. }