|
|
|
|
Location:
TXTRICH.H
Link against: etext.lib
class CRichText : public CGlobalText;
Text with rich formatting.
In rich text, each paragraph can have a different paragraph format, and each character can have a different character format.
All formatting in a rich text object is based on a global character and paragraph format layer, and a chain of layers on which they may be based. In case of conflict, upper layers override lower layers. These two format layers are specified on construction, and are not owned by the text object. Additional formatting may then be added to any portion of the text. This is called specific formatting and in case of conflict, it overrides the formatting in the global layers. Specific formatting is owned by the text object. So, the effective formatting of a rich text object may be composed of specific formatting and formatting specified in a chain of format layers.
Rich text supports styles. A style is a named set of paragraph and character format attributes. Styles are stored in a list which is passed to the rich text object on construction, or which is assigned to the object after construction. Styles can be appended to and removed from the list and existing styles can be modified. Only paragraph styles are supported. This means that styles are applied to entire paragraphs, although both character and paragraph format attributes may be set in the style.
Rich text also supports object embedding. Embedded objects are represented in rich text by CPicture-derived objects. A rich text object which supports the display of pictures needs to be supplied with a picture factory.
MFormatText - Specifies the mixin protocol for getting and setting character and paragraph format attributesMLayDoc - Specifies the interface for providing the information needed by the text layout engine to lay out a text objectCBase - Base class for all classes to be instantiated on the heapCEditableText - An abstract base class which defines the behaviour common to all editable text classesCPlainText - Stores and manipulates plain textCGlobalText - Text with globally applied formattingCRichText - Text with rich formattingDefined in CRichText:
ActivateDefaultParserL(), ActivateParserL(), AppendParagraphL(), AppendTakingSolePictureOwnershipL(), ApplyCharFormatL(), ApplyParaFormatL(), ApplyParagraphStyleL(), CRichText(), CancelInsertCharFormat(), CharPosOfParagraph(), ComponentInfo(), ConstructL(), ConstructL(), CopyComponentsL(), CopyToStoreL(), CopyToStreamL(), CopyToStreamL(), CursorOverTag(), DeactivateParser(), DeactivateParserDefaults(), DelSetInsertCharFormatL(), DeleteFromParagraph(), DeleteL(), DeleteParagraph(), DetachFromStoreL(), DetachFromStoreL(), DoExternalizeMarkupDataL(), DoExternalizeStyleDataL(), DoInternalizeMarkupDataL(), DoInternalizeStyleDataL(), DropPictureOwnership(), EDelimiterCharacterLength, EMultiPara, ESinglePara, ExtendedInterface(), ExternalizeL(), ExternalizeMarkupDataL(), ExternalizeStyleDataL(), GetCharFormat(), GetChars(), GetParaFormatL(), GetParagraphFormatL(), GetPictureSizeInTwips(), GetSpecificCharFormat(), GetSpecificCharFormatRight(), GetSpecificParagraphFormatL(), HasMarkupData(), InsertL(), InsertL(), InsertL(), InternalizeL(), InternalizeMarkupDataL(), InternalizeStyleDataL(), NewL(), NewL(), NewL(), NewL(), NotifyStyleChangedL(), NotifyStyleDeletedL(), ParagraphCount(), ParagraphNumberForPos(), ParagraphStyle(), ParseText(), PasteFromStoreL(), PasteFromStoreL(), PictureCount(), PictureFactory(), PictureHandleL(), PictureHeader(), PositionOfNextTag(), PositionOfNextTag(), PositionOfPrevTag(), PositionOfPrevTag(), RemoveSpecificCharFormatL(), RemoveSpecificParaFormatL(), Reset(), RestoreComponentsL(), RestoreWithStyleListL(), RtInsertL(), SetEditObserver(), SetHasChanged(), SetInsertCharFormatL(), SetPictureFactory(), SetStyleListExternallyOwned(), SetStyleListExternallyOwned(), StoreComponentsL(), StoreMarkupComponentsL(), StoreResolver(), StyleCount(), StyleList(), StyleListExternallyOwned(), StyleListPresent(), TParaType, UpdateFieldL(), anonymous, ~CRichText()
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(),
StoreL(),
TDocumentStorage,
iHasChanged
Inherited from CGlobalText:
CancelSelectLabel(),
EnquirePageBreak(),
GlobalCharFormatLayer(),
GlobalParaFormatLayer(),
LdDocumentLength(),
LdToParagraphStart(),
SelectParagraphLabel(),
SetGlobalCharFormat(),
SetGlobalParaFormat(),
iGlobalCharFormatLayer,
iGlobalParaFormatLayer
Inherited from CPlainText:
ConsumeAdornmentL(),
ConvertAllFieldsToText(),
ConvertFieldToText(),
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(),
ExternalizeFieldDataL(),
ExternalizePlainTextL(),
ExternalizePlainTextNoLengthCountL(),
Extract(),
ExtractSelectively(),
FieldCount(),
FieldFactory(),
FindFields(),
GetWordInfo(),
ImportTextFileL(),
ImportTextL(),
InsertFieldL(),
InternalizeFieldDataL(),
InternalizePlainTextL(),
NewTextFieldL(),
PageContainingPos(),
PtInsertL(),
Read(),
RemoveField(),
RestoreFieldComponentsL(),
SScanData,
ScanParas(),
ScanWords(),
SetFieldFactory(),
SetPageTable(),
StoreFieldComponentsL(),
TImportExportParam,
TImportExportResult,
TScanDataEnd,
TTextOrganisation,
TUnitOfText,
TextField(),
ToParagraphStart(),
UidFromStreamL(),
UpdateAllFieldsL(),
WordCount(),
iByteStore,
iFieldFactory,
iFieldSet,
iPageTable
Inherited from MLayDoc:
EForceLoadFalse,
EForceLoadTrue,
TForcePictureLoad
static IMPORT_C CRichText *NewL(const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer, TDocumentStorage aStorage=ESegmentedStorage, TInt aDefaultTextGranularity=EDefaultTextGranularity, TParaType aParaType=EMultiPara);
Allocates and constructs an empty rich text object, with a global character and paragraph format layer. A single end-of-document delimiter is inserted. No style list is allocated.
|
|
static IMPORT_C CRichText *NewL(const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer, const CStyleList &aStyleList, TDocumentStorage aStorage=ESegmentedStorage, TInt aDefaultTextGranularity=EDefaultTextGranularity, TParaType aParaType=EMultiPara);
Allocates and constructs an empty rich text object which supports styles. It is constructed with a global character and paragraph format layer and a style list. A single end-of-document delimiter is inserted. The rich text object takes ownership of the style list.
Note:
A rich text object not constructed with a style list may still use styles, by calling SetStyleListExternallyOwned() at any time after construction. In this case, the rich text object does not own the style list.
|
|
static IMPORT_C CRichText *NewL(const CStreamStore &aStore, TStreamId aStreamId, const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer, MTextFieldFactory *aFieldFactory=0, TDocumentStorage aStorage=ESegmentedStorage);
Allocates and constructs a rich text object with a field factory. Its text content is internalized from a stream store.
Note:
A rich text object not constructed with a field factory may still support the addition of fields, by calling SetFieldFactory(), defined in the base class CPlainText.
|
|
static IMPORT_C CRichText *NewL(const CStreamStore &aStore, TStreamId aStreamId, const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer, MPictureFactory *aPictureFactory, MRichTextStoreResolver *aStoreResolver, MTextFieldFactory *aFieldFactory=0, TDocumentStorage aStorage=ESegmentedStorage);
Allocates and constructs a rich text object with a field factory and a picture factory. Its text content is internalized from a stream store.
Note:
A rich text object not constructed with a field factory may still support the addition of fields, by calling SetFieldFactory(), defined in the base class CPlainText.
|
|
virtual IMPORT_C ~CRichText();
The destructor frees all resources owned by the rich text object, prior to its destruction.
protected: IMPORT_C CRichText(const CParaFormatLayer *aGlobalParaLayer, const CCharFormatLayer *aGlobalCharLayer, CStyleList *aStyleList=0);
|
protected: IMPORT_C void ConstructL(TDocumentStorage aStorage, TInt aDefaultTextGranularity, TParaType aParaType);
|
protected: IMPORT_C void ConstructL(const CStreamStore &aStore, TStreamId aStreamId, MPictureFactory *aFactory, MRichTextStoreResolver *aStoreResolver, MTextFieldFactory *aFieldFactory=0, TDocumentStorage aStorage=ESegmentedStorage);
|
IMPORT_C void RestoreWithStyleListL(const CStreamStore &aStore, TStreamId aStreamId, const CStyleList &aExternalStyleList);
Restores a rich text object, including all of its components and an externally owned style list, from a stream store.
|
virtual IMPORT_C void StoreComponentsL(CStreamStore &aStore, CStoreMap &aMap) const;
Stores the rich text object's components (field set, style list, formatting and pictures) to the stream store specified.
|
virtual IMPORT_C void RestoreComponentsL(const CStreamStore &aStore);
Restores the rich text object's components (field set, style list, formatting and pictures) from a stream store.
|
virtual IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
Externalises the rich text object and all of its components (field set, style list, rich text formatting, pictures) to a read stream. The presence of this function means that the standard templated operator<<() (defined in s32strm.h) is available to externalise objects of this class.
Notes:
Any "insert pending" state is cancelled (calls CancelInsertCharFormat()).
The global format layers are not owned by the object; they are supplied by the owner of the object and not saved when the object is externalised or loaded when it is internalized.
StoreComponentsL() must be called before calling this function. This is necessary to set up the the stream store needed to externalize rich text objects. It is not possible to get a stream store into a stream and a rich text object cannot be externalized to an arbitrary stream thus StoreComponentsL() will set up this stream store before externalizing.
The inherited function CEditableText::StoreL() combines both calling of StoreComponentsL() to set up the stream store and externalizing the rich text object to this stream store.
|
virtual IMPORT_C void InternalizeL(RReadStream &aStream);
Internalises the rich text object and all of its components (field set, style list, rich text formatting and pictures) 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.
Note: The global format layers are not owned by the object; they are supplied by the owner of the object and not saved when the object is externalised or loaded when it is internalized.
|
IMPORT_C void ExternalizeStyleDataL(RWriteStream &aStream) const;
Externalises the style list owned by the rich text object.
|
IMPORT_C void InternalizeStyleDataL(RReadStream &aStream);
Internalises the style list owned by the rich text object from a read stream, if one is present in the stream.
|
IMPORT_C void StoreMarkupComponentsL(CStreamStore &aStore, CStoreMap &aMap) const;
Stores all pictures in the rich text object to a stream store.
|
IMPORT_C void ExternalizeMarkupDataL(RWriteStream &aStream) const;
Externalises the rich text object's markup (specific formatting, styles and pictures). CRichText::HasMarkupData() can be used to test whether the object has any markup information.
|
IMPORT_C void InternalizeMarkupDataL(RReadStream &aStream);
Internalises the rich text object's markup (specific formatting, styles and pictures).
|
IMPORT_C void SetPictureFactory(MPictureFactory *aPictureFactory, MRichTextStoreResolver *aStoreResolver);
Sets the picture factory.
Pictures in a rich text object may be represented as picture headers, or by the picture data itself. CRichText supports the deferred loading of picture data, so that it is only loaded when it is needed to be displayed, thus economising on memory use. A rich text object which supports the deferred loading of pictures needs to be supplied with a picture factory. It can either be set using this function, or during construction.
Note: A panic occurs if the factory is NULL, but the store resolver is not NULL.
|
inline MPictureFactory *PictureFactory() const;
Gets the picture factory. A picture factory may be set during construction, or by calling CRichText::SetPictureFactory().
|
inline MRichTextStoreResolver *StoreResolver() const;
Gets the store resolver. A store resolver may be set during construction, or by calling CRichText::SetPictureFactory().
|
IMPORT_C TPictureHeader PictureHeader(TInt aPos) const;
Gets the picture header which describes the picture located at a specified document position. If no picture header is located at the position, the function constructs and returns a default one.
|
|
IMPORT_C void DropPictureOwnership(TInt aPos);
Removes ownership from this rich text object of the picture located at a document position. The picture character is deleted from the document and ownership of the picture passes to the caller of this function. Use PictureHandleL() beforehand to get a pointer to the picture.
|
IMPORT_C void DetachFromStoreL(CPicture::TDetach aDegree);
Loads pictures not already present in memory overloaded function. Either loads all pictures in the document, or just the pictures located within a specified range. Note: In order to load pictures, a picture factory and a store resolver must have been set.
|
IMPORT_C void DetachFromStoreL(CPicture::TDetach aDegree, TInt aPos, TInt aLength);
Loads pictures not already present in memory overloaded function. Either loads all pictures in the document, or just the pictures located within a specified range.
Note: In order to load pictures, a picture factory and a store resolver must have been set.
|
IMPORT_C TBool HasMarkupData() const;
Tests whether the rich text object has any markup, or owns a style list.
Markup is rich text-specific information, for instance specific formatting, styles and pictures. It may be stored in a separate stream from the text.
|
virtual IMPORT_C void CopyToStoreL(CStreamStore &aStore, CStreamDictionary &aDictionary, TInt aPos, TInt aLength) const;
Copies a portion of the rich text object, with components to the clipboard.
A panic occurs in the following circumstances:
aPos is an invalid document position
aLength is invalid (zero or less)
the sum of aPos and aLength is greater than or equal to the number of characters in the document
|
virtual IMPORT_C TInt PasteFromStoreL(const CStreamStore &aStore, const CStreamDictionary &aDictionary, TInt aPos);
Pastes plain text and fields, if present, from the clipboard into the current text object at the specified document position. The entire contents of the store are pasted.
|
|
IMPORT_C TInt PasteFromStoreL(const CStreamStore &aStore, const CStreamDictionary &aDictionary, TInt aPos, CParagraphStyle::TStylePasteMode aStylePasteMode);
Pastes the contents of the clipboard into the rich text object at the specified document position. Returns the number of characters pasted.
If the text in the clipboard has been formatted using styles, the aStylePasteMode argument indicates whether the styles should be preserved or discarded. If the argument is not specified, the pasted rich text retains all formatting specified in the styles, and any new style definitions are added to the style list of the rich text object into which it is pasted.
|
|
virtual IMPORT_C void Reset();
Resets the document's contents to a single end-of-document delimiter. Also deletes the style list if owned by the object.
virtual IMPORT_C void InsertL(TInt aPos, const TChar &aChar);
Inserts either a single character or a descriptor into the text object at a specified document position.
The insertion position must be valid or a panic occurs.Note:A panic occurs if the text object is in an "insert pending" state (i.e. SetInsertCharFormatL() has been called and has not been cancelled using CancelInsertCharFormat()) and aPos is not the same as the insertion point.
|
virtual IMPORT_C void InsertL(TInt aPos, const TDesC &aBuf);
Inserts the contents of aBuf into the document at position aPos.
|
IMPORT_C void InsertL(TInt aPos, const TPictureHeader &aHeader);
Inserts a picture header into the text object at a specified document position. The picture header specified must reference a valid picture, or a panic occurs.
A panic also occurs if the text object is in an "insert pending" state (SetInsertCharFormatL() has been called and has not been cancelled using CancelInsertCharFormat()) and aPos is not the same as the insertion point.
This method takes ownership of a picture referenced in aHeader.
|
virtual IMPORT_C TBool DeleteL(TInt aPos, TInt aLength);
Deletes one or more characters beginning at, and including, the character at a specified document position. Can leave because paragraphs may be merged and reformatted by the function.
|
|
IMPORT_C void DeleteFromParagraph(TInt aPos, TInt aLength);
Removes a range of characters from within a single paragraph only. Should not be used for deleting an entire paragraph or paragraphs because this may cause it to leave. Otherwise, it is guaranteed not to leave.
|
IMPORT_C void DeleteParagraph(TInt aPos, TInt aLength);
Deletes one or more whole paragraphs of text. No paragraphs can be merged together by this function, so it cannot leave â it must only be used to delete entire paragraphs.
|
IMPORT_C void SetInsertCharFormatL(const TCharFormat &aFormat, const TCharFormatMask &aMask, TInt aPos);
aPos must be a valid position, or a panic will occur.
Applies character formatting to a zero length selection, for example turning bold on. This has the effect that the formatting will be applied to text subsequently inserted at the position. This "insert pending" state is cancelled by calling CancelInsertCharFormat().
Note 1: After calling this function, if text is inserted at a different position to aPos, a panic will occur, unless CancelInsertCharFormat() has been called before the insertion to cancel the "insert pending" state.
Note 2: If the insert character format is being set for the end of the paragraph, the paragraph delimiter is set to that format as well. This helps end-of-paragraph behaviour be more similar to other places.
|
IMPORT_C void CancelInsertCharFormat();
Cancels the "insert pending" state set by a call to SetInsertCharFormatL() or DelSetInsertCharFormatL().
This function removes the restriction on the text insertion position imposed by these two functions. It is recommended that it is called before every cursor movement, scroll, paste, etc. This call is a small overhead, and has no effect if not applicable.
IMPORT_C TBool DelSetInsertCharFormatL(TInt aPos, TInt aLength);
Deletes a range of characters. The range affected is from aPos to aPos+(aLength-1) inclusive. It differs from DeleteL() in that this function preserves the formatting of the deleted character at position aPos, so that any text subsequently inserted at aPos will have that formatting applied to it.
A panic occurs if:
after calling this function, text is inserted at a different position to aPos, without calling CancelInsertCharFormat() before the insertion
aPos is invalid
aLength is negative
the range goes beyond the end of the document
|
|
virtual IMPORT_C void GetParagraphFormatL(CParaFormat *aFormat, TInt aPos) const;
Gets the effective paragraph formatting which applies to the paragraph which contains a specified document position. On return, aFormat is filled with values for all paragraph format attributes.
|
virtual IMPORT_C void GetChars(TPtrC &aView, TCharFormat &aFormat, TInt aPos) const;
Gets a constant pointer descriptor to a portion of the text object with constant character formatting.
The view starts at the document position specified, and ends at: the last character which shares the same character formatting, orthe end of the document, orthe end of the segment, if segmented storage is being usedwhichever occurs first. Also fills a character format object with the character formatting of the range of characters.
|
virtual IMPORT_C TInt GetPictureSizeInTwips(TSize &aSize, TInt aPos) const;
Gets the size of a picture located at a specified document position.
|
|
virtual IMPORT_C CPicture *PictureHandleL(TInt aPos, MLayDoc::TForcePictureLoad aForceLoad=MLayDoc::EForceLoadTrue) const;
Gets a pointer to the picture located at a specified document position, if one exists. If the picture is not in memory, the function loads it (if the second argument has a value of MLayDoc::EForceLoadTrue).
Note:
In order to load the picture, a picture factory and a store resolver must have been set.
|
|
virtual IMPORT_C void GetParaFormatL(CParaFormat *aFormat, TParaFormatMask &aVaries, TInt aPos, TInt aLength, CParaFormat::TParaFormatGetMode aMode=CParaFormat::EAllAttributes) const;
Gets the effective paragraph formatting which applies to a range of paragraphs. The region involved is every paragraph containing one or more characters in the range aPos to aPos+(aLength-1) inclusive. On return, aFormat is filled with values for all paragraph format attributes and the mask indicates the values that change over the region, and whose value is therefore indeterminate.
Note:
If aMode has a value of EFixedAttributes, the function cannot leave.
|