CTmTextLayout Class Reference

class CTmTextLayout : public CBase

WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. The text layout for a single rectangular piece of text. The object does not own its text or format attributes but gets them from an interface class called MTmSource .

There are functions for setting the text, drawing it, and converting between x-y coordinates and document positions.

Ranges

All ranges of character positions and pixels include the start but not the end. This means that if a line is described by a TTmLineInfo object as starting at document position 345 and ending at 389, character positions 345 to 388 are in the line; 389 is in the next line if any.

Coordinates and units

All coordinates used in TAGMA classes and function arguments are in pixels and are relative to the origin of the object, which is the top left corner of the ordinary text, not including paragraph labels. Vertical coordinates increase from top to bottom.

Document format and positions

A TAGMA document, as supplied by the MTmSource interface, has a length as returned by MTmSource::DocumentLength of zero or more characters. It consists of Unicode text split into paragraphs by standard Unicode paragraph delimiters (character value 0x2029), so the number of paragraphs in the entire document is one more than the number of paragraph delimiters. A document position is a value in the range 0 to one more than the document length. Lines contain all document positions from their start to one less than their end position. These conventions allow all lines to end in a delimiter; the last line contains an imaginary paragraph end, which need not be supplied by the MTmSource interface, at a position equal to the document length. A CTmTextLayout object formatted for an empty document will thus have a start position (returned by StartChar) of 0 and an end position (returned by EndChar) of 1. WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases.

Inherits from

Nested Classes and Structures

