Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: prninf.h
Link against: print.lib

Class CHeaderFooter

CHeaderFooter

Support

Supported from 5.0

Description

A document header or footer.

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

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

Rich text manipulation and formatting functions (see class CRichText) 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.

This class is not intended for user derivation.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CHeaderFooterA document header or footer
MTextFieldFactoryAbstract base class for field factories

Defined in CHeaderFooter:
CharFormat(), CreateTextL(), ExternalizeL(), FileNameFieldInfo(), FirstPageToPrintTo(), InternalizeL(), NewL(), NumPagesFieldInfo(), ParaFormat(), RestoreComponentsL(), RestoreL(), SetCharFormat(), SetFileNameInfo(), SetFirstPageToPrintTo(), SetNumPagesInfo(), SetPageNumInfo(), SetParaFormat(), SetText(), StoreComponentsL(), StoreL(), Text(), ~CHeaderFooter()

Inherited from CBase:
operator new()

Inherited from MTextFieldFactory:
NewFieldL()

See also:


Construction and destruction


NewL()

static CHeaderFooter* NewL();

Description

Allocates and constructs an uninitialised CHeaderFooter object.

Return value

CHeaderFooter*

The newly constructed CHeaderFooter object.

Leave codes

KErrNoMemory

There is insufficient memory.


~CHeaderFooter()

virtual ~CHeaderFooter();

Description

Destructor.

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

[Top]


Stream persistence


StoreL()

TStreamId StoreL(CStreamStore& aStore)const;

Description

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

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

Parameters

CStreamStore& aStore

The store to which the CHeaderFooter should be stored.

Return value

TStreamId

ID of the stream containing the external representation of the CHeaderFooter object

Leave codes

KErrNoMemory

Out of memory.


RestoreL()

void RestoreL(const CStreamStore& aStore,TStreamId aStreamId,MPictureFactory* aFactory);

Description

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

Components include fields and pictures.

Parameters

const CStreamStore& aStore

Stream store from which to restore the CHeaderFooter.

TStreamId aStreamId

ID of the stream containing the external representation of the CHeaderFooter object.

MPictureFactory* aFactory

Picture factory. Must be supplied if the header or footer contains pictures which should be restored.

Leave codes

KErrNoMemory

Out of memory.


StoreComponentsL()

void StoreComponentsL(CStreamStore& aStore,CStoreMap& aMap)const;

Description

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

Components include fields and pictures.

Parameters

CStreamStore& aStore

The store to which the components are stored

CStoreMap& aMap

Table of swizzles. Supports the deferred loading of the rich text components of the header or footer.

Leave codes

KErrNoMemory

The write action caused the stream's resources to be exhausted.

Notes:


RestoreComponentsL()

void RestoreComponentsL(const CStreamStore& aStore,MPictureFactory* aFactory);

Description

Restores this object's components from a stream store.

Components include fields and pictures.

Parameters

const CStreamStore& aStore

Stream store from which the components are restored.

MPictureFactory* aFactory

Picture factory. Must be supplied if the header or footer contains pictures which should be restored.

Leave codes

KErrNoMemory

Out of memory.

Notes:


ExternalizeL()

void ExternalizeL(RWriteStream& aStream) const;

Description

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.

Parameters

RWriteStream& aStream

Stream to which the object should be externalised.

Leave codes

KErrNoMemory

The write action caused the stream's resources to be exhausted.

Notes:


InternalizeL()

void InternalizeL(RReadStream& aStream);

Description

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.

Parameters

RReadStream& aStream

Stream from which the object should be internalised.

Leave codes

KErrNoMemory

Out of memory.

Notes:

[Top]


First page


SetFirstPageToPrintTo()

void SetFirstPageToPrintTo(TInt aPageNum);

Description

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 aPageNum

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


FirstPageToPrintTo()

TInt FirstPageToPrintTo()const;

Description

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

Page numbering begins at zero.

Return value

TInt

The number of the first page on which the header or footer is to be printed.

[Top]


Field support


SetFileNameInfo()

void SetFileNameInfo(const MFieldFileNameInfo& aFileNameInfo);

Description

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& aFileNameInfo

Provides a filename update function.


SetPageNumInfo()

void SetPageNumInfo(const MFieldPageNumInfo& aPageNumInfo);

Description

This function is used internally by the CPrintSetup class.


SetNumPagesInfo()

void SetNumPagesInfo(const MFieldNumPagesInfo& aNumPagesInfo);

Description

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& aNumPagesInfo

Provides a function that updates the total number of pages in the document.


FileNameFieldInfo()

MFieldFileNameInfo* FileNameFieldInfo() const;

Description

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

Return value

MFieldFileNameInfo*

The object which implements the MFieldFileNameInfo interface.


NumPagesFieldInfo()

MFieldNumPagesInfo* NumPagesFieldInfo() const;

Description

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

Return value

MFieldNumPagesInfo*

The object which implements the MFieldNumPagesInfo interface.

[Top]


Rich text


CreateTextL()

void CreateTextL();

Description

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.

Leave codes

KErrNoMemory

There is insufficient memory to perform the operation.


Text()

CRichText* Text() const;

Description

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.

Return value

CRichText*

The rich text object owned by the header or footer.


ParaFormat()

CParaFormatLayer* ParaFormat() const;

Description

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.

Return value

CParaFormatLayer*

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


CharFormat()

CCharFormatLayer* CharFormat()const;

Description

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

Return value

CCharFormatLayer*

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


SetText()

void SetText(CRichText* aText);

Description

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.

Parameters

CRichText* aText

The rich text object to set as the header or footer's rich text object.

Notes:

See also:


SetParaFormat()

void SetParaFormat(CParaFormatLayer* aParaFormat);

Description

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

Parameters

CParaFormatLayer* aParaFormat

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

Notes:


SetCharFormat()

void SetCharFormat(CCharFormatLayer* aCharFormat);

Description

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

Parameters

CCharFormatLayer* aCharFormat

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

Notes: