📄 quickrpt.pas
字号:
property BandType;
property TransparentBand;
property PreCaluculateBandHeight;
property KeepOnOnePage;
end;
{ TQRChildBand }
TQRChildBand = class(TQRCustomBand)
private
FParentBand : TQRCustomBand;
procedure SetParentBand(Value : TQRCustomBand);
protected
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(AOwner : TComponent); override;
published
property ParentBand : TQRCustomBand read FParentBand write SetParentBand;
end;
{ TQRControllerBand }
TQRControllerBand = class(TQRCustomBand)
private
LocalVarCreated : boolean;
FController : TQRCustomController;
FMaster : TComponent;
protected
function GetPrintIfEmpty : boolean;
function GetPrintBefore : boolean;
procedure SetPrintBefore(Value : boolean);
procedure CreateController; virtual;
procedure RegisterBands; virtual;
procedure SetMaster(Value : TComponent); virtual;
procedure SetName(const NewName : TComponentName); override;
procedure SetParent(AParent: TWinControl); override;
procedure SetParentReport(AParentReport : TCustomQuickRep); override;
procedure CreateLocalVar; virtual;
procedure RemoveLocalVar; virtual;
function LocalVarExpression : string; virtual;
procedure SetPrintIfEmpty(Value : boolean);
property Controller : TQRCustomController read FController write FController;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
property PrintIfEmpty : boolean read GetPrintIfEmpty write SetPrintIfEmpty;
property PrintBefore : boolean read GetPrintBefore write SetPrintBefore;
published
property Master : TComponent read FMaster write SetMaster;
end;
{ TQRSubDetailGroupBands }
TQRSubDetailGroupBands = class(TPersistent)
private
Owner : TQRSubDetail;
function GetFooterBand : TQRCustomBand;
function GetHasFooter : boolean;
function GetHasHeader : boolean;
function GetHeaderBand : TQRCustomBand;
procedure SetHasFooter(Value : boolean);
procedure SetHasHeader(Value : boolean);
public
constructor Create(AOwner : TQRSubDetail);
property FooterBand : TQRCustomBand read GetFooterBand;
property HeaderBand : TQRCustomBand read GetHeaderBand;
published
property HasFooter : boolean read GetHasFooter write SetHasFooter stored false;
property HasHeader : boolean read GetHasHeader write SetHasHeader stored false;
end;
{ TQRSubDetail }
TQRSubDetail = class(TQRControllerBand)
private
FBands : TQRSubDetailGroupBands;
function GetDataSet : TDataSet;
function GetFooterBand : TQRCustomBand;
function GetHeaderBand : TQRCustomBand;
function GetOnNeedData : TQROnNeedDataEvent;
procedure SetDataSet(Value :TDataSet);
procedure SetFooterBand(Value : TQRCustomBand);
procedure SetHeaderBand(Value : TQRCustomBand);
procedure SetOnNeedData(Value : TQROnNeedDataEvent);
protected
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure RegisterBands; override;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
procedure AddNotifyClient(Value : TQRPrintable);
published
property Bands : TQRSubDetailGroupBands read FBands write FBands;
property DataSet : TDataSet read GetDataSet write SetDataSet;
property FooterBand : TQRCustomBand read GetFooterBand write SetFooterBand;
property HeaderBand : TQRCustomBand read GetHeaderBand write SetHeaderBand;
property OnNeedData : TQROnNeedDataEvent read GetOnNeedData write SetOnNeedData;
property PrintBefore;
property PrintIfEmpty;
end;
{ TQRLoopController }
TQRLoopController = class(TQRCustomController)
private
FCount : integer;
FPrintCount : integer;
FDetailBand : TQRCustomBand;
protected
function LocalVarValue : TQREvResult; override;
procedure RegisterBands; override;
public
constructor Create(AOwner : TComponent); override;
procedure Execute; override;
property Detail : TQRCustomBand read FDetailBand write FDetailBand;
property PrintCount : integer read FPrintCount write FPrintCount;
property Count : integer read FCount write FCount;
end;
{ TQRLoopBand }
TQRLoopBand = class(TQRControllerBand)
protected
function GetPrintCount : integer;
procedure SetPrintCount(Value : integer);
procedure CreateController; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function BandTypeName : string; override;
function BandComponentName : string; override;
function GetCount : integer;
function LocalVarExpression : string; override;
public
constructor Create(AOwner : TComponent); override;
property Count : integer read GetCount;
published
property PrintCount : integer read GetPrintCount write SetPrintCount;
property PrintBefore;
end;
{ TQRStringsController }
TQRStringsController = class(TQRCustomController)
private
FItems : TStrings;
FIndex : integer;
FDetailBand : TQRCustomBand;
protected
function LocalVarValue : TQREvResult; override;
procedure RegisterBands; override;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
procedure Execute; override;
property Detail : TQRCustomBand read FDetailBand write FDetailBand;
property Items : TStrings read FItems write FItems;
property Index : integer read FIndex write FIndex;
end;
{ TQRStringsBand }
TQRStringsBand = class(TQRControllerBand)
protected
function GetIndex : integer;
function GetItem : string;
function GetItems : TStrings;
function BandTypeName : string; override;
function BandComponentName : string; override;
function LocalVarExpression : string; override;
procedure SetItems(Value : TStrings);
procedure CreateController; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(AOwner : TComponent); override;
property Item : string read GetItem;
property Index : integer read GetIndex;
published
property Items : TStrings read GetItems write SetItems;
property PrintBefore;
end;
{ TQuickRepBands }
TQuickRepBands = class(TPersistent)
private
FOwner : TCustomQuickRep;
function BandInList(BandType : TQRBandType) : TQRCustomBand;
procedure SetBand(BandType : TQRBandType; Value : boolean);
function GetBand(Index : Integer) : TQRCustomBand;
function GetHasBand(Index : integer) : boolean;
procedure SetHasBand(Index : integer; Value : boolean);
public
constructor Create(AOwner : TCustomQuickRep);
property TitleBand : TQRCustomBand index 1 read GetBand;
property PageHeaderBand : TQRCustomBand index 2 read GetBand;
property ColumnHeaderBand : TQRCustomBand index 3 read GetBand;
property DetailBand : TQRCustomBand index 4 read GetBand;
property ColumnFooterBand : TQRCustomBand index 5 read GetBand;
property PageFooterBand : TQRCustomBand index 6 read GetBand;
property SummaryBand : TQRCustomBand index 7 read GetBand;
published
property HasTitle : boolean index 1 read GetHasBand write SetHasBand stored false;
property HasPageHeader : boolean index 2 read GetHasBand write SetHasBand stored false;
property HasColumnHeader : boolean index 3 read GetHasBand write SetHasBand stored false;
property HasDetail : boolean index 4 read GetHasBand write SetHasBand stored false;
property HasPageFooter : boolean index 6 read GetHasBand write SetHasBand stored false;
property HasSummary : boolean index 7 read GetHasBand write SetHasBand stored false;
end;
TQRState = (qrAvailable, qrPrepare, qrPreview, qrPrint, qrEdit);
{ TQuickRepPrinterSettings }
TQuickRepPrinterSettings = class(TQRPrinterSettings)
private
FPrintMetaFile : boolean;
published
property Copies;
property OutputBin;
property Duplex;
property FirstPage;
property LastPage;
property UseStandardprinter;
property UseCustomBinCode;
property CustomBinCode;
property ExtendedDuplex;
property UseCustomPaperCode;
property CustomPaperCode;
property PrintMetaFile : boolean read FPrintMetaFile write FPrintMetaFile;
// added in QR4
property MemoryLimit;
property PrintQuality;
property Collate;
property ColorOption;
end;
TQRCompositePrinterSettings = class(TQuickRepPrinterSettings)
published
property Orientation;
property PaperSize;
property MemoryLimit;
property PrintQuality;
property Collate;
property ColorOption;
end;
{ TQRCreateReportThread - class used to spawn background thread }
TQRCreateReportThread = class(TThread)
private
FQRPrinter : TQRPrinter;
FQuickRep : TCustomQuickRep;
public
constructor Create(AReport : TCustomQuickRep);
procedure Execute; override;
property QuickRep : TCustomQuickRep read FQuickRep write FQuickRep;
end;
TQuickReportOption = (FirstPageHeader,
LastPageFooter,
Compression);
TQuickReportOptions = set of TQuickReportOption;
{ TQuickRep - QuickReport main class }
TQRNotifyEvent = procedure (Sender : TCustomQuickRep) of object;
TQRReportBeforePrintEvent = procedure (Sender : TCustomQuickRep; var PrintReport : Boolean) of object;
TCustomQuickRep = class(TQRBasePanel)
private
BGThread : TQRCreateReportThread;
FBackgroundImage : string;
FBackgroundcontrol : TQRPrintable;
BandRegList : TList;
FAllDataSets : TList;
FAfterPrintEvent : TQRAfterPrintEvent;
FAfterPreviewEvent : TQRAfterPreviewEvent;
FAvailable : boolean;
FBandList : TList;
FBands : TQuickRepBands;
FBeforePrintEvent : TQRReportBeforePrintEvent;
FCancelled : boolean;
FController : TQRCustomController;
FColumnTopPosition : integer;
FCurrentColumn : integer;
FCurrentX : integer;
FCurrentY : integer;
FDescription : TStrings;
FEnvironment : TQREvEnvironment;
FExportFilter : TQRExportFilter;
FExporting : boolean;
FFinalPass : boolean;
FHideBands : boolean;
FLastPage : boolean;
FModified : boolean;
FOnEndPageEvent : TQRNotifyEvent;
FOnNeedDataEvent : TQROnNeedDataEvent;
FOnPreviewEvent : TNotifyEvent;
FOnStartPageEvent : TQRNotifyEvent;
FOptions : TQuickReportOptions;
FPage : TQRPage;
FPreviewPage : TMetafile;
FPageCount : integer;
FPageFooterSize : extended;
FPrinterSettings : TQuickRepPrinterSettings;
FReportTitle : string;
FRotateBands : integer;
FShowProgress : boolean;
FSnapToGrid : boolean;
FState : TQRState;
FQRPrinter : TQRPrinter;
NewColumnForced : boolean;
NewPageForced : boolean;
ReferenceDC : THandle;
PreparingDesignTime : boolean;
EvPageNumber : TQREvElement;
EvColumnNumber : TQREvElement;
EvReportTitle : TQREvElement;
NoForceNewPage : boolean;
FPrevFormStyle : TFormStyle;
FPreviewInitialState : TWindowState;
FPreviewWidth : integer;
FPreviewHeight : integer;
// qr4 :
FPrevShowThumbs : boolean;
FPrevShowSearch : boolean;
FPrevInitialZoom : TQRZoomstate;
FOnGetPrinterSettings : TQRPrinterEvent;
FOnApplyPrinterSettings : TQRPrinterEvent;
function GetPreviewHeight : integer;
function GetPreviewWidth : integer;
function GetPrevShowThumbs : boolean;
procedure SetPrevShowThumbs( value : boolean);
function GetUnits : TQRUnit;
function GetPrintIfEmpty : boolean;
procedure PrintBand(ABand : TQRCustomBand);
procedure PrintPageBackground;
procedure SetExportFilter(Value : TQRExportFilter);
procedure SetUnits(Value : TQRUnit); virtual;
procedure SetDescription(Value : TStrings);
procedure SetPrinterValues;
procedure SetController(Value : TQRCustomController);
protected
procedure Execute; virtual;
procedure CMPageAvailable(var Message : TCM_QRPageAvailable); Message CM_QRPAGEAVAILABLE;
procedure CMPreviewClose(var Message : TCM_QRPreviewClose); Message CM_QRPREVIEWCLOSE;
procedure CMPrint(var Message : TCM_QRPrint); Message CM_QRPRINT;
function PrepareQRPrinter : boolean;
procedure CreateReport(CompositeReport : boolean); virtual;
procedure ForceNewColumn;
procedure ForceNewPage;
procedure GetChildren(Proc: TGetChildProc; root: TComponent); override;
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure PaintColumns; virtual;
procedure PaintMargins; virtual;
procedure PaintFrame; virtual;
procedure PaintRuler(Units : TQRUnit); override;
procedure PreviewFinished(Sender : TObject);
procedure PreviewIt(Modal : boolean);
procedure PrintFinished(Sender : TObject);
procedure RebuildBandList;
procedure RegisterBand(aBand : TQRCustomBand);
procedure SetControllerBands; virtual;
procedure SetPrintIfEmpty(Value : boolean); virtual;
procedure SetHideBands(Value : boolean);
procedure SetRotateBands(Value : integer);
procedure SetZoom(Value : integer); override;
property Controller : TQRCustomController read FController write SetController;
public
UserPrinterSettings : TQuickRepPrinterSettings;
constructor Create(AOwner : TComponent); override;
constructor CreateNew(AOwner : TComponent; Dummy: Integer = 1); virtual;
destructor Destroy; override;
function AvailableSpace : integer;
function CreateBand(BandType : TQRBandType) : TQRBand;
function TextHeight(aFont : TFont; aText : string) : integer;
function TextWidth(aFont : TFont; aText : string) : integer;
procedure AddBand(aBand : TQRCustomBand);
procedure AddNotifyClient(Value : TQRPrintable); virtual;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -