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.
31 class TLayDocTextSource;
32 class TCursorPosition;
36 This interface class defines an interface for clients of Form to provided
37 implementations of customisation interfaces relating to the source text
38 document as requried by the internals of Form and Tagma. Its use by
39 Form clients is optional.
40 Derived objects of this interface are registered with the CTextLayout
41 API and are called from the TLayDocTextSource class at present.
44 @see MTmInlineTextSource
46 class MFormCustomInterfaceProvider
50 Form uses this method to request an interface implmentation for the
51 specified interface Uid. See class description for interfaces covered
54 The unique identifier for the interface wanted by Form.
56 Ptr to interface instance or 0 if not supported by client
58 virtual TAny* GetExtendedInterface(const TUid& aInterfaceId) = 0;
62 /** Parameter used to control which part of a line (top, baseline or bottom)
63 should be scrolled to a certain vertical position in a view rectangle. Used
64 as a parameter in functions like CTextView::HandleGlobalChangeL() and
65 CTextLayout::SetViewL(). The selected part of the line is called the hotspot.
69 class TViewYPosQualifier
71 friend class CTextLayout;
72 friend class CTextView;
74 /** Which part of a line (top, baseline or bottom) should appear at a
75 vertical pixel position. */
78 /** The top pixel is placed at the specified vertical point. */
80 /** The baseline is placed at the specified vertical point. */
82 /** The bottom pixel is placed at the specified vertical point. */
83 EFViewBottomOfLine = 2
86 /** Whether the top line in the view should be fully visible. */
89 /** Force a partially visible top line to be fully visible. */
90 EFViewForceLineFullyVisible = ETrue,
91 /** Do not force a partially visible top line to be fully visible. */
92 EFViewDontForceLineFullyVisible = EFalse
95 inline TViewYPosQualifier();
96 IMPORT_C void SetHotSpot(TPartOfLine aHotSpot);
97 IMPORT_C void SetFillScreen(TBool aFillScreen = ETrue);
98 IMPORT_C void SetMakeLineFullyVisible(TFullyVisible aMakeLineFullyVisible = EFViewForceLineFullyVisible);
100 TPartOfLine iHotSpot;
102 TFullyVisible iFullyVisible;
106 A structure used to return the results of a reformatting operation.
107 @see CTextLayout::HandleBlockChangeL()
111 class TViewRectChanges
115 inline TViewRectChanges();
118 /** The vertical coordinate of the top of the first line of reformatted
121 /** The vertical coordinate of the bottom of the last line of reformatted
124 /** The number of pixels by which text above the reformatted or edited
125 block has scrolled (positive values mean the text moved down). */
127 /** The number of pixels by which text below the reformatted or edited
128 block has scrolled (positive values mean the text moved down). */
129 TInt iScrollAtBottom;
133 The cursor or cursor selection within a document.
135 If the cursor and anchor position differ, the selection covers the text from
136 the lower to the higher position, not including the character after the higher
137 position. If the selection is changed (by shift plus arrow keys in many UIs)
138 the cursor position changes and the anchor remains the same.
142 class TCursorSelection
146 inline TCursorSelection();
147 inline TCursorSelection(TInt aCursorPos,TInt aAnchorPos);
148 inline void SetSelection(TInt aCursorPos,TInt aAnchorPos);
149 inline TInt LowerPos() const;
150 inline TInt HigherPos() const;
151 inline TInt Length() const;
153 /** The cursor position. */
155 /** The anchor position. */
160 Parameters used by functions that draw text.
162 An object of this class is passed to CTextLayout::DrawL() and to
163 InvertRangeL(). The draw context includes the view rectangle, the graphics
164 context, the background colour and the margin widths.
166 You only need to use this class directly when you are using a CTextLayout
167 object which is not owned by a CTextView object.
171 class TDrawTextLayoutContext
178 EFDrawGraphics=0x002,
179 EFUseClippingRect=0x004,
182 EFUseBackgroundColor=0x040,
183 EFUseOverrideTextColor=0x080,
184 EFParagraphFillTextOnly=0x100,
188 IMPORT_C TDrawTextLayoutContext();
190 IMPORT_C void SetGc(CGraphicsContext* aGc,CGraphicsContext* aPictureGc=NULL);
191 IMPORT_C void SetBitmapGc(CBitmapContext* aGc,CBitmapContext* aPictureGc=NULL);
192 IMPORT_C void SetWindowGc(CWindowGc* aGc,CWindowGc* aPictureGc=NULL);
193 IMPORT_C void SetDrawToEveryPixel(TBool aDrawToEveryPixel);
194 IMPORT_C void SetTextColorOverride(const TRgb *aOverrideColor);
195 IMPORT_C void SetDrawTextOnly();
196 IMPORT_C void SetDrawGraphicsOnly();
197 IMPORT_C void SetDrawTextAndGraphics();
198 IMPORT_C void SetClipping(TBool aClipping);
200 IMPORT_C void SetParagraphFillTextOnly(TBool aFillTextOnly);
203 IMPORT_C const TRgb* TextOverrideColor() const;
204 IMPORT_C CGraphicsContext* PrimaryGc() const;
205 IMPORT_C CGraphicsContext* PictureGc() const;
206 IMPORT_C TBool UseClippingRect() const;
207 IMPORT_C TBool UseGcClear() const;
208 IMPORT_C TBool DrawText() const;
209 IMPORT_C TBool DrawGraphics() const;
210 IMPORT_C TBool UseBackgroundColor() const;
212 IMPORT_C TBool ParagraphFillTextOnly() const;
214 //Physical dimensions
215 IMPORT_C TRect TextArea() const;
216 IMPORT_C TInt DisplayHeight() const;
217 IMPORT_C TPoint TopLeftTextArea() const;
218 IMPORT_C TRect TotalMargin() const;
219 IMPORT_C TRect LabelMargin() const;
220 IMPORT_C TBool IsLabelMargin() const;
221 IMPORT_C TRect GutterMargin() const;
222 IMPORT_C TBool IsGutterMargin() const;
223 IMPORT_C TPoint TopLeftText() const;
224 IMPORT_C void WindowToText(TPoint& aWinPos) const;
225 IMPORT_C void WindowToText(TRect& aRect) const;
226 IMPORT_C void TextToWindow(TPoint& aTextAreaPos) const;
227 IMPORT_C void TextToWindow(TRect& aRect) const;
229 TBool UseWindowGc() const;
230 void SetDrawMode(TUint aDrawMode);
231 TUint DrawMode() const;
234 /** The view rectangle (specified in window coordinates). This is used to
235 set the area in which text can be drawn. Text can only be drawn within the
236 intersection between the text area and the aDrawRect parameter passed to
237 CTextLayout::DrawL() or InvertRangeL(). */
239 /** The label margin width. By default zero. Must have the same value as
240 the label margin width as set in the text layout object. */
241 TInt iLabelMarginWidth;
242 /** The gutter margin width (also known as the line cursor margin width).
244 TInt iGutterMarginWidth;
245 /** The horizontal offset between window coordinates and text layout
248 /** The background colour for the view rectangle. The background colour is
249 used to fill the parts of the view rectangle in which text cannot appear,
250 for example, below the last line of the document and in the label, line
251 cursor and left text margins. */
252 TLogicalRgb iBackgroundColor;
254 CGraphicsContext* iGc;
255 CGraphicsContext* iPictureGc;
256 TLogicalRgb iOverrideTextColor;
261 An abstract class which specifies the protocol for customising the way text
262 and its background are drawn.
264 Common uses for this are to implement custom highlighting or to draw a
265 background bitmap. You must create an object of a class derived from this class
266 and call CTextLayout::SetCustomDraw(), passing a pointer to the object. All of
267 these functions have default implementations. Your class can override any of the
268 virtual functions listed below.
272 class MFormCustomDraw
279 Parameters used by several custom draw functions
285 TParam(CGraphicsContext& aGc,MGraphicsDeviceMap& aMap,const TPoint& aTextLayoutTopLeft,const TRect& aDrawRect):
286 iGc(aGc), iMap(aMap), iTextLayoutTopLeft(aTextLayoutTopLeft), iDrawRect(aDrawRect) { }
288 CGraphicsContext& iGc;
289 MGraphicsDeviceMap& iMap;
290 const TPoint& iTextLayoutTopLeft;
291 const TRect& iDrawRect;
296 Contains the line metrics.
302 TLineInfo(const TRect& aOuterRect,const TRect& aInnerRect,TInt aBaseline):
303 iOuterRect(aOuterRect), iInnerRect(aInnerRect), iBaseline(aBaseline) { }
305 const TRect& iOuterRect;
306 const TRect& iInnerRect;
310 IMPORT_C virtual void DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const;
311 IMPORT_C virtual void DrawLineGraphics(const TParam& aParam,const TLineInfo& aLineInfo) const;
312 IMPORT_C virtual void DrawText(const TParam& aParam,const TLineInfo& aLineInfo,const TCharFormat& aFormat,
313 const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const;
314 IMPORT_C virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
316 IMPORT_C virtual void MFormCustomDraw_Reserved_1();
317 IMPORT_C virtual void MFormCustomDraw_Reserved_2();
322 An interface class that can be derived from to implement custom line breaking.
324 Custom line breaking allows the Text Views line wrapping algorithm to break
325 lines in any way. For instance, it may be used to avoid the jagged white space
326 at the right edge of text windows caused by normal line wrapping on a small
329 All of these functions have a default implementation. To change the default
330 behaviour, a pointer to an object that overrides any or all of the functions
331 in the interface needs to be passed to the function CTextLayout::SetCustomWrap().
334 @see CTextLayout::SetCustomWrap()
338 class MFormCustomWrap
342 IMPORT_C virtual TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
343 IMPORT_C virtual TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
344 IMPORT_C virtual TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
345 TBool aForwards,TInt& aBreakPos) const;
346 IMPORT_C virtual TBool IsHangingCharacter(TUint aChar) const;
348 IMPORT_C virtual void MFormCustomWrap_Reserved_1();
349 IMPORT_C virtual void MFormCustomWrap_Reserved_2();
354 Mixin class used to customize visible appearance of invisible characters
355 such as a paragraph mark or a tab.
357 @see CTextView::SetCustomInvisibleCharacterRemapper()
361 class MFormCustomInvisibleCharacterRemapper
364 IMPORT_C static TUint DefaultMapping(TUint aChar, const TNonPrintingCharVisibility aNonPrintingCharVisibility, const TLayDocTextSource& aLayDoc);
367 Allows custom remapping of invisible characters.
369 Called by TLayDocTextSource::Map() if it has been created and registered
370 with TLayDocTextSource using CTextLayout::SetInvisibleCharacterRemapper().
372 Unless there is a specific reason for doing otherwise it is recommended
373 that where this function has not remapped a given character it should
374 pass it to DefaultMapping() to let it try.
377 Invisible character to be remapped
378 @param aDesiredVisibilities
379 Current state of flags showing visibility of invisible characters
381 Const ref to the calling CLayDocTextSource
383 The replacement character if remapping has taken place, else return original character
385 virtual TUint Remap(TUint aChar, const TNonPrintingCharVisibility aNonPrintingCharVisibility, const TLayDocTextSource& aLayDoc) = 0;
393 NONSHARABLE_CLASS(TLayDocTextSource) : public MTmSource, public MFormLabelApi, public MTmTextDrawExt
399 EDefaultFontHeightIncreaseFactor = 7,
400 EDefaultMinimumLineDescent = 3
405 // overrides for MTmSource pure virtual functions
406 MGraphicsDeviceMap& FormatDevice() const;
407 MGraphicsDeviceMap& InterpretDevice() const;
408 TInt DocumentLength() const;
409 void GetText(TInt aPos,TPtrC& aText,TTmCharFormat& aFormat) const;
410 void GetParagraphFormatL(TInt aPos,RTmParFormat& aFormat) const;
411 TInt ParagraphStart(TInt aPos) const;
413 // overrides for other MTmSource virtual functions
414 TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
415 CPicture* PictureL(TInt aPos) const;
416 TInt GetPictureSizeInTwipsL(TInt aPos,TSize& aSize) const;
417 TBool LabelModeSelect(TLabelType aType, TInt aPos);
418 void LabelModeCancel();
419 void LabelMetrics(TLabelType aType, TSize& aLabelSize, TInt& aMarginSize) const;
420 TUint Map(TUint aChar) const;
421 void SetLineHeight(const TLineHeightParam& aParam,TInt& aAscent,TInt& aDescent) const;
422 TBool PageBreakInRange(TInt aStartPos,TInt aEndPos) const;
423 void DrawBackground(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
424 const TLogicalRgb& aBackground,TRect& aRectDrawn) const;
425 void DrawLineGraphics(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
426 const TTmLineInfo& aLineInfo) const;
427 void DrawText(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
428 const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat,
429 const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const;
430 virtual void DrawPicture(CGraphicsContext& aGc,
431 const TPoint& aTextLayoutTopLeft, const TRect& aRect,
432 MGraphicsDeviceMap& aDevice, const CPicture& aPicture) const;
434 // overrides for the MTmSource virtual functions which implements the MFormCustomWrap
435 // if iCustomWrap is set.
436 TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
437 TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
438 TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
439 TBool aForwards,TInt& aBreakPos) const;
440 TBool IsHangingCharacter(TUint aChar) const;
443 TBool CanMap() const;
445 TAny* GetExtendedInterface(const TUid& aInterfaceId);
447 //MTmTextDrawExt implementations
448 virtual void DrawLine(CGraphicsContext& aGc, const TPoint& aPt1, const TPoint& aPt2) const;
449 virtual void DrawText(CGraphicsContext& aGc, const TDesC& aText, const TPoint& aPt) const;
450 virtual void DrawRect(CGraphicsContext& aGc, const TRect& aRc) const;
452 //Set/reset opaque flag of aGc graphics context
453 void SetOpaque(CGraphicsContext& aGc) const;
454 void ResetOpaque(CGraphicsContext& aGc) const;
460 ETruncateWithEllipsis = 2,
465 TUint iFlags; // wrap, truncate, etc.
466 TInt iWidth; // wrapping width
467 TChar iEllipsis; // ellipsis character (or none if 0xFFFF) used if truncating
470 CLayoutData::TFormatMode iFormatMode;
471 MGraphicsDeviceMap* iImageDevice; // device map used for drawing text
472 MGraphicsDeviceMap* iLabelsDevice; // device map used for labels
473 MGraphicsDeviceMap* iFormatDevice; // device map used for formatting
474 TInt iFontHeightIncreaseFactor; // percentage automatically added to font heights
475 TInt iMinimumLineDescent; // minimum line descent in pixels
476 TNonPrintingCharVisibility iNonPrintingCharVisibility;
477 const MFormParam* iFormParam; // if non-null, points to the object that supplies system colours
478 const MFormCustomDraw* iCustomDraw; // if non-null, points to custom drawing routines
479 const MFormCustomWrap* iCustomWrap; // if non-null, points to custom wrapping routines
480 /** Optional object able to provide a concrete customisation object for use
481 internally by Form. */
482 MFormCustomInterfaceProvider* iInterfaceProvider;
483 TBool iDrawOpaque; // Opaque drawing active if the flag is ETrue
484 TInt iExcessHeightRequired; // delta required to position the baseline so there is enough
485 // space for the highset glyph in pixels.
486 MFormCustomInvisibleCharacterRemapper* iInvisibleCharacterRemapper; // Used to customize the remapping of
487 // invisible characters to visible characters
493 CTextLayout is the lowest-level text formatting class in the Text Views API. It
494 obtains text and formatting attributes via the MLayDoc interface class and
495 formats the text to a certain width.
497 It has functions for drawing the text and performing hit-detection that is,
498 converting x-y coordinates to document positions, and vice versa. It defines
499 many public functions that are not generally useful, but are called by the
500 higher-level CTextView class, or exist only for the convenience of closely
501 associated classes like the printing and pagination systems. These are
502 identified in the documentation by the text "not generally useful".
504 When using the CTextLayout class, you must be aware of what functions have
505 previously been called. For example:
507 1) Formatting and scrolling functions must not be called if a CTextView object
508 owns the CTextLayout object, because the CTextView object may be reformatting
509 the CTextLayout object asynchronously by means of an active object, or may hold
510 some state information about the CTextLayout object that would be invalidated
511 by reformatting. These functions are identified in the documentation by the
512 text "Do not use if a CTextView object owns this CTextLayout object.".
514 2) Functions that raise out of memory exceptions can leave the object in an
515 inconsistent state; these functions can be identified as usual by their
516 trailing L. When this occurs, it is necessary to discard the formatting
517 information by calling DiscardFormat().
519 3) Some functions change formatting parameters like the wrap width or band
520 height, but do not reformat to reflect the change. These functions are
521 identified in the documentation by the text "Reformat needed".
525 class CTextLayout: public CBase
528 friend class CTestTextLayout;
531 /**Flags used by CTextLayout::SetViewL(). Whether to reformat and redraw.*/
534 /** Discard all formatting; redraw. */
535 EFViewDiscardAllFormat = TRUE,
536 /** Do not discard all formatting; redraw. */
537 EFViewDontDiscardFormat = FALSE
540 /** Indicates whether blank space should scroll.
541 Used by several CTextView and CTextLayout scrolling functions. */
544 /** Allow blank space to scroll. */
545 EFAllowScrollingBlankSpace = TRUE,
546 /** Disallow blank space from scrolling. */
547 EFDisallowScrollingBlankSpace = FALSE
550 enum // flags for HandleCharEditL
552 /** Insert a character, (not a paragraph delimiter). */
554 /** Insert a paragraph delimiter. */
555 EFParagraphDelimiter,
556 /** Delete single character to the left. */
558 /** Delete single character to the right. */
564 /** A value greater than any possible display height indicates that the
565 entire visible area, at least, was scrolled, and so there is no point
566 in blitting text; a full redraw is needed.
568 EFScrollRedrawWholeScreen = CLayoutData::EFLargeNumber,
569 /** The maximum line width when wrapping is unset. */
570 EFMaximumLineWidth = CLayoutData::EFBodyWidthForNoWrapping,
575 /** Wrapping off; overrides the paragraph format. */
576 EFAllParagraphsNotWrapped = TRUE,
577 /** Wrapping on, unless CParaFormat::iWrap is false. */
578 EFParagraphsWrappedByDefault = FALSE
581 /** Amount to format. Used by CTextLayout::SetAmountToFormat(). */
582 enum TAmountFormatted
584 /** Format the whole document. */
585 EFFormatAllText = FALSE,
586 /** Format the visible band only. */
592 EFScrollOnlyToTopsOfLines = 1
595 /** Formatting information. */
598 /** Returned by some CTextLayout enquiry functions to indicate that no
599 formatting has taken place so that the requested value cannot be
601 EFNoCurrentFormat = -1,
602 /** Returned by CTextLayout::ParagraphHeight() when the paragraph is not formatted. */
603 EFNotInCurrentFormat = 0
608 Specifies the range of characters involved when setting or clearing a
611 This class is used in the CTextLayout::Highlight() function. The following
612 code demonstrates how it should be used to clear an existing highlight and
616 CTextLayout::TRangeChange oldHighlight(anchorPos, old_cursorPos,
617 CTextLayout::TRangeChange::EClear); // existing highlight
618 CTextLayout::TRangeChange newHighlight(anchorPos, new_cursorPos,
619 CTextLayout::TRangeChange::ESet); // new one
620 newHighlight.OptimizeWith(oldHighlight); // doesn't matter which range is
621 the parameter and which is the calling object
622 layout.Highlight(oldHighlight,drawRect,context); // doesn't matter in which
623 order this and following line occur
624 layout.Highlight(newHighlight,drawRect,context);
627 @see CTextLayout::Highlight()
633 /** Enumerates the possible change types. */
636 /** The object is being used to set a range. */
638 /** The object is being used to clear a range. */
641 IMPORT_C TRangeChange(TInt aStart, TInt aEnd, TChangeType aChange);
642 IMPORT_C TRangeChange();
643 IMPORT_C void Set(TInt aStart, TInt aEnd, TChangeType aChange);
644 IMPORT_C TChangeType Get(TInt& aStart, TInt& aEnd) const;
645 IMPORT_C void OptimizeWith(TRangeChange& aBuddy);
646 IMPORT_C TBool NonNull() const;
647 IMPORT_C TBool Clip(TInt aMin, TInt aMax);
649 TBool IsJoinedTo(const TRangeChange aRange);
650 void Join(const TRangeChange aRange);
659 class TTagmaForwarder: public MTmTextLayoutForwarder
661 A standard inquiry interface for the text formatting engine, built on
662 top of a CTextView object.
664 To use it, construct a TTagmaForwarder object, then call InitL(), which
665 finishes background formatting, then call the MTmTextLayoutForwarder
671 inline TTagmaForwarder(const CTextLayout& aLayout);
674 // from MTmTextLayoutForwarder
675 inline const CTmTextLayout& TextLayout() const;
676 inline void GetOrigin(TPoint& aPoint) const;
678 const CTextLayout& iLayout;
682 Accesses text supplied by MTmSource.
685 class TUtf32SourceCache
688 TUtf32SourceCache(const MTmSource& aSource);
689 TUtf32SourceCache(const CTextLayout& aLayout);
690 TText GetUtf16(TInt aIndex);
691 TChar GetUtf32(TInt aIndex);
693 const MTmSource* iSource;
694 TPtrC16 iCurrentView;
695 TInt iCurrentViewIndex;
697 friend class TUtf32SourceCache;
699 IMPORT_C static CTextLayout *NewL(MLayDoc *aDoc,TInt aWrapWidth);
700 IMPORT_C ~CTextLayout();
701 IMPORT_C void DiscardFormat();
702 IMPORT_C void SetLayDoc(MLayDoc *aDoc);
703 IMPORT_C void SetWrapWidth(TInt aWrapWidth);
704 IMPORT_C void SetBandHeight(TInt aHeight);
705 IMPORT_C TInt BandHeight() const;
706 IMPORT_C void SetImageDeviceMap(MGraphicsDeviceMap *aGd);
707 IMPORT_C void SetLabelsDeviceMap(MGraphicsDeviceMap *aDeviceMap);
708 IMPORT_C void SetAmountToFormat(TAmountFormatted aAmountOfFormat = EFFormatBand);
709 IMPORT_C TBool IsFormattingBand() const;
710 IMPORT_C void SetFormatMode(CLayoutData::TFormatMode aFormatMode,TInt aWrapWidth,MGraphicsDeviceMap* aFormatDevice);
711 IMPORT_C void ForceNoWrapping(TBool aNoWrapping = EFAllParagraphsNotWrapped);
712 IMPORT_C TBool IsWrapping() const;
713 IMPORT_C void SetTruncating(TBool aOn);
714 IMPORT_C TBool Truncating() const;
715 IMPORT_C void SetTruncatingEllipsis(TChar aEllipsis);
716 IMPORT_C TChar TruncatingEllipsis() const;
717 IMPORT_C void SetLabelsMarginWidth(TInt aWidth);
718 IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility);
719 IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;
720 IMPORT_C TBool IsBackgroundFormatting() const;
721 IMPORT_C void NotifyTerminateBackgroundFormatting();
723 IMPORT_C void SetExcludePartialLines(TBool aExcludePartialLines = TRUE);
725 IMPORT_C TBool ExcludingPartialLines() const;
726 IMPORT_C void SetFontHeightIncreaseFactor(TInt aPercentage);
727 IMPORT_C TInt FontHeightIncreaseFactor() const;
728 IMPORT_C void SetMinimumLineDescent(TInt aPixels);
729 IMPORT_C TInt MinimumLineDescent() const;
730 IMPORT_C TInt DocumentLength() const;
731 IMPORT_C TInt ToParagraphStart(TInt& aDocPos) const;
732 IMPORT_C TInt PixelsAboveBand() const;
733 IMPORT_C TInt YBottomLastFormattedLine() const;
734 IMPORT_C TInt FormattedHeightInPixels() const;
735 IMPORT_C TInt PosRangeInBand(TInt& aDocPos) const;
736 IMPORT_C TBool PosInBand(const TTmDocPos& aDocPos,TTmLineInfo* aLineInfo = NULL) const;
737 IMPORT_C TBool PosInBand(TTmDocPos aDocPos,TPoint& aXyPos) const;
738 IMPORT_C TBool PosInBand(TInt aDocPos,TPoint& aXyPos) const;
739 IMPORT_C TBool PosIsFormatted(TInt aDocPos) const;
740 IMPORT_C TInt FirstCharOnLine(TInt aLineNo) const;
741 IMPORT_C TInt FormattedLength() const;
742 IMPORT_C TInt FirstFormattedPos() const;
743 IMPORT_C TInt NumFormattedLines() const;
744 IMPORT_C TInt FirstLineInBand() const;
745 IMPORT_C TInt GetLineRect(TInt aYPos,TRect& aLine) const;
746 IMPORT_C TInt ParagraphHeight(TInt aDocPos) const;
747 IMPORT_C TRect ParagraphRectL(TInt aDocPos) const;
748 IMPORT_C TBool CalculateHorizontalExtremesL(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines,
749 TBool aIgnoreWrapCharacters = FALSE) const;
750 IMPORT_C void GetCharacterHeightAndAscentL(TInt aDocPos,TInt& aHeight,TInt& aAscent) const;
751 IMPORT_C void GetFontHeightAndAscentL(const TFontSpec& aFontSpec,TInt& aHeight,TInt& aAscent) const;
752 IMPORT_C TInt XyPosToDocPosL(TPoint &aPos, TUint aFlags = 0) const;
753 IMPORT_C TBool DocPosToXyPosL(TInt aDocPos, TPoint& aPos, TUint aFlags = 0) const;
754 IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL) const;
755 IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL) const;
756 IMPORT_C TRect GetLineRectL(TInt aDocPos1,TInt aDocPos2) const;
757 IMPORT_C TBool PictureRectangleL(TInt aDocPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL) const;
758 IMPORT_C TBool PictureRectangleL(const TPoint& aXyPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL) const;
759 IMPORT_C TInt FirstDocPosFullyInBand() const;
760 IMPORT_C void GetMinimumSizeL(TInt aWrapWidth,TSize& aSize);
761 IMPORT_C void GetMinimumSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize);
762 IMPORT_C TInt MajorVersion() const;
763 IMPORT_C TInt SetViewL(const TTmDocPos& aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier,
764 TDiscard aDiscardFormat = EFViewDontDiscardFormat);
765 IMPORT_C TInt SetViewL(TInt aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier,
766 TDiscard aDiscardFormat = EFViewDontDiscardFormat);
767 IMPORT_C void FormatBandL();
768 IMPORT_C void FormatCharRangeL(TInt aStartDocPos,TInt aEndDocPos);
769 void FormatCharRangeL(TInt aStartDocPos,TInt aEndDocPos,TInt aPixelOffset);
770 IMPORT_C TBool FormatNextLineL(TInt& aBotPixel);
771 IMPORT_C TBool FormatLineL(CParaFormat* aParaFormat,TInt& aDocPos,TInt& aHeight,TBool& aPageBreak);
772 IMPORT_C TInt ScrollParagraphsL(TInt& aNumParas,TAllowDisallow aScrollBlankSpace);
773 IMPORT_C TInt ScrollLinesL(TInt& aNumLines,TAllowDisallow aScrollBlankSpace = EFDisallowScrollingBlankSpace);
774 IMPORT_C TInt ChangeBandTopL(TInt& aPixels,TAllowDisallow aScrollBlankSpace = EFDisallowScrollingBlankSpace);
775 IMPORT_C void PageUpL(TInt& aYCursorPos,TInt& aPixelsScrolled);
776 IMPORT_C void PageDownL(TInt& aYCursorPos,TInt& aPixelsScrolled);
777 IMPORT_C TBool HandleCharEditL(TUint aType,TInt& aCursorPos,TInt& aGood,TInt& aFormattedUpTo,
778 TInt& aFormattedFrom,TInt& aScroll,TBool aFormatChanged);
779 IMPORT_C void HandleBlockChangeL(TCursorSelection aSelection,TInt aOldCharsChanged,TViewRectChanges& aViewChanges,
780 TBool aFormatChanged);
781 IMPORT_C void HandleAdditionalCharactersAtEndL(TInt& aFirstPixel,TInt& aLastPixel);
783 IMPORT_C void ReformatVerticalSpaceL();
784 IMPORT_C void AdjustVerticalAlignment(CParaFormat::TAlignment aVerticalAlignment);
785 IMPORT_C static void DrawBorders(const MGraphicsDeviceMap* aGd,CGraphicsContext& aGc,const TRect& aRect,
786 const TParaBorderArray& aBorder,const TRgb* aBackground = NULL,
787 TRegion* aClipRegion = NULL,const TRect* aDrawRect = NULL);
788 IMPORT_C void DrawL(const TRect& aDrawRect,const TDrawTextLayoutContext* aDrawTextLayoutContext,
789 const TCursorSelection* aHighlight = NULL);
790 IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,
791 TTmPosInfo2& aPosInfo, TBool aToLeft) const;
793 IMPORT_C void InvertRangeL(const TCursorSelection& aHighlight,const TRect& aDrawRect,
794 const TDrawTextLayoutContext* aDrawTextLayoutContext);
795 IMPORT_C void Highlight(const TRangeChange& aHighlight,const TRect& aDrawRect,
796 const TDrawTextLayoutContext* aDrawTextLayoutContext);
797 IMPORT_C void SetCustomDraw(const MFormCustomDraw* aCustomDraw);
798 IMPORT_C const MFormCustomDraw* CustomDraw() const;
799 IMPORT_C void SetCustomWrap(const MFormCustomWrap* aCustomWrap);
800 IMPORT_C const MFormCustomWrap* CustomWrap() const;
801 IMPORT_C void ExtendFormattingToCoverYL(TInt aYPos);
802 IMPORT_C void ExtendFormattingToCoverPosL(TInt aDocPos);
804 IMPORT_C TInt GetLineNumber(TInt aDocPos);
805 IMPORT_C void SetHighlightExtensions(TInt aLeftExtension, TInt aRightExtension, TInt aTopExtension, TInt aBottomExtension);
806 void SetExcessHeightRequired(TInt aExcessHeightRequired);
807 IMPORT_C void SetInterfaceProvider( MFormCustomInterfaceProvider* aProvider );
808 inline const CTmTextLayout& TagmaTextLayout() const;
809 inline void GetOrigin(TPoint& aPoint) const;
812 inline void RestrictScrollToTopsOfLines(TBool aRestrict);
815 // Non-exported public functions
816 void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
817 const TLogicalRgb& aBackground) const;
818 TBool CalculateHorizontalExtremes(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines) const;
819 TBool GetCursor(const TTmDocPos& aDocPos,TTmCursorPlacement aPlacement,
820 TRect& aLineRect,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
821 void GetParagraphRect(const TTmDocPos& aDocPos,TRect& aRect) const;
822 TInt ScrollDocPosIntoViewL(const TTmDocPos& aDocPos);
823 TInt PictureRectangleAndPosL(const TPoint& aXyPos, TRect& aPictureRect,
824 TBool* aCanScaleOrCrop = 0) const;
825 void HighlightUsingExtensions(const CTextLayout::TRangeChange& aChangeHighlight,const TRangeChange& aFullHighlight,
826 const TRect& aDrawRect, const TDrawTextLayoutContext* aDrawTextLayoutContext);
827 inline const TTmHighlightExtensions& HighlightExtensions() const;
828 void GetHighlightRemnants(const TRect& aRect, const TDrawTextLayoutContext& aDrawTextLayoutContext, TRect* aRemainderRects) const;
829 TInt WrapWidth() const;
833 IMPORT_C void SetCustomInvisibleCharacterRemapper(MFormCustomInvisibleCharacterRemapper* aInvisibleCharacterRemapper);
834 IMPORT_C MFormCustomInvisibleCharacterRemapper* GetCustomInvisibleCharacterRemapper();
835 void SetTextViewCursorPos(TCursorPosition* aPos); // Put in for INC092568
837 void SetWindow(RWindow* aWnd);
838 void SetReadyToRedraw();
839 void BeginRedraw(const TRect& aRect);
841 void SetExternalDraw(const TRect& aRect);
842 void ResetExternalDraw();
843 TBool BeginRedrawCalled() const;
844 IMPORT_C void MakeVisible(TBool aVisible);
847 TBool __DbgIsFormattingUpToDate() const;
857 EPixelNotInFormattedLine,
859 ENoCharRangeToFormat,
860 ECharacterNotFormatted,
861 EPrintPreviewModeError,
862 EBadCharacterEditType,
869 static void Panic(TPanicNumber aNumber);
872 IMPORT_C CTextLayout();
873 IMPORT_C void ConstructL(MLayDoc *aDoc,TInt aWrapWidth);
874 void InitFormatParam(TTmFormatParamBase& aParam);
875 TInt ScrollL(TInt aDy,TAllowDisallow aScrollBlankSpace);
876 void FormatBandL(TInt aStartDocPos,TInt aEndDocPos);
877 void PruneFormatL(TBool aFromStart);
878 TInt VisibleHeightInPixels() const;
879 TInt BandHeightInPixels() const;
880 TInt SuggestCursorPos(TInt aCurrentCursorPos) const;
882 TBool AddFormattingAtEndL(TTmFormatParamBase& aFormatParam, TInt& aHeightIncrease, TInt& aParagraphsIncrease);
884 static void ResetOpaque(void* aThis);
887 CTmTextLayout iText; // the TAGMA object that contains the text layout
888 TInt iExcessHeightRequired; // The delta required to position the baseline so there is enough
889 // space for the highset glyph in pixels
890 RWindow *iWnd; // the window to be used to draw
891 TBool iBeginRedrawCount;
893 TCursorPosition* iTextViewCursorPos; // From and owned by owning CTextView if it exists,
894 // Null otherwise. Put in for INC092568
895 TBool iIsWndInExternalRedraw; // If ETrue, then iWnd->EndRedraw() will not be called
896 // from within CTextLayout::EndRedraw() as the window redraw
897 // has been initiated externally and will be ended externally as well
898 TBool iReadyToRedraw; // If EFalse, disables CTextLayout::BeginRedraw() and
899 // CTextLayout::EndRedraw()
900 TInt iDummy[5]; // This dummy variable has been inserted to replace the original size of
901 // a variable that had to be moved to avaid a BC break because it had
902 // increased in size. Feel free to reuse this space - just reduce the size
903 // of this variable by the size of any variable you insert in front of it.
904 // Currently it occupies 5 words.
905 TInt iBandTop; // effectively, scroll position: subtract this from CTmTextLayout y position
906 // to give CTextLayout y position
907 TInt iVisibleHeight;// in pixels if iFormatMode is EFScreenMode or EFWysiwygMode, otherwise twips
908 TInt iBandHeight; // in pixels if iFormatMode is EFScreenMode or EFWysiwygMode, otherwise twips
910 TInt iScrollFlags; // from CTextLayout::TScrollFlags
911 TInt iUnformattedStart; // document position of the start of any unformatted text;
912 // if < KMaxTInt, background formatting can be used
913 // (by calling FormatNextLine) to format the remainder
914 TBool iParInvalid; // if true and background formatting is happening, the remainder of the paragraph
915 // containing iUnformattedStart is invalid and must be reformatted;
916 // otherwise, formatting stops when line ends match
917 TTmHighlightExtensions iHighlightExtensions;
918 TLayDocTextSource iSource; // the source of the text
919 // before adding any new member variables to the end of this class, please
920 // consider whether you can insert them before the iDummy member variable
921 // further up, which currently represents wasted space.
927 The TMovementType enum defined in this class is used to indicate the direction
928 of a scroll or cursor movement. The remainder of this class does not form part
933 class TCursorPosition
939 /** Direction of cursor movement. */
942 /** No cursor movement */
944 /** Single character cursor movement to the left */
946 /** Single character cursor movement to the right */
948 /** Line up cursor movement */
950 /** Line down cursor movement */
952 /** Page up cursor movement */
954 /** Page down cursor movement */
956 /** Cursor movement to line start */
958 /** Cursor movement to line end */
962 /** Selection of the left end or right end of a run of text. */
967 /** Rightmost end. */
973 EPosHintUndefined = 0,
974 /** Left to right typing expected. */
975 EInsertStrongL2R = 1,
976 /** Right to left typing expected. */
977 EInsertStrongR2L = 2,
979 // Maybe several more.
984 inline TCursorPosition();
985 inline void SetLayout(CTextLayout *aLayout);
986 inline void UpdateLatentX(TInt aX);
987 inline void SetToPreviousHighlight();
988 inline void SetToCurrentHighlight();
989 inline void CancelHighlight();
990 inline void SetDocPos(const TTmDocPos& aDocPos);
991 void UpdateLatentPosition();
992 TInt SetSelectionL(const TCursorSelection& aSelection);
993 void SetPendingSelection(const TCursorSelection& aSelection);
994 void GetOldSelection(TCursorSelection& aSelection) const;
995 void GetSelection(TCursorSelection& aSelection) const;
996 TInt SetDocPosL(TBool aDragSelectOn,const TTmDocPos& aDocPos);
997 TInt SetXyPosL(TBool aDragSelectOn,TPoint aPos,TBool aAllowPictureFrame);
998 TInt MoveL(TBool aDragSelectOn,TMovementType& aMovement,TBool aAllowPictureFrame);
999 const TTmDocPos& VisualEndOfRunL(
1000 const TTmDocPos& aStart, const TTmDocPos& aEnd,
1001 TVisualEnd aDirection);
1002 void TextMoveVertically();
1003 inline void DontDrawOldPictureFrame();
1005 // inquiry functions
1006 inline TBool IsSelection() const;
1007 inline TBool IsSelectionToDraw() const;
1008 TBool IsPictureFrame() const;
1009 TBool IsNewPictureFrame() const;
1010 inline const TTmDocPos& TmDocPos() const;
1011 inline TInt DocPos() const;
1012 inline TBool DrawHighlight() const;
1013 inline TBool DrawOldPictureFrame() const;
1014 inline TBool DrawNewPictureFrame() const;
1015 TBool GetCursor(TTmCursorPlacement aPlacement,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
1016 TPosHint PositioningHint() const { return iPositioningHint; }
1017 void SetPositioningHint (TPosHint aHint)
1018 {iPositioningHint = aHint;}
1020 TTmPosInfo2& ChoosePosition(TTmPosInfo2& aPreferred,
1021 TTmPosInfo2& aBackup);
1031 // bit values for iFlags
1035 EDrawOldPictureFrame = 2,
1036 EDrawNewPictureFrame = 4,
1037 EReturnPreviousHighlight = 8,
1041 TInt ViewTopOfLineL(const TTmDocPos& aDocPos,TInt& aYPos);
1042 void CheckSelection(TBool aSelect);
1043 void CheckNullSelection();
1044 inline void UpdateLatentY(TInt aY);
1045 TInt CheckCursorOnScreenL(TInt& aY);
1046 TBool LeftRightL(TTmPosInfo2& aPos, TTmLineInfo& aLine, TMovementType& aMove);
1047 void StartEnd(TTmPosInfo2& aPos, TTmLineInfo& aLine, TMovementType& aMove);
1048 void UpDownL(TTmPosInfo2& aPos, TTmLineInfo& aLine, TMovementType& aMove);
1049 TInt PageScrollL(TMovementType& aMove);
1050 TInt DoSetDocPosL(const TTmDocPos& aDocPos);
1051 TInt DoSetVisibleDocPosL(const TTmDocPos& aDocPos);
1052 void DoSetXyPos(TPoint& aXy);
1053 void SetPictureFrame(const TTmDocPos& aDocPos,TInt aAnchor,const TRect& aPictureRect);
1054 inline TBool CalculateCursorPos(TPoint& aCurPos);
1063 CTextLayout* iLayout;
1064 TPosHint iPositioningHint;
1068 inline const CTmTextLayout& CTextLayout::TagmaTextLayout() const
1073 inline void CTextLayout::GetOrigin(TPoint& aPoint) const
1076 aPoint.iY = -iBandTop;
1079 inline CTextLayout::TTagmaForwarder::TTagmaForwarder(const CTextLayout& aLayout):
1084 inline const CTmTextLayout& CTextLayout::TTagmaForwarder::TextLayout() const
1086 return iLayout.TagmaTextLayout();
1089 inline void CTextLayout::TTagmaForwarder::GetOrigin(TPoint& aPoint) const
1091 iLayout.GetOrigin(aPoint);
1094 inline const TTmHighlightExtensions& CTextLayout::HighlightExtensions() const
1096 return iHighlightExtensions;
1100 Dangerous function. Makes scroll operations set the top of the screen flush to
1101 the top of a line. In general this might scroll the cursor off the screen.
1103 void CTextLayout::RestrictScrollToTopsOfLines(TBool a)
1106 iScrollFlags |= EFScrollOnlyToTopsOfLines;
1108 iScrollFlags &= ~EFScrollOnlyToTopsOfLines;
1111 /**Constructs a fully initialized TViewYPosQualifier object. The hotspot is
1112 initialized to be the baseline of the line, the screen is not filled, and the
1113 top line is not forced to be fully visible. */
1114 inline TViewYPosQualifier::TViewYPosQualifier():
1115 iHotSpot(EFViewBaseLine),
1116 iFillScreen(EFalse),
1117 iFullyVisible(EFViewDontForceLineFullyVisible)
1122 /**Constructs a TViewRectChanges object, initializing its iScrollAtTop and
1123 iScrollAtBottom members to zero. */
1124 inline TViewRectChanges::TViewRectChanges():
1130 /**Constructs the TCursorSelection object initialising the cursor and anchor
1131 positions to zero. */
1132 inline TCursorSelection::TCursorSelection():
1138 /** Constructs the TCursorSelection object with a cursor and anchor position.
1139 @param aCursorPos The cursor position.
1140 @param aAnchorPos The anchor position. */
1141 inline TCursorSelection::TCursorSelection(TInt aCursorPos,TInt aAnchorPos):
1142 iCursorPos(aCursorPos),
1143 iAnchorPos(aAnchorPos)
1147 /** Sets the cursor and anchor positions for the selection.
1148 @param aCursorPos The new cursor position.
1149 @param aAnchorPos The new anchor position. */
1150 inline void TCursorSelection::SetSelection(TInt aCursorPos,TInt aAnchorPos)
1152 iCursorPos = aCursorPos;
1153 iAnchorPos = aAnchorPos;
1156 /** Gets the lesser of the cursor and anchor positions.
1157 @return The lesser of the cursor and anchor positions. */
1158 inline TInt TCursorSelection::LowerPos() const
1160 return Min(iCursorPos,iAnchorPos);
1163 /** Gets the greater of the cursor and anchor positions.
1164 @return The greater of the cursor and anchor positions. */
1165 inline TInt TCursorSelection::HigherPos() const
1167 return Max(iCursorPos,iAnchorPos);
1170 /** Returns the number of characters in the selected range.
1171 @return The length of the selection. */
1172 inline TInt TCursorSelection::Length() const
1174 return Abs(iCursorPos - iAnchorPos);
1177 /** Constructs the TCursorPosition object, initializing its members
1178 iAnchor, iOldDocPos, iOldAnchor, iFlags, iLatentX, iLatentY to
1179 zero, iLayout to NULL, and iPositioningHint to undefined.
1181 inline TCursorPosition::TCursorPosition():
1189 iPositioningHint(EPosHintUndefined)
1193 /** Sets the text layout which TCursorPosition is related.
1194 @param aLayout The text layout.
1196 inline void TCursorPosition::SetLayout(CTextLayout *aLayout)
1201 /** Tests whether there is currently a selected region.
1202 @return True if there is a selected region. False if not. */
1203 inline TBool TCursorPosition::IsSelection() const
1205 return iFlags & ESelected;
1208 /** Tests whether there is currently a highlighted region being drawn.
1209 @return True if there is a selected region. False if not. */
1210 inline TBool TCursorPosition::IsSelectionToDraw() const
1212 return iFlags & (EDrawHighlight | EDrawOldPictureFrame | EDrawNewPictureFrame);
1215 /** Sets the flag which directs <code>GetSelection()</code> and
1216 <code>IsPictureFrame()</code> to operate on the previous highlight
1217 instead of the current highlight.
1219 inline void TCursorPosition::SetToPreviousHighlight()
1221 iFlags |= EReturnPreviousHighlight;
1224 /** Clears the special flag set in <code>SetToPreviousHighlight()</code>
1225 so that <code>GetSelection()</code> and <code>IsPictureFrame()</code>
1226 will operate on the current highlight.
1228 inline void TCursorPosition::SetToCurrentHighlight()
1230 iFlags &= ~EReturnPreviousHighlight;
1233 /** Removes the selection, and redraws the affected part of the screen.
1235 inline void TCursorPosition::CancelHighlight()
1237 iFlags &= ~(ESelected | EDrawHighlight | EDrawOldPictureFrame | EDrawNewPictureFrame);
1240 /** Sets the latent horizontal text cursor position. This is the horizontal
1241 coordinate to which the text cursor will be moved.
1242 @param aX The horizontal coordinate to which the text cursor should be moved
1244 inline void TCursorPosition::UpdateLatentX(TInt aX)
1249 /** Sets the latent vertical text cursor position. This is the vertical
1250 coordinate to which the text cursor will be moved.
1251 @param aY The vertical coordinate to which the text cursor should be moved
1253 inline void TCursorPosition::UpdateLatentY(TInt aY)
1258 /** Caculate x-y position of the cursor
1259 If ETrue is returned, places the position of the intersection of
1260 the character edge with the baseline in aPos
1261 @param aPos On return, stores the position of the intersection of
1262 the character edge with the baseline
1263 @return ETrue if the document is in the formatted text, otherwise EFalse.
1265 inline TBool TCursorPosition::CalculateCursorPos(TPoint& aPos)
1267 TTmPosInfo2 pos_info;
1268 TBool result = iLayout->FindDocPos(iDocPos,pos_info);
1269 aPos = pos_info.iEdge;
1273 /** Gets the document position, the structure for holding a raw document
1274 position that can be converted to or from an x-y position and compared
1275 ordinally, which cannot be done with the more abstract TTmDocPosSpec class.
1276 @return the document position
1278 inline const TTmDocPos& TCursorPosition::TmDocPos() const
1282 /** Gets the edge position in the document.
1283 @return the edge position in the document.
1285 inline TInt TCursorPosition::DocPos() const
1287 return iDocPos.iPos;
1290 /** Sets the document position, the structure for holding a raw document
1291 position that can be converted to or from an x-y position and compared
1292 ordinally, which cannot be done with the more abstract TTmDocPosSpec class.
1293 @param aDocPos the document position
1295 inline void TCursorPosition::SetDocPos(const TTmDocPos& aDocPos)
1300 /** Tests whether the highlighted region needs to be drawn.
1301 The function will be called by CTextView::UpdateHighlightL()
1302 to correct the highlight after a cursor movement
1303 @return True if the highlighted region needs to be drawn. False if not. */
1304 inline TBool TCursorPosition::DrawHighlight() const
1306 return iFlags & EDrawHighlight;
1309 /** Tests whether there is a previous picture frame that needs to be drawn.
1310 The function will be called by CTextView::UpdateHighlightL()
1311 to correct the highlight after a cursor movement
1312 @return True if there is a previous picture frame that needs to be drawn. False if not. */
1313 inline TBool TCursorPosition::DrawOldPictureFrame() const
1315 return iFlags & EDrawOldPictureFrame;
1318 /** Tests whether there is a new picture frame that needs to be drawn.
1319 The function will be called by CTextView::UpdateHighlightL()
1320 to correct the highlight after a cursor movement
1321 @return True if there is a new picture frame that needs to be drawn. False if not. */
1322 inline TBool TCursorPosition::DrawNewPictureFrame() const
1324 return iFlags & EDrawNewPictureFrame;
1327 /** Sets to not draw the previous picture frame
1329 inline void TCursorPosition::DontDrawOldPictureFrame()
1331 iFlags &= ~EDrawOldPictureFrame;