Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Classes | Public Types | Public Member Functions
IlvPrintableDocument Class Reference

Class that manages the document to print. More...

#include <ilviews/printing/document.h>

Classes

class  Iterator
 Iterator class to walk through the objects stored in an IlvPrintableDocument. More...
 
class  ThresholdHook
 Hook class to decide what to do when there are too many pages to print. More...
 

Public Types

enum  PrintingMode { WholeDocument, Page }
 The possible values for the printing mode. More...
 

Public Member Functions

 IlvPrintableDocument (IlvPrintableLayout *layout, PrintingMode mode=WholeDocument)
 Constructor. More...
 
 ~IlvPrintableDocument ()
 Destructor. More...
 
Iterator append (IlvPrintable *printable)
 Appends a printable object. More...
 
Iterator append (IlvPrintable *printable, IlvPrintableLayout *layout)
 Appends a printable object. More...
 
Iterator begin () const
 Returns an iterator to the first printable object. More...
 
Iterator end () const
 Returns an iterator to one past the last printable object. More...
 
IlvPrintableLayoutgetDefaultLayout () const
 Returns the IlvPrintableLayout used by default for this document. More...
 
PrintingMode getPrintingMode () const
 Returns the printing mode used to print this document. More...
 
Iterator insert (IlvPrintable *printable, IlvPrintableLayout *layout, Iterator const &iter)
 Inserts a printable object. More...
 
Iterator insert (IlvPrintable *printable, Iterator const &iter)
 Inserts an IlvPrintable. More...
 
IlBoolean print (IlvPrinter &printer, int first=0, int last=-1, int copyNumber=1, IlBoolean useAbsolutePageIndex=IlTrue) const
 Prints the document. More...
 
IlBoolean print (IlvPrinter &printer, Iterator const &first, Iterator const &last, int copyNumber=1, IlBoolean useAbsolutePageIndex=IlTrue) const
 Prints the document. More...
 
void setPrintingMode (PrintingMode mode)
 Sets the printing mode used to print this document. More...
 
void setThresholdHook (ThresholdHook *newThresholdHook)
 Sets the threshold hook. More...
 

Detailed Description

Class that manages the document to print.

Library: ilvprint

This class contains a list of IlvPrintable objects.

Each IlvPrintable object is associated with an IlvPrintableLayout object. These objects will be printed in the order of the list.

Note
The IlvPrintable and IlvPrintableLayout objects are reference counted.

Member Enumeration Documentation

◆ PrintingMode

The possible values for the printing mode.

This mode defines how several copies of the document will be printed.

Enumerator
WholeDocument 

The whole document is printed for each copy.

Page 

Each page is printed according to the number of copies requested before other pages are printed.

Constructor & Destructor Documentation

◆ IlvPrintableDocument()

IlvPrintableDocument::IlvPrintableDocument ( IlvPrintableLayout layout,
PrintingMode  mode = WholeDocument 
)

Constructor.

Initializes the object with an IlvPrintableLayout that will be the default layout. It is also possible to define the printing mode.

Parameters
layoutThe default layout.
modeThe printing mode. The default value is WholeDocument.
See also
PrintingMode.

◆ ~IlvPrintableDocument()

IlvPrintableDocument::~IlvPrintableDocument ( )

Destructor.

Frees the resources used by the object: it decrements the reference counters of the IlvPrintable and IlvPrintableLayout instances that this object uses.

Member Function Documentation

◆ append() [1/2]

Iterator IlvPrintableDocument::append ( IlvPrintable printable)

Appends a printable object.

This function associates the default IlvPrintableLayout instance to the IlvPrintable object passed as as argument.

Parameters
printableThe IlvPrintable to be inserted at the end of this document.
Returns
An Iterator that points to one past the last inserted IlvPrintable.

◆ append() [2/2]

Iterator IlvPrintableDocument::append ( IlvPrintable printable,
IlvPrintableLayout layout 
)

Appends a printable object.

Parameters
printableThe IlvPrintable to be inserted at the end of this document.
layoutThe IlvPrintableLayout to associate with the printable.
Returns
An Iterator that points to one past the last inserted IlvPrintable.

◆ begin()

Iterator IlvPrintableDocument::begin ( ) const