Public Member Functions
CTmTextLayout ()
~CTmTextLayout ()
IMPORT_C TBool AddParL (const TTmFormatParamBase &, TBool , TInt &, TInt &)
IMPORT_C void Clear ()
const CTmCode & Code ()
IMPORT_C void DeleteFormattingFromEndL (const TTmFormatParamBase &, TInt , TInt &)
IMPORT_C TBool DeletePar (const TTmFormatParamBase &, TBool , TInt , TInt &)
IMPORT_C TBool DocPosToLine (const TTmDocPosSpec &, TTmLineInfo &)
IMPORT_C TBool DocPosToLine (const TTmDocPos &, TTmLineInfo &)
IMPORT_C void DrawBackground ( CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb &)
IMPORT_C void DrawLayout ( CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb *, TBool )
IMPORT_C void DrawLayout ( CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb *, TBool , const TCursorSelection *, const TTmHighlightExtensions *)
IMPORT_C void DrawSection ( CGraphicsContext &, const TPoint &, TInt , TInt , const TRect &)
IMPORT_C void DrawSection ( CGraphicsContext &, const TPoint &, TInt , TInt , const TRect &, const TTmHighlightExtensions &, TInt , TInt )
TInt EndChar ()
IMPORT_C void ExtendFormattingDownwardsL ( TTmFormatParam &)
IMPORT_C TBool FindAdjacentChunks (const TTmDocPosSpec &, TTmChunkDescription &, TTmChunkDescription &)
IMPORT_C TBool FindDocPos (const TTmDocPosSpec &, TTmPosInfo2 &, TTmLineInfo &)
IMPORT_C TBool FindDocPos (const TTmDocPos &, TTmPosInfo &, TTmLineInfo &)
IMPORT_C TBool FindDocPos (const TTmDocPosSpec &, TTmPosInfo2 &, TTmLineInfo &, TInt &)
IMPORT_C TInt FindNextPos ( TInt )
IMPORT_C TInt FindPreviousPos ( TInt )
IMPORT_C TBool FindXyPos (const TPoint &, TTmPosInfo2 &, TTmLineInfo &)
IMPORT_C TBool FindXyPos (const TPoint &, TTmPosInfo &, TTmLineInfo &)
IMPORT_C TBool FindXyPosWithDisambiguation (const TPoint &, TTmPosInfo2 &, TTmPosInfo2 &, TTmLineInfo &)
IMPORT_C void FormatL (const TTmFormatParamBase &, const TTmReformatParam &, TTmReformatResult &)
TUint GetCurrentContextChar ()
IMPORT_C TBool GetCursor (const TTmDocPosSpec &, TTmCursorPlacement , TTmLineInfo &, TPoint &, TInt &, TInt &, TInt &)
IMPORT_C TBool GetCursor (const TTmDocPos &, TTmCursorPlacement , TTmLineInfo &, TPoint &, TInt &, TInt &, TInt &)
IMPORT_C TBool GetDisplayedText ( TInt , TDes &, TInt &)
IMPORT_C TBool GetDisplayedTextL ( TInt , TDes &, TInt &)
TInt GetDrawingInterpFlags ()
IMPORT_C void GetMinimumLayoutSizeL ( TInt , TSize &)
IMPORT_C void GetMinimumLayoutSizeL ( TInt , TBool , TSize &)
IMPORT_C TBool GetNextPosLeftWithDisambiguation (const TTmDocPosSpec &, TTmPosInfo2 &, TTmPosInfo2 &)
IMPORT_C TBool GetNextPosRightWithDisambiguation (const TTmDocPosSpec &, TTmPosInfo2 &, TTmPosInfo2 &)
IMPORT_C TBool GetNextVisualCursorPos (const TTmDocPosSpec &, TTmPosInfo2 &, TBool )
IMPORT_C TBool GetNextVisualCursorPos (const TTmDocPos &, TTmPosInfo &, TBool )
IMPORT_C void GetUpdateBoundingRect ( TInt , TInt , const TPoint &, TRect &)
IMPORT_C void HighlightSection ( CGraphicsContext &, const TPoint &, TInt , TInt , const TRect &)
IMPORT_C void HighlightSection ( CGraphicsContext &, const TPoint &, TInt , TInt , const TRect &, const TTmHighlightExtensions &, TInt , TInt )
IMPORT_C void HorizontalExtremes ( TInt &, TInt &, TInt , TInt )
IMPORT_C void InvertLayout ( CGraphicsContext &, const TPoint &, TInt , TInt )
IMPORT_C void InvertLayout ( CGraphicsContext &, const TPoint &, TInt , TInt , const TTmHighlightExtensions &, TInt , TInt )
TInt LayoutHeight ()
TInt LayoutWidth ()
IMPORT_C TBool LineExtreme (const TTmDocPosSpec &, TBool , TTmDocPos &)
IMPORT_C TBool LineNumberToLine ( TInt , TTmLineInfo &)
IMPORT_C TInt Lines ()
IMPORT_C void MakeVisible ( TBool )
IMPORT_C TInt MemoryUsed ()
IMPORT_C TBool ParNumberToLine ( TInt , TInt , TTmLineInfo &)
IMPORT_C TInt Paragraphs ()
void SetCurrentContextChar ( TUint )
IMPORT_C void SetTextL ( MTmSource &, const TTmFormatParam &)
MTmSource * Source ()
const MTmSource * Source ()
TInt StartChar ()
IMPORT_C TInt WidthOfWidestLine ( TInt , TInt )
IMPORT_C TBool YPosToLine ( TInt , TTmLineInfo &)
Private Member Functions
void AdjustWidth (const TTmFormatParamBase &, TInt )
void Invariant ()
TBool LastLine ( TTmLineInfo &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
TBidirectionalContext * iBdStateAtEnd
CTmCode iCode
TUint iCurrentContextChar
TInt iDrawingInterpFlags
TInt iEndChar
TInt iHeight
MTmSource * iSource
TInt iStartChar
TInt iWidth

Constructor & Destructor Documentation

CTmTextLayout()

IMPORT_C CTmTextLayout ( )

Construct an empty object with no text and zero width and height. It is legal to call all CTmTextLayout functions on an empty object, with the exception of AddParL and FormatL, which panic with ENoSource.

~CTmTextLayout()

IMPORT_C ~CTmTextLayout ( )

The destructor.

Member Functions Documentation

AddParL(const TTmFormatParamBase &, TBool, TInt &, TInt &)

IMPORT_C TBool AddParL ( const TTmFormatParamBase & aParam,
TBool aAtStart,
TInt & aHeightIncrease,
TInt & aParagraphsIncrease
)

Format a new paragraph immediately before or after the band and add it to the formatted text. If the text starts or ends in the middle of the paragraph, complete the paragraph. Return TRUE if text was successfully added, or FALSE if there is no more text to add, or the new text would have exceeded the maximum height allowed. Place the height of the new text in aHeightIncrease. Place the increase in the number of complete paragraphs (0 or 1) in aParagraphsIncrease.

Note that this function will not necessarily add a whole paragraph to the band: if the client has restricted the amount of formatting to add by setting the relevant values in aParam, then these restrictions will be respected with the result that less than a paragraph of formatting may be generated.

This is the case, for example, when CTextLayout adds text below the band.

Parameters

const TTmFormatParamBase & aParam
TBool aAtStart
TInt & aHeightIncrease
TInt & aParagraphsIncrease

AdjustWidth(const TTmFormatParamBase &, TInt)

void AdjustWidth ( const TTmFormatParamBase & aParam,
TInt aWidthOfNewText
) [private]

Parameters

const TTmFormatParamBase & aParam
TInt aWidthOfNewText

Clear()

IMPORT_C void Clear ( )

Reset the object to its empty state; no source or formatting, height and width of 0, start and end char both 0.

Code()

const CTmCode & Code ( ) const [inline]

Returns a reference to the CTmCode object containing the bytecode representing the text layout.

DeleteFormattingFromEndL(const TTmFormatParamBase &, TInt, TInt &)

IMPORT_C void DeleteFormattingFromEndL ( const TTmFormatParamBase & aParam,
TInt aMaxDeletedHeight,
TInt & aHeightDecrease
)

Delete as many lines of formatting as possible from the end of the formatted range, up to the maximum height specified in aMaxDeletedHeight. The height decrease is placed in aHeightDecrease.

Parameters

const TTmFormatParamBase & aParam
TInt aMaxDeletedHeight
TInt & aHeightDecrease

DeletePar(const TTmFormatParamBase &, TBool, TInt, TInt &)

IMPORT_C TBool DeletePar ( const TTmFormatParamBase & aParam,
TBool aAtStart,
TInt aMaxDeletedHeight,
TInt & aHeightDecrease
)

Delete the format for the first or last paragraph if its height does not exceed aMaxDeletedHeight. Return TRUE if a paragraph was successfully deleted. Place the height of the deleted paragraph in aHeightDecrease.

Parameters

const TTmFormatParamBase & aParam
TBool aAtStart
TInt aMaxDeletedHeight
TInt & aHeightDecrease

DocPosToLine(const TTmDocPosSpec &, TTmLineInfo &)

IMPORT_C TBool DocPosToLine ( const TTmDocPosSpec & aDocPos,
TTmLineInfo & aLineInfo
) const

Returns information (including line number and formatting information) of the line containing a given document position.

Parameters

const TTmDocPosSpec & aDocPos Position to find.
TTmLineInfo & aLineInfo Returns information about the line containing aDocPos if aDocPos is within the formatted text, or an undefined value if not.

DocPosToLine(const TTmDocPos &, TTmLineInfo &)

IMPORT_C TBool DocPosToLine ( const TTmDocPos & aDocPos,
TTmLineInfo & aLineInfo
) const

Retrieve information about the line containing a certain document position. Put information about the line containing aDocPos in aLineInfo. Return FALSE if aDocPos is not in the formatted text. 7.0s

Parameters

const TTmDocPos & aDocPos
TTmLineInfo & aLineInfo

DrawBackground(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb &)

IMPORT_C void DrawBackground ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
const TRect & aClipRect,
const TLogicalRgb & aBackground
) const

