Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: TXTGLOBL.H
Link against: etext.lib

Class CGlobalText

class CGlobalText : public CPlainText, public MLayDoc, public MFormatText;

Description

Text with globally applied formatting.

Global text uses a single set of paragraph format attributes to describe the appearance of every paragraph and a single set of character format attributes to describe the appearance of every character.

The paragraph formatting is stored in a CParaFormatLayer and the character formatting is stored in a CCharFormatLayer. A format layer is a set of character or paragraph format attributes, which may own a pointer to another format layer. This pointer is called a based-on link. The effective formatting of a global text object is the set of attributes specified in its two format layers, as well as any attributes inherited from the layers' chain of based-on links. To get the effective formatting, the links are read in turn, so that each attribute's value is taken from the first layer in the chain in which it has been set. Use GetCharFormat() and GetParaFormatL() to get the text object's effective formatting.

A global text object references the two format layers; it does not own them. This allows more than one global text object to use the same formatting. The format layers may be modified (see ApplyParaFormatL() and ApplyCharFormatL()) or replaced (see SetGlobalParaFormat() and SetGlobalCharFormat()) during the text object's lifetime.

Derivation

Members

Defined in CGlobalText:
ApplyCharFormatL(), ApplyParaFormatL(), CGlobalText(), CGlobalText(), CancelSelectLabel(), EnquirePageBreak(), GetCharFormat(), GetChars(), GetParaFormatL(), GetParagraphFormatL(), GetPictureSizeInTwips(), GlobalCharFormatLayer(), GlobalParaFormatLayer(), LdDocumentLength(), LdToParagraphStart(), NewL(), NewL(), PictureHandleL(), SelectParagraphLabel(), SetGlobalCharFormat(), SetGlobalParaFormat(), iGlobalCharFormatLayer, iGlobalParaFormatLayer, ~CGlobalText()

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from CEditableText:
EApostrophe, EBullet, EByteOrderMark, EDefaultTextGranularity, EEllipsis, EFlatStorage, EHyphen, EHyphenMinus, ELeftDoubleQuote, ELeftSingleQuote, ELineBreak, ENonBreakingHyphen, ENonBreakingSpace, EPageBreak, EParagraphDelimiter, EPictureCharacter, EPotentialHyphen, EReversedByteOrderMark, ERightDoubleQuote, ERightSingleQuote, ESegmentedStorage, ESpace, ETabCharacter, EZeroWidthNoBreakSpace, GetLengthOfInlineText(), GetPositionOfInlineTextInDocument(), HasChanged(), OverrideFormatOfInlineTextIfApplicable(), RestoreL(), SetHasChanged(), StoreL(), TDocumentStorage, iHasChanged

Inherited from CPlainText:
CharPosOfParagraph(), ComponentInfo(), ConstructL(), ConsumeAdornmentL(), ConvertAllFieldsToText(), ConvertFieldToText(), CopyToStoreL(), DeleteL(), DoConstructL(), DoExternalizeFieldDataL(), DoExternalizePlainTextL(), DoInternalizeFieldDataL(), DoInternalizePlainTextL(), DoPtDelete(), DoPtInsertL(), DocumentLength(), EBiggestCharacterPaste, EExcludeInlineEditedText, EExtractAll, EExtractVisible, EImportBufSize, EOrganiseByLine, EOrganiseByParagraph, EScanBackwards, EScanEndOfData, EScanJoinDelimiters, EScanPictureIsDelimiter, EScanPunctuationIsDelimiter, EScanStayIfBoundary, EScanToUnitEnd, EScanToUnitStart, EUnitIsParagraph, EUnitIsWord, ExportAsTextL(), ExportTextL(), ExtendedInterface(), ExternalizeFieldDataL(), ExternalizeL(), ExternalizePlainTextL(), ExternalizePlainTextNoLengthCountL(), Extract(), ExtractSelectively(), FieldCount(), FieldFactory(), FindFields(), GetWordInfo(), ImportTextFileL(), ImportTextL(), InsertFieldL(), InsertL(), InternalizeFieldDataL(), InternalizeL(), InternalizePlainTextL(), NewTextFieldL(), PageContainingPos(), ParagraphCount(), ParagraphNumberForPos(), PasteFromStoreL(), PtInsertL(), Read(), RemoveField(), Reset(), RestoreComponentsL(), RestoreFieldComponentsL(), SScanData, ScanParas(), ScanWords(), SetFieldFactory(), SetPageTable(), StoreComponentsL(), StoreFieldComponentsL(), TImportExportParam, TImportExportResult, TScanDataEnd, TTextOrganisation, TUnitOfText, TextField(), ToParagraphStart(), UidFromStreamL(), UpdateAllFieldsL(), UpdateFieldL(), WordCount(), anonymous, iByteStore, iFieldFactory, iFieldSet, iPageTable

Inherited from MLayDoc:
EForceLoadFalse, EForceLoadTrue, TForcePictureLoad


