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