Draw the background, using the custom background graphics implemented by overriding MTmSource::DrawBackground if any: aTopLeft is the top-left corner of the text, aRect is the portion of the background to be drawn, and aBackground is the default background colour. This function is used by higher-level classes for drawing backgrounds outside the ordinary text area consistently with the ordinary background.

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
const TRect & aClipRect
const TLogicalRgb & aBackground

DrawLayout(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb *, TBool)

IMPORT_C void DrawLayout ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
const TRect & aClipRect,
const TLogicalRgb * aDocBackground,
TBool aDrawParBackground
) const

Draw the text.

Parameters

CGraphicsContext & aGc Graphics context to draw to.
const TPoint & aTopLeft The origin of the formatted text in the coordinates of aGc.
const TRect & aClipRect The clipping rectangle in the coordinates of aGc. Nowhere outside this rectangle will be drawn.
const TLogicalRgb * aDocBackground The default document background colour, which is used for regions not drawn by any custom background drawing routine and not covered by any text. If null, no background is drawn in these places.
TBool aDrawParBackground If false no default background is drawn on those areas covered by text. Custom background drawers are invoked regardless of this argument.

DrawLayout(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb *, TBool, const TCursorSelection *, const TTmHighlightExtensions *)

IMPORT_C void DrawLayout ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
const TRect & aClipRect,
const TLogicalRgb * aDocBackground,
TBool aDrawParBackground,
const TCursorSelection * aHighlight,
const TTmHighlightExtensions * aHighlightExtensions
) const

Draw the text.

Parameters

CGraphicsContext & aGc Graphics context to draw to.
const TPoint & aTopLeft The origin of the formatted text in the coordinates of aGc.
const TRect & aClipRect The clipping rectangle in the coordinates of aGc. Nowhere outside this rectangle will be drawn.
const TLogicalRgb * aDocBackground The default document background colour, which is used for regions not drawn by any custom background drawing routine and not covered by any text. If null, no background is drawn in these places.
TBool aDrawParBackground If false no default background is drawn on those areas covered by text. Custom background drawers are invoked regardless of this argument.
const TCursorSelection * aHighlight The current selection. If null, no selection is drawn.
const TTmHighlightExtensions * aHighlightExtensions If not null, the selection highlight has its edges moved by the specified number of pixels

DrawSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &)

IMPORT_C void DrawSection ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
TInt aStartDocPos,
TInt aEndDocPos,
const TRect & aClipRect
) const

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
TInt aStartDocPos
TInt aEndDocPos
const TRect & aClipRect

DrawSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &, const TTmHighlightExtensions &, TInt, TInt)

IMPORT_C void DrawSection ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
TInt aStartDocPos,
TInt aEndDocPos,
const TRect & aClipRect,
const TTmHighlightExtensions & aHighlightExtensions,
TInt aHighlightStartDocPos,
TInt aHighlightEndDocPos
) const

