/Components/FastReport3/Source/frxClass.pas

http://github.com/mitshel/tech-inv · Pascal · 1738 lines · 1600 code · 110 blank · 28 comment · 0 complexity · 27f80dfb2028166247ef6fcfcd2299c3 MD5 · raw file

  1. {******************************************}
  2. { }
  3. { FastReport v3.0 }
  4. { Report classes }
  5. { }
  6. { Copyright (c) 1998-2004 }
  7. { by Alexander Tzyganenko, }
  8. { Fast Reports Inc. }
  9. { }
  10. {******************************************}
  11. unit frxClass;
  12. interface
  13. {$I frx.inc}
  14. uses
  15. SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms, Dialogs,
  16. IniFiles, ExtCtrls, Printers, frxVariables, frxXML,
  17. fs_iinterpreter, fs_ipascal, fs_icpp, fs_ibasic, fs_ijs
  18. {$IFDEF Delphi6}
  19. , Variants
  20. {$ENDIF};
  21. const
  22. fr01cm = 3.77953; // 96 / 25.4
  23. fr1cm = 37.7953;
  24. fr01in = 9.6;
  25. fr1in = 96;
  26. fr1CharX = 9.6;
  27. fr1CharY = 17;
  28. clTransparent = clNone;
  29. crHand = 50;
  30. crZoom = 51;
  31. crFormat = 52;
  32. type
  33. TfrxReport = class;
  34. TfrxPage = class;
  35. TfrxReportPage = class;
  36. TfrxDialogPage = class;
  37. TfrxCustomEngine = class;
  38. TfrxCustomDesigner = class;
  39. TfrxCustomPreview = class;
  40. TfrxCustomPreviewPages = class;
  41. TfrxComponent = class;
  42. TfrxReportComponent = class;
  43. TfrxView = class;
  44. TfrxStyleItem = class;
  45. TfrxCustomExportFilter = class;
  46. TfrxCustomCompressor = class;
  47. TfrxNotifyEvent = type String;
  48. TfrxCloseQueryEvent = type String;
  49. TfrxKeyEvent = type String;
  50. TfrxKeyPressEvent = type String;
  51. TfrxMouseEvent = type String;
  52. TfrxMouseMoveEvent = type String;
  53. TfrxPreviewClickEvent = type String;
  54. TfrxStretchMode = (smDontStretch, smActualHeight, smMaxHeight);
  55. TfrxShiftMode = (smDontShift, smAlways, smWhenOverlapped);
  56. TfrxDuplexMode = (dmNone, dmVertical, dmHorizontal);
  57. TfrxAlign = (baNone, baLeft, baRight, baCenter, baWidth, baBottom);
  58. TfrxFrameStyle = (fsSolid, fsDash, fsDot, fsDashDot, fsDashDotDot, fsDouble);
  59. TfrxFrameType = (ftLeft, ftRight, ftTop, ftBottom);
  60. TfrxFrameTypes = set of TfrxFrameType;
  61. TfrxFormatKind = (fkText, fkNumeric, fkDateTime, fkBoolean);
  62. TfrxHAlign = (haLeft, haRight, haCenter, haBlock);
  63. TfrxVAlign = (vaTop, vaBottom, vaCenter);
  64. TfrxRestriction = (rfDontModify, rfDontSize, rfDontMove, rfDontDelete);
  65. TfrxRestrictions = set of TfrxRestriction;
  66. TfrxShapeKind = (skRectangle, skRoundRectangle, skEllipse, skTriangle,
  67. skDiamond, skDiagonal1, skDiagonal2);
  68. TfrxPreviewButton = (pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind,
  69. pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator);
  70. TfrxPreviewButtons = set of TfrxPreviewButton;
  71. TfrxZoomMode = (zmDefault, zmWholePage, zmPageWidth, zmManyPages);
  72. TfrxPrintPages = (ppAll, ppOdd, ppEven);
  73. TfrxAddPageAction = (apWriteOver, apAdd);
  74. TfrxRangeBegin = (rbFirst, rbCurrent);
  75. TfrxRangeEnd = (reLast, reCurrent, reCount);
  76. TfrxFieldType = (fftNumeric, fftString, fftBoolean);
  77. TfrxRect = record
  78. Left, Top, Right, Bottom: Extended;
  79. end;
  80. TfrxPoint = record
  81. X, Y: Extended;
  82. end;
  83. TfrxProgressEvent = procedure(Pages: TfrxCustomPreviewPages;
  84. Progress: Integer) of object;
  85. TfrxBeforePrintEvent = procedure(Sender: TfrxReportComponent) of object;
  86. TfrxGetValueEvent = procedure(const VarName: String; var Value: Variant) of object;
  87. TfrxUserFunctionEvent = function(const MethodName: String;
  88. var Params: Variant): Variant of object;
  89. TfrxManualBuildEvent = procedure(Page: TfrxPage) of object;
  90. TfrxClickObjectEvent = procedure(Sender: TfrxView;
  91. Button: TMouseButton; Shift: TShiftState; var Modified: Boolean) of object;
  92. TfrxMouseOverObjectEvent = procedure(Sender: TfrxView) of object;
  93. TfrxCheckEOFEvent = procedure(Sender: TObject; var Eof: Boolean) of object;
  94. TfrxRunDialogEvent = procedure(Page: TfrxDialogPage) of object;
  95. { Root classes }
  96. TfrxComponent = class(TComponent)
  97. private
  98. FObjects: TList;
  99. FAllObjects: TList;
  100. FParent: TfrxComponent;
  101. FLeft: Extended;
  102. FTop: Extended;
  103. FWidth: Extended;
  104. FHeight: Extended;
  105. FFont: TFont;
  106. FParentFont: Boolean;
  107. FIsDesigning: Boolean;
  108. FIsLoading: Boolean;
  109. FIsPrinting: Boolean;
  110. FDefaultDiff: Boolean;
  111. FRestrictions: TfrxRestrictions;
  112. FVisible: Boolean;
  113. function GetAbsTop: Extended;
  114. function GetPage: TfrxPage;
  115. function GetReport: TfrxReport;
  116. function IsFontStored: Boolean;
  117. function GetAllObjects: TList;
  118. function GetAbsLeft: Extended;
  119. function GetIsLoading: Boolean;
  120. protected
  121. FAliasName: String;
  122. FBaseName: String;
  123. FOriginalComponent: TfrxComponent;
  124. FOriginalRect: TfrxRect;
  125. FOriginalBand: TfrxComponent;
  126. procedure SetParent(AParent: TfrxComponent); virtual;
  127. procedure SetLeft(Value: Extended); virtual;
  128. procedure SetTop(Value: Extended); virtual;
  129. procedure SetWidth(Value: Extended); virtual;
  130. procedure SetHeight(Value: Extended); virtual;
  131. procedure SetName(const AName: TComponentName); override;
  132. procedure SetFont(Value: TFont); virtual;
  133. procedure SetParentFont(const Value: Boolean); virtual;
  134. procedure SetVisible(Value: Boolean); virtual;
  135. procedure FontChanged(Sender: TObject); virtual;
  136. function DiffFont(f1, f2: TFont; const Add: String): String;
  137. function InternalDiff(AComponent: TfrxComponent): String;
  138. procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
  139. function GetChildOwner: TComponent; override;
  140. public
  141. constructor Create(AOwner: TComponent); override;
  142. constructor DesignCreate(AOwner: TComponent; Flags: Word); virtual;
  143. destructor Destroy; override;
  144. procedure AlignChildren; virtual;
  145. procedure Assign(Source: TPersistent); override;
  146. procedure AssignAll(Source: TfrxComponent);
  147. procedure Clear; virtual;
  148. procedure CreateUniqueName;
  149. procedure LoadFromStream(Stream: TStream); virtual;
  150. procedure SaveToStream(Stream: TStream; SaveChildren: Boolean = True;
  151. SaveDefaultValues: Boolean = False); virtual;
  152. procedure SetBounds(ALeft, ATop, AWidth, AHeight: Extended);
  153. function AllDiff(AComponent: TfrxComponent): String;
  154. function Diff(AComponent: TfrxComponent): String; virtual;
  155. function FindObject(const AName: String): TfrxComponent;
  156. class function GetDescription: String; virtual;
  157. property Objects: TList read FObjects;
  158. property AllObjects: TList read GetAllObjects;
  159. property Parent: TfrxComponent read FParent write SetParent;
  160. property Page: TfrxPage read GetPage;
  161. property Report: TfrxReport read GetReport;
  162. property IsDesigning: Boolean read FIsDesigning write FIsDesigning;
  163. property IsLoading: Boolean read GetIsLoading write FIsLoading;
  164. property IsPrinting: Boolean read FIsPrinting write FIsPrinting;
  165. property BaseName: String read FBaseName;
  166. property DefaultDiff: Boolean read FDefaultDiff write FDefaultDiff;
  167. property Left: Extended read FLeft write SetLeft;
  168. property Top: Extended read FTop write SetTop;
  169. property Width: Extended read FWidth write SetWidth;
  170. property Height: Extended read FHeight write SetHeight;
  171. property AbsLeft: Extended read GetAbsLeft;
  172. property AbsTop: Extended read GetAbsTop;
  173. property Font: TFont read FFont write SetFont stored IsFontStored;
  174. property ParentFont: Boolean read FParentFont write SetParentFont default True;
  175. property Restrictions: TfrxRestrictions read FRestrictions write FRestrictions default [];
  176. property Visible: Boolean read FVisible write SetVisible default True;
  177. end;
  178. TfrxReportComponent = class(TfrxComponent)
  179. private
  180. FOnAfterData: TfrxNotifyEvent;
  181. FOnAfterPrint: TfrxNotifyEvent;
  182. FOnBeforePrint: TfrxNotifyEvent;
  183. FOnPreviewClick: TfrxPreviewClickEvent;
  184. public
  185. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended);
  186. virtual; abstract;
  187. procedure BeforePrint; virtual;
  188. procedure GetData; virtual;
  189. procedure AfterPrint; virtual;
  190. function GetComponentText: String; virtual;
  191. property OnAfterData: TfrxNotifyEvent read FOnAfterData write FOnAfterData;
  192. property OnAfterPrint: TfrxNotifyEvent read FOnAfterPrint write FOnAfterPrint;
  193. property OnBeforePrint: TfrxNotifyEvent read FOnBeforePrint write FOnBeforePrint;
  194. property OnPreviewClick: TfrxPreviewClickEvent read FOnPreviewClick write FOnPreviewClick;
  195. end;
  196. TfrxDialogComponent = class(TfrxReportComponent)
  197. private
  198. FBitmap: TBitmap;
  199. FComponent: TComponent;
  200. procedure ReadLeft(Reader: TReader);
  201. procedure ReadTop(Reader: TReader);
  202. procedure WriteLeft(Writer: TWriter);
  203. procedure WriteTop(Writer: TWriter);
  204. protected
  205. FImageIndex: Integer;
  206. procedure DefineProperties(Filer: TFiler); override;
  207. public
  208. constructor Create(AOwner: TComponent); override;
  209. destructor Destroy; override;
  210. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  211. property Bitmap: TBitmap read FBitmap;
  212. property Component: TComponent read FComponent write FComponent;
  213. end;
  214. TfrxDialogControl = class(TfrxReportComponent)
  215. private
  216. FControl: TControl;
  217. FOnClick: TfrxNotifyEvent;
  218. FOnDblClick: TfrxNotifyEvent;
  219. FOnEnter: TfrxNotifyEvent;
  220. FOnExit: TfrxNotifyEvent;
  221. FOnKeyDown: TfrxKeyEvent;
  222. FOnKeyPress: TfrxKeyPressEvent;
  223. FOnKeyUp: TfrxKeyEvent;
  224. FOnMouseDown: TfrxMouseEvent;
  225. FOnMouseMove: TfrxMouseMoveEvent;
  226. FOnMouseUp: TfrxMouseEvent;
  227. function GetColor: TColor;
  228. function GetEnabled: Boolean;
  229. procedure DoOnClick(Sender: TObject);
  230. procedure DoOnDblClick(Sender: TObject);
  231. procedure DoOnEnter(Sender: TObject);
  232. procedure DoOnExit(Sender: TObject);
  233. procedure DoOnKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  234. procedure DoOnKeyPress(Sender: TObject; var Key: Char);
  235. procedure DoOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
  236. procedure DoOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  237. procedure DoOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  238. procedure DoOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  239. procedure SetColor(const Value: TColor);
  240. procedure SetEnabled(const Value: Boolean);
  241. function GetCaption: String;
  242. procedure SetCaption(const Value: String);
  243. protected
  244. procedure SetLeft(Value: Extended); override;
  245. procedure SetTop(Value: Extended); override;
  246. procedure SetWidth(Value: Extended); override;
  247. procedure SetHeight(Value: Extended); override;
  248. procedure SetParentFont(const Value: Boolean); override;
  249. procedure SetVisible(Value: Boolean); override;
  250. procedure SetParent(AParent: TfrxComponent); override;
  251. procedure FontChanged(Sender: TObject); override;
  252. procedure InitControl(AControl: TControl);
  253. public
  254. constructor Create(AOwner: TComponent); override;
  255. destructor Destroy; override;
  256. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  257. property Caption: String read GetCaption write SetCaption;
  258. property Color: TColor read GetColor write SetColor default clBtnFace;
  259. property Control: TControl read FControl write FControl;
  260. property OnClick: TfrxNotifyEvent read FOnClick write FOnClick;
  261. property OnDblClick: TfrxNotifyEvent read FOnDblClick write FOnDblClick;
  262. property OnEnter: TfrxNotifyEvent read FOnEnter write FOnEnter;
  263. property OnExit: TfrxNotifyEvent read FOnExit write FOnExit;
  264. property OnKeyDown: TfrxKeyEvent read FOnKeyDown write FOnKeyDown;
  265. property OnKeyPress: TfrxKeyPressEvent read FOnKeyPress write FOnKeyPress;
  266. property OnKeyUp: TfrxKeyEvent read FOnKeyUp write FOnKeyUp;
  267. property OnMouseDown: TfrxMouseEvent read FOnMouseDown write FOnMouseDown;
  268. property OnMouseMove: TfrxMouseMoveEvent read FOnMouseMove write FOnMouseMove;
  269. property OnMouseUp: TfrxMouseEvent read FOnMouseUp write FOnMouseUp;
  270. published
  271. property Left;
  272. property Top;
  273. property Width;
  274. property Height;
  275. property Font;
  276. property ParentFont;
  277. property Enabled: Boolean read GetEnabled write SetEnabled default True;
  278. property Visible;
  279. end;
  280. TfrxDataSet = class(TfrxDialogComponent)
  281. private
  282. FCloseDataSource: Boolean;
  283. FEnabled: Boolean;
  284. FOpenDataSource: Boolean;
  285. FRangeBegin: TfrxRangeBegin;
  286. FRangeEnd: TfrxRangeEnd;
  287. FRangeEndCount: Integer;
  288. FReportRef: TfrxReport;
  289. FUserName: String;
  290. FOnCheckEOF: TfrxCheckEOFEvent;
  291. FOnFirst: TNotifyEvent;
  292. FOnNext: TNotifyEvent;
  293. FOnPrior: TNotifyEvent;
  294. FOnOpen: TNotifyEvent;
  295. FOnClose: TNotifyEvent;
  296. function NameExists(const Name: String): Boolean;
  297. protected
  298. FInitialized: Boolean;
  299. FRecNo: Integer;
  300. function GetDisplayText(Index: String): String; virtual;
  301. function GetDisplayWidth(Index: String): Integer; virtual;
  302. function GetFieldType(Index: String): TfrxFieldType; virtual;
  303. function GetValue(Index: String): Variant; virtual;
  304. procedure SetName(const NewName: TComponentName); override;
  305. procedure SetUserName(const Value: String); virtual;
  306. public
  307. constructor Create(AOwner: TComponent); override;
  308. destructor Destroy; override;
  309. { Navigation methods }
  310. procedure Initialize; virtual;
  311. procedure Initialize1; virtual;
  312. procedure Finalize; virtual;
  313. procedure Open; virtual;
  314. procedure Close; virtual;
  315. procedure First; virtual;
  316. procedure Next; virtual;
  317. procedure Prior; virtual;
  318. function Eof: Boolean; virtual;
  319. { Data access }
  320. function FieldsCount: Integer; virtual;
  321. function HasField(const fName: String): Boolean;
  322. function IsBlobField(const fName: String): Boolean; virtual;
  323. procedure AssignBlobTo(const fName: String; Obj: TObject); virtual;
  324. procedure GetFieldList(List: TStrings); virtual;
  325. property DisplayText[Index: String]: String read GetDisplayText;
  326. property DisplayWidth[Index: String]: Integer read GetDisplayWidth;
  327. property FieldType[Index: String]: TfrxFieldType read GetFieldType;
  328. property Value[Index: String]: Variant read GetValue;
  329. property CloseDataSource: Boolean read FCloseDataSource write FCloseDataSource default False;
  330. property OpenDataSource: Boolean read FOpenDataSource write FOpenDataSource default True;
  331. property RecNo: Integer read FRecNo;
  332. property ReportRef: TfrxReport read FReportRef write FReportRef;
  333. property OnClose: TNotifyEvent read FOnClose write FOnClose;
  334. property OnOpen: TNotifyEvent read FOnOpen write FOnOpen;
  335. published
  336. property Enabled: Boolean read FEnabled write FEnabled default True;
  337. property RangeBegin: TfrxRangeBegin read FRangeBegin write FRangeBegin default rbFirst;
  338. property RangeEnd: TfrxRangeEnd read FRangeEnd write FRangeEnd default reLast;
  339. property RangeEndCount: Integer read FRangeEndCount write FRangeEndCount default 0;
  340. property UserName: String read FUserName write SetUserName;
  341. property OnCheckEOF: TfrxCheckEOFEvent read FOnCheckEOF write FOnCheckEOF;
  342. property OnFirst: TNotifyEvent read FOnFirst write FOnFirst;
  343. property OnNext: TNotifyEvent read FOnNext write FOnNext;
  344. property OnPrior: TNotifyEvent read FOnPrior write FOnPrior;
  345. end;
  346. TfrxUserDataSet = class(TfrxDataset);
  347. TfrxCustomDBDataSet = class(TfrxDataSet)
  348. private
  349. FAliases: TStrings;
  350. FFields: TStringList;
  351. procedure SetFieldAliases(const Value: TStrings);
  352. protected
  353. property Fields: TStringList read FFields;
  354. public
  355. constructor Create(AOwner: TComponent); override;
  356. destructor Destroy; override;
  357. function ConvertAlias(const fName: String): String;
  358. function GetAlias(const fName: String): String;
  359. function FieldsCount: Integer; override;
  360. published
  361. property CloseDataSource;
  362. property FieldAliases: TStrings read FAliases write SetFieldAliases;
  363. property OpenDataSource;
  364. property OnClose;
  365. property OnOpen;
  366. end;
  367. TfrxDBComponents = class(TComponent)
  368. public
  369. function GetDescription: String; virtual;
  370. end;
  371. TfrxComponentClass = class of TfrxComponent;
  372. { Report Objects }
  373. TfrxFrame = class(TPersistent)
  374. private
  375. FColor: TColor;
  376. FDropShadow: Boolean;
  377. FShadowWidth: Extended;
  378. FShadowColor: TColor;
  379. FStyle: TfrxFrameStyle;
  380. FTyp: TfrxFrameTypes;
  381. FWidth: Extended;
  382. function IsShadowWidthStored: Boolean;
  383. function IsTypStored: Boolean;
  384. function IsWidthStored: Boolean;
  385. public
  386. constructor Create;
  387. procedure Assign(Source: TPersistent); override;
  388. function Diff(AFrame: TfrxFrame): String;
  389. published
  390. property Color: TColor read FColor write FColor default clBlack;
  391. property DropShadow: Boolean read FDropShadow write FDropShadow default False;
  392. property ShadowColor: TColor read FShadowColor write FShadowColor default clBlack;
  393. property ShadowWidth: Extended read FShadowWidth write FShadowWidth stored IsShadowWidthStored;
  394. property Style: TfrxFrameStyle read FStyle write FStyle default fsSolid;
  395. property Typ: TfrxFrameTypes read FTyp write FTyp stored IsTypStored;
  396. property Width: Extended read FWidth write FWidth stored IsWidthStored;
  397. end;
  398. TfrxView = class(TfrxReportComponent)
  399. private
  400. FAlign: TfrxAlign;
  401. FBrushStyle: TBrushStyle;
  402. FColor: TColor;
  403. FCursor: TCursor;
  404. FDataField: String;
  405. FDataSet: TfrxDataSet;
  406. FDataSetName: String;
  407. FFrame: TfrxFrame;
  408. FPrintable: Boolean;
  409. FShiftMode: TfrxShiftMode;
  410. FTagStr: String;
  411. FTempTag: String;
  412. FTempURL: String;
  413. FURL: String;
  414. procedure SetFrame(const Value: TfrxFrame);
  415. procedure SetDataSet(const Value: TfrxDataSet);
  416. procedure SetDataSetName(const Value: String);
  417. function GetDataSetName: String;
  418. protected
  419. FX, FY, FX1, FY1, FDX, FDY, FFrameWidth: Integer;
  420. FScaleX, FScaleY, FOffsetX, FOffsetY: Extended;
  421. FCanvas: TCanvas;
  422. procedure BeginDraw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); virtual;
  423. procedure DrawBackground; virtual;
  424. procedure DrawFrame; virtual;
  425. procedure DrawLine(x, y, x1, y1, w: Integer);
  426. procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  427. public
  428. constructor Create(AOwner: TComponent); override;
  429. destructor Destroy; override;
  430. function Diff(AComponent: TfrxComponent): String; override;
  431. function IsDataField: Boolean;
  432. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  433. procedure BeforePrint; override;
  434. procedure GetData; override;
  435. procedure AfterPrint; override;
  436. property BrushStyle: TBrushStyle read FBrushStyle write FBrushStyle default bsSolid;
  437. property Color: TColor read FColor write FColor default clTransparent;
  438. property DataField: String read FDataField write FDataField;
  439. property DataSet: TfrxDataSet read FDataSet write SetDataSet;
  440. property DataSetName: String read GetDataSetName write SetDataSetName;
  441. property Frame: TfrxFrame read FFrame write SetFrame;
  442. published
  443. property Align: TfrxAlign read FAlign write FAlign default baNone;
  444. property Cursor: TCursor read FCursor write FCursor default crDefault;
  445. property Printable: Boolean read FPrintable write FPrintable default True;
  446. property ShiftMode: TfrxShiftMode read FShiftMode write FShiftMode default smAlways;
  447. property TagStr: String read FTagStr write FTagStr;
  448. property URL: String read FURL write FURL;
  449. property Left;
  450. property Top;
  451. property Width;
  452. property Height;
  453. property Restrictions;
  454. property Visible;
  455. property OnAfterData;
  456. property OnAfterPrint;
  457. property OnBeforePrint;
  458. property OnPreviewClick;
  459. end;
  460. TfrxStretcheable = class(TfrxView)
  461. private
  462. FStretchMode: TfrxStretchMode;
  463. public
  464. FSaveHeight: Extended;
  465. constructor Create(AOwner: TComponent); override;
  466. function CalcHeight: Extended; virtual;
  467. function DrawPart: Extended; virtual;
  468. procedure InitPart; virtual;
  469. published
  470. property StretchMode: TfrxStretchMode read FStretchMode write FStretchMode
  471. default smDontStretch;
  472. end;
  473. TfrxHighlight = class(TPersistent)
  474. private
  475. FActive: Boolean;
  476. FColor: TColor;
  477. FCondition: String;
  478. FFont: TFont;
  479. procedure SetFont(const Value: TFont);
  480. public
  481. constructor Create;
  482. destructor Destroy; override;
  483. procedure Assign(Source: TPersistent); override;
  484. published
  485. property Active: Boolean read FActive write FActive default False;
  486. property Font: TFont read FFont write SetFont;
  487. property Color: TColor read FColor write FColor default clTransparent;
  488. property Condition: String read FCondition write FCondition;
  489. end;
  490. TfrxFormat = class(TPersistent)
  491. private
  492. FDecimalSeparator: String;
  493. FFormatStr: String;
  494. FKind: TfrxFormatKind;
  495. public
  496. procedure Assign(Source: TPersistent); override;
  497. published
  498. property DecimalSeparator: String read FDecimalSeparator write FDecimalSeparator;
  499. property FormatStr: String read FFormatStr write FFormatStr;
  500. property Kind: TfrxFormatKind read FKind write FKind default fkText;
  501. end;
  502. TfrxCustomMemoView = class(TfrxStretcheable)
  503. private
  504. FAllowExpressions: Boolean;
  505. FAllowHTMLTags: Boolean;
  506. FAutoWidth: Boolean;
  507. FCharSpacing: Extended;
  508. FDisplayFormat: TfrxFormat;
  509. FExpressionDelimiters: String;
  510. FFlowTo: TfrxCustomMemoView;
  511. FGapX: Extended;
  512. FGapY: Extended;
  513. FHAlign: TfrxHAlign;
  514. FHideZeros: Boolean;
  515. FHighlight: TfrxHighlight;
  516. FLineSpacing: Extended;
  517. FMemo: TStrings;
  518. FParagraphGap: Extended;
  519. FRotation: Integer;
  520. FRTLReading: Boolean;
  521. FStyle: String;
  522. FSuppressRepeated: Boolean;
  523. FTempMemo, FPartMemo: String;
  524. FUnderlines: Boolean;
  525. FVAlign: TfrxVAlign;
  526. FWordBreak: Boolean;
  527. FWordWrap: Boolean;
  528. procedure SetMemo(const Value: TStrings);
  529. procedure SetRotation(Value: Integer);
  530. procedure SetText(const Value: String);
  531. function AdjustCalcHeight: Extended;
  532. function AdjustCalcWidth: Extended;
  533. function GetText: String;
  534. function IsExprDelimitersStored: Boolean;
  535. function IsLineSpacingStored: Boolean;
  536. function IsGapXStored: Boolean;
  537. function IsGapYStored: Boolean;
  538. function IsHighlightStored: Boolean;
  539. function IsParagraphGapStored: Boolean;
  540. procedure SetHighlight(const Value: TfrxHighlight);
  541. procedure SetDisplayFormat(const Value: TfrxFormat);
  542. procedure SetStyle(const Value: String);
  543. function IsCharSpacingStored: Boolean;
  544. protected
  545. FLastValue: Variant;
  546. FTotalPages: Integer;
  547. FTextRect: TRect;
  548. FValue: Variant;
  549. function CalcAndFormat(const Expr: String): String;
  550. procedure BeginDraw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  551. procedure SetDrawParams(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended);
  552. procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  553. public
  554. constructor Create(AOwner: TComponent); override;
  555. destructor Destroy; override;
  556. class function GetDescription: String; override;
  557. function Diff(AComponent: TfrxComponent): String; override;
  558. function CalcHeight: Extended; override;
  559. function CalcWidth: Extended; virtual;
  560. function DrawPart: Extended; override;
  561. function GetComponentText: String; override;
  562. function FormatData(const Value: Variant; AFormat: TfrxFormat = nil): String;
  563. function WrapText: String;
  564. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  565. procedure BeforePrint; override;
  566. procedure GetData; override;
  567. procedure AfterPrint; override;
  568. procedure InitPart; override;
  569. procedure ApplyStyle(Style: TfrxStyleItem);
  570. procedure ExtractTotalPages;
  571. property Text: String read GetText write SetText;
  572. property AllowExpressions: Boolean read FAllowExpressions write FAllowExpressions default True;
  573. property AllowHTMLTags: Boolean read FAllowHTMLTags write FAllowHTMLTags default False;
  574. property AutoWidth: Boolean read FAutoWidth write FAutoWidth default False;
  575. property CharSpacing: Extended read FCharSpacing write FCharSpacing stored IsCharSpacingStored;
  576. property DisplayFormat: TfrxFormat read FDisplayFormat write SetDisplayFormat;
  577. property ExpressionDelimiters: String read FExpressionDelimiters
  578. write FExpressionDelimiters stored IsExprDelimitersStored;
  579. property FlowTo: TfrxCustomMemoView read FFlowTo write FFlowTo;
  580. property GapX: Extended read FGapX write FGapX stored IsGapXStored;
  581. property GapY: Extended read FGapY write FGapY stored IsGapYStored;
  582. property HAlign: TfrxHAlign read FHAlign write FHAlign default haLeft;
  583. property HideZeros: Boolean read FHideZeros write FHideZeros default False;
  584. property Highlight: TfrxHighlight read FHighlight write SetHighlight
  585. stored IsHighlightStored;
  586. property LineSpacing: Extended read FLineSpacing write FLineSpacing stored IsLineSpacingStored;
  587. property Memo: TStrings read FMemo write SetMemo;
  588. property ParagraphGap: Extended read FParagraphGap write FParagraphGap stored IsParagraphGapStored;
  589. property Rotation: Integer read FRotation write SetRotation default 0;
  590. property RTLReading: Boolean read FRTLReading write FRTLReading default False;
  591. property Style: String read FStyle write SetStyle;
  592. property SuppressRepeated: Boolean read FSuppressRepeated write FSuppressRepeated default False;
  593. property Underlines: Boolean read FUnderlines write FUnderlines default False;
  594. property WordBreak: Boolean read FWordBreak write FWordBreak default False;
  595. property WordWrap: Boolean read FWordWrap write FWordWrap default True;
  596. property VAlign: TfrxVAlign read FVAlign write FVAlign default vaTop;
  597. end;
  598. TfrxMemoView = class(TfrxCustomMemoView)
  599. published
  600. property AutoWidth;
  601. property AllowExpressions;
  602. property AllowHTMLTags;
  603. property BrushStyle;
  604. property CharSpacing;
  605. property Color;
  606. property DataField;
  607. property DataSet;
  608. property DataSetName;
  609. property DisplayFormat;
  610. property ExpressionDelimiters;
  611. property FlowTo;
  612. property Font;
  613. property Frame;
  614. property GapX;
  615. property GapY;
  616. property HAlign;
  617. property HideZeros;
  618. property Highlight;
  619. property LineSpacing;
  620. property Memo;
  621. property ParagraphGap;
  622. property ParentFont;
  623. property Rotation;
  624. property RTLReading;
  625. property Style;
  626. property SuppressRepeated;
  627. property Underlines;
  628. property WordBreak;
  629. property WordWrap;
  630. property VAlign;
  631. end;
  632. TfrxSysMemoView = class(TfrxCustomMemoView)
  633. public
  634. class function GetDescription: String; override;
  635. published
  636. property AutoWidth;
  637. property BrushStyle;
  638. property CharSpacing;
  639. property Color;
  640. property DisplayFormat;
  641. property Font;
  642. property Frame;
  643. property GapX;
  644. property GapY;
  645. property HAlign;
  646. property HideZeros;
  647. property Highlight;
  648. property Memo;
  649. property ParentFont;
  650. property Rotation;
  651. property RTLReading;
  652. property Style;
  653. property SuppressRepeated;
  654. property VAlign;
  655. end;
  656. TfrxCustomLineView = class(TfrxStretcheable)
  657. private
  658. FDiagonal: Boolean;
  659. procedure DrawDiagonalLine;
  660. public
  661. constructor Create(AOwner: TComponent); override;
  662. constructor DesignCreate(AOwner: TComponent; Flags: Word); override;
  663. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  664. property Diagonal: Boolean read FDiagonal write FDiagonal default False;
  665. end;
  666. TfrxLineView = class(TfrxCustomLineView)
  667. public
  668. class function GetDescription: String; override;
  669. published
  670. property Frame;
  671. property Diagonal;
  672. end;
  673. TfrxPictureView = class(TfrxView)
  674. private
  675. FAutoSize: Boolean;
  676. FCenter: Boolean;
  677. FKeepAspectRatio: Boolean;
  678. FPicture: TPicture;
  679. FPictureChanged: Boolean;
  680. FStretched: Boolean;
  681. procedure SetPicture(const Value: TPicture);
  682. procedure PictureChanged(Sender: TObject);
  683. procedure SetAutoSize(const Value: Boolean);
  684. public
  685. constructor Create(AOwner: TComponent); override;
  686. destructor Destroy; override;
  687. function Diff(AComponent: TfrxComponent): String; override;
  688. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  689. procedure GetData; override;
  690. class function GetDescription: String; override;
  691. published
  692. property AutoSize: Boolean read FAutoSize write SetAutoSize default False;
  693. property Center: Boolean read FCenter write FCenter default False;
  694. property DataField;
  695. property DataSet;
  696. property DataSetName;
  697. property Frame;
  698. property KeepAspectRatio: Boolean read FKeepAspectRatio write FKeepAspectRatio default True;
  699. property Picture: TPicture read FPicture write SetPicture;// stored IsPictureStored;
  700. property Stretched: Boolean read FStretched write FStretched default True;
  701. end;
  702. TfrxShapeView = class(TfrxView)
  703. private
  704. FShape: TfrxShapeKind;
  705. public
  706. constructor Create(AOwner: TComponent); override;
  707. constructor DesignCreate(AOwner: TComponent; Flags: Word); override;
  708. function Diff(AComponent: TfrxComponent): String; override;
  709. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  710. class function GetDescription: String; override;
  711. published
  712. property BrushStyle;
  713. property Color;
  714. property Frame;
  715. property Shape: TfrxShapeKind read FShape write FShape default skRectangle;
  716. end;
  717. TfrxSubreport = class(TfrxView)
  718. private
  719. FPage: TfrxReportPage;
  720. FPrintOnParent: Boolean;
  721. procedure SetPage(const Value: TfrxReportPage);
  722. public
  723. constructor Create(AOwner: TComponent); override;
  724. destructor Destroy; override;
  725. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  726. class function GetDescription: String; override;
  727. published
  728. property Page: TfrxReportPage read FPage write SetPage;
  729. property PrintOnParent: Boolean read FPrintOnParent write FPrintOnParent
  730. default False;
  731. end;
  732. { Bands }
  733. TfrxChild = class;
  734. TfrxBand = class(TfrxReportComponent)
  735. private
  736. FAllowSplit: Boolean;
  737. FChild: TfrxChild;
  738. FKeepChild: Boolean;
  739. FOnAfterCalcHeight: TfrxNotifyEvent;
  740. FOutlineText: String;
  741. FOverflow: Boolean;
  742. FStartNewPage: Boolean;
  743. FStretched: Boolean;
  744. FPrintChildIfInvisible: Boolean;
  745. FVertical: Boolean;
  746. function GetBandName: String;
  747. protected
  748. procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  749. procedure SetLeft(Value: Extended); override;
  750. procedure SetTop(Value: Extended); override;
  751. procedure SetHeight(Value: Extended); override;
  752. public
  753. FSubBands: TList; { list of subbands }
  754. FHeader, FFooter, FGroup: TfrxBand; { h./f./g. bands }
  755. FLineN: Integer; { used for Line# }
  756. FLineThrough: Integer; { used for LineThrough# }
  757. FOriginalObjectsCount: Integer; { used for TfrxSubReport.PrintOnParent }
  758. FHasVBands: Boolean; { whether the band should show vbands }
  759. constructor Create(AOwner: TComponent); override;
  760. destructor Destroy; override;
  761. function BandNumber: Integer;
  762. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended); override;
  763. class function GetDescription: String; override;
  764. property AllowSplit: Boolean read FAllowSplit write FAllowSplit default False;
  765. property BandName: String read GetBandName;
  766. property Child: TfrxChild read FChild write FChild;
  767. property KeepChild: Boolean read FKeepChild write FKeepChild default False;
  768. property Overflow: Boolean read FOverflow write FOverflow;
  769. property PrintChildIfInvisible: Boolean read FPrintChildIfInvisible
  770. write FPrintChildIfInvisible default False;
  771. property StartNewPage: Boolean read FStartNewPage write FStartNewPage default False;
  772. property Stretched: Boolean read FStretched write FStretched default False;
  773. published
  774. property Font;
  775. property Height;
  776. property Left;
  777. property OutlineText: String read FOutlineText write FOutlineText;
  778. property ParentFont;
  779. property Restrictions;
  780. property Top;
  781. property Vertical: Boolean read FVertical write FVertical default False;
  782. property Visible;
  783. property Width;
  784. property OnAfterCalcHeight: TfrxNotifyEvent read FOnAfterCalcHeight
  785. write FOnAfterCalcHeight;
  786. property OnAfterPrint;
  787. property OnBeforePrint;
  788. end;
  789. TfrxBandClass = class of TfrxBand;
  790. TfrxDataBand = class(TfrxBand)
  791. private
  792. FColumnGap: Extended;
  793. FColumnWidth: Extended;
  794. FColumns: Integer;
  795. FCurColumn: Integer;
  796. FDataSet: TfrxDataSet;
  797. FDataSetName: String;
  798. FFooterAfterEach: Boolean;
  799. FKeepFooter: Boolean;
  800. FKeepTogether: Boolean;
  801. FPrintIfDetailEmpty: Boolean;
  802. FRowCount: Integer;
  803. FOnMasterDetail: TfrxNotifyEvent;
  804. FVirtualDataSet: TfrxUserDataSet;
  805. procedure SetCurColumn(Value: Integer);
  806. procedure SetRowCount(const Value: Integer);
  807. procedure SetDataSet(const Value: TfrxDataSet);
  808. procedure SetDataSetName(const Value: String);
  809. function GetDataSetName: String;
  810. protected
  811. procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  812. public
  813. FMaxY: Extended; { used for columns }
  814. constructor Create(AOwner: TComponent); override;
  815. destructor Destroy; override;
  816. class function GetDescription: String; override;
  817. property CurColumn: Integer read FCurColumn write SetCurColumn;
  818. property VirtualDataSet: TfrxUserDataSet read FVirtualDataSet;
  819. published
  820. property AllowSplit;
  821. property Child;
  822. property Columns: Integer read FColumns write FColumns default 0;
  823. property ColumnWidth: Extended read FColumnWidth write FColumnWidth;
  824. property ColumnGap: Extended read FColumnGap write FColumnGap;
  825. property DataSet: TfrxDataSet read FDataSet write SetDataSet;
  826. property DataSetName: String read GetDataSetName write SetDataSetName;
  827. property FooterAfterEach: Boolean read FFooterAfterEach write FFooterAfterEach default False;
  828. property KeepChild;
  829. property KeepFooter: Boolean read FKeepFooter write FKeepFooter default False;
  830. property KeepTogether: Boolean read FKeepTogether write FKeepTogether default False;
  831. property PrintChildIfInvisible;
  832. property PrintIfDetailEmpty: Boolean read FPrintIfDetailEmpty
  833. write FPrintIfDetailEmpty default False;
  834. property RowCount: Integer read FRowCount write SetRowCount;
  835. property StartNewPage;
  836. property Stretched;
  837. property OnMasterDetail: TfrxNotifyEvent read FOnMasterDetail write FOnMasterDetail;
  838. end;
  839. TfrxHeader = class(TfrxBand)
  840. private
  841. FReprintOnNewPage: Boolean;
  842. published
  843. property AllowSplit;
  844. property Child;
  845. property KeepChild;
  846. property PrintChildIfInvisible;
  847. property ReprintOnNewPage: Boolean read FReprintOnNewPage write FReprintOnNewPage default False;
  848. property StartNewPage;
  849. property Stretched;
  850. end;
  851. TfrxFooter = class(TfrxBand)
  852. private
  853. public
  854. published
  855. property AllowSplit;
  856. property Child;
  857. property KeepChild;
  858. property PrintChildIfInvisible;
  859. property Stretched;
  860. end;
  861. TfrxMasterData = class(TfrxDataBand)
  862. private
  863. public
  864. published
  865. end;
  866. TfrxDetailData = class(TfrxDataBand)
  867. private
  868. public
  869. published
  870. end;
  871. TfrxSubdetailData = class(TfrxDataBand)
  872. private
  873. public
  874. published
  875. end;
  876. TfrxDataBand4 = class(TfrxDataBand)
  877. private
  878. public
  879. published
  880. end;
  881. TfrxDataBand5 = class(TfrxDataBand)
  882. private
  883. public
  884. published
  885. end;
  886. TfrxDataBand6 = class(TfrxDataBand)
  887. private
  888. public
  889. published
  890. end;
  891. TfrxPageHeader = class(TfrxBand)
  892. private
  893. FPrintOnFirstPage: Boolean;
  894. public
  895. constructor Create(AOwner: TComponent); override;
  896. published
  897. property PrintOnFirstPage: Boolean read FPrintOnFirstPage write FPrintOnFirstPage default True;
  898. property Stretched;
  899. end;
  900. TfrxPageFooter = class(TfrxBand)
  901. private
  902. FPrintOnFirstPage: Boolean;
  903. FPrintOnLastPage: Boolean;
  904. public
  905. constructor Create(AOwner: TComponent); override;
  906. published
  907. property PrintOnFirstPage: Boolean read FPrintOnFirstPage write FPrintOnFirstPage default True;
  908. property PrintOnLastPage: Boolean read FPrintOnLastPage write FPrintOnLastPage default True;
  909. end;
  910. TfrxColumnHeader = class(TfrxBand)
  911. private
  912. public
  913. published
  914. property Stretched;
  915. end;
  916. TfrxColumnFooter = class(TfrxBand)
  917. private
  918. public
  919. published
  920. end;
  921. TfrxGroupHeader = class(TfrxBand)
  922. private
  923. FCondition: String;
  924. FKeepTogether: Boolean;
  925. FReprintOnNewPage: Boolean;
  926. public
  927. FLastValue: Variant;
  928. published
  929. property AllowSplit;
  930. property Child;
  931. property Condition: String read FCondition write FCondition;
  932. property KeepChild;
  933. property KeepTogether: Boolean read FKeepTogether write FKeepTogether default False;
  934. property ReprintOnNewPage: Boolean read FReprintOnNewPage write FReprintOnNewPage default False;
  935. property PrintChildIfInvisible;
  936. property StartNewPage;
  937. property Stretched;
  938. end;
  939. TfrxGroupFooter = class(TfrxBand)
  940. private
  941. public
  942. published
  943. property AllowSplit;
  944. property Child;
  945. property KeepChild;
  946. property PrintChildIfInvisible;
  947. property Stretched;
  948. end;
  949. TfrxReportTitle = class(TfrxBand)
  950. private
  951. public
  952. published
  953. property Child;
  954. property KeepChild;
  955. property PrintChildIfInvisible;
  956. property StartNewPage;
  957. property Stretched;
  958. end;
  959. TfrxReportSummary = class(TfrxBand)
  960. private
  961. public
  962. published
  963. property AllowSplit;
  964. property Child;
  965. property KeepChild;
  966. property PrintChildIfInvisible;
  967. property StartNewPage;
  968. property Stretched;
  969. end;
  970. TfrxChild = class(TfrxBand)
  971. private
  972. public
  973. published
  974. property AllowSplit;
  975. property Child;
  976. property KeepChild;
  977. property PrintChildIfInvisible;
  978. property StartNewPage;
  979. property Stretched;
  980. end;
  981. TfrxOverlay = class(TfrxBand)
  982. private
  983. public
  984. published
  985. end;
  986. TfrxNullBand = class(TfrxBand);
  987. { Pages }
  988. TfrxPage = class(TfrxComponent)
  989. private
  990. protected
  991. public
  992. published
  993. property Font;
  994. property Visible;
  995. end;
  996. TfrxReportPage = class(TfrxPage)
  997. private
  998. FBackPicture: TfrxPictureView;
  999. FBin: Integer;
  1000. FBinOtherPages: Integer;
  1001. FBottomMargin: Extended;
  1002. FColumns: Integer;
  1003. FColumnWidth: Extended;
  1004. FColumnPositions: TStrings;
  1005. FDataSet: TfrxDataSet;
  1006. FDuplex: TfrxDuplexMode;
  1007. FHGuides: TStrings;
  1008. FLargeDesignHeight: Boolean;
  1009. FLeftMargin: Extended;
  1010. FMirrorMargins: Boolean;
  1011. FOrientation: TPrinterOrientation;
  1012. FOutlineText: String;
  1013. FPrintIfEmpty: Boolean;
  1014. FPrintOnPreviousPage: Boolean;
  1015. FRightMargin: Extended;
  1016. FSubReport: TfrxSubReport;
  1017. FTitleBeforeHeader: Boolean;
  1018. FTopMargin: Extended;
  1019. FVGuides: TStrings;
  1020. FOnAfterPrint: TfrxNotifyEvent;
  1021. FOnBeforePrint: TfrxNotifyEvent;
  1022. FOnManualBuild: TfrxNotifyEvent;
  1023. FDataSetName: String;
  1024. procedure SetColumns(const Value: Integer);
  1025. procedure SetOrientation(Value: TPrinterOrientation);
  1026. procedure SetHGuides(const Value: TStrings);
  1027. procedure SetVGuides(const Value: TStrings);
  1028. procedure SetColumnPositions(const Value: TStrings);
  1029. procedure SetFrame(const Value: TfrxFrame);
  1030. function GetFrame: TfrxFrame;
  1031. function GetColor: TColor;
  1032. procedure SetColor(const Value: TColor);
  1033. function GetBackPicture: TPicture;
  1034. procedure SetBackPicture(const Value: TPicture);
  1035. procedure SetDataSet(const Value: TfrxDataSet);
  1036. procedure SetDataSetName(const Value: String);
  1037. function GetDataSetName: String;
  1038. protected
  1039. FPaperHeight: Extended;
  1040. FPaperSize: Integer;
  1041. FPaperWidth: Extended;
  1042. procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  1043. procedure SetPaperHeight(const Value: Extended); virtual;
  1044. procedure SetPaperWidth(const Value: Extended); virtual;
  1045. procedure SetPaperSize(const Value: Integer); virtual;
  1046. procedure UpdateDimensions;
  1047. public
  1048. FSubBands: TList; { list of master bands }
  1049. FVSubBands: TList; { list of vertical master bands }
  1050. constructor Create(AOwner: TComponent); override;
  1051. destructor Destroy; override;
  1052. class function GetDescription: String; override;
  1053. function FindBand(Band: TfrxBandClass): TfrxBand;
  1054. function IsSubReport: Boolean;
  1055. procedure AlignChildren; override;
  1056. procedure ClearGuides;
  1057. procedure Draw(Canvas: TCanvas; ScaleX, ScaleY, OffsetX, OffsetY: Extended);
  1058. procedure SetDefaults; virtual;
  1059. property SubReport: TfrxSubReport read FSubReport;
  1060. published
  1061. { paper }
  1062. property Orientation: TPrinterOrientation read FOrientation
  1063. write SetOrientation default poPortrait;
  1064. property PaperWidth: Extended read FPaperWidth write SetPaperWidth;
  1065. property PaperHeight: Extended read FPaperHeight write SetPaperHeight;
  1066. property PaperSize: Integer read FPaperSize write SetPaperSize;
  1067. { margins }
  1068. property LeftMargin: Extended read FLeftMargin write FLeftMargin;
  1069. property RightMargin: Extended read FRightMargin write FRightMargin;
  1070. property TopMargin: Extended read FTopMargin write FTopMargin;
  1071. property BottomMargin: Extended read FBottomMargin write FBottomMargin;
  1072. property MirrorMargins: Boolean read FMirrorMargins write FMirrorMargins
  1073. default False;
  1074. { columns }
  1075. property Columns: Integer read FColumns write SetColumns default 0;
  1076. property ColumnWidth: Extended read FColumnWidth write FColumnWidth;
  1077. property ColumnPositions: TStrings read FColumnPositions write SetColumnPositions;
  1078. { bins }
  1079. property Bin: Integer read FBin write FBin default DMBIN_AUTO;
  1080. property BinOtherPages: Integer read FBinOtherPages write FBinOtherPages
  1081. default DMBIN_AUTO;
  1082. { other }
  1083. property BackPicture: TPicture read GetBackPicture write SetBackPicture;
  1084. property Color: TColor read GetColor write SetColor default clTransparent;
  1085. property DataSet: TfrxDataSet read FDataSet write SetDataSet;
  1086. property DataSetName: String read GetDataSetName write SetDataSetName;
  1087. property Duplex: TfrxDuplexMode read FDuplex write FDuplex default dmNone;
  1088. property Frame: TfrxFrame read GetFrame write SetFrame;
  1089. property LargeDesignHeight: Boolean read FLargeDesignHeight
  1090. write FLargeDesignHeight default False;
  1091. property OutlineText: String read FOutlineText write FOutlineText;
  1092. property PrintIfEmpty: Boolean read FPrintIfEmpty write FPrintIfEmpty default True;
  1093. property PrintOnPreviousPage: Boolean read FPrintOnPreviousPage
  1094. write FPrintOnPreviousPage default False;
  1095. property TitleBeforeHeader: Boolean read FTitleBeforeHeader
  1096. write FTitleBeforeHeader default True;
  1097. property HGuides: TStrings read FHGuides write SetHGuides;
  1098. property VGuides: TStrings read FVGuides write SetVGuides;
  1099. property OnAfterPrint: TfrxNotifyEvent read FOnAfterPrint write FOnAfterPrint;
  1100. property OnBeforePrint: TfrxNotifyEvent read FOnBeforePrint write FOnBeforePrint;
  1101. property OnManualBuild: TfrxNotifyEvent read FOnManualBuild write FOnManualBuild;
  1102. end;
  1103. TfrxDialogPage = class(TfrxPage)
  1104. private
  1105. FBorderStyle: TFormBorderStyle;
  1106. FCaption: String;
  1107. FColor: TColor;
  1108. FForm: TForm;
  1109. FOnActivate: TfrxNotifyEvent;
  1110. FOnClick: TfrxNotifyEvent;
  1111. FOnDeactivate: TfrxNotifyEvent;
  1112. FOnHide: TfrxNotifyEvent;
  1113. FOnShow: TfrxNotifyEvent;
  1114. FOnCloseQuery: TfrxCloseQueryEvent;
  1115. FPosition: TPosition;
  1116. FWindowState: TWindowState;
  1117. FOnResize: TfrxNotifyEvent;
  1118. procedure DoInitialize;
  1119. procedure DoOnActivate(Sender: TObject);
  1120. procedure DoOnClick(Sender: TObject);
  1121. procedure DoOnCloseQuery(Sender: TObject; var CanClose: Boolean);
  1122. procedure DoOnDeactivate(Sender: TObject);
  1123. procedure DoOnHide(Sender: TObject);
  1124. procedure DoOnShow(Sender: TObject);
  1125. procedure DoOnResize(Sender: TObject);
  1126. procedure SetBorderStyle(const Value: TFormBorderStyle);
  1127. procedure SetCaption(const Value: String);
  1128. procedure SetColor(const Value: TColor);
  1129. function GetModalResult: TModalResult;
  1130. procedure SetModalResult(const Value: TModalResult);
  1131. protected
  1132. procedure SetLeft(Value: Extended); override;
  1133. procedure SetTop(Value: Extended); override;
  1134. procedure SetWidth(Value: Extended); override;
  1135. procedure SetHeight(Value: Extended); override;
  1136. procedure FontChanged(Sender: TObject); override;
  1137. public
  1138. constructor Create(AOwner: TComponent); override;
  1139. destructor Destroy; override;
  1140. class function GetDescription: String; override;
  1141. procedure Initialize;
  1142. function ShowModal: TModalResult;
  1143. property DialogForm: TForm read FForm;
  1144. property ModalResult: TModalResult read GetModalResult write SetModalResult;
  1145. published
  1146. property BorderStyle: TFormBorderStyle read FBorderStyle write SetBorderStyle default bsSizeable;
  1147. property Caption: String read FCaption write SetCaption;
  1148. property Color: TColor read FColor write SetColor default clBtnFace;
  1149. property Height;
  1150. property Left;
  1151. property Position: TPosition read FPosition write FPosition default poScreenCenter;
  1152. property Top;
  1153. property Width;
  1154. property WindowState: TWindowState read FWindowState write FWindowState default wsNormal;
  1155. property OnActivate: TfrxNotifyEvent read FOnActivate write FOnActivate;
  1156. property OnClick: TfrxNotifyEvent read FOnClick write FOnClick;
  1157. property OnCloseQuery: TfrxCloseQueryEvent read FOnCloseQuery write FOnCloseQuery;
  1158. property OnDeactivate: TfrxNotifyEvent read FOnDeactivate write FOnDeactivate;
  1159. property OnHide: TfrxNotifyEvent read FOnHide write FOnHide;
  1160. property OnShow: TfrxNotifyEvent read FOnShow write FOnShow;
  1161. property OnResize: TfrxNotifyEvent read FOnResize write FOnResize;
  1162. end;
  1163. { Report }
  1164. TfrxEngineOptions = class(TPersistent)
  1165. private
  1166. FConvertNulls: Boolean;
  1167. FDoublePass: Boolean;
  1168. FMaxMemSize: Integer;
  1169. FPrintIfEmpty: Boolean;
  1170. FReportThread: TThread;
  1171. FSilentMode: Boolean;
  1172. FTempDir: String;
  1173. FUseFileCache: Boolean;
  1174. public
  1175. constructor Create;
  1176. procedure Assign(Source: TPersistent); override;
  1177. procedure Clear;
  1178. property ReportThread: TThread read FReportThread write FReportThread;
  1179. published
  1180. property ConvertNulls: Boolean read FConvertNulls write FConvertNulls default True;
  1181. property DoublePass: Boolean read FDoublePass write FDoublePass default False;
  1182. property MaxMemSize: Integer read FMaxMemSize write FMaxMemSize default 10;
  1183. property PrintIfEmpty: Boolean read FPrintIfEmpty write FPrintIfEmpty default True;
  1184. property SilentMode: Boolean read FSilentMode write FSilentMode default False;
  1185. property TempDir: String read FTempDir write FTempDir;
  1186. property UseFileCache: Boolean read FUseFileCache write FUseFileCache default False;
  1187. end;
  1188. TfrxPrintOptions = class(TPersistent)
  1189. private
  1190. FCopies: Integer;
  1191. FCollate: Boolean;
  1192. FPageNumbers: String;
  1193. FPrinter: String;
  1194. FPrintPages: TfrxPrintPages;
  1195. FShowDialog: Boolean;
  1196. public
  1197. constructor Create;
  1198. procedure Assign(Source: TPersistent); override;
  1199. procedure Clear;
  1200. published
  1201. property Copies: Integer read FCopies write FCopies default 1;
  1202. property Collate: Boolean read FCollate write FCollate default True;
  1203. property PageNumbers: String read FPageNumbers write FPageNumbers;
  1204. property Printer: String read FPrinter write FPrinter;
  1205. property PrintPages: TfrxPrintPages read FPrintPages write FPrintPages default ppAll;
  1206. property ShowDialog: Boolean read FShowDialog write FShowDialog default True;
  1207. end;
  1208. TfrxPreviewOptions = class(TPersistent)
  1209. private
  1210. FAllowEdit: Boolean;
  1211. FButtons: TfrxPreviewButtons;
  1212. FDoubleBuffered: Boolean;
  1213. FMaximized: Boolean;
  1214. FMDIChild: Boolean;
  1215. FModal: Boolean;
  1216. FOutlineVisible: Boolean;
  1217. FOutlineWidth: Integer;
  1218. FShowCaptions: Boolean;
  1219. FZoom: Extended;
  1220. FZoomMode: TfrxZoomMode;
  1221. public
  1222. constructor Create;
  1223. procedure Assign(Source: TPersistent); override;
  1224. procedure Clear;
  1225. published
  1226. property AllowEdit: Boolean read FAllowEdit write FAllowEdit default True;
  1227. property Buttons: TfrxPreviewButtons read FButtons write FButtons;
  1228. property DoubleBuffered: Boolean read FDoubleBuffered write FDoubleBuffered default True;
  1229. property Maximized: Boolean read FMaximized write FMaximized default True;
  1230. property MDIChild: Boolean read FMDIChild write FMDIChild default False;
  1231. property Modal: Boolean read FModal write FModal default True;
  1232. property OutlineVisible: Boolean read FOutlineVisible write FOutlineVisible default False;
  1233. property OutlineWidth: Integer read FOutlineWidth write FOutlineWidth default 120;
  1234. property ShowCaptions: Boolean read FShowCaptions write FShowCaptions default False;
  1235. property Zoom: Extended read FZoom write FZoom;
  1236. property ZoomMode: TfrxZoomMode read FZoomMode write FZoomMode default zmDefault;
  1237. end;
  1238. TfrxReportOptions = class(TPersistent)
  1239. private
  1240. FAuthor: String;
  1241. FCompressed: Boolean;
  1242. FCreateDate: TDateTime;
  1243. FDescription: TStrings;
  1244. FInitString: String;
  1245. FName: String;
  1246. FLastChange: TDateTime;
  1247. FPassword: String;
  1248. FPicture: TPicture;
  1249. FVersionBuild: String;
  1250. FVersionMajor: String;
  1251. FVersionMinor: String;
  1252. FVersionRelease: String;
  1253. procedure SetDescription(const Value: TStrings);
  1254. procedure SetPicture(const Value: TPicture);
  1255. public
  1256. constructor Create;
  1257. destructor Destroy; override;
  1258. procedure Assign(Source: TPersistent); override;
  1259. procedure Clear;
  1260. function CheckPassword: Boolean;
  1261. published
  1262. property Author: String read FAuthor write FAuthor;
  1263. property Compressed: Boolean read FCompressed write FCompressed default False;
  1264. property CreateDate: TDateTime read FCreateDate write FCreateDate;
  1265. property Description: TStrings read FDescription write SetDescription;
  1266. property InitString: String read FInitString write FInitString;
  1267. property Name: String read FName write FName;
  1268. property LastChange: TDateTime read FLastChange write FLastChange;
  1269. property Password: String read FPassword write FPassword;
  1270. property Picture: TPicture read FPicture write SetPicture;
  1271. property VersionBuild: String read FVersionBuild write FVersionBuild;
  1272. property VersionMajor: String read FVersionMajor write FVersionMajor;
  1273. property VersionMinor: String read FVersionMinor write FVersionMinor;
  1274. property VersionRelease: String read FVersionRelease write FVersionRelease;
  1275. end;
  1276. TfrxExpressionCache = class(TObject)
  1277. private
  1278. FExpressions: TStringList;
  1279. FScript: TfsScript;
  1280. public
  1281. constructor Create(AScript: TfsScript);
  1282. destructor Destroy; override;
  1283. procedure Clear;
  1284. function Calc(const Expression: String; var ErrorMsg: String): Variant;
  1285. end;
  1286. TfrxDataSetItem = class(TCollectionItem)
  1287. private
  1288. FDataSet: TfrxDataSet;
  1289. FDataSetName: String;
  1290. procedure SetDataSet(const Value: TfrxDataSet);
  1291. procedure SetDataSetName(const Value: String);
  1292. function GetDataSetName: String;
  1293. published
  1294. property DataSet: TfrxDataSet read FDataSet write SetDataSet;
  1295. property DataSetName: String read GetDataSetName write SetDataSetName;
  1296. end;
  1297. TfrxReportDataSets = class(TCollection)
  1298. private
  1299. FReport: TfrxReport;
  1300. function GetItem(Index: Integer): TfrxDataSetItem;
  1301. public
  1302. constructor Create(AReport: TfrxReport);
  1303. procedure Initialize;
  1304. procedure Finalize;
  1305. procedure Add(ds: TfrxDataSet);
  1306. function Find(ds: TfrxDataSet): TfrxDataSetItem; overload;
  1307. function Find(const Name: String): TfrxDataSetItem; overload;
  1308. property Items[Index: Integer]: TfrxDataSetItem read GetItem; default;
  1309. end;
  1310. TfrxStyleItem = class(TCollectionItem)
  1311. private
  1312. FName: String;
  1313. FColor: TColor;
  1314. FFont: TFont;
  1315. FFrame: TfrxFrame;
  1316. procedure SetFont(const Value: TFont);
  1317. procedure SetFrame(const Value: TfrxFrame);
  1318. procedure SetName(const Value: String);
  1319. public
  1320. constructor Create(Collection: TCollection); override;
  1321. destructor Destroy; override;
  1322. procedure Assign(Source: TPersistent); override;
  1323. procedure CreateUniqueName;
  1324. published
  1325. property Name: String read FName write SetName;
  1326. property Color: TColor read FColor write FColor;
  1327. property Font: TFont read FFont write SetFont;
  1328. property Frame: TfrxFrame read FFrame write SetFrame;
  1329. end;
  1330. TfrxStyles = class(TCollection)
  1331. private
  1332. FName: String;
  1333. FReport: TfrxReport;
  1334. function GetItem(Index: Integer): TfrxStyleItem;
  1335. public
  1336. constructor Create(AReport: TfrxReport);
  1337. function Add: TfrxStyleItem;
  1338. function Find(const Name: String): TfrxStyleItem;
  1339. procedure Apply;
  1340. procedure GetList(List: TStrings);
  1341. procedure LoadFromFile(const FileName: String);
  1342. procedure LoadFromStream(Stream: TStream);
  1343. procedure LoadFromXMLItem(Item: TfrxXMLItem);
  1344. procedure SaveToFile(const FileName: String);
  1345. procedure SaveToStream(Stream: TStream);
  1346. procedure SaveToXMLItem(Item: TfrxXMLItem);
  1347. property Items[Index: Integer]: TfrxStyleItem read GetItem; default;
  1348. property Name: String read FName write FName;
  1349. end;
  1350. TfrxStyleSheet = class(TObject)
  1351. private
  1352. FItems: TList;
  1353. function GetItems(Index: Integer): TfrxStyles;
  1354. public
  1355. constructor Create;
  1356. destructor Destroy; override;
  1357. procedure Clear;
  1358. procedure Delete(Index: Integer);
  1359. procedure GetList(List: TStrings);
  1360. procedure LoadFromFile(const FileName: String);
  1361. procedure LoadFromStream(Stream: TStream);
  1362. procedure SaveToFile(const FileName: String);
  1363. procedure SaveToStream(Stream: TStream);
  1364. function Add: TfrxStyles;
  1365. function Count: Integer;
  1366. function Find(const Name: String): TfrxStyles;
  1367. function IndexOf(const Name: String): Integer;
  1368. property Items[Index: Integer]: TfrxStyles read GetItems; default;
  1369. end;
  1370. TfrxReport = class(TfrxComponent)
  1371. private
  1372. FCurObject: String;
  1373. FDataSet: TfrxDataSet;
  1374. FDataSetName: String;
  1375. FDataSets: TfrxReportDatasets;
  1376. FDesigner: TfrxCustomDesigner;
  1377. FDotMatrixReport: Boolean;
  1378. FDrawText: Pointer;
  1379. FEngine: TfrxCustomEngine;
  1380. FEngineOptions: TfrxEngineOptions;
  1381. FErrors: TStrings;
  1382. FExpressionCache: TfrxExpressionCache;
  1383. FFileName: String;
  1384. FIniFile: String;
  1385. FLoadStream: TStream;
  1386. FLocalValue: TfsCustomVariable;
  1387. FPreviewPages: TfrxCustomPreviewPages;
  1388. FParentForm: TForm;
  1389. FPreview: TfrxCustomPreview;
  1390. FPreviewForm: TForm;
  1391. FPreviewOptions: TfrxPreviewOptions;
  1392. FPrintOptions: TfrxPrintOptions;
  1393. FProgram: TfsScript;
  1394. FReloading: Boolean;
  1395. FReportOptions: TfrxReportOptions;
  1396. FScript: TfsScript;
  1397. FScriptLanguage: String;
  1398. FScriptText: TStrings;
  1399. FStyles: TfrxStyles;
  1400. FSysVariables: TStrings;
  1401. FTimer: TTimer;
  1402. FVariables: TfrxVariables;
  1403. FOnAfterPrint: TfrxBeforePrintEvent;
  1404. FOnBeforePrint: TfrxBeforePrintEvent;
  1405. FOnClickObject: TfrxClickObjectEvent;
  1406. FOnGetValue: TfrxGetValueEvent;
  1407. FOnManualBuild: TfrxManualBuildEvent;
  1408. FOnMouseOverObject: TfrxMouseOverObjectEvent;
  1409. FOnStartReport: TfrxNotifyEvent;
  1410. FOnStopReport: TfrxNotifyEvent;
  1411. FOnUserFunction: TfrxUserFunctionEvent;
  1412. function DoGetValue(const Expr: String; var Value: Variant): Boolean;
  1413. function GetScriptValue(Instance: TObject; ClassType: TClass;
  1414. const MethodName: String; var Params: Variant): Variant;
  1415. function SetScriptValue(Instance: TObject; ClassType: TClass;
  1416. const MethodName: String; var Params: Variant): Variant;
  1417. function DoUserFunction(Instance: TObject; ClassType: TClass;
  1418. const MethodName: String; var Params: Variant): Variant;
  1419. function GetDataSetName: String;
  1420. function GetLocalValue: Variant;
  1421. function GetPages(Index: Integer): TfrxPage;
  1422. function GetPagesCount: Integer;
  1423. procedure DoClear;
  1424. procedure DoLoadFromStream;
  1425. procedure OnTimer(Sender: TObject);
  1426. procedure ReadDatasets(Reader: TReader);
  1427. procedure ReadStyle(Reader: TReader);
  1428. procedure ReadVariables(Reader: TReader);
  1429. procedure SetDataSet(const Value: TfrxDataSet);
  1430. procedure SetDataSetName(const Value: String);
  1431. procedure SetEngineOptions(const Value: TfrxEngineOptions);
  1432. procedure SetLocalValue(const Value: Variant);
  1433. procedure SetPreviewOptions(const Value: TfrxPreviewOptions);
  1434. procedure SetPrintOptions(const Value: TfrxPrintOptions);
  1435. procedure SetReportOptions(const Value: TfrxReportOptions);
  1436. procedure SetScriptText(const Value: TStrings);
  1437. procedure SetStyles(const Value: TfrxStyles);
  1438. procedure WriteDatasets(Writer: TWriter);
  1439. procedure WriteStyle(Writer: TWriter);
  1440. procedure WriteVariables(Writer: TWriter);
  1441. protected
  1442. procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  1443. procedure DefineProperties(Filer: TFiler); override;
  1444. public
  1445. constructor Create(AOwner: TComponent); override;
  1446. destructor Destroy; override;
  1447. procedure Clear; override;
  1448. class function GetDescription: String; override;
  1449. { internal methods }
  1450. function Calc(const Expr: String): Variant;
  1451. function DesignPreviewPage: Boolean;
  1452. function GetAlias(DataSet: TfrxDataSet): String;
  1453. function GetDataset(const Alias: String): TfrxDataset;
  1454. function GetIniFile: TCustomIniFile;
  1455. function PrepareScript: Boolean;
  1456. procedure DoNotifyEvent(Obj: TObject; const EventName: String;
  1457. RunAlways: Boolean = False);
  1458. procedure DoParamEvent(const EventName: String; var Params: Variant;
  1459. RunAlways: Boolean = False);
  1460. procedure DoAfterPrint(c: TfrxReportComponent);
  1461. procedure DoBeforePrint(c: TfrxReportComponent);
  1462. procedure DoPreviewClick(v: TfrxView; Button: TMouseButton;
  1463. Shift: TShiftState; var Modified: Boolean);
  1464. procedure GetDatasetAndField(const ComplexName: String;
  1465. var Dataset: TfrxDataset; var Field: String);
  1466. procedure GetDataSetList(List: TStrings; OnlyDB: Boolean = False);
  1467. procedure SelectPrinter;
  1468. { public methods }
  1469. function LoadFromFile(const FileName: String;
  1470. ExceptionIfNotFound: Boolean = False): Boolean;
  1471. procedure LoadFromStream(Stream: TStream); override;
  1472. procedure SaveToFile(const FileName: String);
  1473. procedure SaveToStream(Stream: TStream; SaveChildren: Boolean = True;
  1474. SaveDefaultValues: Boolean = False); override;
  1475. procedure DesignReport; overload;
  1476. procedure DesignReport(IDesigner: IUnknown; Editor: TObject); overload;
  1477. function PrepareReport(ClearLastReport: Boolean = True): Boolean;
  1478. procedure ShowPreparedReport;
  1479. procedure ShowReport(ClearLastReport: Boolean = True);
  1480. procedure Print;
  1481. procedure Export(Filter: TfrxCustomExportFilter);
  1482. procedure AddFunction(const FuncName: String; const Category: String = '';
  1483. const Description: String = '');
  1484. { internals }
  1485. property CurObject: String read FCurObject write FCurObject;
  1486. property LocalValue: Variant read GetLocalValue write SetLocalValue;
  1487. property Script1: TfsScript read FProgram;
  1488. { public }
  1489. property DataSets: TfrxReportDataSets read FDataSets;
  1490. property Designer: TfrxCustomDesigner read FDesigner;
  1491. property Engine: TfrxCustomEngine read FEngine;
  1492. property Errors: TStrings read FErrors;
  1493. property FileName: String read FFileName write FFileName;
  1494. property PreviewPages: TfrxCustomPreviewPages read FPreviewPages;
  1495. property Pages[Index: Integer]: TfrxPage read GetPages;
  1496. property PagesCount: Integer read GetPagesCount;
  1497. property Script: TfsScript read FScript;
  1498. property Styles: TfrxStyles read FStyles write SetStyles;
  1499. property Variables: TfrxVariables read FVariables;
  1500. published
  1501. property DataSet: TfrxDataSet read FDataSet write SetDataSet;
  1502. property DataSetName: String read GetDataSetName write SetDataSetName;
  1503. property DotMatrixReport: Boolean read FDotMatrixReport write FDotMatrixReport;
  1504. property EngineOptions: TfrxEngineOptions read FEngineOptions write SetEngineOptions;
  1505. property IniFile: String read FIniFile write FIniFile;
  1506. property Preview: TfrxCustomPreview read FPreview write FPreview;
  1507. property PreviewOptions: TfrxPreviewOptions read FPreviewOptions write SetPreviewOptions;
  1508. property PrintOptions: TfrxPrintOptions read FPrintOptions write SetPrintOptions;
  1509. property ReportOptions: TfrxReportOptions read FReportOptions write SetReportOptions;
  1510. property ScriptLanguage: String read FScriptLanguage write FScriptLanguage;
  1511. property ScriptText: TStrings read FScriptText write SetScriptText;
  1512. property OnAfterPrint: TfrxBeforePrintEvent read FOnAfterPrint write FOnAfterPrint;
  1513. property OnBeforePrint: TfrxBeforePrintEvent read FOnBeforePrint write FOnBeforePrint;
  1514. property OnClickObject: TfrxClickObjectEvent read FOnClickObject write FOnClickObject;
  1515. property OnGetValue: TfrxGetValueEvent read FOnGetValue write FOnGetValue;
  1516. property OnManualBuild: TfrxManualBuildEvent read FOnManualBuild write FOnManualBuild;
  1517. property OnMouseOverObject: TfrxMouseOverObjectEvent read FOnMouseOverObject
  1518. write FOnMouseOverObject;
  1519. property OnStartReport: TfrxNotifyEvent read FOnStartReport write FOnStartReport;
  1520. property OnStopReport: TfrxNotifyEvent read FOnStopReport write FOnStopReport;
  1521. property OnUserFunction: TfrxUserFunctionEvent read FOnUserFunction write FOnUserFunction;
  1522. end;
  1523. TfrxCustomDesigner = class(TForm)
  1524. private
  1525. FReport: TfrxReport;
  1526. FIsPreviewDesigner: Boolean;
  1527. FMemoFontName: String;
  1528. FMemoFontSize: Integer;
  1529. FUseObjectFont: Boolean;
  1530. protected
  1531. FModalFinished: Boolean;
  1532. FModified: Boolean;
  1533. FObjects: TList;
  1534. FPage: TfrxPage;
  1535. FSelectedObjects: TList;
  1536. procedure SetModified(const Value: Boolean); virtual;
  1537. procedure SetPage(const Value: TfrxPage); virtual;
  1538. function GetCode: TStrings; virtual; abstract;
  1539. public
  1540. constructor CreateDesigner(AOwner: TComponent; AReport: TfrxReport;
  1541. APreviewDesigner: Boolean = False);
  1542. destructor Destroy; override;
  1543. function InsertExpression(const Expr: String): String; virtual; abstract;
  1544. procedure Lock; virtual; abstract;
  1545. procedure ReloadPages(Index: Integer); virtual; abstract;
  1546. procedure ReloadReport; virtual; abstract;
  1547. procedure UpdateDataTree; virtual; abstract;
  1548. procedure UpdatePage; virtual; abstract;
  1549. property IsPreviewDesigner: Boolean read FIsPreviewDesigner;
  1550. property Modified: Boolean read FModified write SetModified;
  1551. property Objects: TList read FObjects;
  1552. property Report: TfrxReport read FReport;
  1553. property SelectedObjects: TList read FSelectedObjects;
  1554. property Page: TfrxPage read FPage write SetPage;
  1555. property Code: TStrings read GetCode;
  1556. property UseObjectFont: Boolean read FUseObjectFont write FUseObjectFont;
  1557. property MemoFontName: String read FMemoFontName write FMemoFontName;
  1558. property MemoFontSize: Integer read FMemoFontSize write FMemoFontSize;
  1559. end;
  1560. TfrxDesignerClass = class of TfrxCustomDesigner;
  1561. TfrxCustomExportFilter = class(TComponent)
  1562. private
  1563. FCurPage: Boolean;
  1564. FNoRegister: Boolean;
  1565. FPageNumbers: String;
  1566. FReport: TfrxReport;
  1567. FShowDialog: Boolean;
  1568. protected
  1569. public
  1570. constructor Create(AOwner: TComponent); override;
  1571. constructor CreateNoRegister;
  1572. destructor Destroy; override;
  1573. class function GetDescription: String; virtual;
  1574. function ShowModal: TModalResult; virtual;
  1575. function Start: Boolean; virtual;
  1576. procedure ExportObject(Obj: TfrxComponent); virtual; abstract;
  1577. procedure Finish; virtual;
  1578. procedure FinishPage(Page: TfrxReportPage; Index: Integer); virtual;
  1579. procedure StartPage(Page: TfrxReportPage; Index: Integer); virtual;
  1580. property CurPage: Boolean read FCurPage write FCurPage;
  1581. property PageNumbers: String read FPageNumbers write FPageNumbers;
  1582. property Report: TfrxReport read FReport write FReport;
  1583. published
  1584. property ShowDialog: Boolean read FShowDialog write FShowDialog default True;
  1585. end;
  1586. TfrxCustomWizard = class(TComponent)
  1587. private
  1588. FDesigner: TfrxCustomDesigner;
  1589. FReport: TfrxReport;
  1590. public
  1591. constructor Create(AOwner: TComponent); override;
  1592. class function GetDescription: String; virtual;
  1593. function Execute: Boolean; virtual; abstract;
  1594. property Designer: TfrxCustomDesigner read FDesigner;
  1595. property Report: TfrxReport read FReport;
  1596. end;
  1597. TfrxWizardClass = class of TfrxCustomWizard;
  1598. TfrxCustomEngine = class(TPersistent)
  1599. private
  1600. FCurColumn: Integer;
  1601. FCurVColumn: Integer;
  1602. FCurLine: Integer;
  1603. FCurLineThrough: Integer;
  1604. FCurX: Extended;
  1605. FCurY: Extended;
  1606. FFinalPass: Boolean;
  1607. FFooterHeight: Extended;
  1608. FHeaderHeight: Extended;
  1609. FPageHeight: Extended;
  1610. FPageWidth: Extended;
  1611. FPreviewPages: TfrxCustomPreviewPages;
  1612. FReport: TfrxReport;
  1613. FRunning: Boolean;
  1614. FStartDate: TDateTime;
  1615. FStartTime: TDateTime;
  1616. FTotalPages: Integer;
  1617. FOnRunDialog: TfrxRunDialogEvent;
  1618. function GetDoublePass: Boolean;
  1619. protected
  1620. public
  1621. constructor Create(AReport: TfrxReport); virtual;
  1622. procedure EndPage; virtual; abstract;
  1623. procedure NewColumn; virtual; abstract;
  1624. procedure NewPage; virtual; abstract;
  1625. procedure ShowBand(Band: TfrxBand); overload; virtual; abstract;
  1626. procedure ShowBand(Band: TfrxBandClass); overload; virtual; abstract;
  1627. procedure StopReport;
  1628. function FreeSpace: Extended; virtual; abstract;