Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: prnprev.h
Link against: prev.lib

Class CPrintPreviewImage

CPrintPreviewImage

Support

Supported from 5.0

Description

Print preview image.

This class provides a standard print preview image. An object of this type should be owned by a control, which is in turn owned by the print preview dialog. The control's window provides the region into which this object draws the preview image.

The class provides a callback to the application code that draws the preview pages.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CPrintPreviewImagePrint preview image
MPageRegionPrinterInterface for printing in bands
MPrintProcessObserverPrint progress and status notification interface class

Defined in CPrintPreviewImage:
DrawL(), EHideMargins, EShowMargins, FormatL(), NewL(), SetMargins(), SetNumBands(), SetObserver(), TMarginState, ~CPrintPreviewImage()

Inherited from CBase:
operator new()

Inherited from MPageRegionPrinter:
PrintBandL()

Inherited from MPrintProcessObserver:
NotifyBandPrinted(), NotifyPrintEnded(), NotifyPrintStarted()


Construction and destruction


NewL()

static CPrintPreviewImage* NewL(CPrintSetup& aPrintSetup,MPageRegionPrinter& aBodyPrinter, RWsSession& aWsSession,RWindow& aWindow,const TSize& aMaxWindowSize, const TPrintPreviewFormat& aStaticFormat);

Description

Static constructor for a CPrintPreviewImage object.

Parameters

CPrintSetup& aPrintSetup

The printer setup.

MPageRegionPrinter& aBodyPrinter

A page region printer. Defines a function to print the body of each page band by band.

RWsSession& aWsSession

A window server session. This may be the GUI framework session accessed through iEikonEnv->WsSession().

RWindow& aWindow

The window in which the image is to be drawn. Typically this is the window of the owning control.

const TSize& aMaxWindowSize

The maximum size of the window aWindow.

const TPrintPreviewFormat& aStaticFormat

The print preview format.

Return value

CPrintPreviewImage*

The newly created print preview image.


~CPrintPreviewImage()

virtual ~CPrintPreviewImage();

Description

Destructor.

This ends printing, and frees all resources owned by the CPrintPreviewImage object, prior to its destruction.

[Top]


Member functions


DrawL()

void DrawL(const TPoint& aOrigin,const TRect& aInvalidRegion);

Description

Draws the preview.

This function should be called every time the window needs to be refreshed.

Note that typically this function is called in the owning control's Draw() function. Since DrawL() can leave it must be called within a trap harness — the normal behaviour is to clear the image rectangle if a leave occurs.

Parameters

const TPoint& aOrigin

The drawing origin.

const TRect& aInvalidRegion

The invalid region. This is assumed to be relative to aOrigin.

Leave codes

KErrNoMemory

If there is an out of memory error.

Panic codes

4

If the panel array has not been initialised — call FormatL().


FormatL()

void FormatL(TInt aNumPagesInDoc,TInt aFirstPageToDisplay,TInt aNumPagesToView);

Description

Sets preview formatting information.

This function can be called prior to previewing, or dynamically during previewing. It is used to alter the display parameters, e.g. turn margin indicator lines on or off, show/hide labels, change the number of panels viewed, or scroll the preview to show different pages.

Note:

Parameters

TInt aNumPagesInDoc

The number of pages in the document.

TInt aFirstPageToDisplay

The first page to display.

TInt aNumPagesToView

The number of pages to preview.

Panic codes

6

If the number of pages in the document or the number of pages to be previewed is not greater than zero.

7

If aFirstPageToDisplay is not less than aNumPagesInDoc or if the first page to display is less than zero.


SetMargins()

void SetMargins(TMarginState aState);

Description

Sets whether or not margins are displayed.

Parameters

TMarginState aState

The margin state — on or off.


SetNumBands()

void SetNumBands(TInt aNum);

Description

Sets the number of print bands to be drawn in the preview.

This object is created with the default number of bands equal to 1.

Parameters

TInt aNum

The number of print bands.


SetObserver()

void SetObserver(MPrintProcessObserver& aObserver);

Description

Sets the process observer.

The observer is informed of events occurring during print previewing. It allows error dialogs to be displayed by the GUI print preview dialogs if there are problems during previewing.

Parameters

MPrintProcessObserver& aObserver

The preview process observer.

[Top]


Enumerations


Enum TMarginState

TMarginState

Description

Margin display state flags.

EShowMargins

Show margins in print preview image.

EHideMargins

Hide margins in print preview image.