epoc32/include/prninf.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/prninf.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/prninf.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,254 @@
     1.4 -prninf.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __PRNINF_H__
    1.21 +#define __PRNINF_H__
    1.22 +
    1.23 +#if !defined(__E32STD_H__)
    1.24 +#include <e32std.h>
    1.25 +#endif
    1.26 +#if !defined(__GDI_H__)
    1.27 +#include <gdi.h>
    1.28 +#endif
    1.29 +#if !defined(__FLDBASE_H__)
    1.30 +#include <fldbase.h>
    1.31 +#endif
    1.32 +
    1.33 +// Classes defined
    1.34 +//class TPageNumbers;
    1.35 +class CHeaderFooter;
    1.36 +class TPrintParameters;		
    1.37 +class TPageMargins;
    1.38 +class MPrintProcessObserver;	
    1.39 +
    1.40 +// classes referenced
    1.41 +class RReadStream;
    1.42 +class RWriteStream;
    1.43 +class CRichText;
    1.44 +class CParaFormatLayer;
    1.45 +class CCharFormatLayer;
    1.46 +class MFieldFileNameInfo;
    1.47 +class MFieldPageNumInfo;
    1.48 +class MFieldNumPagesInfo;
    1.49 +//////////////////
    1.50 +
    1.51 +
    1.52 +class TPrintParameters
    1.53 +/** Print parameters.
    1.54 +
    1.55 +This data is associated with a particular print request, not with the document 
    1.56 +to be printed, so is separate from the print setup information.
    1.57 +
    1.58 +An object of this class is passed to CPrintSetup::StartPrintL() and to CPrintSetup::StartPreviewPrintL().
    1.59 +
    1.60 +@see CPrintSetup 
    1.61 +@publishedAll 
    1.62 +@released */
    1.63 +	{
    1.64 +public:
    1.65 +	IMPORT_C TPrintParameters(); // sets to 1,0,0
    1.66 +public:
    1.67 +	/** The number of copies to print. */
    1.68 +	TInt iNumCopies;									
    1.69 +	/** The first page to be printed. 
    1.70 +	
    1.71 +	This value should be less than or equal to iLastPage. Zero indicates the first page 
    1.72 +	in the document. */
    1.73 +	TInt iFirstPage;			
    1.74 +	/** The last page to be printed. 
    1.75 +	
    1.76 +	This value should be greater than or equal to iFirstPage. Zero indicates the first 
    1.77 +	page in the document. */
    1.78 +	TInt iLastPage;
    1.79 +	};
    1.80 +
    1.81 +class TPageMargins
    1.82 +/** Page margins.
    1.83 +
    1.84 +Page margins are accessed via the public iPageMarginsInTwips member of class 
    1.85 +CPrintSetup. A single margin settings object applies throughout a document, 
    1.86 +so that gutter margins are not supported.
    1.87 +
    1.88 +If the document contains headers and footers, they are located within the 
    1.89 +top and bottom margins respectively. 
    1.90 +
    1.91 +@publishedAll 
    1.92 +@released */
    1.93 +	{
    1.94 +public:
    1.95 +	IMPORT_C void InternalizeL(RReadStream& aStream); 	
    1.96 +	IMPORT_C void ExternalizeL(RWriteStream& aStream)const;
    1.97 +public:
    1.98 +	/** The distance between the top of the header and the top of the page in twips 
    1.99 +	or pixels.
   1.100 +	
   1.101 +	This must be less than the height of the top margin to ensure that the header 
   1.102 +	is visible. */
   1.103 +	TInt iHeaderOffset;
   1.104 +	/** The distance between the top of the footer and the top of the bottom margin 
   1.105 +	in twips or pixels. 
   1.106 +	
   1.107 +	This must be less than the height of the bottom margin to ensure that the 
   1.108 +	footer is visible. */
   1.109 +	TInt iFooterOffset;
   1.110 +	/** The widths of each of the four margins in twips or pixels.
   1.111 +	
   1.112 +	@see TMargins */
   1.113 +	TMargins iMargins;
   1.114 +	};
   1.115 +
   1.116 +class CHeaderFooter : public CBase, private MTextFieldFactory
   1.117 +/** A document header or footer.
   1.118 +
   1.119 +The header is located in the top page margin and the footer in the 
   1.120 +bottom page margin. No more than one header or footer can exist in a document.
   1.121 +
   1.122 +CHeaderFooter derives from MTextFieldFactory. This allows the insertion of 
   1.123 +various fields, including page number, current date or time and filename.
   1.124 +
   1.125 +Rich text manipulation and formatting functions can be accessed through 
   1.126 +the rich text object which is owned by the header/footer.
   1.127 +
   1.128 +The header and footer are retrieved using the CPrintSetup::Header() and Footer() 
   1.129 +functions and they are stored and restored together with the rest of the print 
   1.130 +setup information.
   1.131 +
   1.132 +@publishedAll 
   1.133 +@released */
   1.134 +	{
   1.135 +public:
   1.136 +	IMPORT_C static CHeaderFooter* NewL();
   1.137 +	IMPORT_C virtual ~CHeaderFooter();
   1.138 +	//
   1.139 +	IMPORT_C void CreateTextL();
   1.140 +	IMPORT_C void SetFirstPageToPrintTo(TInt aPageNum); // allows the first few pages of a doc not to have a header on them
   1.141 +	inline TInt FirstPageToPrintTo()const; // relative to the first page being numbered 0
   1.142 +	//
   1.143 +	// persistence
   1.144 +	IMPORT_C TStreamId StoreL(CStreamStore& aStore)const;
   1.145 +	IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aStreamId,MPictureFactory* aFactory);
   1.146 +	IMPORT_C void StoreComponentsL(CStreamStore& aStore,CStoreMap& aMap)const;
   1.147 +	IMPORT_C void RestoreComponentsL(const CStreamStore& aStore,MPictureFactory* aFactory);
   1.148 +	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.149 +	IMPORT_C void InternalizeL(RReadStream& aStream);
   1.150 +	//
   1.151 +	// text bits
   1.152 +	IMPORT_C CRichText* Text()const;
   1.153 +	IMPORT_C CParaFormatLayer* ParaFormat()const;
   1.154 +	IMPORT_C CCharFormatLayer* CharFormat()const;
   1.155 +	IMPORT_C void SetText(CRichText* aText); // takes ownership
   1.156 +	IMPORT_C void SetParaFormat(CParaFormatLayer* aParaFormat); // takes ownership
   1.157 +	IMPORT_C void SetCharFormat(CCharFormatLayer* aCharFormat); // takes ownership
   1.158 +	//
   1.159 +	// field bits
   1.160 +	IMPORT_C void SetFileNameInfo(const MFieldFileNameInfo& aFileNameInfo); // call if you want headers/footers to support filename fields
   1.161 +	IMPORT_C void SetNumPagesInfo(const MFieldNumPagesInfo& aNumPagesInfo); // call if you want headers/footers to support "total number of pages" fields
   1.162 +	inline MFieldFileNameInfo* FileNameFieldInfo()const;
   1.163 +	inline MFieldNumPagesInfo* NumPagesFieldInfo()const;
   1.164 +	//
   1.165 +	void SetPageNumInfo(const MFieldPageNumInfo& aPageNumInfo); // called by CPrintSetup
   1.166 +private:
   1.167 +	CHeaderFooter();
   1.168 +	void CreateFormatLayersL();
   1.169 +	// from MTextFieldFactory
   1.170 +	CTextField* NewFieldL(TUid aFieldType);
   1.171 +private:
   1.172 +	TInt iFirstPageToPrintTo; // relative to the first page being numbered 0
   1.173 +	MFieldFileNameInfo* iFileNameInfo;
   1.174 +	MFieldPageNumInfo* iPageNumInfo;
   1.175 +	MFieldNumPagesInfo* iNumPagesInfo;
   1.176 +	CRichText* iText; // RichText Doc Handle
   1.177 +	CParaFormatLayer* iParaLayer;
   1.178 +	CCharFormatLayer* iCharLayer;
   1.179 +private:
   1.180 +	enum { ETextExists = 0x0001 };
   1.181 +	};
   1.182 +
   1.183 +class MPrintProcessObserver
   1.184 +/** Print progress and status notification interface class.
   1.185 +
   1.186 +The notification functions are called before, during and after a print or 
   1.187 +print preview operation, to give notification of its progress.
   1.188 +
   1.189 +The print process observer will often be the GUI's standard print progress 
   1.190 +or print preview dialog.
   1.191 +
   1.192 +An object of a class which implements this interface may be passed as a parameter 
   1.193 +to CPrintSetup::StartPrintL(), or to CPrintSetup::StartPreviewPrintL(). 
   1.194 +
   1.195 +@publishedAll 
   1.196 +@released */
   1.197 +	{
   1.198 +public:
   1.199 +	/** Notifies that a print or print preview operation is about to begin.
   1.200 +	
   1.201 +	It may be used to display information about the document to be printed. It 
   1.202 +	is called once, immediately before printing or print previewing begins.
   1.203 +	
   1.204 +	When subclassing, add variables to store initialisation information as required.
   1.205 +	
   1.206 +	@param aPrintParams The parameters for the print job. */
   1.207 +	virtual void NotifyPrintStarted(TPrintParameters aPrintParams)=0;
   1.208 +	/** Notifies that a band is about to be printed.
   1.209 +	
   1.210 +	It may be used to display print progress information, including the current 
   1.211 +	page number. It is called immediately before each band is printed.
   1.212 +	
   1.213 +	@param aPercentageOfPagePrinted The percentage of the page that has been printed.
   1.214 +	@param aCurrentPageNum The number of the page currently being printed.
   1.215 +	@param aCurrentCopyNum The number of the copy currently being printed (if multiple 
   1.216 +	copies are being printed). */
   1.217 +	virtual void NotifyBandPrinted(TInt aPercentageOfPagePrinted, TInt aCurrentPageNum, TInt aCurrentCopyNum)=0;
   1.218 +	/** Notifies that the print or print preview operation has completed.
   1.219 +	
   1.220 +	It may be used to display information about how the operation completed, for 
   1.221 +	example any errors that occurred. It is called once, immediately after the 
   1.222 +	print job terminates.
   1.223 +	
   1.224 +	@param anErrorCode KErrNone if the print job completed successfully, otherwise 
   1.225 +	another of the system-wide error codes. */
   1.226 +	virtual void NotifyPrintEnded(TInt anErrorCode)=0;
   1.227 +	//
   1.228 +	};
   1.229 +
   1.230 +
   1.231 +//
   1.232 +// inlines
   1.233 +//
   1.234 +
   1.235 +inline TInt CHeaderFooter::FirstPageToPrintTo()const
   1.236 +/** Gets the first page on which the header or footer is to be printed.
   1.237 +
   1.238 +Page numbering begins at zero.
   1.239 +
   1.240 +@return The number of the first page on which the header or footer is to be 
   1.241 +printed. */
   1.242 +	{ return iFirstPageToPrintTo; }
   1.243 +
   1.244 +inline MFieldFileNameInfo* CHeaderFooter::FileNameFieldInfo()const
   1.245 +/** Gets the object which implements the MFieldFileNameInfo interface, as set by 
   1.246 +SetFileNameInfo().
   1.247 +
   1.248 +@return The object which implements the MFieldFileNameInfo interface. */
   1.249 +	{ return iFileNameInfo; }
   1.250 +
   1.251 +inline MFieldNumPagesInfo* CHeaderFooter::NumPagesFieldInfo()const
   1.252 +/** Gets the object which implements the MFieldNumPagesInfo interface, as set by 
   1.253 +SetNumPagesInfo().
   1.254 +
   1.255 +@return The object which implements the MFieldNumPagesInfo interface. */
   1.256 +	{ return iNumPagesInfo; }
   1.257 +
   1.258 +#endif