Analogous to DrawSection( CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &) but with highlight extensions applied. DrawSection(CGraphicsContext&, const TPoint&, TInt, TInt, const TRect&)

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
TInt aStartDocPos
TInt aEndDocPos
const TRect & aClipRect
const TTmHighlightExtensions & aHighlightExtensions
TInt aHighlightStartDocPos
TInt aHighlightEndDocPos

EndChar()

TInt EndChar ( ) const [inline]

Returns the character after the last formatted character.

ExtendFormattingDownwardsL(TTmFormatParam &)

IMPORT_C void ExtendFormattingDownwardsL ( TTmFormatParam & aParam )
Extend the formatted range downwards. That is, starting at the end of the current formatted range, generate some new formatting and append it to the end of the range.
Pre-condition
The object must have been initialised with an MTmSource , or it will panic.

Parameters

TTmFormatParam & aParam This controls how much new formatting to generate. We will generate formatting up whichever comes first of:the character position specified in TTmFormatParam::iEndCharthe height specified (in pixels) in TTmFormatParamBase::iMaxHeightthe number of lines specified in TTmFormatParamBase::iMaxLines We replace the values specified in TTmFormatParam::iStartChar and TmFormatParam::iLineInPar

FindAdjacentChunks(const TTmDocPosSpec &, TTmChunkDescription &, TTmChunkDescription &)

IMPORT_C TBool FindAdjacentChunks ( const TTmDocPosSpec & aPos,
TTmChunkDescription & aLeft,
TTmChunkDescription & aRight
) const

Returns the chunks of text adjacent to aPos.

Parameters

const TTmDocPosSpec & aPos
TTmChunkDescription & aLeft Returns a description of the chunk on the left of the cursor.
TTmChunkDescription & aRight Returns a description of the chunk on the right.

FindDocPos(const TTmDocPosSpec &, TTmPosInfo2 &, TTmLineInfo &)

IMPORT_C TBool FindDocPos ( const TTmDocPosSpec & aDocPos,
TTmPosInfo2 & aPosInfo,
TTmLineInfo & aLineInfo
) const

Finds a document position and returns information about it and the line it is in.

Parameters

const TTmDocPosSpec & aDocPos The position to find.
TTmPosInfo2 & aPosInfo Returns information on the found position.
TTmLineInfo & aLineInfo Returns information on the line containing the position found.

FindDocPos(const TTmDocPos &, TTmPosInfo &, TTmLineInfo &)

IMPORT_C TBool FindDocPos ( const TTmDocPos & aDocPos,
TTmPosInfo & aPosInfo,
TTmLineInfo & aLineInfo
) const

Find a document position and return information about it and the line it is in. Return FALSE if the document position is outside the formatted text. The document position to be found is passed in aDocPos and the information about the position found is returned in aPosInfo. The line information is returned in aLineInfo. 7.0s

Parameters

const TTmDocPos & aDocPos
TTmPosInfo & aPosInfo
TTmLineInfo & aLineInfo

FindDocPos(const TTmDocPosSpec &, TTmPosInfo2 &, TTmLineInfo &, TInt &)

IMPORT_C TBool FindDocPos ( const TTmDocPosSpec & aDocPos,
TTmPosInfo2 & aPosInfo,
TTmLineInfo & aLineInfo,
TInt & aSubscript
) const

Finds a document position and returns information about it and the line it is in.

Parameters

const TTmDocPosSpec & aDocPos The position to find.
TTmPosInfo2 & aPosInfo Returns information on the found position.
TTmLineInfo & aLineInfo Returns information on the line containing the position found.
TInt & aSubscript Returns the subscript height value.

FindNextPos(TInt)

IMPORT_C TInt FindNextPos ( TInt aStart ) const

Finds the position after the horizontally spacing element after aStart. A horizontally spacing element is a spacing glyph (such as a letter or number) plus all its combining accent, or other spacing character such as a tab or carriage return. This function will also skip any zero-width characters that precede the next horizontally spacing element.

Parameters

TInt aStart Starting position. The returned position will be greater than this.

FindPreviousPos(TInt)

IMPORT_C TInt FindPreviousPos ( TInt aStart ) const

Finds the position before the horizontally spacing element before aStart. Zero-width characters immediately before aStart are also skipped. FindNextPos

Parameters

TInt aStart Starting position. The returned position will be greater than this.

FindXyPos(const TPoint &, TTmPosInfo2 &, TTmLineInfo &)

IMPORT_C TBool FindXyPos ( const TPoint & aXyPos,
TTmPosInfo2 & aPosInfo,
TTmLineInfo & aLineInfo
) const

Finds a document position (i.e. the edge between two adjacent characters) by x-y position relative to the top-left corner of the formatted text.

Parameters

const TPoint & aXyPos Position to find.
TTmPosInfo2 & aPosInfo Returns information on the position closest to aXyPos.
TTmLineInfo & aLineInfo Returns information on the line containing aXyPos.

FindXyPos(const TPoint &, TTmPosInfo &, TTmLineInfo &)

IMPORT_C TBool FindXyPos ( const TPoint & aXyPos,
TTmPosInfo & aPosInfo,
TTmLineInfo & aLineInfo
) const

