Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: TXTETEXT.H
Link against: etext.lib

Class CEditableText

class CEditableText : public CBase;

Description

An abstract base class which defines the behaviour common to all editable text classes.

It provides no storage for text or text formatting, so it is not directly usable. It defines protocols for editing the contents of a text object and for extracting format data from a text object which supports formatting.

Note: when specifying a position in a text object (the document position), zero is before the first character in the document. If the document contains n characters, position n is after the last character. Valid document positions are therefore between zero and the length of the document, inclusive. Many editable text functions raise a panic if a specified document position is invalid.

Note also that the functions which implement support for front-end-processor inline editing are intended for internal use only by Symbian.

Derivation

Members

Defined in CEditableText:
CopyToStoreL(), DeleteL(), DocumentLength(), EApostrophe, EBullet, EByteOrderMark, EDefaultTextGranularity, EEllipsis, EFlatStorage, EHyphen, EHyphenMinus, ELeftDoubleQuote, ELeftSingleQuote, ELineBreak, ENonBreakingHyphen, ENonBreakingSpace, EPageBreak, EParagraphDelimiter, EPictureCharacter, EPotentialHyphen, EReversedByteOrderMark, ERightDoubleQuote, ERightSingleQuote, ESegmentedStorage, ESpace, ETabCharacter, EZeroWidthNoBreakSpace, ExtendedInterface(), ExternalizeL(), Extract(), Extract(), GetLengthOfInlineText(), GetPositionOfInlineTextInDocument(), GetWordInfo(), HasChanged(), InsertL(), InsertL(), InternalizeL(), OverrideFormatOfInlineTextIfApplicable(), ParagraphCount(), PasteFromStoreL(), Read(), Read(), Reset(), RestoreComponentsL(), RestoreL(), ScanParas(), ScanWords(), SetHasChanged(), StoreComponentsL(), StoreL(), TDocumentStorage, ToParagraphStart(), WordCount(), anonymous, anonymous, iHasChanged, ~CEditableText()

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


Construction and destruction


~CEditableText()

IMPORT_C ~CEditableText();

Description

[Top]


Member functions


StoreL()

IMPORT_C TStreamId StoreL(CStreamStore &aStore) const;

Description

Stores the text and its components. The components (e.g. fields and pictures) are stored in separate streams within the stream store.

Parameters

CStreamStore &aStore

Stream store to which the text and text components are written.

Return value

TStreamId

The ID of the stream store.


RestoreL()

IMPORT_C void RestoreL(const CStreamStore &aStore, TStreamId aStreamId);

Description

Restores the text and its components from a stream store.

Parameters

const CStreamStore &aStore

Stream store containing the text and its components.

TStreamId aStreamId

The ID of the stream store in which the text was previously stored.


ExternalizeL()

virtual void ExternalizeL(RWriteStream &aStream) const;

Description

Parameters

RWriteStream &aStream


InternalizeL()

virtual void InternalizeL(RReadStream &aStream);

Description

Parameters

RReadStream &aStream


StoreComponentsL()

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

Description

Stores the text components, e.g. fields, pictures and formatting to the stream store specified. Does not store the text content.

Parameters

CStreamStore &aStore

Stream store to which the text components are written.

CStoreMap &aMap

A store map. This binds the address of text components to the stream ID of aStore. This is needed to support deferred loading of pictures in rich text.


RestoreComponentsL()

virtual void RestoreComponentsL(const CStreamStore &aStore)=0;

Description

Restores the text components, e.g. fields, pictures and formatting from the stream store. Does not restore the text content.

Parameters

const CStreamStore &aStore

The stream store from which the text components are restored.


Reset()

virtual void Reset()=0;

Description

Deletes the text content and components from the text object, leaving the single end-of-text paragraph delimiter.


InsertL()

virtual void InsertL(TInt aInsertPos, const TChar &aChar)=0;

Description

Inserts a single character or a descriptor into the text object at a specified document position.

Parameters

TInt aInsertPos

A valid document position at which to insert the character or descriptor.

const TChar &aChar

The character to insert.


InsertL()

virtual void InsertL(TInt aInsertPos, const TDesC &aBuf)=0;

Description

Inserts a single character or a descriptor into the text object at a specified document position.

Parameters

TInt aInsertPos

A valid document position at which to insert the character or descriptor.

const TDesC &aBuf

The descriptor to insert.


DeleteL()

virtual TBool DeleteL(TInt aPos, TInt aLength)=0;

