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 TBoolAddParL(const TTmFormatParamBase &, TBool, TInt &, TInt &)
IMPORT_C voidClear()
const CTmCode &Code()
IMPORT_C voidDeleteFormattingFromEndL(const TTmFormatParamBase &, TInt, TInt &)
IMPORT_C TBoolDeletePar(const TTmFormatParamBase &, TBool, TInt, TInt &)
IMPORT_C TBoolDocPosToLine(const TTmDocPosSpec &, TTmLineInfo &)
IMPORT_C TBoolDocPosToLine(const TTmDocPos &, TTmLineInfo &)
IMPORT_C voidDrawBackground(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb &)
IMPORT_C voidDrawLayout(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb *, TBool)
IMPORT_C voidDrawLayout(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb *, TBool, const TCursorSelection *, const TTmHighlightExtensions *)
IMPORT_C voidDrawSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &)
IMPORT_C voidDrawSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &, const TTmHighlightExtensions &, TInt, TInt)
TInt EndChar()
IMPORT_C voidExtendFormattingDownwardsL(TTmFormatParam &)
IMPORT_C TBoolFindAdjacentChunks(const TTmDocPosSpec &, TTmChunkDescription &, TTmChunkDescription &)
IMPORT_C TBoolFindDocPos(const TTmDocPosSpec &, TTmPosInfo2 &, TTmLineInfo &)
IMPORT_C TBoolFindDocPos(const TTmDocPos &, TTmPosInfo &, TTmLineInfo &)
IMPORT_C TBoolFindDocPos(const TTmDocPosSpec &, TTmPosInfo2 &, TTmLineInfo &, TInt &)
IMPORT_C TIntFindNextPos(TInt)
IMPORT_C TIntFindPreviousPos(TInt)
IMPORT_C TBoolFindXyPos(const TPoint &, TTmPosInfo2 &, TTmLineInfo &)
IMPORT_C TBoolFindXyPos(const TPoint &, TTmPosInfo &, TTmLineInfo &)
IMPORT_C TBoolFindXyPosWithDisambiguation(const TPoint &, TTmPosInfo2 &, TTmPosInfo2 &, TTmLineInfo &)
IMPORT_C voidFormatL(const TTmFormatParamBase &, const TTmReformatParam &, TTmReformatResult &)
TUint GetCurrentContextChar()
IMPORT_C TBoolGetCursor(const TTmDocPosSpec &, TTmCursorPlacement, TTmLineInfo &, TPoint &, TInt &, TInt &, TInt &)
IMPORT_C TBoolGetCursor(const TTmDocPos &, TTmCursorPlacement, TTmLineInfo &, TPoint &, TInt &, TInt &, TInt &)
IMPORT_C TBoolGetDisplayedText(TInt, TDes &, TInt &)
IMPORT_C TBoolGetDisplayedTextL(TInt, TDes &, TInt &)
TInt GetDrawingInterpFlags()
IMPORT_C voidGetMinimumLayoutSizeL(TInt, TSize &)
IMPORT_C voidGetMinimumLayoutSizeL(TInt, TBool, TSize &)
IMPORT_C TBoolGetNextPosLeftWithDisambiguation(const TTmDocPosSpec &, TTmPosInfo2 &, TTmPosInfo2 &)
IMPORT_C TBoolGetNextPosRightWithDisambiguation(const TTmDocPosSpec &, TTmPosInfo2 &, TTmPosInfo2 &)
IMPORT_C TBoolGetNextVisualCursorPos(const TTmDocPosSpec &, TTmPosInfo2 &, TBool)
IMPORT_C TBoolGetNextVisualCursorPos(const TTmDocPos &, TTmPosInfo &, TBool)
IMPORT_C voidGetUpdateBoundingRect(TInt, TInt, const TPoint &, TRect &)
IMPORT_C voidHighlightSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &)
IMPORT_C voidHighlightSection(CGraphicsContext &, const TPoint &, TInt, TInt, const TRect &, const TTmHighlightExtensions &, TInt, TInt)
IMPORT_C voidHorizontalExtremes(TInt &, TInt &, TInt, TInt)
IMPORT_C voidInvertLayout(CGraphicsContext &, const TPoint &, TInt, TInt)
IMPORT_C voidInvertLayout(CGraphicsContext &, const TPoint &, TInt, TInt, const TTmHighlightExtensions &, TInt, TInt)
TInt LayoutHeight()
TInt LayoutWidth()
IMPORT_C TBoolLineExtreme(const TTmDocPosSpec &, TBool, TTmDocPos &)
IMPORT_C TBoolLineNumberToLine(TInt, TTmLineInfo &)
IMPORT_C TIntLines()
IMPORT_C voidMakeVisible(TBool)
IMPORT_C TIntMemoryUsed()
IMPORT_C TBoolParNumberToLine(TInt, TInt, TTmLineInfo &)
IMPORT_C TIntParagraphs()
voidSetCurrentContextChar(TUint)
IMPORT_C voidSetTextL(MTmSource &, const TTmFormatParam &)
MTmSource *Source()
const MTmSource *Source()
TInt StartChar()
IMPORT_C TIntWidthOfWidestLine(TInt, TInt)
IMPORT_C TBoolYPosToLine(TInt, TTmLineInfo &)
Private Member Functions
voidAdjustWidth(const TTmFormatParamBase &, TInt)
voidInvariant()
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_CCTmTextLayout()

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 TBoolAddParL(const TTmFormatParamBase &aParam,
TBoolaAtStart,
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)