Find an x-y position, relative to the top-left corner of the text, and return information about it and the line it is in. Return FALSE if the position is outside the formatted text. The document position to be found is passed in aDocPos and the information about the position found is returned in aPosInfo. The line information is returned in aLineInfo. 7.0s

Parameters

const TPoint & aXyPos
TTmPosInfo & aPosInfo
TTmLineInfo & aLineInfo

FindXyPosWithDisambiguation(const TPoint &, TTmPosInfo2 &, TTmPosInfo2 &, TTmLineInfo &)

IMPORT_C TBool FindXyPosWithDisambiguation ( const TPoint & aXyPos,
TTmPosInfo2 & aPosLeft,
TTmPosInfo2 & aPosRight,
TTmLineInfo & aLineInfo
) const

Finds information about the visual position closest to the point specified. If there are two positions at this place that represent the ends of blocks that are not logically contiguous, different positions representing the ends of these blocks are returned. there is an ambiguity at this position, the document positions that represent the ends of the different blocks that meet here are returned.

Parameters

const TPoint & aXyPos The position to find.
TTmPosInfo2 & aPosLeft The position returned. If this position is ambiguous, this is the position attached to the block on the left.
TTmPosInfo2 & aPosRight The position returned. If this position is ambiguous, this is the position attached to the block on the right. If it is not ambiguous, aPosLeft == aPosRight.
TTmLineInfo & aLineInfo Information about the line containing aPosLeft and aPosRight.

FormatL(const TTmFormatParamBase &, const TTmReformatParam &, TTmReformatResult &)

IMPORT_C void FormatL ( const TTmFormatParamBase & aParam,
const TTmReformatParam & aReformatParam,
TTmReformatResult & TTmReformatResult
)

Format part of the text that has changed and indicate whether further formatting needs to be done.

The backing text must remain constant during background formatting. What this means is that if background formatting is enabled ( TTmReformatParam::iMaxExtraLines is some small number, causing formatting to end mid-way with TTmReformatResult::iUnformattedStart less than KMaxTInt), so that text can be formatted bit by bit by a higher-level object, as is done by CTextView, the backing text must not change between the series of calls to this function that make up a single reformatting act.

Parameters

const TTmFormatParamBase & aParam
const TTmReformatParam & aReformatParam
TTmReformatResult & TTmReformatResult

GetCurrentContextChar()

TUint GetCurrentContextChar ( ) const

GetCursor(const TTmDocPosSpec &, TTmCursorPlacement, TTmLineInfo &, TPoint &, TInt &, TInt &, TInt &)

IMPORT_C TBool GetCursor ( const TTmDocPosSpec & aDocPos,
TTmCursorPlacement aPlacement,
TTmLineInfo & aLineInfo,
TPoint & aOrigin,
TInt & aWidth,
TInt & aAscent,
TInt & aDescent
) const

Returns metrics for the cursor suitable for the document position and placement specified, as well as information about the line containing the position specified.

Parameters

const TTmDocPosSpec & aDocPos The document position to return information about.
TTmCursorPlacement aPlacement The shape of the cursor.
TTmLineInfo & aLineInfo Returns information about the line containing aDocPos if this position is within the formatted text, or an undefined value otherwise.
TPoint & aOrigin Returns a position to which aWidth, aAscent and aDescent is relative if the position is within formatted text. Returns an undefined value otherwise. This position will be on the baseline of the character found.
TInt & aWidth When aPlacement is ECursorVertical aWidth represents which side of the origin to paint the cursor, -1 paint left, +1 paint right. When aPlacement is ECursorUnderlineXXXX aWidth represents the X offset from the origin X to draw the cursor between, -ve for previous & +ve for next when text L2R (e.g. Latin), +ve for previous & -ve for next when text is R2L (e.g. Arabic)
TInt & aAscent Returns how far above aOrigin the cursor extends if aDocPos is within formatted text, or an undefined value otherwise.
TInt & aDescent Returns how far below aOrigin the cursor extends if aDocPos is within formatted text, or an undefined value otherwise.

GetCursor(const TTmDocPos &, TTmCursorPlacement, TTmLineInfo &, TPoint &, TInt &, TInt &, TInt &)

IMPORT_C TBool GetCursor ( const TTmDocPos & aDocPos,
TTmCursorPlacement aPlacement,
TTmLineInfo & aLineInfo,
TPoint & aOrigin,
TInt & aWidth,
TInt & aAscent,
TInt & aDescent
) const

Return cursor metrics suitable for the supplied document position and placement. The cursor is defined like a character, with an origin, width, height and depth. This allows the caller to preserve the origin while overriding the other metrics. 7.0s

Parameters

const TTmDocPos & aDocPos
TTmCursorPlacement aPlacement
TTmLineInfo & aLineInfo
TPoint & aOrigin
TInt & aWidth
TInt & aAscent
TInt & aDescent