Construction and destruction


NewL()

static IMPORT_C CGlobalText *NewL(const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer, TDocumentStorage aStorage=ESegmentedStorage, TInt aDefaultTextGranularity=EDefaultTextGranularity);

Description

Allocates and constructs an empty global text object with a paragraph and a character format layer. A single end-of-document delimiter is inserted.

Parameters

const CParaFormatLayer *aGlobalParaLayer

Pointer to the paragraph format layer referenced by the text object. Must not be NULL, or a panic occurs.

const CCharFormatLayer *aGlobalCharLayer

Pointer to the character format layer referenced by the text object. Must not be NULL, or a panic occurs.

TDocumentStorage aStorage

The type of in-memory buffer to use. Defaults to ESegmentedStorage.

TInt aDefaultTextGranularity

Specifies the granularity of the in-memory buffer. Default is EDefaultTextGranularity bytes (=256).

Return value

CGlobalText *

Pointer to the global text object.


NewL()

static IMPORT_C CGlobalText *NewL(const CStreamStore &aStore, TStreamId aStreamId, const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer, MTextFieldFactory *aFieldFactory=0, TDocumentStorage=ESegmentedStorage);

Description

Returns a handle to a new instance of this class, whose textual content is restored from the specified read-stream. The global text object *uses* (does not own) the supplied global format layers.

Parameters

const CStreamStore &aStore

TStreamId aStreamId

const CParaFormatLayer *aGlobalParaLayer

const CCharFormatLayer *aGlobalCharLayer

MTextFieldFactory *aFieldFactory

TDocumentStorage

Return value

CGlobalText *


~CGlobalText()

IMPORT_C ~CGlobalText();

Description

The destructor is empty, and is present only to cause the virtual function table to be defined in a unique module.


CGlobalText()

protected: IMPORT_C CGlobalText();

Description


CGlobalText()

protected: IMPORT_C CGlobalText(const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer);

Description

Parameters

const CParaFormatLayer *aGlobalParaLayer

const CCharFormatLayer *aGlobalCharLayer

[Top]


Member functions


SetGlobalParaFormat()

IMPORT_C void SetGlobalParaFormat(const CParaFormatLayer *aParaFormatLayer);

Description

Replaces the paragraph format layer referenced by the global text object.

Parameters

const CParaFormatLayer *aParaFormatLayer

Pointer to the paragraph format layer to be referenced by the global text object.


SetGlobalCharFormat()

IMPORT_C void SetGlobalCharFormat(const CCharFormatLayer *aCharFormatLayer);

Description

Replaces the character format layer referenced by the global text object.

Parameters

const CCharFormatLayer *aCharFormatLayer

Pointer to the character format layer to be referenced by the global text object.


GlobalParaFormatLayer()

inline const CParaFormatLayer *GlobalParaFormatLayer() const;

Description

Gets the paragraph format layer referenced by the global text object.

Return value

const CParaFormatLayer *

Pointer to the paragraph format layer referenced by the global text object.


GlobalCharFormatLayer()

inline const CCharFormatLayer *GlobalCharFormatLayer() const;

Description

Gets the character format layer referenced by the global text object.

Return value

const CCharFormatLayer *

Pointer to the character format layer referenced by the global text object.


LdDocumentLength()

virtual IMPORT_C TInt LdDocumentLength() const;

Description

Gets the the number of characters in the document.

Note: the count includes all non-printing characters but excludes the end of text paragraph delimiter, so that the smallest return value is always zero.

Return value

TInt

The number of characters contained in the document.


LdToParagraphStart()

virtual IMPORT_C TInt LdToParagraphStart(TInt &aCurrentPos) const;

Description

Gets the document position of the start of the paragraph containing a specified document position.

Parameters

TInt &aCurrentPos

Specifies a document position: must be valid or a panic occurs. On return, specifies the document position of the first character in the paragraph in which it is located.

Return value

TInt

The number of characters skipped in scanning to the start of the paragraph.


GetParagraphFormatL()

virtual IMPORT_C void GetParagraphFormatL(CParaFormat *aFormat, TInt aPos) const;

Description

Gets the text object's effective paragraph formatting. The aPos value is only used in the rich text implementation of this function.

Parameters

CParaFormat *aFormat

On return, filled with the text object's effective paragraph formatting.

TInt aPos

This argument is not used for global text.


GetChars()

virtual IMPORT_C void GetChars(TPtrC &aView, TCharFormat &aFormat, TInt aStartPos) const;

Description

Gets a constant pointer descriptor to a portion of the text object. The portion starts at document position aStartPos, and ends at the end of the document, or the end of the segment, if segmented storage is being used. Also fills a character format object with the text object's effective character formatting. The start position must be valid, or a panic occurs.

Parameters

TPtrC &aView

On return, a constant pointer to a portion of the text.

TCharFormat &aFormat