voidAdjustWidth(const TTmFormatParamBase &aParam,
TIntaWidthOfNewText
)[private]

Parameters

const TTmFormatParamBase & aParam
TInt aWidthOfNewText

Clear()

IMPORT_C voidClear()

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 voidDeleteFormattingFromEndL(const TTmFormatParamBase &aParam,
TIntaMaxDeletedHeight,
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 TBoolDeletePar(const TTmFormatParamBase &aParam,
TBoolaAtStart,
TIntaMaxDeletedHeight,
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 TBoolDocPosToLine(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 & aDocPosPosition to find.
TTmLineInfo & aLineInfoReturns 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 TBoolDocPosToLine(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 voidDrawBackground(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 voidDrawLayout(CGraphicsContext &aGc,
const TPoint &aTopLeft,
const TRect &aClipRect,
const TLogicalRgb *aDocBackground,
TBoolaDrawParBackground
)const

Draw the text.

Parameters

CGraphicsContext & aGcGraphics context to draw to.
const TPoint & aTopLeftThe origin of the formatted text in the coordinates of aGc.
const TRect & aClipRectThe clipping rectangle in the coordinates of aGc. Nowhere outside this rectangle will be drawn.
const TLogicalRgb * aDocBackgroundThe 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 aDrawParBackgroundIf 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 voidDrawLayout(CGraphicsContext &aGc,
const TPoint &aTopLeft,
const TRect &aClipRect,
const TLogicalRgb *aDocBackground,
TBoolaDrawParBackground,
const TCursorSelection *aHighlight,
const TTmHighlightExtensions *aHighlightExtensions
)const

Draw the text.

Parameters

CGraphicsContext & aGcGraphics context to draw to.
const TPoint & aTopLeftThe origin of the formatted text in the coordinates of aGc.
const TRect & aClipRectThe clipping rectangle in the coordinates of aGc. Nowhere outside this rectangle will be drawn.
const TLogicalRgb * aDocBackgroundThe 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 aDrawParBackgroundIf false no default background is drawn on those areas covered by text. Custom background drawers are invoked regardless of this argument.
const TCursorSelection * aHighlightThe current selection. If null, no selection is drawn.
const TTmHighlightExtensions * aHighlightExtensionsIf 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 voidDrawSection(CGraphicsContext &aGc,
const TPoint &aTopLeft,
TIntaStartDocPos,
TIntaEndDocPos,
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 voidDrawSection(CGraphicsContext &aGc,
const TPoint &aTopLeft,
TIntaStartDocPos,
TIntaEndDocPos,
const TRect &aClipRect,
const TTmHighlightExtensions &aHighlightExtensions,
TIntaHighlightStartDocPos,
TIntaHighlightEndDocPos
)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 voidExtendFormattingDownwardsL(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 & aParamThis 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 TBoolFindAdjacentChunks(const TTmDocPosSpec &aPos,
TTmChunkDescription &aLeft,
TTmChunkDescription &aRight
)const

Returns the chunks of text adjacent to aPos.

Parameters

const TTmDocPosSpec & aPos
TTmChunkDescription & aLeftReturns a description of the chunk on the left of the cursor.
TTmChunkDescription & aRightReturns a description of the chunk on the right.

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

IMPORT_C TBoolFindDocPos(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 & aDocPosThe position to find.
TTmPosInfo2 & aPosInfoReturns information on the found position.
TTmLineInfo & aLineInfoReturns information on the line containing the position found.

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

IMPORT_C TBoolFindDocPos(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 TBoolFindDocPos(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 & aDocPosThe position to find.
TTmPosInfo2 & aPosInfoReturns information on the found position.
TTmLineInfo & aLineInfoReturns information on the line containing the position found.
TInt & aSubscriptReturns the subscript height value.

FindNextPos(TInt)

IMPORT_C TIntFindNextPos(TIntaStart)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 aStartStarting position. The returned position will be greater than this.

FindPreviousPos(TInt)

IMPORT_C TIntFindPreviousPos(TIntaStart)const

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

Parameters

TInt aStartStarting position. The returned position will be greater than this.

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

IMPORT_C TBoolFindXyPos(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 & aXyPosPosition to find.
TTmPosInfo2 & aPosInfoReturns information on the position closest to aXyPos.
TTmLineInfo & aLineInfoReturns information on the line containing aXyPos.

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

IMPORT_C TBoolFindXyPos(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 TBoolFindXyPosWithDisambiguation(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 & aXyPosThe position to find.
TTmPosInfo2 & aPosLeftThe position returned. If this position is ambiguous, this is the position attached to the block on the left.
TTmPosInfo2 & aPosRightThe 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 & aLineInfoInformation about the line containing aPosLeft and aPosRight.

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

IMPORT_C voidFormatL(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 TBoolGetCursor(const TTmDocPosSpec &aDocPos,
TTmCursorPlacementaPlacement,
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 & aDocPosThe document position to return information about.
TTmCursorPlacement aPlacementThe shape of the cursor.
TTmLineInfo & aLineInfoReturns information about the line containing aDocPos if this position is within the formatted text, or an undefined value otherwise.
TPoint & aOriginReturns 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 & aWidthWhen 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 & aAscentReturns how far above aOrigin the cursor extends if aDocPos is within formatted text, or an undefined value otherwise.
TInt & aDescentReturns 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 TBoolGetCursor(const TTmDocPos &aDocPos,
TTmCursorPlacementaPlacement,
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 TBoolGetDisplayedText(TIntaLineNumber,
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 TBoolGetDisplayedTextL(TIntaLineNumber,
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 aLineNumberThe line to fetch the display text of.
TDes & aTextA buffer into which the display text is placed.
TInt & aNeededReturns 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 voidGetMinimumLayoutSizeL(TIntaWrapWidth,
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 voidGetMinimumLayoutSizeL(TIntaWrapWidth,
TBoolaAllowLegalLineBreaksOnly,
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 TBoolGetNextPosLeftWithDisambiguation(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 & aDocPosThe position to find.
TTmPosInfo2 & aPosLeftThe position returned. If this position is ambiguous, this is the position attached to the block on the left.
TTmPosInfo2 & aPosRightThe 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 TBoolGetNextPosRightWithDisambiguation(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 & aDocPosThe position to find.
TTmPosInfo2 & aPosLeftThe position returned. If this position is ambiguous, this is the position attached to the block on the left.
TTmPosInfo2 & aPosRightThe 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 TBoolGetNextVisualCursorPos(const TTmDocPosSpec &aDocPos,
TTmPosInfo2 &aInfo,
TBoolaToLeft
)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 & aDocPosStart position.
TTmPosInfo2 & aInfoReturns 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 aToLeftTrue if the direction to search in is leftwards.

GetNextVisualCursorPos(const TTmDocPos &, TTmPosInfo &, TBool)

IMPORT_C TBoolGetNextVisualCursorPos(const TTmDocPos &aDocPos,
TTmPosInfo &aInfo,
TBoolaToLeft
)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 voidGetUpdateBoundingRect(TIntaStartDocPos,
TIntaEndDocPos,
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 aStartDocPosThe section starting position
TInt aEndDocPosThe section ending position
const TPoint & aTopLeftTextview position in graphics context coordinates. The resulting region can be used to clip the drawing in that graphics context.
TRect & aBoundingRectThe 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 voidHighlightSection(CGraphicsContext &aGc,
const TPoint &aTopLeft,
TIntaStartDocPos,
TIntaEndDocPos,
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 voidHighlightSection(CGraphicsContext &aGc,
const TPoint &aTopLeft,
TIntaStartDocPos,
TIntaEndDocPos,
const TRect &aClipRect,
const TTmHighlightExtensions &aHighlightExtensions,
TIntaHighlightStartDocPos,
TIntaHighlightEndDocPos
)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 voidHorizontalExtremes(TInt &aLeft,
TInt &aRight,
TIntaTopY = 0,
TIntaBottomY =  KMaxTInt
)const

Parameters

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

Invariant()

voidInvariant()const [private, inline]

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

IMPORT_C voidInvertLayout(CGraphicsContext &aGc,
const TPoint &aTopLeft,
TIntaStartDocPos,
TIntaEndDocPos
)const

Parameters

CGraphicsContext & aGc
const TPoint & aTopLeft
TInt aStartDocPos
TInt aEndDocPos

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

IMPORT_C voidInvertLayout(CGraphicsContext &aGc,
const TPoint &aTopLeft,
TIntaStartDocPos,
TIntaEndDocPos,
const TTmHighlightExtensions &aHighlightExtensions,
TIntaHighlightStartDocPos,
TIntaHighlightEndDocPos
)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 TBoolLineExtreme(const TTmDocPosSpec &aPos,
TBoolaToRight,
TTmDocPos &aExtreme
)const

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

Parameters

const TTmDocPosSpec & aPos
TBool aToRightEFalse for finding the left hand end, ETrue for the right.
TTmDocPos & aExtremeReturns the document position at the end requested.

LineNumberToLine(TInt, TTmLineInfo &)

IMPORT_C TBoolLineNumberToLine(TIntaLineNumber,
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 TIntLines()const

Return the number of formatted lines.

MakeVisible(TBool)

IMPORT_C voidMakeVisible(TBoolaVisible)

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 TIntMemoryUsed()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 TBoolParNumberToLine(TIntaParNumber,
TIntaLineInPar,
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 TIntParagraphs()const

Return the number of formatted paragraphs.

SetCurrentContextChar(TUint)

voidSetCurrentContextChar(TUintaContextChar)

Parameters

TUint aContextChar

SetTextL(MTmSource &, const TTmFormatParam &)

IMPORT_C voidSetTextL(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 TIntWidthOfWidestLine(TIntaTop = 0,
TIntaBottom =  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 TBoolYPosToLine(TIntaYPos,
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]