GetDisplayedText(TInt, TDes &, TInt &)

IMPORT_C TBool GetDisplayedText ( TInt aLineNumber,
TDes & aText,
TInt & aNeeded
) const

Retrieve the text as displayed on a particular line. Return FALSE if the operation is impossible (e.g., because no MTmSource has yet been assigned). The text is returned in aText. The number of characters needed, which may be greater than the size of aText, is placed in aNeeded.

The text will be returned in display order, after all transformations have been applied to the backing text. These transformations include bidirectional reordering (making Arabic and Hebrew go right to left, etc.), ligation (combining adjacent characters into a single glyph), suppressing control characters, and converting characters to visible forms like visible spaces if necessary. 7.0 It can fail due to environmental conditions, and should therefore be leavable. Use GetDisplayedTextL instead.

Parameters

TInt aLineNumber
TDes & aText
TInt & aNeeded

GetDisplayedTextL(TInt, TDes &, TInt &)

IMPORT_C TBool GetDisplayedTextL ( TInt aLineNumber,
TDes & aText,
TInt & aNeeded
) const

Retrieve the text as displayed on a particular line.

The text will be returned in display order, after all transformations have been applied to the backing text. These transformations include bidirectional reordering (making Arabic and Hebrew go right to left, etc.), ligation (combining adjacent characters into a single glyph), suppressing control characters, and converting characters to visible forms like visible spaces if necessary.

Precondition: SetTextL must have been called on this object before GetDisplayedText can be called.

Please note that any text that has passed through a shaper (for example Devanagari text) will be replaced in the returned text with the Unicode Replacement Character 0xFFFD. This is because the shaper produces glyph codes, not Unicode characters, and this is because Unicode does not contain all the ligatures and glyph variants required to display such scripts correctly.

Since
7.0

Parameters

TInt aLineNumber The line to fetch the display text of.
TDes & aText A buffer into which the display text is placed.
TInt & aNeeded Returns the number of characters in the displayed line. The text is truncated if aText is not big enough, aNeeded returns how large the buffer would need to be to return the whole line.

GetDrawingInterpFlags()

TInt GetDrawingInterpFlags ( ) const

GetMinimumLayoutSizeL(TInt, TSize &)

IMPORT_C void GetMinimumLayoutSizeL ( TInt aWrapWidth,
TSize & aSize
) const

Get the size of the minimal bounding box of the text when formatted to the specified wrap width. The width may be greater than aWrapWidth. To find the minimum width for the text, pass 0 for aWrapWidth. To find the minimum height, pass KMaxTInt for aWrapWidth.

Parameters

TInt aWrapWidth
TSize & aSize

GetMinimumLayoutSizeL(TInt, TBool, TSize &)

IMPORT_C void GetMinimumLayoutSizeL ( TInt aWrapWidth,
TBool aAllowLegalLineBreaksOnly,
TSize & aSize
) const

Get the size of the minimal bounding box of the text when formatted to the specified wrap width. The width may be greater than aWrapWidth. To find the minimum width for the text, pass 0 for aWrapWidth. To find the minimum height, pass KMaxTInt for aWrapWidth. Use aAllowLegalLineBreaksOnly to set whether or not illegal line breaks should be considered when determining aSize.

Parameters

TInt aWrapWidth
TBool aAllowLegalLineBreaksOnly
TSize & aSize

GetNextPosLeftWithDisambiguation(const TTmDocPosSpec &, TTmPosInfo2 &, TTmPosInfo2 &)

IMPORT_C TBool GetNextPosLeftWithDisambiguation ( const TTmDocPosSpec & aDocPos,
TTmPosInfo2 & aPosLeft,
TTmPosInfo2 & aPosRight
) const

Finds information about the position visually to the left of the position specified, as long as it is on the same line. If there are two positions at this place that represent the ends of blocks that are not logically contiguous, different positions representing the ends of these blocks are returned.

Parameters

const TTmDocPosSpec & aDocPos The position to find.
TTmPosInfo2 & aPosLeft The position returned. If this position is ambiguous, this is the position attached to the block on the left.
TTmPosInfo2 & aPosRight The position returned. If this position is ambiguous, this is the position attached to the block on the right. If it is not ambiguous, aPosLeft == aPosRight.

GetNextPosRightWithDisambiguation(const TTmDocPosSpec &, TTmPosInfo2 &, TTmPosInfo2 &)

IMPORT_C TBool GetNextPosRightWithDisambiguation ( const TTmDocPosSpec & aDocPos,
TTmPosInfo2 & aPosLeft,
TTmPosInfo2 & aPosRight
) const

Finds information about the position visually to the right of the position specified, as long as it is on the same line. If there are two positions at this place that represent the ends of blocks that are not logically contiguous, different positions representing the ends of these blocks are returned.

Parameters

