epoc32/include/prnprev.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/prnprev.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,200 +0,0 @@
     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 -#if !defined (__PRNPREV_H__)
    1.20 -#define __PRNPREV_H__
    1.21 -
    1.22 -#if !defined(__E32STD_H__)
    1.23 -#include  <e32std.h>
    1.24 -#endif
    1.25 -#if !defined(__E32BASE_H__)
    1.26 -#include  <e32base.h>
    1.27 -#endif
    1.28 -#if !defined(__PRNSETUP_H__)
    1.29 -#include <prnsetup.h>
    1.30 -#endif
    1.31 -
    1.32 -// classes defined:
    1.33 -class TPrintPreviewFormat;
    1.34 -class TPreviewPanel;
    1.35 -class CPrintPreviewImage;
    1.36 -//
    1.37 -
    1.38 -// forward references:
    1.39 -class RWsSession;
    1.40 -class RWindow;
    1.41 -class CPrintPreviewDevice;
    1.42 -//
    1.43 -
    1.44 -
    1.45 -class TPrintPreviewFormat
    1.46 -/** Print preview format information.
    1.47 -
    1.48 -The print preview format information is accessed via its public data members. 
    1.49 -Typically there is a system wide TPrintPreviewFormat supplied by the GUI framework. 
    1.50 -
    1.51 -Preview information includes:
    1.52 -
    1.53 -- panel settings: multiple pages can be previewed at once; the display area 
    1.54 -for each page is termed a panel.
    1.55 -
    1.56 -- label settings: each panel can have an associated label, which specifies the 
    1.57 -corresponding document page number 
    1.58 -
    1.59 -@publishedAll 
    1.60 -@released */
    1.61 -	{
    1.62 -public:
    1.63 -	/** The minimum panel gutter size, in pixels. */
    1.64 -	TSize iMinPanelGutterInPixels;
    1.65 -	/** The width of the panel shadow, in pixels. */
    1.66 -	TInt iPanelShadowWidthInPixels;
    1.67 -	/** The colour of the panel shadow. */
    1.68 -	TRgb iPanelShadowColor;
    1.69 -	/** The panel margin colour. */
    1.70 -	TRgb iPanelMarginColor;
    1.71 -	/** The color of both the paper and the window background. */
    1.72 -	TRgb iPreviewBackgroundColor;
    1.73 -	/** X pixel offset of the label text from the panel edge. */
    1.74 -	TInt iLabelOffsetInPixels;
    1.75 -	/** Font specification for the label text. */
    1.76 -	TFontSpec iLabelFontSpecInPixels;
    1.77 -	};
    1.78 -
    1.79 -
    1.80 -class CPrintPreviewImage : public CBase, private MPrintProcessObserver, private MPageRegionPrinter
    1.81 -/** Print preview image.
    1.82 -
    1.83 -This class provides a standard print preview image. An object of this type 
    1.84 -should be owned by a control, which is in turn owned by the print preview 
    1.85 -dialog. The control's window provides the region into which this object draws 
    1.86 -the preview image.
    1.87 -
    1.88 -The class provides a callback to the application code that draws the preview 
    1.89 -pages. 
    1.90 -
    1.91 -@publishedAll 
    1.92 -@released */
    1.93 -	{
    1.94 -public:
    1.95 -	/** Margin display state flags. */
    1.96 -	enum TMarginState {
    1.97 -		/** Show margins in print preview image. */
    1.98 -		EShowMargins,
    1.99 -		/** Hide margins in print preview image. */
   1.100 -		EHideMargins
   1.101 -		};
   1.102 -public:
   1.103 -	IMPORT_C static CPrintPreviewImage* NewL(CPrintSetup& aPrintSetup,MPageRegionPrinter& aBodyPrinter,
   1.104 -											RWsSession& aWsSession,RWindow& aWindow,const TSize& aMaxWindowSize,
   1.105 -											const TPrintPreviewFormat& aStaticFormat);
   1.106 -	IMPORT_C virtual ~CPrintPreviewImage();
   1.107 -	IMPORT_C void SetMargins(TMarginState aState); // whether  or not to show margins
   1.108 -	IMPORT_C void SetObserver(MPrintProcessObserver& aObserver);
   1.109 -	IMPORT_C void SetNumBands(TInt aNum);
   1.110 -	IMPORT_C void FormatL(TInt aNumPagesInDoc,TInt aFirstPageToDisplay,TInt aNumPagesToView); // call when scrolling or changing num pages to view
   1.111 -	IMPORT_C void DrawL(const TPoint& aOrigin,const TRect& aInvalidRegion); // aOrigin is the point in the window I will treat as the origin (ie offset)
   1.112 -	//
   1.113 -private:
   1.114 -	class TPreviewPanel;
   1.115 -	class TRange
   1.116 -		{
   1.117 -	public:
   1.118 -		TInt iFrom;
   1.119 -		TInt iTo;
   1.120 -		};
   1.121 -private:
   1.122 -	CPrintPreviewImage(CPrintSetup& aPrintSetup,MPageRegionPrinter& aBodyPrinter,RWsSession& aWsSession,
   1.123 -						RWindow& aWindow,const TSize& aMaxWindowSize,const TPrintPreviewFormat& aStaticFormat);
   1.124 -	void ConstructL();
   1.125 -	void CalculateHeaderFooterRects(TRect& aHeaderRectInPixels,TRect& aFooterRectInPixels);
   1.126 -	TInt SetPanelArrayL(const TInt aFirstPage,const TInt aNumPagesToView); 
   1.127 -	void SetLabelWidth();
   1.128 -	void ScrollPanels();
   1.129 -	void DrawBorder(CGraphicsContext* aGc); // and shadow
   1.130 -	void DrawMargins(CGraphicsContext* aGc); // including header/footer lines
   1.131 -	void DrawLabel(CGraphicsContext* aGc,TInt aPageNo);
   1.132 -	void DrawToGutter(CGraphicsContext* aGc,TInt aPageNo); // blanks all the gutter areas associated to a particular panel
   1.133 -	void DrawExtremities(CGraphicsContext* aGc); // blanks very left and right of the window
   1.134 -	inline TBool IsFirstPanel(TInt aPageNum);
   1.135 -	inline TBool IsLastPanel(TInt aPageNum);
   1.136 -	// from MPrintProcessObserver
   1.137 -	virtual void NotifyPrintStarted(TPrintParameters aPrintParams);
   1.138 -	virtual void NotifyBandPrinted(TInt aPercentageOfPagePrinted, TInt aCurrentPageNum, TInt aCurrentCopyNum);
   1.139 -	virtual void NotifyPrintEnded(TInt anErrorCode);
   1.140 -	// from MPageRegionPrinter
   1.141 -	virtual void PrintBandL(CGraphicsDevice* aDevice,TInt aPageNo,const TBandAttributes& aBand);
   1.142 -private:
   1.143 -	CPrintPreviewDevice* iDevice;
   1.144 -	CPrintSetup* iPrintSetup;
   1.145 -	MPageRegionPrinter* iAppBodyPrinter;
   1.146 -	MPrintProcessObserver* iObserver; // may be null
   1.147 -	RWsSession* iWsSession;
   1.148 -	RWindow* iWindow;
   1.149 -	CFont* iLabelFont;
   1.150 -	CArrayFix<TPreviewPanel>* iPanelArray;
   1.151 -	//
   1.152 -	TPrintPreviewFormat iFormat;
   1.153 -	TPrintParameters iPrintParams; // current preview range
   1.154 -	TMarginState iMarginState; // whether the margins are on or not
   1.155 -	TSize iPanelSizeInPixels;
   1.156 -	TSize iWinSize; // size of the window (for layout purposes)
   1.157 -	TPoint iOrigin; // origin in the window to use for drawing
   1.158 -	TSize iLabelSize;
   1.159 -	TSize iActualGutter; // gap from the edge of the panel to either screen edge or adjacent panel
   1.160 -	TInt iNumPagesInDoc; 
   1.161 -	TInt iNumBands;
   1.162 -	TSize iRndError; // rounding error from calculation of iActualGutter
   1.163 -	TRange iDrawRange; // the pages that actually require drawing - ie have not been scrolled 
   1.164 -	};
   1.165 -
   1.166 -
   1.167 -/** Internalises the margin state from a read stream.
   1.168 -
   1.169 -@param aThing The margin state to be internalised - on or off.
   1.170 -@param aStream The read stream from which the margin state is to be internalised. 
   1.171 -
   1.172 -@publishedAll 
   1.173 -@released */
   1.174 -IMPORT_C void InternalizeL(CPrintPreviewImage::TMarginState& aThing,RReadStream& aStream);
   1.175 -
   1.176 -inline RWriteStream& operator<<(RWriteStream& aStream,const CPrintPreviewImage::TMarginState& aThing) 
   1.177 -/**
   1.178 -@publishedAll 
   1.179 -@released 
   1.180 -*/
   1.181 -	{aStream.WriteUint8L(aThing);return aStream;}
   1.182 -
   1.183 -inline RReadStream& operator>>(RReadStream& aStream,CPrintPreviewImage::TMarginState& aThing) 
   1.184 -/**
   1.185 -@publishedAll 
   1.186 -@released 
   1.187 -*/
   1.188 -	{InternalizeL(aThing,aStream);return aStream;}
   1.189 -
   1.190 -//
   1.191 -// inlines
   1.192 -//
   1.193 -
   1.194 -// move to private source...
   1.195 -
   1.196 -inline TBool CPrintPreviewImage::IsFirstPanel(TInt aPageNum) 
   1.197 -	{ return aPageNum==iPrintParams.iFirstPage; }
   1.198 -
   1.199 -inline TBool CPrintPreviewImage::IsLastPanel(TInt aPageNum) 
   1.200 -	{ return aPageNum==iPrintParams.iLastPage; }
   1.201 -
   1.202 -
   1.203 -#endif