1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __TXTETEXT_H__
17 #define __TXTETEXT_H__
26 class CParaFormatLayer;
27 class CCharFormatLayer;
28 class MTextFieldFactory;
32 class CInlineEditData;
33 class MFepInlineTextFormatRetriever;
35 class CEditableTextOptionalData;
43 const TUid KPlainTextFieldDataUid = {268435555};
44 const TUid KEditableTextUid = {268450334};
45 const TUid KPlainTextCharacterDataUid = {268450341};
46 const TUid KClipboardUidTypePlainText = {268450333};
47 const TUid KUidRichText = {271013233};
52 const TInt KMaxFieldBufferSize=0x14;
55 An abstract base class which defines the behaviour common to all editable
58 It provides no storage for text or text formatting, so it is not directly
59 usable. It defines protocols for editing the contents of a text object and
60 for extracting format data from a text object which supports formatting.
62 Note: when specifying a position in a text object (the document position),
63 zero is before the first character in the document. If the document contains
64 n characters, position n is after the last character. Valid document positions
65 are therefore between zero and the length of the document, inclusive. Many
66 editable text functions raise a panic if a specified document position is
69 Note also that the functions which implement support for front-end-processor
70 inline editing are intended for internal use only by Symbian.
74 class CEditableText : public CBase
77 IMPORT_C ~CEditableText();
78 IMPORT_C TStreamId StoreL(CStreamStore& aStore) const;
79 IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aStreamId);
81 // virtual persistence functions
82 virtual void ExternalizeL(RWriteStream& aStream) const;
83 virtual void InternalizeL(RReadStream& aStream);
85 /** Stores the text components, e.g. fields, pictures and formatting to the
86 stream store specified. Does not store the text content.
88 @param aStore Stream store to which the text components are written.
89 @param aMap A store map. This binds the address of text components to the
90 stream ID of aStore. This is needed to support deferred loading of
91 pictures in rich text. */
92 virtual void StoreComponentsL(CStreamStore& aStore,CStoreMap& aMap) const = 0;
94 /** Restores the text components, e.g. fields, pictures and formatting from
95 the stream store. Does not restore the text content.
97 @param aStore The stream store from which the text components are restored. */
98 virtual void RestoreComponentsL(const CStreamStore& aStore) = 0;
100 // modifier functions
102 /** Deletes the text content and components from the text object, leaving
103 the single end-of-text paragraph delimiter. */
104 virtual void Reset() = 0;
106 /** Inserts a single character or a descriptor into the text object at a
107 specified document position.
109 @param aInsertPos A valid document position at which to insert the
110 character or descriptor.
111 @param aChar The character to insert. */
112 virtual void InsertL(TInt aInsertPos,const TChar& aChar) = 0;
114 /** Inserts a single character or a descriptor into the text object at a
115 specified document position.
117 @param aInsertPos A valid document position at which to insert the
118 character or descriptor.
119 @param aBuf The descriptor to insert.*/
120 virtual void InsertL(TInt aInsertPos,const TDesC& aBuf) = 0;
122 /** Deletes one or more characters beginning at (and including) the
123 character at the specified document position.
125 @param aPos The document position from which to delete.
126 @param aLength The number of characters to delete.
127 @return Indicates whether or not two paragraphs have been merged as a
128 result of the delete, so that the resulting paragraph needs to be
129 reformatted. This value is only relevant to rich text, so for plain and
130 global text implementations, the function always returns EFalse. */
131 virtual TBool DeleteL(TInt aPos,TInt aLength) = 0;
133 // interrogation functions
135 /** Gets a read-only pointer descriptor to a portion of the text.
137 @param aStartPos A valid document position from which to read.
138 @param aLength If specified, the number of characters to read,inclusive of
139 the character at position aStartPos. If not specified, the read continues
140 to the end of the document, or the end of the segment if using segmented storage.
141 @return Read-only pointer descriptor to a portion of the text. */
142 virtual TPtrC Read(TInt aStartPos) const = 0;
144 /** Gets a read-only pointer descriptor to a portion of the text.
146 @param aStartPos A valid document position from which to read.
147 @param aLength If specified, the number of characters to read, inclusive of
148 the character at position aStartPos. If not specified, the read continues
149 to the end of the document, or the end of the segment if using segmented
151 @return Read-only pointer descriptor to a portion of the text. */
152 virtual TPtrC Read(TInt aStartPos,TInt aLength) const = 0;
154 /** Copies a portion of the text into a descriptor.
156 Starts at the position specified and continues to the end of the document.
157 A length may optionally be specified.
159 @param aBuf Buffer which on return contains the extracted text.
160 @param aPos The document position from which to copy. Must be a valid
161 position, or a panic occurs.
162 @param aLength If specified, the number of characters to copy. */
163 virtual void Extract(TDes& aBuf,TInt aPos=0) const = 0;
165 /** Copies a portion of the text into a descriptor. Starts at the position
166 specified and continues to the end of the document. A length may optionally
169 @param aBuf Buffer which on return contains the extracted text.
170 @param aPos The document position from which to copy. Must be a valid
171 position, or a panic occurs.
172 @param aLength If specified, the number of characters to copy. */
173 virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const = 0;
176 /** Copies a portion of the text to the clipboard.
178 @param aStore The clipboard's store (see class CClipboard).
179 @param aDictionary The clipboard's stream dictionary (see class CClipboard).
180 @param aPos A valid document position from which to begin copying.
181 @param aLength The number of characters to copy. */
182 virtual void CopyToStoreL(CStreamStore& aStore,CStreamDictionary& aDictionary,TInt aPos,TInt aLength) const = 0;
184 /** Pastes the contents of the clipboard into the text object at the
185 specified document position.
187 @param aStore The clipboard's store (see class CClipboard).
188 @param aDictionary The clipboard's stream dictionary (see class CClipboard).
189 @param aPos A valid document position at which to paste the text.
190 @return The number of characters pasted. */
191 virtual TInt PasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDictionary,TInt aPos) = 0;
195 /** Returns a count of the number of words in the document.
197 @return The number of words in the document */
198 virtual TInt WordCount() const = 0;
200 /** Returns a count of the number of paragraphs in the document.
202 @return The number of paragraphs in the document. Notes: The end-of-text
203 paragraph delimiter at the end of every document means this function
204 always returns a count of at least one. */
205 virtual TInt ParagraphCount() const = 0;
207 /** Returns a count of the number of characters in the document,
208 excluding the end-of-text paragraph delimiter.
210 @return The number of characters in the document. */
211 virtual TInt DocumentLength() const = 0;
213 /** Updates a document position to the start of the paragraph.
215 @param aPos Initially specifies a valid document position. On return, set
216 to the document position of the first character in the paragraph.
217 @return The number of characters skipped in scanning to the start of the
219 virtual TInt ToParagraphStart(TInt& aPos) const = 0;
220 inline TBool HasChanged() const;
222 /** Returns the start position and length of the word that contains the
223 specified document position.
225 @param aCurrentPos A valid document position.
226 @param aStartPos On return, the document position of the first character in
227 the word containing document position aCurrentPos.
228 @param aLength On return, the length of the word containing document
229 position aCurrentPos. Does not include the trailing word delimiter
231 @param aPictureIsDelimiter Specifies whether picture characters should be
232 considered to be word delimiters. For example, this value might be EFalse
233 when navigating a document, but ETrue when carrying out spell checking.
234 @param aPunctuationIsDelimiter Specifies whether puncutation characters
235 should be considered to be word delimiters. */
236 virtual void GetWordInfo(TInt aCurrentPos,TInt& aStartPos,TInt& aLength,
237 TBool aPictureIsDelimiter,TBool aPunctuationIsDelimiter) const = 0;
239 IMPORT_C virtual TInt ScanWords(TInt& aPos,TUint& aScanMask) const;
240 IMPORT_C virtual TInt ScanParas(TInt& aPos,TUint& aScanMask) const;
241 IMPORT_C virtual void SetHasChanged(TBool aHasChanged);
243 // Internal to Symbian - support for front-end-processor inline editing
244 IMPORT_C void StartFepInlineEditL(TBool& aParagraphContainingStartPositionOfInlineTextHasChangedFormat,TInt& aNumberOfCharactersSuccessfullyDeleted,TInt& aNumberOfCharactersSuccessfullyInserted,TInt& aPositionOfInsertionPointInDocument,TInt aNewPositionOfInsertionPointInDocument,const TDesC& aInitialInlineText,TInt aPositionOfInlineTextInDocument,TInt aNumberOfCharactersToHide,MFepInlineTextFormatRetriever& aInlineTextFormatRetriever);
245 IMPORT_C void UpdateFepInlineTextL(TBool& aParagraphContainingStartPositionOfInlineTextHasChangedFormat,TInt& aNumberOfCharactersSuccessfullyDeleted,TInt& aNumberOfCharactersSuccessfullyInserted,TInt& aPositionOfInsertionPointInDocument,TInt aNewPositionOfInsertionPointInDocument,const TDesC& aNewInlineText);
246 IMPORT_C void CommitFepInlineEditL(TBool& aParagraphContainingStartPositionOfInlineTextHasChangedFormat,TInt& aNumberOfCharactersSuccessfullyDeleted,TInt& aNumberOfCharactersSuccessfullyInserted,TInt& aPositionOfInsertionPointInDocument,TInt aNewPositionOfInsertionPointInDocument);
247 IMPORT_C void CancelFepInlineEdit(TBool& aParagraphContainingStartPositionOfInlineTextHasChangedFormat,TInt& aNumberOfCharactersSuccessfullyDeleted,TInt& aNumberOfCharactersSuccessfullyInserted,TInt& aPositionOfInsertionPointInDocument,TInt aNewPositionOfInsertionPointInDocument);
249 IMPORT_C virtual void ExtendedInterface(TAny*& aInterface, TUid aInterfaceId);
251 IMPORT_C TInt GetPositionOfInlineTextInDocument() const;
252 IMPORT_C TInt GetLengthOfInlineText() const;
255 enum TDocumentStorage
257 /** Storage uses a flat buffer (CBufFlat). */
259 /** Storage uses a segmented buffer (CBufSeg). */
263 /** Miscellaneous constants. */
266 /** Granularity of the buffer, default 256 characters. */
267 EDefaultTextGranularity = 256
271 Useful Unicode character definitions.
272 ETEXT uses standard Unicode to store its text. In particular 0x2029 and 0x2028 are used
273 as paragraph separator and forced line break respectively.
276 { // Unicode name, etc.
278 ETabCharacter = 0x0009, // horizontal tabulation
280 EPageBreak = 0x000C, // form feed
281 /** Visible space character. */
282 ESpace = 0x0020, // space
283 EApostrophe = 0x0027, // apostrophe
284 EHyphenMinus = 0x002D, // hyphen-minus; generally used for hyphen, but see 0x2010
285 /** A hard (non-breaking) space. */
286 ENonBreakingSpace = 0x00A0, // no-break space
287 /** A soft hyphen (ensures that a hyphen followed by a new line will be
288 inserted at that point should a line break be required anywhere within
291 EPotentialHyphen = 0x00AD, // soft hyphen
292 EHyphen = 0x2010, // hyphen; intended as an unambiguous hyphen codepoint
293 /** A hard (non-breaking) hyphen. */
294 ENonBreakingHyphen = 0x2011, // non-breaking hyphen
295 ELeftSingleQuote = 0x2018, // left single quotation mark
296 ERightSingleQuote = 0x2019, // right single quotation mark
297 ELeftDoubleQuote = 0x201C, // left double quotation mark
298 ERightDoubleQuote = 0x201D, // right double quotation mark
299 EBullet = 0x2022, // bullet
300 EEllipsis = 0x2026, // horizontal ellipsis
301 /** Forced line break. */
302 ELineBreak = 0x2028, // line separator
303 /** Paragraph delimiter. */
304 EParagraphDelimiter = 0x2029, // paragraph separator
305 /** Represents a picture inserted into the text object. */
306 EPictureCharacter = 0xFFFC, // object replacement character
307 EZeroWidthNoBreakSpace = 0xFEFF,// zero-width no-break space
308 EByteOrderMark = 0xFEFF, // byte order mark; SAME AS zero-width no-break space
309 EReversedByteOrderMark = 0xFFFE // not a character; evidence of endianness opposite to that of platform
313 // support for front-end-processor inline-editing
314 IMPORT_C void OverrideFormatOfInlineTextIfApplicable(TPtrC& aView,TCharFormat& aFormat,TInt aStartPos) const;
319 void SetAndTransferOwnershipOfInlineEditDataL(CInlineEditData* aInlineEditData);
320 CInlineEditData* InlineEditData() const;
321 void DeleteInlineEditDataAndSetToNull();
322 TBool DeleteWithoutDestroyingFormatL(TInt aPos, TInt aLength);
324 CEditableTextOptionalData* iOptionalData;
328 // Information relating to the number of components owned by an editable text instance.
331 Provides information about the number of components owned by an editable
334 Components are fields and (rich text only), pictures and styles.
336 An instance of this class is returned by CPlainText::ComponentInfo() and by
337 CRichText::ComponentInfo().
341 class TEtextComponentInfo
344 IMPORT_C TEtextComponentInfo();
345 IMPORT_C TEtextComponentInfo(TInt aFieldCount,TInt aPictureCount,TInt aStyleCount);
347 /** The number of fields in the text object. */
349 /** The number of pictures in the text object (rich text only). */
351 /** The number of styles owned or referenced by the text object (rich text only). */
358 This is an array of integers; each integer represents the number or characters
363 typedef CArrayFix<TInt> TPageTable;
366 Stores and manipulates plain text.
368 Plain text cannot be displayed, so this class provides no support for formatting.
369 It is purely an in-memory buffer for text, and provides services that act
370 upon it. These services include the following: import from and export to streams,
371 optionally translating between Unicode and other encodings; reading and writing
372 of field data; extraction of text; finding word and paragraph boundaries.
374 The type and size of in-memory buffer can be specified upon object construction.
375 However, if no specification is provided a buffer is provided with default
376 settings. There are two types of storage buffer: segmented buffers and flat
377 buffers. The default buffer for plain text is segmented (CBufSeg). This is
378 most efficient when a large quantity of text is to be stored, or will have
379 a large dynamic range. A flat buffer (CBufFlat) is most appropriate for storing
380 small quantities of text of bounded length. For most uses, however, a segmented
381 buffer is sufficient.
385 class CPlainText: public CEditableText
388 /** Line delimiter translation. */
389 enum TTextOrganisation
392 /** When importing text from a text file, all line feeds are
393 converted into paragraph delimiters.
395 When exporting text to a text file, lines do not wrap and paragraph
396 delimiters are converted into CR/LF pairs. */
397 EOrganiseByParagraph,
398 /** When importing text from a text file, a single line feed or a
399 line feed followed by a carriage return is converted into a space
400 character. A line feed which is followed by another line feed is
401 converted into a CEditableText::EParagraphDelimiter.
403 When exporting text to a text file, lines wrap at the specified wrap
404 width and paragraph delimiters are converted into CR/LFs pairs. */
408 /** Scan mask values. */
411 /** Scan direction is backwards. The default is forwards. */
412 EScanBackwards = 0x01,
413 /** If the current document position is a word or paragraph boundary, no
415 EScanStayIfBoundary = 0x02,
416 /** Scan to the first character in the word or paragraph. */
417 EScanToUnitStart = 0x04,
418 /** Scan to the last character in the word or paragraph. */
419 EScanToUnitEnd = 0x08,
420 /** Treat adjacent word or paragraph delimiters as a single delimiter.
421 Required when performing a word count, for example.
423 EScanJoinDelimiters = 0x10,
424 /** Picture characters are considered to be word delimiters. */
425 EScanPictureIsDelimiter = 0x20,
426 /** Punctuation characters, except hyphens and apostrophes, are considered
427 to be word delimiters. */
428 EScanPunctuationIsDelimiter = 0x40
432 /** Used in text scanning functions to indicate the end of the document
436 /** Indicates that a scan has passed the end of text paragraph delimiter. */
440 class TImportExportParam
441 /** Parameters for importing or exporting text using
442 CPlainText::ImportTextL() or CPlainText::ExportTextL(). */
445 TImportExportParam():
446 iOrganisation(EOrganiseByParagraph),
447 iMaxOutputChars(KMaxTInt),
448 iMaxInputChars(KMaxTInt),
449 iMaxLineLength(KMaxTInt),
450 iOutputInternal(FALSE),
451 iInputInternal(FALSE),
453 iGuessForeignEncoding(FALSE),
456 /** Default constructor. All member data is assigned default values.
457 For details, see the member data. */
461 /** Controls how line delimiters are translated. By default,
462 EOrganiseByParagraph.
464 @see CPlainText::TTextOrganisation */
465 TTextOrganisation iOrganisation;
466 /** The maximum number of characters to write to the stream (when
467 exporting) or to write to the text object (when importing). By default,
469 TInt iMaxOutputChars;
470 /** The maximum number of characters to read from the stream (when
471 importing) or to read from the text object (when exporting). By
472 default, KMaxTInt. */
474 /** The wrap width as a number of characters.
476 Only relevant when exporting by line, (iOrganisation is
477 CPlainText::EOrganiseByLine). Not used in CPlainText::ImportTextL().
478 By default, KMaxTInt. */
479 TInt iMaxLineLength; // maximum line length when exporting text
480 /** If ETrue, output is in internal format, so is written according to
481 native endianness. Used in CPlainText::ExportTextL(). By default,
483 TBool iOutputInternal;
484 /** If ETrue, input is in internal format, so is read according to
485 native endianness. Used in CPlainText::ImportTextL(). By default,
487 TBool iInputInternal;
488 /** The identifier of the foreign character set encoding to be used
489 to convert from or to.
491 Not used if iGuessForeignEncoding is true. If conversion to/from
492 iForeignEncoding is not available on the phone, the function leaves
493 with KErrNotSupported. By default, zero. */
494 TUint iForeignEncoding;
495 /** If ETrue, an attempt is made to guess the encoding of the foreign
496 text being imported before converting it into Unicode. Used in
497 CPlainText::ImportTextL(). If EFalse, the value specified in
498 iForeignEncoding (if any) is used. If none of the available character
499 conversion plug-ins on the phone return a confidence level greater
500 than 50%, CPlainText::ImportTextL() leaves with KErrNotSupported.
501 By default, false. */
502 TBool iGuessForeignEncoding;
503 /** If non-null, a connected file server session used to load character
504 conversion data. Only relevant if the text needs to be converted to or
505 from Unicode. By default, null. */
510 class TImportExportResult
511 /** Results of importing or exporting text using CPlainText::ImportTextL()
512 or CPlainText::ExportTextL(). */
515 TImportExportResult():
520 /** Default constructor. All member data is initialised to zero. */
524 /** The number of characters written to the stream (when exporting) or
525 written to this text object (when importing). */
527 /** The number of characters read from the stream (when importing) or
528 read from this text object (when exporting). */
530 /** The identifier for the character set encoding selected when
531 importing text whose encoding is guessed (iGuessForeignEncoding was
533 TUint iForeignEncoding; // foreign encoding actually used; useful if the encoding was guessed
537 IMPORT_C static CPlainText* NewL(TDocumentStorage aStorage = ESegmentedStorage,
538 TInt aDefaultTextGranularity = EDefaultTextGranularity);
539 IMPORT_C static CPlainText* NewL(const CStreamStore& aStore,TStreamId aStreamId,
540 MTextFieldFactory* aFieldFactory = NULL,
541 TDocumentStorage aStorage = ESegmentedStorage);
542 IMPORT_C virtual ~CPlainText();
544 // primary persistence functions
545 IMPORT_C virtual void StoreComponentsL(CStreamStore& aStore,CStoreMap& aMap) const;
546 IMPORT_C virtual void RestoreComponentsL(const CStreamStore& aStore);
547 IMPORT_C virtual void ExternalizeL(RWriteStream& aStream) const;
548 IMPORT_C virtual void InternalizeL(RReadStream& aStream);
550 // secondary persistence functions
551 IMPORT_C void ExternalizePlainTextL(RWriteStream& aStream) const;
552 IMPORT_C void InternalizePlainTextL(RReadStream& aStream);
553 IMPORT_C void ExternalizePlainTextNoLengthCountL(RWriteStream& aStream) const; // Deprecated
554 IMPORT_C void InternalizePlainTextL(RReadStream& aStream,TInt aLength); // Deprecated
556 // import and export text
557 IMPORT_C void ImportTextL(TInt aPos,RReadStream& aInput,TTextOrganisation aTextOrganisation,
558 TInt aMaxOutputChars = KMaxTInt,TInt aMaxInputChars = KMaxTInt,
559 TInt* aOutputChars = NULL,TInt* aInputChars = NULL);
560 IMPORT_C void ExportTextL(TInt aPos,RWriteStream& aOutput,TTextOrganisation aTextOrganisation,
561 TInt aMaxOutputChars = KMaxTInt,TInt aMaxInputChars = KMaxTInt,
562 TInt aMaxLineLength = KMaxTInt,
563 TInt* aOutputChars = NULL,TInt* aInputChars = NULL) const;
564 IMPORT_C virtual TInt ImportTextFileL(TInt aPos,const TDes& aFileName,TTextOrganisation aTextOrganisation);
565 IMPORT_C virtual void ExportAsTextL(const TDes& aFileName,TTextOrganisation aTextOrganisation,
566 TInt aMaxLineLength) const;
568 // import and export text AND optionally translate from or to a non-Unicode encoding
569 IMPORT_C void ImportTextL(TInt aPos,RReadStream& aInput,
570 const TImportExportParam& aParam,TImportExportResult& aResult);
571 IMPORT_C void ExportTextL(TInt aPos,RWriteStream& aOutput,
572 const TImportExportParam& aParam,TImportExportResult& aResult) const;
574 // read and write field data
575 IMPORT_C void StoreFieldComponentsL(CStreamStore& aStore,CStoreMap& aMap) const;
576 IMPORT_C void RestoreFieldComponentsL(const CStreamStore& aStore);
577 IMPORT_C void ExternalizeFieldDataL(RWriteStream& aStream) const;
578 IMPORT_C void InternalizeFieldDataL(RReadStream& aStream);
580 // modifier functions
581 IMPORT_C virtual void Reset();
582 IMPORT_C virtual void InsertL(TInt aPos,const TChar& aChar);
583 IMPORT_C virtual void InsertL(TInt aPos,const TDesC& aBuf);
584 IMPORT_C virtual TBool DeleteL(TInt aPos,TInt aLength);
586 // interrogation functions
587 IMPORT_C virtual TPtrC Read(TInt aStartPos) const;
588 IMPORT_C virtual TPtrC Read(TInt aStartPos,TInt aLength) const;
589 IMPORT_C virtual void Extract(TDes& aBuf,TInt aPos=0) const;
590 IMPORT_C virtual void Extract(TDes& aBuf,TInt aPos,TInt aLength) const;
592 // Flags for ExtractSelectively
595 EExtractAll = 0, // extract all characters
596 EExtractVisible = 1, // discard control characters and soft hyphens; change par and line separators to spaces
597 EExcludeInlineEditedText = 2 // discard the inline text
599 IMPORT_C void ExtractSelectively(TDes& aBuf,TInt aPos,TInt aLength,TUint aFlags);
602 IMPORT_C virtual void CopyToStoreL(CStreamStore& aStore,CStreamDictionary& aDictionary,TInt aPos,TInt aLength) const;
603 IMPORT_C virtual TInt PasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDictionary,TInt aPos);
606 IMPORT_C void SetPageTable(TPageTable* aPageTable);
607 IMPORT_C TInt PageContainingPos(TInt aPos) const;
608 IMPORT_C virtual TInt DocumentLength() const;
609 IMPORT_C virtual TInt WordCount() const;
610 IMPORT_C virtual TInt ParagraphCount() const;
611 IMPORT_C virtual TInt ToParagraphStart(TInt& aPos) const;
612 IMPORT_C virtual TInt CharPosOfParagraph(TInt& aLength,TInt aParaOffset) const;
613 IMPORT_C virtual TInt ParagraphNumberForPos(TInt& aPos) const;
614 IMPORT_C virtual void GetWordInfo(TInt aCurrentPos,TInt& aStartPos,TInt& aLength,
615 TBool aPictureIsDelimiter,TBool aPunctuationIsDelimiter) const;
616 IMPORT_C virtual TInt ScanWords(TInt& aPos,TUint& aScanMask) const;
617 IMPORT_C virtual TInt ScanParas(TInt& aPos,TUint& aScanMask) const;
618 IMPORT_C virtual TEtextComponentInfo ComponentInfo() const;
621 IMPORT_C void SetFieldFactory(MTextFieldFactory* aFactory);
622 inline const MTextFieldFactory* FieldFactory() const;
623 IMPORT_C CTextField* NewTextFieldL(TUid aFieldType) const;
624 IMPORT_C void InsertFieldL(TInt aPos,CTextField* aField,TUid aFieldType);
625 IMPORT_C virtual void UpdateFieldL(TInt aPos);
626 IMPORT_C void UpdateAllFieldsL();
627 IMPORT_C TInt FieldCount() const;
628 IMPORT_C const CTextField* TextField(TInt aPos) const;
629 IMPORT_C TBool FindFields(TInt aPos) const;
630 IMPORT_C TBool FindFields(TFindFieldInfo& aInfo,TInt aPos,TInt aRange=0) const;
631 IMPORT_C TBool RemoveField(TInt aPos);
632 IMPORT_C TBool ConvertFieldToText(TInt aPos);
633 IMPORT_C void ConvertAllFieldsToText();
635 IMPORT_C void ExtendedInterface(TAny*& aInterface, TUid aInterfaceId); // from CEditableText
638 IMPORT_C CPlainText();
639 IMPORT_C void ConstructL(TDocumentStorage aStorage = ESegmentedStorage,
640 TInt aDefaultTextGranularity = EDefaultTextGranularity);
641 IMPORT_C void ConstructL(const CStreamStore& aStore,TStreamId aStreamId,MTextFieldFactory* aFieldFactory,
642 TDocumentStorage aStorage = ESegmentedStorage);
643 IMPORT_C void DoConstructL(TDocumentStorage aStorage,TInt aDefaultTextGranularity,
644 MTextFieldFactory* aFieldFactory = NULL);
645 void DoExtract(TDes& aBuf,TInt aPos,TInt aLength,TUint aFlags = 0) const;
646 IMPORT_C void PtInsertL(TInt aInsertPos,const TDesC& aBuf);
647 IMPORT_C void DoPtInsertL(TInt aPos,const TDesC& aBuf);
648 IMPORT_C TBool DoPtDelete(TInt aPos,TInt aLength);
649 void InsertL(TInt aPos,const CPlainText* aText);
650 TBool Delete(TInt aPos,TInt aLength);
653 IMPORT_C void DoExternalizeFieldDataL(RWriteStream& aStream) const;
654 IMPORT_C void DoInternalizeFieldDataL(RReadStream& aStream);
655 IMPORT_C void DoExternalizePlainTextL(RWriteStream& aStream) const;
656 IMPORT_C void DoInternalizePlainTextL(RReadStream& aStream);
657 TStreamId DoCopyToStoreL(CStreamStore& aStore,CStreamDictionary& aDictionary,TInt aPos,TInt aLength) const;
658 TInt DoPasteFromStoreL(const CStreamStore& aStore,TStreamId aStreamId,TInt aPos);
659 void CopyComponentsL(CStreamStore& aStore,CStoreMap& aMap,TInt aPos,TInt aLength) const;
660 void PasteComponentsL(const CStreamStore& aStore,TInt aPos);
661 void CopyToStreamL(RWriteStream& aStream,TInt aPos,TInt aLength) const;
664 inline static void ConsumeAdornmentL(RReadStream& aStream);
665 inline static TUid UidFromStreamL(RReadStream& aStream);
669 EImportBufSize = 512,
670 EBiggestCharacterPaste=0x100000
681 TInt pos; // current character position
682 TInt oldPos; // old character position
683 TText* buf; // address of data (Unicode-aware)
684 TInt currentSegLen; // number of characters left in segment
685 TInt totalBufLen; // number of unread characters
686 TInt delta; // specifies current scan direction
687 TUint32 scanMask; // bitmask containing the scan settings
690 EInsideUnit = 0x10000000,
691 EStopEnd = 0x20000000,
692 EStopBegin = 0x40000000,
693 EIsDelimiter = 0x80000000
698 CPlainText(const CPlainText& aPlainTextDoc);
699 CPlainText& operator=(const CPlainText& aPlainTextDoc);
700 TInt PasteFromStreamL(RReadStream& aStream,TInt aPos);
701 TInt DoPasteFromStreamL(RReadStream& aStream, TInt aPos);
703 void InitScanControl(TInt& aPos,TUint& aScanMask,TUnitOfText aContext,SScanData& aScanData) const;
704 void InitScanData(TInt aPos,SScanData& aScanData) const;
706 TInt CountUnits(TUnitOfText aContext) const;
707 TInt ScanUnit(TInt& aPos,TUnitOfText aContext,SScanData& aScanData) const;
708 TBool TestForDelimiter(TUnitOfText aContext,SScanData& aScanData) const;
709 TBool GetChar(SScanData& aScanData,TChar& aChar) const;
710 void UpdatePageTable(TInt aPos,TInt aLength);
711 inline TBool FieldSetPresent() const;
712 void CreateFieldSetL(TInt aDocumentLength);
714 IMPORT_C virtual void Reserved_2(); // new
719 CBufBase* iByteStore; // handle to document storage class.
720 TSwizzle<CTextFieldSet> iFieldSet; // handle to field storage class
721 TPageTable* iPageTable; // may be NULL
722 MTextFieldFactory* iFieldFactory; // temporary handle to field factory during restoration
728 #include <txtetext.inl>
730 #endif // __TXTETEXT_H__