epoc32/include/mw/prnsetup.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __PRNSETUP_H__
williamr@2
    17
#define __PRNSETUP_H__
williamr@2
    18
williamr@2
    19
#if !defined(__E32STD_H__)
williamr@2
    20
#include <e32std.h>
williamr@2
    21
#endif
williamr@2
    22
#if !defined(__E32BASE_H__)
williamr@2
    23
#include <e32base.h>
williamr@2
    24
#endif
williamr@2
    25
#if !defined(__FLDBLTIN_H__)
williamr@2
    26
#include <fldbltin.h>
williamr@2
    27
#endif
williamr@2
    28
#if !defined(__PRNINF_H__)
williamr@2
    29
#include <prninf.h>
williamr@2
    30
#endif
williamr@2
    31
williamr@4
    32
#ifndef SYMBIAN_ENABLE_MIXED_HEADERS
williamr@4
    33
#include <printinguisupport/prnpath.h>
williamr@4
    34
#endif
williamr@4
    35
williamr@4
    36
/** 
williamr@4
    37
@publishedAll 
williamr@4
    38
@released */
williamr@2
    39
const TInt KErrMorePages=4747; // Leave with this error code to print extra pages in PrintBandL
williamr@2
    40
williamr@2
    41
// Classes defined //
williamr@2
    42
class CPrintSetup;
williamr@2
    43
//
williamr@2
    44
williamr@2
    45
// Forward Reference
williamr@2
    46
class CPreviewProcess;
williamr@2
    47
class CPrintProcess;
williamr@2
    48
class CPdrModelList;
williamr@2
    49
class CPdrDevice;
williamr@2
    50
class CHeaderFooter;
williamr@2
    51
class TPageSpec;
williamr@2
    52
class RReadStream;
williamr@2
    53
class RWriteStream;
williamr@2
    54
class MPageRegionPrinter;
williamr@2
    55
class RFs;
williamr@2
    56
class CPrinterDriver;
williamr@2
    57
class CPrinterDriverUI;
williamr@2
    58
//
williamr@2
    59
williamr@2
    60
class CPrintSetup : public CBase, private MFieldPageNumInfo
williamr@2
    61
/** Print setup information.
williamr@2
    62
williamr@2
    63
This class stores the information needed to set up, start and stop a print 
williamr@2
    64
job. This includes the target printer device, the page margins and 
williamr@2
    65
the header and footer. The page specification, (page orientation and page 
williamr@2
    66
dimensions) can be set via the printer device.
williamr@2
    67
williamr@2
    68
Print setup information is associated with a document and is stored as part 
williamr@2
    69
of the persistent form of the document. Print parameters on the other hand, 
williamr@2
    70
(class TPrintParameters) are associated with a particular print request, 
williamr@2
    71
not with the document itself, so are not part of the print setup information. 
williamr@2
    72
williamr@2
    73
@publishedAll
williamr@2
    74
@released */
williamr@2
    75
	{
williamr@2
    76
public:
williamr@2
    77
	IMPORT_C static CPrintSetup* NewL();
williamr@2
    78
	IMPORT_C virtual ~CPrintSetup();
williamr@2
    79
	//
williamr@2
    80
	// printer model selection/control functions
williamr@2
    81
	IMPORT_C void AddPrinterDriverDirL(const TDesC& aDriverDir);
williamr@2
    82
	IMPORT_C CPrinterModelList* ModelNameListL(RFs& aFs);
williamr@2
    83
	IMPORT_C void FreeModelList();
williamr@2
    84
	IMPORT_C void CreatePrinterDeviceL(TInt aModelIndex); // requires ModelList to exist
williamr@2
    85
	IMPORT_C void CreatePrinterDeviceL(TUid aModelUid,RFs& aFs);
williamr@2
    86
	IMPORT_C CPrinterDevice* PrinterDevice()const;
williamr@2
    87
	IMPORT_C CPrinterDriverUI* CreatePrinterDriverUIL(); // ownership is transfered to the caller
williamr@2
    88
	//
williamr@2
    89
	// print functions
williamr@2
    90
	IMPORT_C void EndPrint();
williamr@2
    91
	IMPORT_C TInt StartPrintL(const TPrintParameters& aPrintParams,MPageRegionPrinter& aBodyPrinter,
williamr@2
    92
				CPrinterPort* aPort,MPrintProcessObserver* anObserver);
williamr@2
    93
	IMPORT_C TInt StartPreviewPrintL(const TPrintParameters& aPrintParams,MPageRegionPrinter& aBodyPrinter,
williamr@2
    94
				MPrintProcessObserver* anObserver,CGraphicsDevice& aPreviewDev,const TRect& aHeaderRectInPixels,
williamr@2
    95
				const TRect& aFooterRectInPixels,TInt aNumBands);
williamr@2
    96
	//
williamr@2
    97
	// accessors
williamr@2
    98
	inline CHeaderFooter* Header()const;
williamr@2
    99
	inline CHeaderFooter* Footer()const;
williamr@2
   100
	//
williamr@2
   101
	// persistence
williamr@2
   102
	IMPORT_C TStreamId StoreL(CStreamStore& aStore)const;
williamr@2
   103
	IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aStreamId,const MFieldFileNameInfo* aFileNameInfo=NULL,const MFieldNumPagesInfo* aNumPagesInfo=NULL,MPictureFactory* aFactory=NULL);
