OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TPrintout Class Reference

TPrintout represents the physical printed document that is to sent to a printer to be printed. More...

#include <owl/printer.h>

Inheritance diagram for owl::TPrintout:
owl::TStreamableBase owl::TRichEditPrintout

Public Member Functions

 TPrintout (LPCTSTR title)
 Constructs an instance of TPrintout with the given title.
 
 TPrintout (const tstring &title)
 Constructs an instance of TPrintout with the given title.
 
virtual ~TPrintout ()
 Place-holder.
 
virtual void SetPrintParams (TPrintDC *dc, TSize pageSize)
 SetPrintParams sets DC to dc and PageSize to pageSize.
 
virtual void GetDialogInfo (int &minPage, int &maxPage, int &selFromPage, int &selToPage)
 Retrieves information needed to allow the printing of selected pages of the document and returns true if page selection is possible.
 
virtual void BeginPrinting ()
 The printer object's Print function calls BeginPrinting once at the beginning of a print job, regardless of how many copies of the document are to be printed.
 
virtual void BeginDocument (int startPage, int endPage, uint flags)
 The printer object's Print function calls BeginDocument once before printing each copy of a document.
 
virtual bool HasPage (int pageNumber)
 HasPage is called after every page is printed.
 
virtual void PrintPage (int page, TRect &rect, uint flags)
 PrintPage is called for every page (or band, if Banding is true) and must be overridden to print the contents of the given page.
 
virtual void EndDocument ()
 The printer object's Print function calls EndDocument after each copy of the document finishes printing.
 
virtual void EndPrinting ()
 The printer object's Print function calls EndPrinting after all copies of the document finish printing.
 
TSize GetPageSize () const
 Retrieves the size of the page.
 
LPCTSTR GetTitle () const
 Returns the title of the current printout.
 
bool WantBanding () const
 Returns true if banding is desired.
 
void SetBanding (bool banding=true)
 Sets the banding flag for the printout.
 
bool WantForceAllBands () const
 Returns true if the force all bands.
 
void SetForceAllBands (bool force=true)
 Sets the force banding flag.
 
TPrintDCGetPrintDC ()
 Returns the DC associated with the printout.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Protected Member Functions

void SetTitle (LPCTSTR title)
 Sets a new title for this printout.
 
void SetTitle (const tstring &title)
 Sets a new title for this printout. The passed title string is copied.
 
void SetPrintDC (TPrintDC *dc)
 Sets the associated DC.
 
void SetPageSize (const TSize &pagesize)
 Sets the size of the page.
 

Detailed Description

TPrintout represents the physical printed document that is to sent to a printer to be printed.

TPrintout does the rendering of the document onto the printer. Because this object type is abstract, it cannot be used to print anything by itself. For every document, or document type, a class derived from TPrintout must be created and its PrintPage function must be overridden.

Definition at line 75 of file printer.h.

Constructor & Destructor Documentation

◆ TPrintout() [1/2]

owl::TPrintout::TPrintout ( LPCTSTR title)
explicit

Constructs an instance of TPrintout with the given title.

If the given title is a null-pointer, an empty string is assigned.

Definition at line 17 of file printout.cpp.

◆ TPrintout() [2/2]

owl::TPrintout::TPrintout ( const tstring & title)

Constructs an instance of TPrintout with the given title.

Definition at line 28 of file printout.cpp.

◆ ~TPrintout()

owl::TPrintout::~TPrintout ( )
virtual

Place-holder.

Definition at line 40 of file printout.cpp.

Member Function Documentation

◆ BeginDocument()

void owl::TPrintout::BeginDocument ( int startPage,
int endPage,
uint flags )
virtual

The printer object's Print function calls BeginDocument once before printing each copy of a document.

The flags field indicates if the current print band accepts graphics, text, or both. The default BeginDocument does nothing. Derived objects can override BeginDocument to perform any initialization needed at the beginning of each copy of the document.

Definition at line 163 of file printout.cpp.

◆ BeginPrinting()

void owl::TPrintout::BeginPrinting ( )
virtual

The printer object's Print function calls BeginPrinting once at the beginning of a print job, regardless of how many copies of the document are to be printed.

Derived objects can override BeginPrinting to perform any initialization needed before printing.

Reimplemented in owl::TRichEditPrintout.

Definition at line 150 of file printout.cpp.

◆ EndDocument()

void owl::TPrintout::EndDocument ( )
virtual