On return, contains the text object's effective character formatting.

TInt aStartPos

The start position for the view.


GetPictureSizeInTwips()

virtual IMPORT_C TInt GetPictureSizeInTwips(TSize &aSize, TInt aPos) const;

Description

Global text provides no support for pictures, so this implementation of the function returns KErrNotFound.

Parameters

TSize &aSize

TInt aPos

Return value

TInt


PictureHandleL()

virtual IMPORT_C CPicture *PictureHandleL(TInt aPos, MLayDoc::TForcePictureLoad aForceLoad) const;

Description

Global text provides no support for pictures, so this implementation of the function returns NULL.

Parameters

TInt aPos

MLayDoc::TForcePictureLoad aForceLoad

Return value

CPicture *


EnquirePageBreak()

virtual IMPORT_C TBool EnquirePageBreak(TInt aPos, TInt aLength=0) const;

Description

Tests whether a page break occurs within a range of characters. Returns false if no page table has been set up: see CPlainText::SetPageTable(). The start and end of the range must be valid document positions, or a panic occurs.

Parameters

TInt aPos

The document position from which to begin searching for a page break.

TInt aLength

The number of characters to search for a page break, beginning at aPos. The default is zero.

Return value

TBool

ETrue if a page break occurs within the specified range, otherwise EFalse.


SelectParagraphLabel()

virtual IMPORT_C TBool SelectParagraphLabel(TInt aPos);

Description

Global text does not support paragraph labels, so this function returns EFalse.

Parameters

TInt aPos

Return value

TBool


CancelSelectLabel()

virtual IMPORT_C void CancelSelectLabel();

Description

Not supported.


GetParaFormatL()

virtual IMPORT_C void GetParaFormatL(CParaFormat *aFormat, TParaFormatMask &aVaries, TInt aPos, TInt aLength, CParaFormat::TParaFormatGetMode aMode=CParaFormat::EAllAttributes) const;

Description

Gets the the global text object's effective paragraph formatting. Note that the position and length arguments are only used in the rich text implementation of this function.

Parameters

CParaFormat *aFormat

Must not be NULL or a panic occurs. On return, contains the effective paragraph formatting for the global text object.

TParaFormatMask &aVaries

On return, a bitmask indicating which paragraph format attributes vary over the range of characters selected. This is only relevant for rich text, so for global text returns a value of zero for all attributes.

TInt aPos

This argument is not used for global text.

TInt aLength

This argument is not used for global text.

CParaFormat::TParaFormatGetMode aMode

The default, EAllAttributes indicates that values for all paragraph format attributes are written to aFormat. EFixedAttributes indicates that tabs, bullets and borders are not written to aFormat.


ApplyParaFormatL()

virtual IMPORT_C void ApplyParaFormatL(const CParaFormat *aFormat, const TParaFormatMask &aMask, TInt aPos, TInt aLength);

Description

Changes the text object's paragraph formatting. The attributes which are set in the mask are read from aFormat into the text object's paragraph format layer. The attributes which are not set in the mask are not changed. Note that the position and length arguments are only used in the rich text implementation of this function.

Parameters

const CParaFormat *aFormat

Contains the paragraph format attribute values to apply.

const TParaFormatMask &aMask

Bitmask specifying the paragraph format attributes to change.

TInt aPos

This argument is not used for global text.

TInt aLength

This argument is not used for global text.


GetCharFormat()

virtual IMPORT_C void GetCharFormat(TCharFormat &aFormat, TCharFormatMask &aVaries, TInt aPos, TInt aLength) const;

Description

Gets the global text object's effective character formatting. Note that the last three arguments are not relevant to the global text implementation of this function.

Parameters

TCharFormat &aFormat

On return, contains the effective character formatting for the global text object.

TCharFormatMask &aVaries

On return, a bitmask indicating which character format attributes vary over the range of characters selected. This is only relevant for rich text, so for global text returns a value of zero for all attributes.

TInt aPos

This argument is not used for global text.

TInt aLength

This argument is not used for global text.


ApplyCharFormatL()

virtual IMPORT_C void ApplyCharFormatL(const TCharFormat &aFormat, const TCharFormatMask &aMask, TInt aPos, TInt aLength);

Description

Changes the text object's character formatting. The attributes which are set in the mask are read from aFormat into the text object's character format layer. The attributes which are not set in the mask are not changed. Note that the position and length arguments are only used in the rich text implementation of this function.

Parameters

const TCharFormat &aFormat

Contains the character format attribute values to apply.

const TCharFormatMask &aMask

Bitmask specifying the character format attributes to change.

TInt aPos

This argument is not used for global text.

TInt aLength

This argument is not used for global text.

[Top]


Member data


iGlobalParaFormatLayer

protected: const CParaFormatLayer * iGlobalParaFormatLayer;

Description


iGlobalCharFormatLayer

protected: const CCharFormatLayer * iGlobalCharFormatLayer;

Description