Description

Deletes one or more characters beginning at (and including) the character at the specified document position.

Parameters

TInt aPos

The document position from which to delete.

TInt aLength

The number of characters to delete.

Return value

TBool

Indicates whether or not two paragraphs have been merged as a result of the delete, so that the resulting paragraph needs to be reformatted. This value is only relevant to rich text, so for plain and global text implementations, the function always returns EFalse.


Read()

virtual TPtrC Read(TInt aStartPos) const=0;

Description

Gets a read-only pointer descriptor to a portion of the text.

Parameters

TInt aStartPos

A valid document position from which to read.

Return value

TPtrC

Read-only pointer descriptor to a portion of the text.


Read()

virtual TPtrC Read(TInt aStartPos, TInt aLength) const=0;

Description

Gets a read-only pointer descriptor to a portion of the text.

Parameters

TInt aStartPos

A valid document position from which to read.

TInt aLength

If specified, the number of characters to read, inclusive of the character at position aStartPos. If not specified, the read continues to the end of the document, or the end of the segment if using segmented storage.

Return value

TPtrC

Read-only pointer descriptor to a portion of the text.


Extract()

virtual void Extract(TDes &aBuf, TInt aPos=0) const=0;

Description

Copies a portion of the text into a descriptor.

Starts at the position specified and continues to the end of the document. A length may optionally be specified.

Parameters

TDes &aBuf

Buffer which on return contains the extracted text.

TInt aPos

The document position from which to copy. Must be a valid position, or a panic occurs.


Extract()

virtual void Extract(TDes &aBuf, TInt aPos, TInt aLength) const=0;

Description

Copies a portion of the text into a descriptor. Starts at the position specified and continues to the end of the document. A length may optionally be specified.

Parameters

TDes &aBuf

Buffer which on return contains the extracted text.

TInt aPos

The document position from which to copy. Must be a valid position, or a panic occurs.

TInt aLength

If specified, the number of characters to copy.


CopyToStoreL()

virtual void CopyToStoreL(CStreamStore &aStore, CStreamDictionary &aDictionary, TInt aPos, TInt aLength) const=0;

Description

Copies a portion of the text to the clipboard.

Parameters

CStreamStore &aStore

The clipboard's store (see class CClipboard).

CStreamDictionary &aDictionary

The clipboard's stream dictionary (see class CClipboard).

TInt aPos

A valid document position from which to begin copying.

TInt aLength

The number of characters to copy.


PasteFromStoreL()

virtual TInt PasteFromStoreL(const CStreamStore &aStore, const CStreamDictionary &aDictionary, TInt aPos)=0;

Description

Pastes the contents of the clipboard into the text object at the specified document position.

Parameters

const CStreamStore &aStore

The clipboard's store (see class CClipboard).

const CStreamDictionary &aDictionary

The clipboard's stream dictionary (see class CClipboard).

TInt aPos

A valid document position at which to paste the text.

Return value

TInt

The number of characters pasted.


WordCount()

virtual TInt WordCount() const=0;

Description

Returns a count of the number of words in the document.

Return value

TInt

The number of words in the document


ParagraphCount()

virtual TInt ParagraphCount() const=0;

Description

Returns a count of the number of paragraphs in the document.

Return value

TInt

The number of paragraphs in the document. Notes: The end-of-text paragraph delimiter at the end of every document means this function always returns a count of at least one.


DocumentLength()

virtual TInt DocumentLength() const=0;

Description

Returns a count of the number of characters in the document, excluding the end-of-text paragraph delimiter.

Return value

TInt

The number of characters in the document.


ToParagraphStart()

virtual TInt ToParagraphStart(TInt &aPos) const=0;

Description

Updates a document position to the start of the paragraph.

Parameters

TInt &aPos

Initially specifies a valid document position. On return, set to the document position of the first character in the paragraph.

Return value

TInt

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


HasChanged()

inline TBool HasChanged() const;

Description

Tests whether the editable text object has been changed by an operation on it, as set by SetHasChanged().

Return value

TBool

ETrue if a change has occurred to the text object. EFalse if there has been no change.


GetWordInfo()

virtual void GetWordInfo(TInt aCurrentPos, TInt &aStartPos, TInt &aLength, TBool aPictureIsDelimiter, TBool aPunctuationIsDelimiter) const=0;

Description

Returns the start position and length of the word that contains the specified document position.

Parameters

TInt aCurrentPos

A valid document position.

TInt &aStartPos

