class CPlainText : public CEditableText |
Stores and manipulates plain text.
Plain text cannot be displayed, so this class provides no support for formatting. It is purely an in-memory buffer for text, and provides services that act upon it. These services include the following: import from and export to streams, optionally translating between Unicode and other encodings; reading and writing of field data; extraction of text; finding word and paragraph boundaries.
The type and size of in-memory buffer can be specified upon object construction. However, if no specification is provided a buffer is provided with default settings. There are two types of storage buffer: segmented buffers and flat buffers. The default buffer for plain text is segmented (CBufSeg). This is most efficient when a large quantity of text is to be stored, or will have a large dynamic range. A flat buffer (CBufFlat) is most appropriate for storing small quantities of text of bounded length. For most uses, however, a segmented buffer is sufficient.
Private Member Functions | |
---|---|
CPlainText(const CPlainText &) | |
TInt | CountUnits(TUnitOfText) |
void | CreateFieldSetL(TInt) |
TInt | DoPasteFromStreamL(RReadStream &, TInt) |
TBool | FieldSetPresent() |
TBool | GetChar(SScanData &, TChar &) |
void | InitScanControl(TInt &, TUint &, TUnitOfText, SScanData &) |
void | InitScanData(TInt, SScanData &) |
void | InsertEodL() |
void | KillFieldSet() |
TInt | PasteFromStreamL(RReadStream &, TInt) |
IMPORT_C void | Reserved_2() |
TInt | ScanUnit(TInt &, TUnitOfText, SScanData &) |
TBool | TestForDelimiter(TUnitOfText, SScanData &) |
void | UpdatePageTable(TInt, TInt) |
CPlainText & | operator=(const CPlainText &) |
Public Member Enumerations | |
---|---|
enum | anonymous { EScanBackwards = 0x01, EScanStayIfBoundary = 0x02, EScanToUnitStart = 0x04, EScanToUnitEnd = 0x08, EScanJoinDelimiters = 0x10, EScanPictureIsDelimiter = 0x20, EScanPunctuationIsDelimiter = 0x40 } |
enum | anonymous { EExtractAll = 0, EExtractVisible = 1, EExcludeInlineEditedText = 2 } |
enum | TScanDataEnd { EScanEndOfData = -1 } |
enum | TTextOrganisation { EOrganiseByParagraph, EOrganiseByLine } |
Protected Member Enumerations | |
---|---|
enum | anonymous { EImportBufSize = 512, EBiggestCharacterPaste = 0x100000 } |
enum | TUnitOfText { EUnitIsWord, EUnitIsParagraph } |
Inherited Enumerations | |
---|---|
CEditableText:@117 | |
CEditableText:@118 | |
CEditableText:TDocumentStorage |
Protected Attributes | |
---|---|
__DECLARE_TEST | |
CBufBase * | iByteStore |
MTextFieldFactory * | iFieldFactory |
TSwizzle< CTextFieldSet > | iFieldSet |
TPageTable * | iPageTable |
Private Attributes | |
---|---|
void * | iReserved_1 |
Inherited Attributes | |
---|---|
CEditableText::iHasChanged |
CPlainText | ( | const CPlainText & | aPlainTextDoc | ) | [private] |
const CPlainText & aPlainTextDoc |
IMPORT_C TInt | CharPosOfParagraph | ( | TInt & | aLength, |
TInt | aParaOffset | |||
) | const [virtual] |
IMPORT_C void | ConstructL | ( | TDocumentStorage | aStorage = ESegmentedStorage, |
TInt | aDefaultTextGranularity = EDefaultTextGranularity | |||
) | [protected] |
TDocumentStorage aStorage = ESegmentedStorage | |
TInt aDefaultTextGranularity = EDefaultTextGranularity |
IMPORT_C void | ConstructL | ( | const CStreamStore & | aStore, |
TStreamId | aStreamId, | |||
MTextFieldFactory * | aFieldFactory, | |||
TDocumentStorage | aStorage = ESegmentedStorage | |||
) | [protected] |
const CStreamStore & aStore | |
TStreamId aStreamId | |
MTextFieldFactory * aFieldFactory | |
TDocumentStorage aStorage = ESegmentedStorage |
void | ConsumeAdornmentL | ( | RReadStream & | aStream | ) | [protected, static, inline] |
RReadStream & aStream |
void | CopyComponentsL | ( | CStreamStore & | aStore, |
CStoreMap & | aMap, | |||
TInt | aPos, | |||
TInt | aLength | |||
) | const [protected] |
CStreamStore & aStore | |
CStoreMap & aMap | |
TInt aPos | |
TInt aLength |
IMPORT_C void | CopyToStoreL | ( | CStreamStore & | aStore, |
CStreamDictionary & | aDictionary, | |||
TInt | aPos, | |||
TInt | aLength | |||
) | const [virtual] |
Copies a portion of the text to the clipboard.
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. |
void | CopyToStreamL | ( | RWriteStream & | aStream, |
TInt | aPos, | |||
TInt | aLength | |||
) | const [protected] |
RWriteStream & aStream | |
TInt aPos | |
TInt aLength |
TInt | CountUnits | ( | TUnitOfText | aContext | ) | const [private] |
TUnitOfText aContext |
void | CreateFieldSetL | ( | TInt | aDocumentLength | ) | [private] |
TInt aDocumentLength |
IMPORT_C TBool | DeleteL | ( | TInt | aPos, |
TInt | aLength | |||
) | [virtual] |
Deletes one or more characters beginning at (and including) the character at the specified document position.
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.
IMPORT_C void | DoConstructL | ( | TDocumentStorage | aStorage, |
TInt | aDefaultTextGranularity, | |||
MTextFieldFactory * | aFieldFactory = NULL | |||
) | [protected] |
TDocumentStorage aStorage | |
TInt aDefaultTextGranularity | |
MTextFieldFactory * aFieldFactory = NULL |
TStreamId | DoCopyToStoreL | ( | CStreamStore & | aStore, |
CStreamDictionary & | aDictionary, | |||
TInt | aPos, | |||
TInt | aLength | |||
) | const [protected] |
CStreamStore & aStore | |
CStreamDictionary & aDictionary | |
TInt aPos | |
TInt aLength |
IMPORT_C void | DoExternalizeFieldDataL | ( | RWriteStream & | aStream | ) | const [protected] |
RWriteStream & aStream |
IMPORT_C void | DoExternalizePlainTextL | ( | RWriteStream & | aStream | ) | const [protected] |
RWriteStream & aStream |
void | DoExtract | ( | TDes & | aBuf, |
TInt | aPos, | |||
TInt | aLength, | |||
TUint | aFlags = 0 | |||
) | const [protected] |
IMPORT_C void | DoInternalizeFieldDataL | ( | RReadStream & | aStream | ) | [protected] |
RReadStream & aStream |
IMPORT_C void | DoInternalizePlainTextL | ( | RReadStream & | aStream | ) | [protected] |
RReadStream & aStream |
TInt | DoPasteFromStoreL | ( | const CStreamStore & | aStore, |
TStreamId | aStreamId, | |||
TInt | aPos | |||
) | [protected] |
const CStreamStore & aStore | |
TStreamId aStreamId | |
TInt aPos |
TInt | DoPasteFromStreamL | ( | RReadStream & | aStream, |
TInt | aPos | |||
) | [private] |
RReadStream & aStream | |
TInt aPos |
IMPORT_C TInt | DocumentLength | ( | ) | const [virtual] |
Returns a count of the number of characters in the document, excluding the end-of-text paragraph delimiter.
The number of characters in the document.
IMPORT_C void | ExportAsTextL | ( | const TDes & | aFileName, |
TTextOrganisation | aTextOrganisation, | |||
TInt | aMaxLineLength | |||
) | const [virtual] |
const TDes & aFileName | |
TTextOrganisation aTextOrganisation | |
TInt aMaxLineLength |
IMPORT_C void | ExportTextL | ( | TInt | aPos, |
RWriteStream & | aOutput, | |||
TTextOrganisation | aTextOrganisation, | |||
TInt | aMaxOutputChars = KMaxTInt , | |||
TInt | aMaxInputChars = KMaxTInt , | |||
TInt | aMaxLineLength = KMaxTInt , | |||
TInt * | aOutputChars = NULL, | |||
TInt * | aInputChars = NULL | |||
) | const |
IMPORT_C void | ExportTextL | ( | TInt | aPos, |
RWriteStream & | aOutput, | |||
const TImportExportParam & | aParam, | |||
TImportExportResult & | aResult | |||
) | const |
TInt aPos | |
RWriteStream & aOutput | |
const TImportExportParam & aParam | |
TImportExportResult & aResult |
IMPORT_C void | ExtendedInterface | ( | TAny *& | aInterface, |
TUid | aInterfaceId | |||
) | [virtual] |
IMPORT_C void | ExternalizeFieldDataL | ( | RWriteStream & | aStream | ) | const |
RWriteStream & aStream |
IMPORT_C void | ExternalizeL | ( | RWriteStream & | aStream | ) | const [virtual] |
RWriteStream & aStream |
IMPORT_C void | ExternalizePlainTextL | ( | RWriteStream & | aStream | ) | const |
RWriteStream & aStream |
IMPORT_C void | ExternalizePlainTextNoLengthCountL | ( | RWriteStream & | aStream | ) | const |
RWriteStream & aStream |
IMPORT_C void | Extract | ( | TDes & | aBuf, |
TInt | aPos = 0 | |||
) | const [virtual] |
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.
IMPORT_C void | Extract | ( | TDes & | aBuf, |
TInt | aPos, | |||
TInt | aLength | |||
) | const [virtual] |
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.
IMPORT_C void | ExtractSelectively | ( | TDes & | aBuf, |
TInt | aPos, | |||
TInt | aLength, | |||
TUint | aFlags | |||
) |
IMPORT_C TBool | FindFields | ( | TFindFieldInfo & | aInfo, |
TInt | aPos, | |||
TInt | aRange = 0 | |||
) | const |
TFindFieldInfo & aInfo | |
TInt aPos | |
TInt aRange = 0 |
IMPORT_C void | GetWordInfo | ( | TInt | aCurrentPos, |
TInt & | aStartPos, | |||
TInt & | aLength, | |||
TBool | aPictureIsDelimiter, | |||
TBool | aPunctuationIsDelimiter | |||
) | const [virtual] |
Returns the start position and length of the word that contains the specified document position.
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. |
IMPORT_C TInt | ImportTextFileL | ( | TInt | aPos, |
const TDes & | aFileName, | |||
TTextOrganisation | aTextOrganisation | |||
) | [virtual] |
TInt aPos | |
const TDes & aFileName | |
TTextOrganisation aTextOrganisation |
IMPORT_C void | ImportTextL | ( | TInt | aPos, |
RReadStream & | aInput, | |||
TTextOrganisation | aTextOrganisation, | |||
TInt | aMaxOutputChars = KMaxTInt , | |||
TInt | aMaxInputChars = KMaxTInt , | |||
TInt * | aOutputChars = NULL, | |||
TInt * | aInputChars = NULL | |||
) |
TInt aPos | |
RReadStream & aInput | |
TTextOrganisation aTextOrganisation | |
TInt aMaxOutputChars = KMaxTInt | |
TInt aMaxInputChars = KMaxTInt | |
TInt * aOutputChars = NULL | |
TInt * aInputChars = NULL |
IMPORT_C void | ImportTextL | ( | TInt | aPos, |
RReadStream & | aInput, | |||
const TImportExportParam & | aParam, | |||
TImportExportResult & | aResult | |||
) |
TInt aPos | |
RReadStream & aInput | |
const TImportExportParam & aParam | |
TImportExportResult & aResult |
void | InitScanControl | ( | TInt & | aPos, |
TUint & | aScanMask, | |||
TUnitOfText | aContext, | |||
SScanData & | aScanData | |||
) | const [private] |
TInt & aPos | |
TUint & aScanMask | |
TUnitOfText aContext | |
SScanData & aScanData |
IMPORT_C void | InsertFieldL | ( | TInt | aPos, |
CTextField * | aField, | |||
TUid | aFieldType | |||
) |
TInt aPos | |
CTextField * aField | |
TUid aFieldType |
IMPORT_C void | InsertL | ( | TInt | aInsertPos, |
const TChar & | aChar | |||
) | [virtual] |
Inserts a single character or a descriptor into the text object at a specified document position.
IMPORT_C void | InsertL | ( | TInt | aInsertPos, |
const TDesC & | aBuf | |||
) | [virtual] |
Inserts a single character or a descriptor into the text object at a specified document position.
void | InsertL | ( | TInt | aPos, |
const CPlainText * | aText | |||
) | [protected] |
TInt aPos | |
const CPlainText * aText |
IMPORT_C void | InternalizeFieldDataL | ( | RReadStream & | aStream | ) |
RReadStream & aStream |
IMPORT_C void | InternalizeL | ( | RReadStream & | aStream | ) | [virtual] |
RReadStream & aStream |
IMPORT_C void | InternalizePlainTextL | ( | RReadStream & | aStream | ) |
RReadStream & aStream |
IMPORT_C void | InternalizePlainTextL | ( | RReadStream & | aStream, |
TInt | aLength | |||
) |
RReadStream & aStream | |
TInt aLength |
IMPORT_C CPlainText * | NewL | ( | TDocumentStorage | aStorage = ESegmentedStorage, |
TInt | aDefaultTextGranularity = EDefaultTextGranularity | |||
) | [static] |
TDocumentStorage aStorage = ESegmentedStorage | |
TInt aDefaultTextGranularity = EDefaultTextGranularity |
IMPORT_C CPlainText * | NewL | ( | const CStreamStore & | aStore, |
TStreamId | aStreamId, | |||
MTextFieldFactory * | aFieldFactory = NULL, | |||
TDocumentStorage | aStorage = ESegmentedStorage | |||
) | [static] |
const CStreamStore & aStore | |
TStreamId aStreamId | |
MTextFieldFactory * aFieldFactory = NULL | |
TDocumentStorage aStorage = ESegmentedStorage |
IMPORT_C CTextField * | NewTextFieldL | ( | TUid | aFieldType | ) | const |
TUid aFieldType |
IMPORT_C TInt | ParagraphCount | ( | ) | const [virtual] |
Returns a count of the number of paragraphs in the document.
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.
IMPORT_C TInt | ParagraphNumberForPos | ( | TInt & | aPos | ) | const [virtual] |
TInt & aPos |
void | PasteComponentsL | ( | const CStreamStore & | aStore, |
TInt | aPos | |||
) | [protected] |
const CStreamStore & aStore | |
TInt aPos |
IMPORT_C TInt | PasteFromStoreL | ( | const CStreamStore & | aStore, |
const CStreamDictionary & | aDictionary, | |||
TInt | aPos | |||
) | [virtual] |
Pastes the contents of the clipboard into the text object at the specified document position.
The number of characters pasted.
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. |
TInt | PasteFromStreamL | ( | RReadStream & | aStream, |
TInt | aPos | |||
) | [private] |
RReadStream & aStream | |
TInt aPos |
IMPORT_C void | PtInsertL | ( | TInt | aInsertPos, |
const TDesC & | aBuf | |||
) | [protected] |
IMPORT_C TPtrC | Read | ( | TInt | aStartPos | ) | const [virtual] |
Gets a read-only pointer descriptor to a portion of the text.
Read-only pointer descriptor to a portion of the text.
TInt aStartPos | A valid document position from which to read. |
IMPORT_C TPtrC | Read | ( | TInt | aStartPos, |
TInt | aLength | |||
) | const [virtual] |
Gets a read-only pointer descriptor to a portion of the text.
Read-only pointer descriptor to a portion of the text.
IMPORT_C void | Reset | ( | ) | [virtual] |
Deletes the text content and components from the text object, leaving the single end-of-text paragraph delimiter.
IMPORT_C void | RestoreComponentsL | ( | const CStreamStore & | aStore | ) | [virtual] |
Restores the text components, e.g. fields, pictures and formatting from the stream store. Does not restore the text content.
const CStreamStore & aStore | The stream store from which the text components are restored. |
IMPORT_C void | RestoreFieldComponentsL | ( | const CStreamStore & | aStore | ) |
const CStreamStore & aStore |
TInt | ScanUnit | ( | TInt & | aPos, |
TUnitOfText | aContext, | |||
SScanData & | aScanData | |||
) | const [private] |
TInt & aPos | |
TUnitOfText aContext | |
SScanData & aScanData |
IMPORT_C void | SetFieldFactory | ( | MTextFieldFactory * | aFactory | ) |
MTextFieldFactory * aFactory |
IMPORT_C void | SetPageTable | ( | TPageTable * | aPageTable | ) |
TPageTable * aPageTable |
IMPORT_C void | StoreComponentsL | ( | CStreamStore & | aStore, |
CStoreMap & | aMap | |||
) | const [virtual] |
Stores the text components, e.g. fields, pictures and formatting to the stream store specified. Does not store the text content.
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. |
IMPORT_C void | StoreFieldComponentsL | ( | CStreamStore & | aStore, |
CStoreMap & | aMap | |||
) | const |
CStreamStore & aStore | |
CStoreMap & aMap |
TBool | TestForDelimiter | ( | TUnitOfText | aContext, |
SScanData & | aScanData | |||
) | const [private] |
TUnitOfText aContext | |
SScanData & aScanData |
IMPORT_C TInt | ToParagraphStart | ( | TInt & | aPos | ) | const [virtual] |
Updates a document position to the start of the paragraph.
The number of characters skipped in scanning to the start of the paragraph.
TInt & aPos | Initially specifies a valid document position. On return, set to the document position of the first character in the paragraph. |
TUid | UidFromStreamL | ( | RReadStream & | aStream | ) | [protected, static, inline] |
RReadStream & aStream |
IMPORT_C TInt | WordCount | ( | ) | const [virtual] |
Returns a count of the number of words in the document.
The number of words in the document
CPlainText & | operator= | ( | const CPlainText & | aPlainTextDoc | ) | [private] |
const CPlainText & aPlainTextDoc |
Scan mask values.
EScanBackwards = 0x01 |
Scan direction is backwards. The default is forwards. |
EScanStayIfBoundary = 0x02 |
If the current document position is a word or paragraph boundary, no scan occurs. |
EScanToUnitStart = 0x04 |
Scan to the first character in the word or paragraph. |
EScanToUnitEnd = 0x08 |
Scan to the last character in the word or paragraph. |
EScanJoinDelimiters = 0x10 |
Treat adjacent word or paragraph delimiters as a single delimiter. Required when performing a word count, for example. |
EScanPictureIsDelimiter = 0x20 |
Picture characters are considered to be word delimiters. |
EScanPunctuationIsDelimiter = 0x40 |
Punctuation characters, except hyphens and apostrophes, are considered to be word delimiters. |
Used in text scanning functions to indicate the end of the document has been passed.
EScanEndOfData = -1 |
Indicates that a scan has passed the end of text paragraph delimiter. |
Line delimiter translation.
EOrganiseByParagraph |
When importing text from a text file, all line feeds are converted into paragraph delimiters. When exporting text to a text file, lines do not wrap and paragraph delimiters are converted into CR/LF pairs. |
EOrganiseByLine |
When importing text from a text file, a single line feed or a line feed followed by a carriage return is converted into a space character. A line feed which is followed by another line feed is converted into a CEditableText::EParagraphDelimiter. When exporting text to a text file, lines wrap at the specified wrap width and paragraph delimiters are converted into CR/LFs pairs. |