|
||
class CPrintSetup : public CBase, private MFieldPageNumInfo;
Print setup information.
This class stores the information needed to set up, start and stop a print job. This includes the target printer device, the page margins and the header and footer. The page specification, (page orientation and page dimensions) can be set via the printer device.
Print setup information is associated with a document and is stored as part of the persistent form of the document. Print
parameters on the other hand, (class TPrintParameters
) are associated with a particular print request, not with the document itself, so are not part of the print setup information.
MFieldPageNumInfo
- No description.
CBase
-
Base class for all classes to be instantiated on the heap.
CPrintSetup
- Print setup information.
Defined in CPrintSetup
:
AddPrinterDriverDirL(const TDesC &)
Adds a search path for printer drivers.CreatePrinterDeviceL(TInt)
Selects the target printer device by its index into the list of printer models.CreatePrinterDeviceL(TUid,RFs &)
Selects the target printer device, from the list of printer models.CreatePrinterDriverUIL()
Creates a user interface for the target printer device, if the current printer d...EndPrint()
Aborts the print operation, if one is currently taking place.ExternalizeL(RWriteStream &)const
Externalises a CPrintSetup object to a write stream.Footer()const
Gets the footer.FreeModelList()
Deletes and sets the printer model list to NULL. Header()const
Gets the header.InternalizeL(RReadStream &)
Internalises a CPrintSetup object from a read stream.ModelNameListL(RFs &)
Gets the names of all printer models supported.NewL()
Allocates and constructs an uninitialised CPrintSetup object.PrinterDevice()const
Gets the selected printer device.RestoreComponentsL(const CStreamStore &,const MFieldFileNameInfo *,const MFieldNumPagesInfo *,MPictureFactory *)
Restores the rich text components of the print setup object's header and footer.RestoreL(const CStreamStore &,TStreamId,const MFieldFileNameInfo *,const MFieldNumPagesInfo *,MPictureFactory *)
Restores a CPrintSetup object, including its components from a stream store.StartPreviewPrintL(const TPrintParameters &,MPageRegionPrinter &,MPrintProcessObserver *,CGraphicsDevice &,const TRect &,const
TRect &,TInt)
Starts a new print preview.StartPrintL(const TPrintParameters &,MPageRegionPrinter &,CPrinterPort *,MPrintProcessObserver *)
Starts a new print job.StoreComponentsL(CStreamStore &,CStoreMap &)const
Stores the rich text components of the print setup object's header and footer.StoreL(CStreamStore &)const
Stores a CPrintSetup object, including its components (e.g. header and footer) t...UpdateFieldPageNum()const
Implementations of this function should return the current page number.iNumOfFirstPage
The number of the first page in the document.iPageMarginsInTwips
The header and footer offset and the width of the four margins.~CPrintSetup()
Destructor.Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.Extension_(TUint,TAny *&,TAny *)
Extension function operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...IMPORT_C static CPrintSetup* NewL();
Allocates and constructs an uninitialised CPrintSetup object.
After construction, the print settings, including the target printer device and the page specification must be set before printing can begin.
|
IMPORT_C virtual ~CPrintSetup();
Destructor.
This frees all resources owned by the CPrintSetup object, prior to its destruction.
IMPORT_C void AddPrinterDriverDirL(const TDesC &aDriverDir);
Adds a search path for printer drivers.
This function must be called before a model name list can be created. It can be called repeatedly to add a number of paths to the search list.
When a printer model name list is requested (using CPrintSetup::ModelNameListL(RFs &)
), the directories specified in each of the search paths are scanned on all non-remote drives for .pdr files, indicating the
models supported. If any path contains a drive, that drive alone is searched.
|
|
IMPORT_C CPrinterModelList* ModelNameListL(RFs &aFs);
Gets the names of all printer models supported.
The function scans all directories in the search path list which were added using CPrintSetup::AddPrinterDriverDirL(const TDesC &)
. It returns a list of the printer models supported by the .pdr files found in those directories.
|
|
|
IMPORT_C void CreatePrinterDeviceL(TInt aModelIndex);
Selects the target printer device by its index into the list of printer models.
Unlike the other overload of this function, a panic occurs if no printer model list has previously been created using CPrintSetup::ModelNameListL(RFs &)
.
If a print process is taking place when this function is called, it is aborted.
The existing printer device's page specification is preserved.
|
|
IMPORT_C void CreatePrinterDeviceL(TUid aModelUid, RFs &aFs);
Selects the target printer device, from the list of printer models.
If no printer model name list has previously been created by a call to CPrintSetup::ModelNameListL(RFs &)
, this function will temporarily create one, freeing it before exiting.
If no printer model in the list has the UID specified, the first printer model in the list is selected by default. If the list contains no printer models at all, a leave occurs.
If a print process is taking place when this function is called, it is aborted.
The existing printer device's page specification is preserved.
|
|
IMPORT_C CPrinterDevice* PrinterDevice() const;
Gets the selected printer device.
|
|
IMPORT_C CPrinterDriverUI* CreatePrinterDriverUIL();
Creates a user interface for the target printer device, if the current printer driver has a matching .udl file.
Returns a NULL pointer if no matching .udl file was found. The UI can provide such things as custom print setup dialogs.
|
|
IMPORT_C void EndPrint();
Aborts the print operation, if one is currently taking place.
If a print process observer exists, its NotifyPrintEnded() function is called with KErrCancel.
MPrintProcessObserver
Print progress and status notification interface class.IMPORT_C TInt StartPrintL(const TPrintParameters &aPrintParams, MPageRegionPrinter &aBodyPrinter, CPrinterPort *aPort, MPrintProcessObserver
*anObserver);
Starts a new print job.
If a print process observer is specified, this function calls its NotifyPrintStarted() function.
|
|
|
StartPreviewPrintL(const TPrintParameters &,MPageRegionPrinter &,MPrintProcessObserver *,CGraphicsDevice &,const TRect &,const
TRect &,TInt)
IMPORT_C TInt StartPreviewPrintL(const TPrintParameters &aPrintParams, MPageRegionPrinter &aBodyPrinter, MPrintProcessObserver
*anObserver, CGraphicsDevice &aPreviewDev, const TRect &aHeaderRectInPixels, const TRect &aFooterRectInPixels, TInt aNumBands);
Starts a new print preview.
If a print process observer is specified, this function calls its NotifyPrintStarted() function.
|
|
|
inline CHeaderFooter* Header() const;
Gets the header.
The CPrintSetup object owns the header and footer. CPrintSetup implements the MFieldPageNumInfo
interface, which allows page numbering to be easily added to fields.
|
inline CHeaderFooter* Footer() const;
Gets the footer.
|
IMPORT_C TStreamId StoreL(CStreamStore &aStore) const;
Stores a CPrintSetup object, including its components (e.g. header and footer) to a stream store.
A panic occurs if no printer device has been created. Use CreatePrinterDevice() to create one.
|
|
RestoreL(const CStreamStore &,TStreamId,const MFieldFileNameInfo *,const MFieldNumPagesInfo *,MPictureFactory *)
IMPORT_C void RestoreL(const CStreamStore &aStore, TStreamId aStreamId, const MFieldFileNameInfo *aFileNameInfo=0,const MFieldNumPagesInfo
*aNumPagesInfo=0,MPictureFactory *aFactory=0);
Restores a CPrintSetup object, including its components from a stream store.
|
IMPORT_C void StoreComponentsL(CStreamStore &aStore, CStoreMap &aMap) const;
Stores the rich text components of the print setup object's header and footer.
This function does not store any other print setup information, so may need to be accompanied by a call to CPrintSetup::ExternalizeL(RWriteStream &)const
.
|
RestoreComponentsL(const CStreamStore &,const MFieldFileNameInfo *,const MFieldNumPagesInfo *,MPictureFactory *)
IMPORT_C void RestoreComponentsL(const CStreamStore &aStore, const MFieldFileNameInfo *aFileNameInfo=0,const MFieldNumPagesInfo
*aNumPagesInfo=0,MPictureFactory *aFactory=0);
Restores the rich text components of the print setup object's header and footer.
This function only restores the rich text components of the header and footer (e.g. fields, pictures and rich text-specific
formatting), so it may need to be accompanied by a call to CPrintSetup::InternalizeL(RReadStream &)
.
|
IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
Externalises a CPrintSetup object to a write stream.
The presence of this function means that the standard templated operator<<(RWriteStream &,const T &)
(defined in s32strm.h
) is available to externalise objects of this class.
This function does not externalise the rich text components of the header and footer (e.g. fields, pictures and rich text-specific
formatting), so it may need to be accompanied by a call to CPrintSetup::StoreComponentsL(CStreamStore &,CStoreMap &)const
.
|
|
IMPORT_C void InternalizeL(RReadStream &aStream);
Internalises a CPrintSetup object from a read stream.
The presence of this function means that the standard templated operator>>(RReadStream &,T &)
(defined in s32strm.h
) is available to internalise objects of this class.
This function does not restore the rich text components of the header and footer, (e.g. fields, pictures and rich text-specific
formatting), so it may need to be accompanied by a call to CPrintSetup::RestoreComponentsL(const CStreamStore &,const MFieldFileNameInfo *,const MFieldNumPagesInfo *,MPictureFactory
*)
.
|
private: virtual TInt UpdateFieldPageNum() const;
Implementations of this function should return the current page number.
|
TPageMargins iPageMarginsInTwips;
The header and footer offset and the width of the four margins.
All measurements are in twips.
TPageMargins
Page margins.TInt iNumOfFirstPage;
The number of the first page in the document.
This value is used for printing or displaying page numbering. Note that all other page numbering is zero indexed, to preserve independence from user-defined page numbering.