const TTmDocPosSpec & aDocPos The position to find.
TTmPosInfo2 & aPosLeft The position returned. If this position is ambiguous, this is the position attached to the block on the left.
TTmPosInfo2 & aPosRight The position returned. If this position is ambiguous, this is the position attached to the block on the right. If it is not ambiguous, aPosLeft == aPosRight.

GetNextVisualCursorPos(const TTmDocPosSpec &, TTmPosInfo2 &, TBool)

IMPORT_C TBool GetNextVisualCursorPos ( const TTmDocPosSpec & aDocPos,
TTmPosInfo2 & aInfo,
TBool aToLeft
) const

Find the nearest document position to the current one in the visual direction specified. This only works if the document position is within formatted text. False is returned if this condition is not met.

Parameters

const TTmDocPosSpec & aDocPos Start position.
TTmPosInfo2 & aInfo Returns the position found, or an undefined value if aDocPos is not in formatted text or is already at the end of the line in the direction being searched.
TBool aToLeft True if the direction to search in is leftwards.

GetNextVisualCursorPos(const TTmDocPos &, TTmPosInfo &, TBool)

IMPORT_C TBool GetNextVisualCursorPos ( const TTmDocPos & aDocPos,
TTmPosInfo & aInfo,
TBool aToLeft
) const

Get the next cursor position in visual order. This function is useful for text that contains Arabic, Hebrew, or other right-to-left languages because it allows the cursor to be moved right or left on the display whatever the order of the backing text.

The cursor position to the left or right of aDocPos is found, depending on the value of aToLeft. Information about the resulting position is returned in aInfo. The function returns TRUE if successful, FALSE if not. A FALSE return value means that there is no text, or aDocPos is outside the formatted text, or aDocPos cannot move in the required direction because it is at the end of the line. 7.0s

Parameters

const TTmDocPos & aDocPos
TTmPosInfo & aInfo
TBool aToLeft

GetUpdateBoundingRect(TInt, TInt, const TPoint &, TRect &)

IMPORT_C void GetUpdateBoundingRect ( TInt aStartDocPos,
TInt aEndDocPos,
const TPoint & aTopLeft,
TRect & aBoundingRect
) const

Calculate the bounding rectangle of the region that must be redrawn to redraw the given document section.

Parameters

TInt aStartDocPos The section starting position
TInt aEndDocPos The section ending position
const TPoint & aTopLeft Textview position in graphics context coordinates. The resulting region can be used to clip the drawing in that graphics context.
TRect & aBoundingRect The resulting bounding rectangle, that is the smallest rectangle that should be redrawn to redraw the specified document section.

HighlightSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &)

IMPORT_C void HighlightSection ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
TInt aStartDocPos,
TInt aEndDocPos,
const TRect & aClipRect
) const

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
TInt aStartDocPos
TInt aEndDocPos
const TRect & aClipRect

HighlightSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &, const TTmHighlightExtensions &, TInt, TInt)

IMPORT_C void HighlightSection ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
TInt aStartDocPos,
TInt aEndDocPos,
const TRect & aClipRect,
const TTmHighlightExtensions & aHighlightExtensions,
TInt aHighlightStartDocPos,
TInt aHighlightEndDocPos
) const

Analogous to HighlightSection( CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &) but with highlight extensions applied. HighlightSecion( CGraphicsContext &, const TPoint &, TInt , TInt , const TRect &)

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
TInt aStartDocPos
TInt aEndDocPos
const TRect & aClipRect
const TTmHighlightExtensions & aHighlightExtensions
TInt aHighlightStartDocPos
TInt aHighlightEndDocPos

HorizontalExtremes(TInt &, TInt &, TInt, TInt)

IMPORT_C void HorizontalExtremes ( TInt & aLeft,
TInt & aRight,
TInt aTopY = 0,
TInt aBottomY =  KMaxTInt
) const

Parameters

TInt & aLeft
TInt & aRight
TInt aTopY = 0
TInt aBottomY =  KMaxTInt

Invariant()

void Invariant ( ) const [private, inline]

InvertLayout(CGraphicsContext &, const TPoint &, TInt, TInt)

IMPORT_C void InvertLayout ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
TInt aStartDocPos,
TInt aEndDocPos
) const

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
TInt aStartDocPos
TInt aEndDocPos

InvertLayout(CGraphicsContext &, const TPoint &, TInt, TInt, const TTmHighlightExtensions &, TInt, TInt)

IMPORT_C void InvertLayout ( CGraphicsContext & aGc,
const TPoint & aTopLeft,
TInt aStartDocPos,
TInt aEndDocPos,
const TTmHighlightExtensions & aHighlightExtensions,
TInt aHighlightStartDocPos,
TInt aHighlightEndDocPos
) const

Analogous to InvertLayout(CGraphicsContext, const TPoint&, TInt, TInt) but with highlight extensions applied. InvertLayout(CGraphicsContext, const TPoint&, TInt, TInt)

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
TInt aStartDocPos
TInt aEndDocPos
const TTmHighlightExtensions & aHighlightExtensions
TInt aHighlightStartDocPos
TInt aHighlightEndDocPos

