CHeaderFooter Class Reference

class CHeaderFooter : public CBase

A document header or footer.

The header is located in the top page margin and the footer in the bottom page margin. No more than one header or footer can exist in a document.

CHeaderFooter derives from MTextFieldFactory. This allows the insertion of various fields, including page number, current date or time and filename.

Rich text manipulation and formatting functions can be accessed through the rich text object which is owned by the header/footer.

The header and footer are retrieved using the CPrintSetup::Header() and Footer() functions and they are stored and restored together with the rest of the print setup information.

Inherits from

Public Member Functions
~CHeaderFooter()
IMPORT_C CCharFormatLayer *CharFormat()
IMPORT_C voidCreateTextL()
IMPORT_C voidExternalizeL(RWriteStream &)
MFieldFileNameInfo *FileNameFieldInfo()
TInt FirstPageToPrintTo()
IMPORT_C voidInternalizeL(RReadStream &)
IMPORT_C CHeaderFooter *NewL()
MFieldNumPagesInfo *NumPagesFieldInfo()
IMPORT_C CParaFormatLayer *ParaFormat()
IMPORT_C voidRestoreComponentsL(const CStreamStore &, MPictureFactory *)
IMPORT_C voidRestoreL(const CStreamStore &, TStreamId, MPictureFactory *)
IMPORT_C voidSetCharFormat(CCharFormatLayer *)
IMPORT_C voidSetFileNameInfo(const MFieldFileNameInfo &)
IMPORT_C voidSetFirstPageToPrintTo(TInt)
IMPORT_C voidSetNumPagesInfo(const MFieldNumPagesInfo &)
voidSetPageNumInfo(const MFieldPageNumInfo &)
IMPORT_C voidSetParaFormat(CParaFormatLayer *)
IMPORT_C voidSetText(CRichText *)
IMPORT_C voidStoreComponentsL(CStreamStore &, CStoreMap &)
IMPORT_C TStreamIdStoreL(CStreamStore &)
IMPORT_C CRichText *Text()
Private Member Functions
CHeaderFooter()
voidCreateFormatLayersL()
CTextField *NewFieldL(TUid)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
CCharFormatLayer *iCharLayer
MFieldFileNameInfo *iFileNameInfo
TInt iFirstPageToPrintTo
MFieldNumPagesInfo *iNumPagesInfo
MFieldPageNumInfo *iPageNumInfo
CParaFormatLayer *iParaLayer
CRichText *iText

Constructor & Destructor Documentation

CHeaderFooter()

CHeaderFooter()[private]

~CHeaderFooter()

IMPORT_C~CHeaderFooter()[virtual]

Destructor.

This frees all resources owned by the CHeaderFooter object, prior to its destruction.

Member Functions Documentation

CharFormat()

IMPORT_C CCharFormatLayer *CharFormat()const

Gets the character format layer upon which the header or footer's character formatting is based.

CreateFormatLayersL()

voidCreateFormatLayersL()[private]

CreateTextL()

IMPORT_C voidCreateTextL()

Allocates and constructs the rich text object owned by the header or footer.

The object's formatting is based on default values. If the header or footer's rich text object has already been allocated, the object is deleted and replaced by the one created by this function. So, calling this function causes a header or footer to lose all its existing text content, fields and formatting.

ExternalizeL(RWriteStream &)

IMPORT_C voidExternalizeL(RWriteStream &aStream)const

Externalises this object's text content and global format layers to a write stream.

The object's components are not externalised. The presence of this function means that the standard templated operator<<() (defined in s32strm.h) is available to externalise objects of this class.

This function does not store any fields, pictures or rich text-specific formatting, so may need to be accompanied by a call to StoreComponentsL().

Parameters

RWriteStream & aStreamStream to which the object should be externalised.

FileNameFieldInfo()

MFieldFileNameInfo *FileNameFieldInfo()const [inline]

Gets the object which implements the MFieldFileNameInfo interface, as set by SetFileNameInfo().

FirstPageToPrintTo()

TInt FirstPageToPrintTo()const [inline]

Gets the first page on which the header or footer is to be printed.

Page numbering begins at zero.

InternalizeL(RReadStream &)

IMPORT_C voidInternalizeL(RReadStream &aStream)

Internalises this object's text content and global format layers from a read stream.

The presence of this function means that the standard templated operator>>() (defined in s32strm.h) is available to internalise objects of this class.

This function does not restore any fields, pictures or rich text-specific formatting, so may need to be accompanied by a call to RestoreComponentsL().

Parameters

RReadStream & aStreamStream from which the object should be internalised.

NewFieldL(TUid)

CTextField *NewFieldL(TUidaFieldType)[private]

Parameters

TUid aFieldType

NewL()

IMPORT_C CHeaderFooter *NewL()[static]

Allocates and constructs an uninitialised CHeaderFooter object.

NumPagesFieldInfo()

MFieldNumPagesInfo *NumPagesFieldInfo()const [inline]

Gets the object which implements the MFieldNumPagesInfo interface, as set by SetNumPagesInfo().

ParaFormat()

IMPORT_C CParaFormatLayer *ParaFormat()const

Gets the paragraph format layer which is owned by the header or footer.

The header or footer's paragraph formatting is based upon this layer.

RestoreComponentsL(const CStreamStore &, MPictureFactory *)

IMPORT_C voidRestoreComponentsL(const CStreamStore &aStore,
MPictureFactory *aFactory
)

Restores this object's components from a stream store.

Components include fields and pictures.

This function does not restore the text content or global formatting of the header and footer, so it may need to be accompanied by a call to InternalizeL().