williamr@2
   104
	IMPORT_C void StoreComponentsL(CStreamStore& aStore,CStoreMap& aMap)const;
williamr@2
   105
	IMPORT_C void RestoreComponentsL(const CStreamStore& aStore,const MFieldFileNameInfo* aFileNameInfo=NULL,const MFieldNumPagesInfo* aNumPagesInfo=NULL,MPictureFactory* aFactory=NULL);
williamr@2
   106
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
williamr@2
   107
	IMPORT_C void InternalizeL(RReadStream& aStream);
williamr@2
   108
	//
williamr@2
   109
private:
williamr@2
   110
	CPrintSetup();
williamr@2
   111
	void ConstructL();
williamr@2
   112
	void DoStartPrintL(const TPrintParameters& aPrintParams,MPageRegionPrinter& aBodyPrinter,MPrintProcessObserver* aObserver,CPrinterPort* aPort);
williamr@2
   113
	void InitializePrintingL(CGraphicsDevice* aPrinterDev,const TPrintParameters& aPrintParams,MPrintProcessObserver* aObserver);
williamr@2
   114
	void InitializePrintingL(const TPrintParameters& aPrintParams,MPrintProcessObserver* aObserver,
williamr@2
   115
									 const TRect& aHeaderRectInPixels,const TRect& aFooterRectInPixels);
williamr@2
   116
	// from MFieldPageNumInfo
williamr@2
   117
	TInt UpdateFieldPageNum()const;
williamr@2
   118
public:
williamr@2
   119
	// Info regarding print setup etc.
williamr@2
   120
	/** The header and footer offset and the width of the four margins. 
williamr@2
   121
	
williamr@2
   122
	All measurements are in twips.
williamr@2
   123
	
williamr@2
   124
	@see TPageMargins */
williamr@2
   125
	TPageMargins iPageMarginsInTwips;
williamr@2
   126
	/** The number of the first page in the document.
williamr@2
   127
	
williamr@2
   128
	This value is used for printing or displaying page numbering. Note that all 
williamr@2
   129
	other page numbering is zero indexed, to preserve independence from user-defined 
williamr@2
   130
	page numbering. */
williamr@2
   131
	TInt iNumOfFirstPage; // value to start page numbering at
williamr@2
   132
private:
williamr@2
   133
	enum {
williamr@2
   134
		ENumberFirstPage = 0x0001,
williamr@2
   135
		};
williamr@2
   136
private:
williamr@2
   137
	CHeaderFooter* iHeader;
williamr@2
   138
	CHeaderFooter* iFooter;
williamr@2
   139
	CPrinterDriver* iPrinterDriver; // the target printer driver
williamr@2
   140
	CPreviewProcess* iPrintProcess;
williamr@2
   141
	CPdrModelList* iModelList;
williamr@2
   142
	MPrintProcessObserver* iPrintObserver;
williamr@2
   143
	TPrintParameters iPrintParams; // not persisted
williamr@2
   144
	CArrayFixSeg<TFileName>* iDriverDirList;
williamr@2
   145
	};
williamr@2
   146
williamr@2
   147
williamr@2
   148
//
williamr@2
   149
// inlines
williamr@2
   150
//
williamr@2
   151
williamr@2
   152
inline CHeaderFooter* CPrintSetup::Header()const
williamr@2
   153
/** Gets the header.
williamr@2
   154
williamr@2
   155
The CPrintSetup object owns the header and footer. CPrintSetup implements 
williamr@2
   156
the MFieldPageNumInfo interface, which allows page numbering to be easily 
williamr@2
   157
added to fields.
williamr@2
   158
williamr@2
   159
@return The header. */
williamr@2
   160
	{ return iHeader; }
williamr@2
   161
williamr@2
   162
inline CHeaderFooter* CPrintSetup::Footer()const
williamr@2
   163
/** Gets the footer.
williamr@2
   164
williamr@2
   165
@return The footer. */
williamr@2
   166
	{ return iFooter; }
williamr@2
   167
williamr@2
   168
williamr@2
   169
williamr@2
   170
williamr@2
   171
#endif