LastLine(TTmLineInfo &)

TBool LastLine ( TTmLineInfo & aLine ) [private]

Parameters

TTmLineInfo & aLine

LayoutHeight()

TInt LayoutHeight ( ) const [inline]

Returns the height in pixels of the formatted text.

LayoutWidth()

TInt LayoutWidth ( ) const [inline]

Return the width in pixels of the formatted text, not including paragraph labels if present.

LineExtreme(const TTmDocPosSpec &, TBool, TTmDocPos &)

IMPORT_C TBool LineExtreme ( const TTmDocPosSpec & aPos,
TBool aToRight,
TTmDocPos & aExtreme
) const

Returns the position at the left or right extreme of the line containing aPos.

Parameters

const TTmDocPosSpec & aPos
TBool aToRight EFalse for finding the left hand end, ETrue for the right.
TTmDocPos & aExtreme Returns the document position at the end requested.

LineNumberToLine(TInt, TTmLineInfo &)

IMPORT_C TBool LineNumberToLine ( TInt aLineNumber,
TTmLineInfo & aLineInfo
) const

Retrieve information about a line, referring to the line by its line number.

Put information about the line numbered aLineNumber, counting the first formatted line as 0, in aLineInfo. Return FALSE if aLineNumber is not formatted.

Parameters

TInt aLineNumber
TTmLineInfo & aLineInfo

Lines()

IMPORT_C TInt Lines ( ) const

Return the number of formatted lines.

MakeVisible(TBool)

IMPORT_C void MakeVisible ( TBool aVisible )

Stops or allows text to be drawn. Included to allow users to control visibility if text is part of an invisible control.

Parameters

TBool aVisible

MemoryUsed()

IMPORT_C TInt MemoryUsed ( ) const

Return the amount of memory used by a CTmTextLayout object, The amount returned is in bytes. The amount returned does not include memory used by non-owned objects.

ParNumberToLine(TInt, TInt, TTmLineInfo &)

IMPORT_C TBool ParNumberToLine ( TInt aParNumber,
TInt aLineInPar,
TTmLineInfo & aLineInfo
) const

Retrieve information about a line, referring to the line by its paragraph number and line number within the paragraph.

Put information about line aLineNumber in paragraph aParNumber, counting the first formatted paragraph as 0, in aLineInfo. Return FALSE if aParNumber is not formatted. If aLineInPar is greater than the number of lines in the paragraph the last line in the paragraph is returned.

Parameters

TInt aParNumber
TInt aLineInPar
TTmLineInfo & aLineInfo

Paragraphs()

IMPORT_C TInt Paragraphs ( ) const

Return the number of formatted paragraphs.

SetCurrentContextChar(TUint)

void SetCurrentContextChar ( TUint aContextChar )

Parameters

TUint aContextChar

SetTextL(MTmSource &, const TTmFormatParam &)

IMPORT_C void SetTextL ( MTmSource & aSource,
const TTmFormatParam & aParam
)

Set the text, discarding any existing layout information. The text from aParam.iStartChar to aParam.iEndChar is extracted from aSource and formatted.

Parameters

MTmSource & aSource
const TTmFormatParam & aParam

Source()

MTmSource * Source ( ) [inline]

Returns a pointer to to the MTmSource object, if any, that provides text and formatting to this object. Returns null if no source object has been set.

Source()

const MTmSource * Source ( ) const [inline]

StartChar()

TInt StartChar ( ) const [inline]

Returns the first formatted character.

WidthOfWidestLine(TInt, TInt)

IMPORT_C TInt WidthOfWidestLine ( TInt aTop = 0,
TInt aBottom =  KMaxTInt
) const

Find the width of the widest line in the specified vertical range. The width is the 'inner width'; that of the text itself not including indents or margins.

Parameters

TInt aTop = 0
TInt aBottom =  KMaxTInt

YPosToLine(TInt, TTmLineInfo &)

IMPORT_C TBool YPosToLine ( TInt aYPos,
TTmLineInfo & aLineInfo
) const

Retrieve information about a line containing a certain y coordinate.

Put information about the line containing the y coordinate aYPos, relative to 0 as the top of the formatted text, in aLineInfo. Return FALSE if aYPos is outside all formatted lines.

Parameters

TInt aYPos
TTmLineInfo & aLineInfo

Member Data Documentation

TBidirectionalContext * iBdStateAtEnd

TBidirectionalContext * iBdStateAtEnd [private]

CTmCode iCode

CTmCode iCode [private]

TUint iCurrentContextChar

TUint iCurrentContextChar [private]

TInt iDrawingInterpFlags

TInt iDrawingInterpFlags [private]

TInt iEndChar

TInt iEndChar [private]

TInt iHeight

TInt iHeight [private]

MTmSource * iSource

MTmSource * iSource [private]

TInt iStartChar

TInt iStartChar [private]

TInt iWidth

TInt iWidth [private]