Returns an iterator to the first printable object.

Returns
An iterator to the first IlvPrintable.

◆ end()

Iterator IlvPrintableDocument::end ( ) const

Returns an iterator to one past the last printable object.

Returns
An iterator to one past the last IlvPrintable.

◆ getDefaultLayout()

IlvPrintableLayout* IlvPrintableDocument::getDefaultLayout ( ) const

Returns the IlvPrintableLayout used by default for this document.

Returns
A pointer to the default IlvPrintableLayout of this document.

◆ getPrintingMode()

PrintingMode IlvPrintableDocument::getPrintingMode ( ) const

Returns the printing mode used to print this document.

Returns
The printing mode of this document.
See also
PrintingMode.

◆ insert() [1/2]

Iterator IlvPrintableDocument::insert ( IlvPrintable printable,
IlvPrintableLayout layout,
Iterator const &  iter 
)

Inserts a printable object.

Parameters
printableThe IlvPrintable object to be inserted in this document.
layoutThe IlvPrintableLayout to associate with the printable.
iterThe location where the IlvPrintable must be inserted.
Returns
An Iterator that points to one past the last inserted IlvPrintable.

◆ insert() [2/2]

Iterator IlvPrintableDocument::insert ( IlvPrintable printable,
Iterator const &  iter 
)

Inserts an IlvPrintable.

This function associates the default IlvPrintableLayout instance to the IlvPrintable object passed as an argument.

Parameters
printableA const pointer to the IlvPrintable to be inserted in this document.
iterA reference to an iterator to the location where the IlvPrintable must be inserted.
Returns
An Iterator that points to one past the last inserted IlvPrintable.
See also
getPrintingMode().

◆ print() [1/2]

IlBoolean IlvPrintableDocument::print ( IlvPrinter printer,
int  first = 0,
int  last = -1,
int  copyNumber = 1,
IlBoolean  useAbsolutePageIndex = IlTrue 
) const

Prints the document.

This function prints the part of the document specified by the indices of the pages given as parameters. The printing is done on the device associated with the IlvPrinter object given as argument. The layout is specified by the IlvPrintableLayout objects associated with each printable.

Parameters
printerThe IlvPrinter where printing is to occur.
firstThe index (starting at 0) of the first page to print. The default value is 0, that is, the first page of the document.
lastThe index (starting at 0) of the last page to print. The default value is -1 that indicates the last page of the document.
copyNumberThe number of copies. The default value is 1.
useAbsolutePageIndexWhen IlFalse, the page numbers start from 1. Otherwise, they start from the page number that would have been if the printing had started from the first page.
Returns
IlTrue if the printing was successful, and IlFalse if an error occurred.

◆ print() [2/2]

IlBoolean IlvPrintableDocument::print ( IlvPrinter printer,
Iterator const &  first,
Iterator const &  last,
int  copyNumber = 1,
IlBoolean  useAbsolutePageIndex = IlTrue 
) const

Prints the document.

This function prints the part of the document specified by the iterators given as parameters, that is, all the IlvPrintable objects stored between these two iterators. The printing is done on the device associated with the IlvPrinter object given as an argument. The layout is specified by the IlvPrintableLayout objects associated with each printable.

Parameters
printerThe IlvPrinter where printing is to occur.
firstThe Iterator that specifies where to start.
lastThe Iterator that specifies where to stop. This points to one past the last element to be printed.
copyNumberThe number of copies. The default value is 1.
useAbsolutePageIndexWhen IlFalse, the page numbers start from 1. Otherwise, they start from the page number that would have been if the printing had started from the first printable.
Returns
IlTrue if the printing was successful, and IlFalse if an error occurred.

◆ setPrintingMode()

void IlvPrintableDocument::setPrintingMode ( PrintingMode  mode)

Sets the printing mode used to print this document.

Parameters
modeThe printing mode.
See also
PrintingMode, setPrintingMode().

◆ setThresholdHook()

void IlvPrintableDocument::setThresholdHook ( ThresholdHook newThresholdHook)

Sets the threshold hook.

The pointer must be valid during the lifetime of this object or until the next call to this function. The pointed object is not deleted by this object.

Parameters
newThresholdHookThe new threshold hook.