| Class TamPrinter (unit amPrvPrt) |
TComponent
-----------------------------------} {TamPrinter
| Constructors |
Constructor Create(AOwner: TComponent);| Functions |
Procedure AdjustPaper;
Destructor Destroy;
Function EndPageFinishToPrint : Boolean;
Function EndPageNewPage : Boolean;
Function ExecutePrintDialog : Boolean;
Function Print : Boolean;
Function PrintMetaFile(Const MetaFile: TMetaFile): Boolean;
Procedure RestorePaper;
Procedure SelectPrinter;------------------------------------------------------------------------ TamPrinter.
Function StartToPrint : Boolean;
Procedure StorePaper;
Function CompareDevMode: Boolean;------------------------------------------------------------------------ TamPrinter.
Function GetaQRPrinter: TQRPrinter;
Function GetaQuickrep: TQuickrep;
Procedure InitDevMode;
Function PreparePrinter : Boolean;
Function PrinterReady : Boolean;
Procedure RestorePrinter;
Procedure SetQuickrep(Value: TQuickrep);
Procedure SetSelectPrinterDialog(Value: Boolean);
Procedure SetShowPrintDialog(Value: Boolean);
Procedure StorePrinter;| Properties |
property aQuickrep : TQuickrep
property Copyright : String
property SelectPrinterDialog : Boolean
property ShowPrintDialog : Boolean
property Version : String
property aQRPrinter : TQRPrinter| Events |
| Variables |
EndPage : Integer;
fCopyright : String;
fDummy : String;
fOldOrientation : TPrinterOrientation;
fOldPaperLength : Extended;
fOldPaperSize : TQRPaperSize;
fOldPaperWidth : Extended;
fQuickrep : TQuickrep;
fSelectprinterDialog : Boolean;
fShowPrintDialog : Boolean;
fVersion : String;
IsDevModeInit : Boolean;
IsPrintDlgInit : Boolean;
IsPrinterSel : Boolean;
PaperEQ : TPaperEQ;
pDev : Pchar;
pDrv : Pchar;
pPort : Pchar;
PrintDialog : TPrintDialog;
pSDev : Pchar;
pSDrv : Pchar;
pSPort : Pchar;
RefreshRequest : Boolean;
sDevMode : pDevMode;
SelPrinterDlg : TSelPrinterDlg;
shDevMode : THANDLE;
sPrintersCount : Integer;
StartPage : Integer;| Constructors |
Constructor Create(AOwner: TComponent);------------------------------------------------------------------------} {TAMPRINTER Component} {------------------------------------------------------------------------} {------------------------------------------------------------------------} {TamPrinter.Create Purpose: Creates the Object and sets the aQuickrep and ShowPrintDialog (Creates PrintDialog if True).} {------------------------------------------------------------------------
| Functions |
Procedure AdjustPaper;------------------------------------------------------------------------ TamPrinter.AdjustPaper Prupose: Try to set Papersize to Custom if not supported by printer ------------------------------------------------------------------------
Destructor Destroy;------------------------------------------------------------------------} {TamPrinter.Destroy Purpose: Standard} {------------------------------------------------------------------------
Function EndPageFinishToPrint : Boolean;------------------------------------------------------------------------} {TamPrinter.EndPageFinishToPrint Purpose: Just calls the TPrinter method with some additonal checking. {------------------------------------------------------------------------
Function EndPageNewPage : Boolean;------------------------------------------------------------------------} {TamPrinter.EndPageNewPage Purpose: Just calls the TPrinter method with some additonal checking. {------------------------------------------------------------------------
Function ExecutePrintDialog : Boolean;------------------------------------------------------------------------} {TamPrinter.ExecutePrintDialog purpose: nearly standard} {------------------------------------------------------------------------
Function Print : Boolean;------------------------------------------------------------------------} {TamPrinter.PrintQRPreview Purpose: The main function, you see it is very simple... The "trick" is not to call TPrinter.NewPage if we are printing the last Page. That's all... {------------------------------------------------------------------------
Function PrintMetaFile(Const MetaFile: TMetaFile): Boolean;------------------------------------------------------------------------} {TamPrinter.PrintMetaFile Purpose: Can be used with any TMetafile Object.} {------------------------------------------------------------------------
Procedure RestorePaper;------------------------------------------------------------------------ TamPrinter.RestorePaper ------------------------------------------------------------------------
Procedure SelectPrinter;Public-Deklarationen
------------------------------------------------------------------------ TamPrinter.SelectPrinter ------------------------------------------------------------------------
Function StartToPrint : Boolean;------------------------------------------------------------------------ TamPrinter.StartToPrint Purpose: Just calls the TPrinter method with some additonal checking. ------------------------------------------------------------------------
Procedure StorePaper;------------------------------------------------------------------------ TamPrinter.StorePaper ------------------------------------------------------------------------
Function CompareDevMode: Boolean;Protected-Deklarationen
------------------------------------------------------------------------ TamPrinter.CompareDevMode Purpose: Check for user made changes, ask user to apply and try to adjust ------------------------------------------------------------------------
Function GetaQRPrinter: TQRPrinter;------------------------------------------------------------------------ TamPrinter.GetaQRPrinter Purpose: dynamically find the valid QrPrinter ------------------------------------------------------------------------
Function GetaQuickrep: TQuickrep;------------------------------------------------------------------------ Function TamPrinter.GetaQuickrep Purpose: intelligent search the valid Quickrep ------------------------------------------------------------------------
Procedure InitDevMode;------------------------------------------------------------------------ TamPrinter.InitDevMode Purpose: Init the deviceMode for Printer ------------------------------------------------------------------------
Function PreparePrinter : Boolean;------------------------------------------------------------------------} {TamPrinter.PreparePrinter purpose: Set the DeviceMode for the Printer and call PrinterDialog befor printing;} {------------------------------------------------------------------------
Function PrinterReady : Boolean;------------------------------------------------------------------------} {TamPrinter.PrinterReady Purpose: additional checking if printer is still printing and printing was not aborted. {------------------------------------------------------------------------
Procedure RestorePrinter;------------------------------------------------------------------------} {TamPrinter.RestorePrinter; purpose: If it was selected a printout to a File there will be a new Printer added, which will confuse Quickrep the next time previewing. So the Printer.PrinterIndex has to be restored after printing to a File.} {------------------------------------------------------------------------
Procedure SetQuickrep(Value: TQuickrep);------------------------------------------------------------------------ TamPrinter.SetQuickrep(Value: TQuickrep); Purpose: Standard ------------------------------------------------------------------------
Procedure SetSelectPrinterDialog(Value: Boolean);------------------------------------------------------------------------ Procedure TamPrinter.SetSelectPrinterDialog Purpose: set value depending on cQRVersion ------------------------------------------------------------------------
Procedure SetShowPrintDialog(Value: Boolean);------------------------------------------------------------------------ TamPrinter.SetShowPrintDialog(Value: Boolean); purpose: Set the Property and create or free the Dialog component. ------------------------------------------------------------------------
Procedure StorePrinter;------------------------------------------------------------------------} {Procedure TamPrinter.StorePrinter; {------------------------------------------------------------------------
| Properties |
property aQuickrep : TQuickrepPublished-Deklarationen
property Copyright : String
property SelectPrinterDialog : Boolean
property ShowPrintDialog : Boolean
property Version : String
property aQRPrinter : TQRPrinter| Events |
| Variables |
EndPage : Integer;
fCopyright : String;Private-Deklarationen
fDummy : String;
fOldOrientation : TPrinterOrientation;
fOldPaperLength : Extended;
fOldPaperSize : TQRPaperSize;
fOldPaperWidth : Extended;
fQuickrep : TQuickrep;
fSelectprinterDialog : Boolean;
fShowPrintDialog : Boolean;
fVersion : String;
IsDevModeInit : Boolean;
IsPrintDlgInit : Boolean;
IsPrinterSel : Boolean;
PaperEQ : TPaperEQ;
pDev : Pchar;
pDrv : Pchar;
pPort : Pchar;
PrintDialog : TPrintDialog;
pSDev : Pchar;
pSDrv : Pchar;
pSPort : Pchar;
RefreshRequest : Boolean;
sDevMode : pDevMode;
SelPrinterDlg : TSelPrinterDlg;
shDevMode : THANDLE;
sPrintersCount : Integer;
StartPage : Integer;