The printer object's Print function calls EndDocument after each copy of the document finishes printing.

Derived objects can override EndDocument to perform any needed actions at the end of each document.

Definition at line 196 of file printout.cpp.

◆ EndPrinting()

void owl::TPrintout::EndPrinting ( )
virtual

The printer object's Print function calls EndPrinting after all copies of the document finish printing.

Derived objects can override EndPrinting to perform any needed actions at the end of each document.

Reimplemented in owl::TRichEditPrintout.

Definition at line 206 of file printout.cpp.

◆ GetDialogInfo()

void owl::TPrintout::GetDialogInfo ( int & minPage,
int & maxPage,
int & selFromPage,
int & selToPage )
virtual

Retrieves information needed to allow the printing of selected pages of the document and returns true if page selection is possible.

Use of page ranges is optional, but if the page count is easy to determine, GetDialogInfo sets the number of pages in the document. Otherwise, it sets the number of pages to 0 and printing will continue until HasPage returns false.

Reimplemented in owl::TRichEditPrintout.

Definition at line 136 of file printout.cpp.

◆ GetPageSize()

TSize owl::TPrintout::GetPageSize ( ) const

Retrieves the size of the page.

Definition at line 102 of file printout.cpp.

◆ GetPrintDC()

TPrintDC * owl::TPrintout::GetPrintDC ( )

Returns the DC associated with the printout.

Definition at line 70 of file printout.cpp.

◆ GetTitle()

LPCTSTR owl::TPrintout::GetTitle ( ) const

Returns the title of the current printout.

Definition at line 46 of file printout.cpp.

◆ HasPage()

bool owl::TPrintout::HasPage ( int page)
virtual

HasPage is called after every page is printed.

By default, it returns false, indicating that only one page is to be printed. If the document contains more than one page, this function must be overridden to return true while there are more pages to print.

Reimplemented in owl::TRichEditPrintout.

Definition at line 174 of file printout.cpp.

◆ PrintPage()

void owl::TPrintout::PrintPage ( int page,
TRect & rect,
uint flags )
virtual

PrintPage is called for every page (or band, if Banding is true) and must be overridden to print the contents of the given page.

The rect and flags parameters are used during banding to indicate the extent and type of band currently requested from the driver (and should be ignored if Banding is false). page is the number of the current page.

Reimplemented in owl::TRichEditPrintout.

Definition at line 186 of file printout.cpp.

◆ SetBanding()

void owl::TPrintout::SetBanding ( bool banding = true)

Sets the banding flag for the printout.

Definition at line 78 of file printout.cpp.

◆ SetForceAllBands()

void owl::TPrintout::SetForceAllBands ( bool force = true)

Sets the force banding flag.

Definition at line 86 of file printout.cpp.

◆ SetPageSize()

void owl::TPrintout::SetPageSize ( const TSize & pagesize)
protected

Sets the size of the page.

Definition at line 110 of file printout.cpp.

◆ SetPrintDC()

void owl::TPrintout::SetPrintDC ( TPrintDC * dc)
protected

Sets the associated DC.

Definition at line 94 of file printout.cpp.

◆ SetPrintParams()

void owl::TPrintout::SetPrintParams ( TPrintDC * dc,
TSize pageSize )
virtual

SetPrintParams sets DC to dc and PageSize to pageSize.

The printer object's Print function calls SetPrintParams to obtain the information it needs to determine pagination and page count. Derived objects that override SetPrintParams must call the inherited function.

Reimplemented in owl::TRichEditPrintout.

Definition at line 122 of file printout.cpp.

References SetPageSize(), and SetPrintDC().

◆ SetTitle() [1/2]

void owl::TPrintout::SetTitle ( const tstring & title)
protected

Sets a new title for this printout. The passed title string is copied.

Definition at line 223 of file printout.cpp.

◆ SetTitle() [2/2]

void owl::TPrintout::SetTitle ( LPCTSTR title)
protected

Sets a new title for this printout.

The passed title string is copied. If the given title is a null-pointer, an empty string is assigned.

Definition at line 214 of file printout.cpp.

◆ WantBanding()

bool owl::TPrintout::WantBanding ( ) const

Returns true if banding is desired.

Definition at line 54 of file printout.cpp.

◆ WantForceAllBands()

bool owl::TPrintout::WantForceAllBands ( ) const

Returns true if the force all bands.

Definition at line 62 of file printout.cpp.


The documentation for this class was generated from the following files: