CPrintPreviewImage Class Reference

#include <mw/prnprev.h>

Link against: prev.lib

class CPrintPreviewImage : public CBase

Inherits from

  • CPrintPreviewImage

    Nested Classes and Structures

    Detailed 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.

    Member Enumeration Documentation

    Enum TMarginState

    Margin display state flags.

    EnumeratorValueDescription
    EShowMargins

    Show margins in print preview image.

    EHideMargins

    Hide margins in print preview image.

    Constructor & Destructor Documentation

    ~CPrintPreviewImage ( )

    IMPORT_C~CPrintPreviewImage()[virtual]

    Destructor.

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

    Member Function Documentation

    DrawL ( const TPoint &, const TRect & )

    IMPORT_C voidDrawL(const TPoint &aOrigin,
    const TRect &aInvalidRegion
    )

    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.

    leave
    KErrNoMemory If there is an out of memory error.
    panic
    4 If the panel array has not been initialised. Call FormatL() to avoid this.
    ParameterDescription
    aOriginThe drawing origin.
    aInvalidRegionThe invalid region. This is assumed to be relative to aOrigin.

    FormatL ( TInt, TInt, TInt )

    IMPORT_C voidFormatL(TIntaNumPagesInDoc,
    TIntaFirstPageToDisplay,
    TIntaNumPagesToView
    )

    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:

    The panels are fitted to the maximum window area available. This means that the print preview dialog will always be the same size irrespective of the number of panels displayed.

    panic
    6 If the number of pages in the document or the number of pages to be previewed is not greater than zero.
    panic
    7 If aFirstPageToDisplay is not less than aNumPagesInDoc or if the first page to display is less than zero.
    ParameterDescription
    aNumPagesInDocThe number of pages in the document.
    aFirstPageToDisplayThe first page to display.
    aNumPagesToViewThe number of pages to preview.

    NewL ( CPrintSetup &, MPageRegionPrinter &, RWsSession &, RWindow &, const TSize &, const TPrintPreviewFormat & )

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

    Static constructor for a CPrintPreviewImage object.

    ParameterDescription
    aPrintSetupThe printer setup.
    aBodyPrinterA page region printer. Defines a function to print the body of each page band by band.
    aWsSessionA window server session. This may be the GUI framework session accessed through iEikonEnv->WsSession().
    aWindowThe window in which the image is to be drawn. Typically this is the window of the owning control.
    aMaxWindowSizeThe maximum size of the window aWindow.
    aStaticFormatThe print preview format.

    Returns: The newly created print preview image.

    SetMargins ( TMarginState )

    IMPORT_C voidSetMargins(TMarginStateaState)

    Sets whether or not margins are displayed.

    ParameterDescription
    aStateThe margin state - on or off.

    SetNumBands ( TInt )

    IMPORT_C voidSetNumBands(TIntaNum)

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

    On construction, the number of bands is initialised to to 1.

    ParameterDescription
    aNumThe number of print bands.

    SetObserver ( MPrintProcessObserver & )

    IMPORT_C voidSetObserver(MPrintProcessObserver &aObserver)

    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.

    ParameterDescription
    aObserverThe preview process observer.