Class TamPrinter (unit amPrvPrt)

Inherits from

TComponent

-----------------------------------} {TamPrinter

Constructors


Constructor Create(AOwner: TComponent);

------------------------------------------------------------------------} {TAMPRINTER Component} {------------------------------------------------------------------------} {------------------------------------------------------------------------} {TamPrinter.


Functions

Procedure AdjustPaper;

------------------------------------------------------------------------ TamPrinter.

Destructor Destroy;

------------------------------------------------------------------------} {TamPrinter.

Function EndPageFinishToPrint : Boolean;

------------------------------------------------------------------------} {TamPrinter.

Function EndPageNewPage : Boolean;

------------------------------------------------------------------------} {TamPrinter.

Function ExecutePrintDialog : Boolean;

------------------------------------------------------------------------} {TamPrinter.

Function Print : Boolean;

------------------------------------------------------------------------} {TamPrinter.

Function PrintMetaFile(Const MetaFile: TMetaFile): Boolean;

------------------------------------------------------------------------} {TamPrinter.

Procedure RestorePaper;

------------------------------------------------------------------------ TamPrinter.

Procedure SelectPrinter;

Public-Deklarationen

------------------------------------------------------------------------ TamPrinter.


Function StartToPrint : Boolean;

------------------------------------------------------------------------ TamPrinter.

Procedure StorePaper;

------------------------------------------------------------------------ TamPrinter.

Function CompareDevMode: Boolean;

Protected-Deklarationen

------------------------------------------------------------------------ TamPrinter.


Function GetaQRPrinter: TQRPrinter;

------------------------------------------------------------------------ TamPrinter.

Function GetaQuickrep: TQuickrep;

------------------------------------------------------------------------ Function TamPrinter.

Procedure InitDevMode;

------------------------------------------------------------------------ TamPrinter.

Function PreparePrinter : Boolean;

------------------------------------------------------------------------} {TamPrinter.

Function PrinterReady : Boolean;

------------------------------------------------------------------------} {TamPrinter.

Procedure RestorePrinter;

------------------------------------------------------------------------} {TamPrinter.

Procedure SetQuickrep(Value: TQuickrep);

------------------------------------------------------------------------ TamPrinter.

Procedure SetSelectPrinterDialog(Value: Boolean);

------------------------------------------------------------------------ Procedure TamPrinter.

Procedure SetShowPrintDialog(Value: Boolean);

------------------------------------------------------------------------ TamPrinter.

Procedure StorePrinter;

------------------------------------------------------------------------} {Procedure TamPrinter.

Properties

property aQuickrep : TQuickrep

Published-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;



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 : TQuickrep

Published-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;