Parameters

const CStreamStore & aStoreStream store from which the components are restored.
MPictureFactory * aFactoryPicture factory. Must be supplied if the header or footer contains pictures which should be restored.

RestoreL(const CStreamStore &, TStreamId, MPictureFactory *)

IMPORT_C voidRestoreL(const CStreamStore &aStore,
TStreamIdaStreamId,
MPictureFactory *aFactory
)

Restores this object and all associated components from a stream store.

Components include fields and pictures.

Parameters

const CStreamStore & aStoreStream store from which to restore the CHeaderFooter.
TStreamId aStreamIdID of the stream containing the external representation of the CHeaderFooter object.
MPictureFactory * aFactoryPicture factory. Must be supplied if the header or footer contains pictures which should be restored.

SetCharFormat(CCharFormatLayer *)

IMPORT_C voidSetCharFormat(CCharFormatLayer *aCharFormat)

Sets the format layer upon which the header or footer's character formatting is based.

Ownership of aCharFormat is transferred to this object.

Any existing character format layer is replaced, but not deleted by this function.

Parameters

CCharFormatLayer * aCharFormatThe format layer upon which the header or footer's character formatting is based.

SetFileNameInfo(const MFieldFileNameInfo &)

IMPORT_C voidSetFileNameInfo(const MFieldFileNameInfo &aFileNameInfo)

Sets an object to update the document's filename.

If the header or footer supports filename fields, use this function to set an object that implements the MFieldFileNameInfo interface.

Parameters

const MFieldFileNameInfo & aFileNameInfoProvides a filename update function.

SetFirstPageToPrintTo(TInt)

IMPORT_C voidSetFirstPageToPrintTo(TIntaPageNum)

Sets the first page on which the header or footer is to be printed, allowing headers and footers to be omitted from the beginning of a document.

Page numbering begins at zero.

Parameters

TInt aPageNumThe number of the first page on which the header or footer is to be printed. The first page is numbered zero. If less than zero, a panic occurs.

SetNumPagesInfo(const MFieldNumPagesInfo &)

IMPORT_C voidSetNumPagesInfo(const MFieldNumPagesInfo &aNumPagesInfo)

Sets an object to update the total number of pages.

If the header or footer supports total number of pages fields, use this function to set up an object that implements the MFieldNumPagesInfo interface.

Parameters

const MFieldNumPagesInfo & aNumPagesInfoProvides a function that updates the total number of pages in the document.

SetPageNumInfo(const MFieldPageNumInfo &)

voidSetPageNumInfo(const MFieldPageNumInfo &aPageNumInfo)

This function is used internally by the CPrintSetup class.

Parameters

const MFieldPageNumInfo & aPageNumInfo

SetParaFormat(CParaFormatLayer *)

IMPORT_C voidSetParaFormat(CParaFormatLayer *aParaFormat)

Sets the format layer upon which the header or footer's paragraph formatting is based.

Ownership of aParaFormat is transferred to this object.

Any existing paragraph format layer is replaced, but not deleted by this function.

Parameters

CParaFormatLayer * aParaFormatThe format layer upon which the header or footer's paragraph formatting is based.

SetText(CRichText *)

IMPORT_C voidSetText(CRichText *aText)

Sets the rich text object which is owned by the header or footer.

The character and paragraph format layers upon which the header or footer's formatting is based are not updated by this function, so you may also need to call SetParaFormat() and SetCharFormat(), specifying the paragraph and character format layers referenced by aText.

Ownership of aText is transferred to this object.

Any existing rich text object is replaced, but is not deleted by this function.

Parameters

CRichText * aTextThe rich text object to set as the header or footer's rich text object.

StoreComponentsL(CStreamStore &, CStoreMap &)

IMPORT_C voidStoreComponentsL(CStreamStore &aStore,
CStoreMap &aMap
)const

Stores this object's components to a stream store, specifying a stream store and store map.

Components include fields and pictures.

This function does not store the text content or global formatting of the header and footer, so it may need to be accompanied by a call to ExternalizeL().

Parameters

CStreamStore & aStoreThe store to which the components are stored
CStoreMap & aMapTable of swizzles. Supports the deferred loading of the rich text components of the header or footer.

StoreL(CStreamStore &)

IMPORT_C TStreamIdStoreL(CStreamStore &aStore)const

Stores a CHeaderFooter object and all associated components to a stream store.

Components include rich text-specific formatting, fields and pictures.

leave
KErrNoMemory Out of memory.

Parameters

CStreamStore & aStoreThe store to which the CHeaderFooter should be stored.

Text()

IMPORT_C CRichText *Text()const

Gets the rich text object owned by this header or footer.

Through this object, rich text, fields and pictures can be inserted. This function can also be used to find out whether the rich text component is NULL, in which case a call to CreateTextL() or SetText() may be necessary.

Member Data Documentation

CCharFormatLayer * iCharLayer

CCharFormatLayer *iCharLayer[private]

MFieldFileNameInfo * iFileNameInfo

MFieldFileNameInfo *iFileNameInfo[private]

TInt iFirstPageToPrintTo

TInt iFirstPageToPrintTo[private]

MFieldNumPagesInfo * iNumPagesInfo

MFieldNumPagesInfo *iNumPagesInfo[private]

MFieldPageNumInfo * iPageNumInfo

MFieldPageNumInfo *iPageNumInfo[private]

CParaFormatLayer * iParaLayer

CParaFormatLayer *iParaLayer[private]

CRichText * iText

CRichText *iText[private]