On return, the document position of the first character in the word containing document position aCurrentPos.

TInt &aLength

On return, the length of the word containing document position aCurrentPos. Does not include the trailing word delimiter character.

TBool aPictureIsDelimiter

Specifies whether picture characters should be considered to be word delimiters. For example, this value might be EFalse when navigating a document, but ETrue when carrying out spell checking.

TBool aPunctuationIsDelimiter

Specifies whether puncutation characters should be considered to be word delimiters.


ScanWords()

virtual IMPORT_C TInt ScanWords(TInt &aPos, TUint &aScanMask) const;

Description

Scans the text from a specified document position to a location determined by the flags specified in a bitmask. The function can scan forwards or backwards to the beginning or end of a word.

Parameters

TInt &aPos

A valid document position from which to scan. On return, contains the new document position.

TUint &aScanMask

The scan mask to use. See the scanning enumeration defined in class CPlainText.

Return value

TInt

The number of characters skipped to reach the new document position. Notes: If the scan passes the end of text delimiter, on return, aPos is set to EScanEndOfData and the function's return value indicates the number of characters skipped in passing the end of text delimiter.


ScanParas()

virtual IMPORT_C TInt ScanParas(TInt &aPos, TUint &aScanMask) const;

Description

Scans the text from a specified document position to a location determined by the flags specified in a bitmask. The function can scan forwards or backwards to the beginning or end of a paragraph.

Parameters

TInt &aPos

A valid document position from which to scan. On return, contains the new document position.

TUint &aScanMask

The scan mask to use. See the scanning enumeration defined in class CPlainText.

Return value

TInt

The number of characters skipped to reach the new document position. Notes: If the scan passes the end of text delimiter, on return, aPos is set to EScanEndOfData and the function's return value indicates the number of characters skipped in passing the end of text delimiter.


SetHasChanged()

virtual IMPORT_C void SetHasChanged(TBool aHasChanged);

Description

Sets whether a change has occurred to the editable text object. This is called by functions which change the text object in some way.

Parameters

TBool aHasChanged

ETrue if a change has occurred to the text object. EFalse if no change has occurred.


ExtendedInterface()

virtual IMPORT_C void ExtendedInterface(TAny *&aInterface, TUid aInterfaceId);

Description

Returns the interface corresponding to the specified UID if it exists, or 0 if not. Overridden versions should base call rather than returning 0.

Parameters

TAny *&aInterface

The interface corresponding to aInterfaceId if it is supported, or 0 if it is not

TUid aInterfaceId

The UID indicating the interface to return


GetPositionOfInlineTextInDocument()

IMPORT_C TInt GetPositionOfInlineTextInDocument() const;

Description

Return value

TInt


GetLengthOfInlineText()

IMPORT_C TInt GetLengthOfInlineText() const;

Description

Return value

TInt


OverrideFormatOfInlineTextIfApplicable()

protected: IMPORT_C void OverrideFormatOfInlineTextIfApplicable(TPtrC &aView, TCharFormat &aFormat, TInt aStartPos) const;

Description

Parameters

TPtrC &aView

TCharFormat &aFormat

TInt aStartPos

[Top]


Member enumerations


Enum TDocumentStorage

TDocumentStorage

Description

Storage type

EFlatStorage

Storage uses a flat buffer (CBufFlat).

ESegmentedStorage

Storage uses a segmented buffer (CBufSeg).


Enum anonymous

n/a

Description

Miscellaneous constants.

EDefaultTextGranularity

Granularity of the buffer, default 256 characters.


Enum anonymous

n/a

Description

ETabCharacter

Tab stop.

EPageBreak

New page.

ESpace

Visible space character.

EApostrophe

EHyphenMinus

ENonBreakingSpace

A hard (non-breaking) space.

EPotentialHyphen

A soft hyphen (ensures that a hyphen followed by a new line will be inserted at that point should a line break be required anywhere within the word).

EHyphen

ENonBreakingHyphen

A hard (non-breaking) hyphen.

ELeftSingleQuote

ERightSingleQuote

ELeftDoubleQuote

ERightDoubleQuote

EBullet

EEllipsis

ELineBreak

Forced line break.

EParagraphDelimiter

Paragraph delimiter.

EPictureCharacter

Represents a picture inserted into the text object.

EZeroWidthNoBreakSpace

EByteOrderMark

EReversedByteOrderMark

[Top]


Member data


iHasChanged

protected: TBool iHasChanged;

Description