CTextLayout Class Reference

#include <frmtlay.h>

class CTextLayout : public CBase, public CBase

Inherits from

Public Member Enumerations
enumanonymous { EFCharacterInsert, EFParagraphDelimiter, EFLeftDelete, EFRightDelete }
enumanonymous { EFScrollRedrawWholeScreen, EFMaximumLineWidth }
enumanonymous { EFAllParagraphsNotWrapped, EFParagraphsWrappedByDefault }
enumTAllowDisallow { EFAllowScrollingBlankSpace, EFDisallowScrollingBlankSpace }
enumTAmountFormatted { EFFormatAllText, EFFormatBand }
enumTCurrentFormat { EFNoCurrentFormat, EFNotInCurrentFormat }
enumTDiscard { EFViewDiscardAllFormat, EFViewDontDiscardFormat }
enumTPanicNumber { EUnimplemented, ENoMemory, EDrawingBorderError, EFormatDeviceNotSet, ..., EInvalidRedraw }
enumTScrollFlags { EFScrollOnlyToTopsOfLines }
Public Member Functions
~CTextLayout()
IMPORT_C voidAdjustVerticalAlignment(CParaFormat::TAlignment)
IMPORT_C TIntBandHeight()
voidBeginRedraw(const TRect &)
TBool BeginRedrawCalled()
TBool CalculateHorizontalExtremes(TInt &, TInt &, TBool)
IMPORT_C TBoolCalculateHorizontalExtremesL(TInt &, TInt &, TBool, TBool)
IMPORT_C TIntChangeBandTopL(TInt &, TAllowDisallow)
IMPORT_C voidChangeBandTopNoLimitBorderL(TInt)
IMPORT_C const MFormCustomDraw *CustomDraw()
IMPORT_C const MFormCustomWrap *CustomWrap()
IMPORT_C voidDiscardFormat()
IMPORT_C TBoolDocPosToXyPosL(TInt, TPoint &, TUint)
IMPORT_C TIntDocumentLength()
voidDrawBackground(CGraphicsContext &, const TPoint &, const TRect &, const TLogicalRgb &)
IMPORT_C voidDrawBorders(const MGraphicsDeviceMap *, CGraphicsContext &, const TRect &, const TParaBorderArray &, const TRgb *, TRegion *, const TRect *)
IMPORT_C voidDrawL(const TRect &, const TDrawTextLayoutContext *, const TCursorSelection *)
voidEndRedraw()
IMPORT_C TBoolExcludingPartialLines()
IMPORT_C voidExtendFormattingToCoverPosL(TInt)
IMPORT_C voidExtendFormattingToCoverYL(TInt)
IMPORT_C TBoolFindDocPos(const TTmDocPosSpec &, TTmPosInfo2 &, TTmLineInfo *)
IMPORT_C TBoolFindXyPos(const TPoint &, TTmPosInfo2 &, TTmLineInfo *)
IMPORT_C TIntFirstCharOnLine(TInt)
IMPORT_C TIntFirstDocPosFullyInBand()
IMPORT_C TIntFirstFormattedPos()
IMPORT_C TIntFirstLineInBand()
IMPORT_C TIntFontHeightIncreaseFactor()
IMPORT_C voidForceNoWrapping(TBool)
IMPORT_C voidFormatBandL()
IMPORT_C voidFormatCharRangeL(TInt, TInt)
voidFormatCharRangeL(TInt, TInt, TInt)
IMPORT_C TBoolFormatLineL(CParaFormat *, TInt &, TInt &, TBool &)
IMPORT_C TBoolFormatNextLineL(TInt &)
IMPORT_C TIntFormattedHeightInPixels()
IMPORT_C TIntFormattedLength()
IMPORT_C voidGetCharacterHeightAndAscentL(TInt, TInt &, TInt &)
TBool GetCursor(const TTmDocPos &, TTmCursorPlacement, TRect &, TPoint &, TInt &, TInt &, TInt &)
IMPORT_C MFormCustomInvisibleCharacterRemapper *GetCustomInvisibleCharacterRemapper()
IMPORT_C voidGetFontHeightAndAscentL(const TFontSpec &, TInt &, TInt &)
voidGetHighlightRemnants(const TRect &, const TDrawTextLayoutContext &, TRect *)
IMPORT_C TIntGetLineNumber(TInt)
IMPORT_C TIntGetLineRect(TInt, TRect &)
IMPORT_C TRectGetLineRectL(TInt, TInt)
IMPORT_C voidGetMinimumSizeL(TInt, TSize &)
IMPORT_C voidGetMinimumSizeL(TInt, TBool, TSize &)
IMPORT_C TBoolGetNextVisualCursorPos(const TTmDocPosSpec &, TTmPosInfo2 &, TBool)
voidGetOrigin(TPoint &)
voidGetParagraphRect(const TTmDocPos &, TRect &)
IMPORT_C voidHandleAdditionalCharactersAtEndL(TInt &, TInt &)
IMPORT_C voidHandleBlockChangeL(TCursorSelection, TInt, TViewRectChanges &, TBool)
IMPORT_C TBoolHandleCharEditL(TUint, TInt &, TInt &, TInt &, TInt &, TInt &, TBool)
IMPORT_C voidHighlight(const TRangeChange &, const TRect &, const TDrawTextLayoutContext *)
const TTmHighlightExtensions &HighlightExtensions()
voidHighlightUsingExtensions(const CTextLayout::TRangeChange &, const TRangeChange &, const TRect &, const TDrawTextLayoutContext *)
IMPORT_C voidInvertRangeL(const TCursorSelection &, const TRect &, const TDrawTextLayoutContext *)
IMPORT_C TBoolIsBackgroundFormatting()
IMPORT_C TBoolIsFormattingBand()
IMPORT_C TBoolIsWrapping()
IMPORT_C TIntMajorVersion()
IMPORT_C voidMakeVisible(TBool)
IMPORT_C TIntMinimumLineDescent()
IMPORT_C CTextLayout *NewL(MLayDoc *, TInt)
IMPORT_C TNonPrintingCharVisibilityNonPrintingCharsVisibility()
IMPORT_C voidNotifyTerminateBackgroundFormatting()
IMPORT_C TIntNumFormattedLines()
IMPORT_C voidPageDownL(TInt &, TInt &)
IMPORT_C voidPageUpL(TInt &, TInt &)
voidPanic(TPanicNumber)
IMPORT_C TIntParagraphHeight(TInt)
IMPORT_C TRectParagraphRectL(TInt)
TInt PictureRectangleAndPosL(const TPoint &, TRect &, TBool *)
IMPORT_C TBoolPictureRectangleL(TInt, TRect &, TBool *)
IMPORT_C TBoolPictureRectangleL(const TPoint &, TRect &, TBool *)
IMPORT_C TIntPixelsAboveBand()
IMPORT_C TBoolPosInBand(const TTmDocPos &, TTmLineInfo *)
IMPORT_C TBoolPosInBand(TTmDocPos, TPoint &)
IMPORT_C TBoolPosInBand(TInt, TPoint &)
IMPORT_C TBoolPosIsFormatted(TInt)
IMPORT_C TIntPosRangeInBand(TInt &)
IMPORT_C voidReformatVerticalSpaceL()
voidResetExternalDraw()
voidRestrictScrollToTopsOfLines(TBool)
TInt ScrollDocPosIntoViewL(const TTmDocPos &)
IMPORT_C TIntScrollLinesL(TInt &, TAllowDisallow)
IMPORT_C TIntScrollParagraphsL(TInt &, TAllowDisallow)
IMPORT_C voidSetAmountToFormat(TAmountFormatted)
IMPORT_C voidSetBandHeight(TInt)
IMPORT_C voidSetCustomDraw(const MFormCustomDraw *)
IMPORT_C voidSetCustomInvisibleCharacterRemapper(MFormCustomInvisibleCharacterRemapper *)
IMPORT_C voidSetCustomWrap(const MFormCustomWrap *)
voidSetExcessHeightRequired(TInt)
IMPORT_C voidSetExcludePartialLines(TBool)
voidSetExternalDraw(const TRect &)
IMPORT_C voidSetFontHeightIncreaseFactor(TInt)
IMPORT_C voidSetFormatMode(CLayoutData::TFormatMode, TInt, MGraphicsDeviceMap *)
IMPORT_C voidSetHighlightExtensions(TInt, TInt, TInt, TInt)
IMPORT_C voidSetImageDeviceMap(MGraphicsDeviceMap *)
IMPORT_C voidSetInterfaceProvider(MFormCustomInterfaceProvider *)
IMPORT_C voidSetLabelsDeviceMap(MGraphicsDeviceMap *)
IMPORT_C voidSetLabelsMarginWidth(TInt)
IMPORT_C voidSetLayDoc(MLayDoc *)
IMPORT_C voidSetMinimumLineDescent(TInt)
IMPORT_C voidSetNonPrintingCharsVisibility(TNonPrintingCharVisibility)
voidSetOpaqueLC()
voidSetReadyToRedraw()
voidSetTextViewCursorPos(TCursorPosition *)
IMPORT_C voidSetTruncating(TBool)
IMPORT_C voidSetTruncatingEllipsis(TChar)
IMPORT_C TIntSetViewL(const TTmDocPos &, TInt &, TViewYPosQualifier, TDiscard)
IMPORT_C TIntSetViewL(TInt, TInt &, TViewYPosQualifier, TDiscard)
voidSetWindow(RWindow *)
IMPORT_C voidSetWrapWidth(TInt)
const CTmTextLayout &TagmaTextLayout()
IMPORT_C TIntToParagraphStart(TInt &)
IMPORT_C TBoolTruncating()
IMPORT_C TCharTruncatingEllipsis()
TInt WrapWidth()
IMPORT_C TIntXyPosToDocPosL(TPoint &, TUint)
IMPORT_C TIntYBottomLastFormattedLine()
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()

Detailed Description

Text layout.

CTextLayout is the lowest-level text formatting class in the Text Views API. It obtains text and formatting attributes via the MLayDoc interface class and formats the text to a certain width.

It has functions for drawing the text and performing hit-detection that is, converting x-y coordinates to document positions, and vice versa. It defines many public functions that are not generally useful, but are called by the higher-level CTextView class, or exist only for the convenience of closely associated classes like the printing and pagination systems. These are identified in the documentation by the text "not generally useful".

When using the CTextLayout class, you must be aware of what functions have previously been called. For example:

1) Formatting and scrolling functions must not be called if a CTextView object owns the CTextLayout object, because the CTextView object may be reformatting the CTextLayout object asynchronously by means of an active object, or may hold some state information about the CTextLayout object that would be invalidated by reformatting. These functions are identified in the documentation by the text "Do not use if a CTextView object owns this CTextLayout object.".

2) Functions that raise out of memory exceptions can leave the object in an inconsistent state; these functions can be identified as usual by their trailing L. When this occurs, it is necessary to discard the formatting information by calling DiscardFormat().

3) Some functions change formatting parameters like the wrap width or band height, but do not reformat to reflect the change. These functions are identified in the documentation by the text "Reformat needed".

Member Enumeration Documentation

Enum anonymous

EnumeratorValueDescription
EFCharacterInsert

Insert a character, (not a paragraph delimiter).

EFParagraphDelimiter

Insert a paragraph delimiter.

EFLeftDelete

Delete single character to the left.

EFRightDelete

Delete single character to the right.

Enum anonymous

EnumeratorValueDescription
EFScrollRedrawWholeScreenCLayoutData::EFLargeNumber

A value greater than any possible display height indicates that the entire visible area, at least, was scrolled, and so there is no point in blitting text; a full redraw is needed.

EFMaximumLineWidthCLayoutData::EFBodyWidthForNoWrapping

The maximum line width when wrapping is unset.

Enum anonymous

EnumeratorValueDescription
EFAllParagraphsNotWrapped1

Wrapping off; overrides the paragraph format.

EFParagraphsWrappedByDefault0

Wrapping on, unless CParaFormat::iWrap is false.

Enum TAllowDisallow

Indicates whether blank space should scroll. Used by several CTextView and CTextLayout scrolling functions.

EnumeratorValueDescription
EFAllowScrollingBlankSpace1

Allow blank space to scroll.

EFDisallowScrollingBlankSpace0

Disallow blank space from scrolling.

Enum TAmountFormatted

Amount to format. Used by CTextLayout::SetAmountToFormat().

EnumeratorValueDescription
EFFormatAllText0

Format the whole document.

EFFormatBand1

Format the visible band only.

Enum TCurrentFormat

Formatting information.

EnumeratorValueDescription
EFNoCurrentFormat-1

Returned by some CTextLayout enquiry functions to indicate that no formatting has taken place so that the requested value cannot be calculated.

EFNotInCurrentFormat0

Returned by CTextLayout::ParagraphHeight() when the paragraph is not formatted.

Enum TDiscard

Flags used by CTextLayout::SetViewL(). Whether to reformat and redraw.

EnumeratorValueDescription
EFViewDiscardAllFormat1

Discard all formatting; redraw.

EFViewDontDiscardFormat0

Do not discard all formatting; redraw.

Enum TPanicNumber

Enum TScrollFlags

EnumeratorValueDescription
EFScrollOnlyToTopsOfLines1

Constructor & Destructor Documentation

~CTextLayout ( )

IMPORT_C~CTextLayout()

Member Function Documentation

AdjustVerticalAlignment ( CParaFormat::TAlignment )

IMPORT_C voidAdjustVerticalAlignment(CParaFormat::TAlignmentaVerticalAlignment)

Temporarily changes the vertical alignment of the text with respect to the visible height.

Notes:

Not generally useful.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aVerticalAlignmentSpecifies whether the formatted text should be placed at the top (CParaFormat::ETopAlign), vertical centre (CParaFormat::ECenterAlign or CParaFormat::EJustifiedAlign) or bottom (CParaFormat::EBottomAlign) of the band. CParaFormat::EUnspecifiedAlign or CParaFormat::ECustomAlign may also be specified. These values cause the baseline of the first formatted line to be positioned 82% of the way down the band (provided for the Agenda's application's year view).

BandHeight ( )

IMPORT_C TIntBandHeight()const

Gets the height of the band in pixels or twips.

Return Value
The height of the band in pixels or twips.

BeginRedraw ( const TRect & )

voidBeginRedraw(const TRect &aRect)

BeginRedrawCalled ( )

TBool BeginRedrawCalled()const

CalculateHorizontalExtremes ( TInt &, TInt &, TBool )

TBool CalculateHorizontalExtremes(TInt &aLeftX,
TInt &aRightX,
TBoolaOnlyVisibleLines
)const

CalculateHorizontalExtremesL ( TInt &, TInt &, TBool, TBool )

IMPORT_C TBoolCalculateHorizontalExtremesL(TInt &aLeftX,
TInt &aRightX,
TBoolaOnlyVisibleLines,
TBoolaIgnoreWrapCharacters = 0
)const

Returns the left and right extremes, in layout coordinates, of the formatted text.

Parameters
aLeftXOn return, contains the x coordinate of the leftmost point of the formatted text.
aRightXOn return, contains the x coordinate of the rightmost point of the formatted text.
aOnlyVisibleLinesIf ETrue, only scans partially or fully visible lines. If EFalse, scans all the formatted text.
aIgnoreWrapCharactersIf ETrue, does not include wrap characters in the measurement (paragraph delimiters, forced line breaks, etc.). If EFalse, includes them.
Return Value
EFalse if there is no formatted text, otherwise ETrue.

ChangeBandTopL ( TInt &, TAllowDisallow )

IMPORT_C TIntChangeBandTopL(TInt &aPixels,
TAllowDisallowaScrollBlankSpace = EFDisallowScrollingBlankSpace
)

Scrolls the text up or down by aPixels pixels, disallowing blank space at the bottom of the visible area if aScrollBlankSpace is CTextLayout::EFDisallowScrollingBlankSpace.

The return value (not aPixels, as you would expect from ScrollParagraphsL() and ScrollLinesL()) contains the number of pixels not successfully scrolled, that is, the original value of aPixels, minus the number of pixels actually scrolled. On return, aPixels is set to the number of pixels actually scrolled.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aPixelsThe number of pixels to scroll; may be a positive or negative value. On return, contains the number of pixels actually scrolled.
aScrollBlankSpaceOnly relevant when scrolling downwards. CTextLayout::EFAllowScrollingBlankSpace allows blank space to scroll into the visible area. CTextLayout::EFDisallowScrollingBlankSpace prevents blank space from scrolling into the visible area.
Return Value
The difference between the requested number of pixels to scroll and the number of pixels actually scrolled.

ChangeBandTopNoLimitBorderL ( TInt )

IMPORT_C voidChangeBandTopNoLimitBorderL(TIntaPixels)

Scrolls the text up or down by aPixels pixels, allowing blank space at top and bottom of the visible area, which means the scrolling can go beyond the top or bottom border.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aPixelsThe number of pixels to scroll; may be a positive or negative value. The actual scrolled pixel number is always identical to aPixels

CustomDraw ( )

IMPORT_C const MFormCustomDraw *CustomDraw()const
Returns a pointer to the current custom drawing implementation. Returns NULL if custom drawing is not in force.
Since
6.0
Return Value
Pointer to the custom drawing object.

CustomWrap ( )

IMPORT_C const MFormCustomWrap *CustomWrap()const

Gets the custom line breaking object, as set using SetCustomWrap().

Return Value
A pointer to the custom line breaking object, or NULL if custom line breaking is not in effect.

DiscardFormat ( )

IMPORT_C voidDiscardFormat()

Discards all formatting information. This function is used by the CTextView and the printing classes, but should be called by higher-level classes that need to clean up after any CTextLayout function has caused an out-of-memory exception.

DocPosToXyPosL ( TInt, TPoint &, TUint )

IMPORT_C TBoolDocPosToXyPosL(TIntaDocPos,
TPoint &aPos,
TUintaFlags = 0
)const

Returns the x-y coordinates of the document position aDocPos in aPos. The return value is ETrue if the position is formatted, or EFalse if it is not, in which case aPos is undefined.

Deprecated - use the more powerful FindDocPos() instead

Parameters
aDocPosThe document position.
aPosOn return, contains the x-y coordinates of aDocPos.
aFlagsTwo possible values: 0 is the default, and performs the task at full accuracy, and CLayoutData::EFWholeLinesOnly, which examines lines only and sets aXyPos.iY only, and cannot leave.
Return Value
ETrue if the document position is formatted, EFalse if not.

DocumentLength ( )

IMPORT_C TIntDocumentLength()const

Returns the document length in characters, including all the text, not just the formatted portion, but not including the final paragraph delimiter (the "end-of-text character") if any. Thus the length of an empty document is zero.

Return Value
The number of characters in the document

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

voidDrawBackground(CGraphicsContext &aGc,
const TPoint &aTopLeft,
const TRect &aClipRect,
const TLogicalRgb &aBackground
)const

DrawBorders ( const MGraphicsDeviceMap *, CGraphicsContext &, const TRect &, const TParaBorderArray &, const TRgb *, TRegion *, const TRect * )

IMPORT_C voidDrawBorders(const MGraphicsDeviceMap *aGd,
CGraphicsContext &aGc,
const TRect &aRect,
const TParaBorderArray &aBorder,
const TRgb *aBackground = 0,
TRegion *aClipRegion = 0,
const TRect *aDrawRect = 0
)[static]

Draws paragraph borders, optionally with a background colour for the border and a clip region. Provided for applications that display a menu of border styles, like a wordprocessor.

Parameters
aGdProvides twip-to-pixel conversion.
aGcGraphics context to which to draw the border. Its pen settings are overridden by the values specified by aBorder and its draw mode is set to CGraphicsContext::EDrawModePEN.
aRectThe outer bounds of the border.
aBorderSpecifies the four sides of the border.
aBackgroundIf not null, the background colour, (used between double border lines, or between dots or dashes).
aClipRegionIf non-null, specifies a clip region.
aDrawRectIf non-null, and if aClipRegion is non-null, specifies a rectangle to be subtracted from the clip region.

DrawL ( const TRect &, const TDrawTextLayoutContext *, const TCursorSelection * )

IMPORT_C voidDrawL(const TRect &aDrawRect,
const TDrawTextLayoutContext *aDrawTextLayoutContext,
const TCursorSelection *aHighlight = 0
)

Draws the text. Draws any lines that intersect aDrawRect, which is specified in window coordinates. The drawing parameters, including the graphics context, are given in aDrawTextLayoutContext. If aHighlight is non-null, highlights (by exclusive-ORing) the specified range of text.

Parameters
aDrawRectThe function draw the lines within the visible area, which intersect this rectangle (which is specified in window coordinates).
aDrawTextLayoutContextProvides a graphics context and other parameters for the function.
aHighlightIf not NULL, this range of text is drawn highlighted.

EndRedraw ( )

voidEndRedraw()

ExcludingPartialLines ( )

IMPORT_C TBoolExcludingPartialLines()const

Tests whether partial lines at the top and bottom of the view are currently excluded.

Deprecated7.0

Return Value
ETrue if partial lines are excluded, EFalse if they are displayed.

ExtendFormattingToCoverPosL ( TInt )

IMPORT_C voidExtendFormattingToCoverPosL(TIntaDocPos)
Allows you to increase the formatted text range by specifying a point in the text you want to increase the range to. Makes sure the line that aDocPos is in (if it exists) is covered by the formatting.
Pre-condition
aDocPos is in the range 0...DocumentLength
Post-condition
aDocPos has been formatted
Parameters
aDocPosPosition in the text you wish to extend the formatting to. e.g. passing in 0 will increase the formatting range to the very first character entered in the document.

ExtendFormattingToCoverYL ( TInt )

IMPORT_C voidExtendFormattingToCoverYL(TIntaYPos)

Makes sure the line that aYPos is in (if it exists) is covered by the formatting.

Parameters
aYPosY pixel position in window-relative co-ordinates.

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

IMPORT_C TBoolFindDocPos(const TTmDocPosSpec &aDocPos,
TTmPosInfo2 &aPosInfo,
TTmLineInfo *aLineInfo = 0
)const

Finds the x-y position of the document position aDocPos.

If ETrue is returned, places information about the document position in aPosInfo and information about the line containing the document position in aLineInfo if it is non-NULL.

Parameters
aDocPosContains the document position to check.
aPosInfoOn return, stores information about the document position if the position is formatted.
aLineInfoBuffer to store the line information if the document position is formatted.
Return Value
ETrue if aDocPos is in the formatted text, otherwise EFalse.

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

IMPORT_C TBoolFindXyPos(const TPoint &aXyPos,
TTmPosInfo2 &aPosInfo,
TTmLineInfo *aLineInfo = 0
)const

Finds the document position nearest to aXyPos. If aXyPos is in the formatted text returns ETrue, otherwise returns EFalse. If ETrue is returned, places information about the document position in aPosInfo and information about the line containing the document position in aLineInfo if it is non-NULL.

Parameters
aXyPosContains coordinates to convert to a document position.
aPosInfoBuffer to store information about the document position if the specified coordinates are located in the formatted text.
aLineInfoBuffer to store information about the line if the specified coordinates are located in the formatted text.
Return Value
ETrue if aXyPos is a formatted position, otherwise EFalse.

FirstCharOnLine ( TInt )

IMPORT_C TIntFirstCharOnLine(TIntaLineNo)const

Gets the document position of the first character in the specified line, counting the first line as line one (not zero) in the band. If the line is after the band, returns the last character position of the band. If there is no formatted text, returns CTextLayout::EFNoCurrentFormat.

Parameters
aLineNoLine number in formatted text, counting the first line as line one.
Return Value
The document position of the first character on the line.

FirstDocPosFullyInBand ( )

IMPORT_C TIntFirstDocPosFullyInBand()const

Gets the first document position in a line that starts at or below the top of the visible area. If there is no such line, returns the position after the last formatted character.

Return Value
The document position of the first character in a line within the visible area.

FirstFormattedPos ( )

IMPORT_C TIntFirstFormattedPos()const

Returns the document position of the first formatted character.

Return Value
The document position of the first formatted character.

FirstLineInBand ( )

IMPORT_C TIntFirstLineInBand()const

Returns the line number, counting from 0, of the first fully visible line.

Return Value
The line number of the first fully visible line.

FontHeightIncreaseFactor ( )

IMPORT_C TIntFontHeightIncreaseFactor()const

Returns the font height increase factor as a percentage (i.e. a return value of 7 means that font heights are increased by 7% to provide automatic extra spacing between lines).

Return Value
Factor by which font heights are increased.

ForceNoWrapping ( TBool )

IMPORT_C voidForceNoWrapping(TBoolaNoWrapping = EFAllParagraphsNotWrapped)

Turns wrapping on (if aNoWrapping is EFParagraphsWrappedByDefault) or off (if aNoWrapping is EFAllParagraphsNotWrapped). Overrides the paragraph format when wrapping is turned off -paragraphs are not broken into lines even if the iWrap member of CParaFormat is ETrue. If wrapping is turned on, CParaFormat::iWrap is honoured.

The text needs to be reformatted after a call to this function.

Parameters
aNoWrappingEFAllParagraphsNotWrapped (the default) to turn wrapping off, EFParagraphsWrappedByDefault to turn wrapping on.

FormatBandL ( )

IMPORT_C voidFormatBandL()

Formats enough text to fill the visible band.

Note: Do not use if a CTextView object owns this CTextLayout object.

FormatCharRangeL ( TInt, TInt )

IMPORT_C voidFormatCharRangeL(TIntaStartDocPos,
TIntaEndDocPos
)

Sets the formatted text to begin at the start of the paragraph including aStartPos and end at aEndPos. Moves the line containing aStartDocPos to the top of the visible area.

Notes:

This function is not generally useful; it exists for the convenience of the printing system.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aStartDocPosA document position within the paragraph from which to begin formatting.
aEndDocPosDocument position at which to end formatting.

FormatCharRangeL ( TInt, TInt, TInt )

voidFormatCharRangeL(TIntaStartDocPos,
TIntaEndDocPos,
TIntaPixelOffset
)

FormatLineL ( CParaFormat *, TInt &, TInt &, TBool & )

IMPORT_C TBoolFormatLineL(CParaFormat *aParaFormat,
TInt &aDocPos,
TInt &aHeight,
TBool &aPageBreak
)

Controls the height of a single line, for use by the pagination system only. Using the format supplied in aParaFormat, determines the height of the line containing aDocPos and returns it in aHeight. Changes aDocPos to the end of the line and returns ETrue if that position is not the end of the paragraph.

Notes:

Not generally useful; it exists for use by the pagination system only.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aParaFormatContains paragraph formatting.
aDocPosA document position. On return, contains the document position of the end of the line.
aHeightOn return, contains the height of the formatted line containing aDocPos.
aPageBreakOn return, ETrue if the last character on the line is a page break. EFalse if not.
Return Value
ETrue if the line is not the last line in the paragraph. EFalse if it is the last line.

FormatNextLineL ( TInt & )

IMPORT_C TBoolFormatNextLineL(TInt &aBotPixel)

A special function to support background formatting by the higher level CTextView class. It formats the next pending line. The return value is ETrue if there is more formatting to do. On entry, aBotPixel contains the y coordinate of the bottom of the formatted text; this is updated by the function.

Notes:

Not generally useful.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aBotPixelOn entry, contains the y coordinate of the bottom of the formatted text; this is updated by the function.
Return Value
ETrue if there is more formatting to do. EFalse if not.

FormattedHeightInPixels ( )

IMPORT_C TIntFormattedHeightInPixels()const

Returns the height in pixels of the formatted text.

Return Value
The height in pixels of all the formatted text.

FormattedLength ( )

IMPORT_C TIntFormattedLength()const

Returns the number of formatted characters. This will be one more than expected if the formatted text runs to the end of the document, because it will include the end-of-text character.

Return Value
The number of formatted characters in the document.

GetCharacterHeightAndAscentL ( TInt, TInt &, TInt & )

IMPORT_C voidGetCharacterHeightAndAscentL(TIntaDocPos,
TInt &aHeight,
TInt &aAscent
)const

Gets the height (ascent + descent) and ascent of the font of the character at aDocPos, as created using the graphics device map used for drawing (the "image device") and returns them in aHeight and aAscent, after increasing aHeight by the font height increase factor (see SetFontHeightIncreaseFactor()).

Parameters
aDocPosA document position.
aHeightOn return contains the height in pixels of the character at aDocPos.
aAscentOn return, contains the ascent in pixels of the character at aDocPos.

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

TBool GetCursor(const TTmDocPos &aDocPos,
TTmCursorPlacementaPlacement,
TRect &aLineRect,
TPoint &aOrigin,
TInt &aWidth,
TInt &aAscent,
TInt &aDescent
)const

GetCustomInvisibleCharacterRemapper ( )

IMPORT_C MFormCustomInvisibleCharacterRemapper *GetCustomInvisibleCharacterRemapper()

Allows Form clients to see which character remapper object is currently registered.

GetFontHeightAndAscentL ( const TFontSpec &, TInt &, TInt & )

IMPORT_C voidGetFontHeightAndAscentL(const TFontSpec &aFontSpec,
TInt &aHeight,
TInt &aAscent
)const

Gets the height (ascent + descent) and ascent of the font specified by aFontSpec, as created using the graphics device map used for drawing (the "image device") and puts them into aHeight and aAscent, after increasing aHeight by the font height increase factor (see SetFontHeightIncreaseFactor()).

Parameters
aFontSpecFont specification.
aHeightOn return, contains the height in pixels of the font.
aAscentOn return, contains the ascent in pixels of the font.

GetHighlightRemnants ( const TRect &, const TDrawTextLayoutContext &, TRect * )

voidGetHighlightRemnants(const TRect &aRect,
const TDrawTextLayoutContext &aDrawTextLayoutContext,
TRect *aRemainderRects
)const

For any rectangle, aRect, which may be extended, calculate the "remainder" rectanges when the view rectangle is intersected with the extended rect and then subtracted. The remainder rectangles are returned via aRemainderRects, which is required to be a pointer to an array of 4 TRect's. aRemainderRects[0] is top remainder, ...[1] is bottom, ...[2] is left, ...[3] is right

GetLineNumber ( TInt )

IMPORT_C TIntGetLineNumber(TIntaDocPos)

GetLineRect ( TInt, TRect & )

IMPORT_C TIntGetLineRect(TIntaYPos,
TRect &aLine
)const

Gets the rectangle enclosing the formatted line that contains or is closest to y coordinate aYPos. If aYPos is above the first formatted line, the rectangle returned is that of the first formatted line. If aYPos is below the last formatted line the rectangle returned is that of the last formatted line. If there is no formatted text, returns CTextLayout::EFNoCurrentFormat.

Parameters
aYPosThe y coordinate of the line of interest.
aLineOn return, contains the rectangle which encloses the line at aYPos.
Return Value
The line width in pixels.

GetLineRectL ( TInt, TInt )

IMPORT_C TRectGetLineRectL(TIntaDocPos1,
TIntaDocPos2
)const

Gets a rectangle enclosing two formatted document positions on the same line. If the second position is less than the first, or on a different line, it is taken to indicate the end of the line. This function panics if either position is unformatted.

Note:

CTextLayout must have been set with a valid wrap width and band height before calling this function, otherwise no formatting will take place and the function will panic. Wrap width and band height values must be > 0 to be valid.

See also: SetBandHeight SetWrapWidth

Parameters
aDocPos1The first document position on the line.
aDocPos2The second document position on the line.
Return Value
The minimal rectangle, which bounds both positions.

GetMinimumSizeL ( TInt, TSize & )

IMPORT_C voidGetMinimumSizeL(TIntaWrapWidth,
TSize &aSize
)

Gets the width and height of the bounding box of the text, including indents and margins, when formatted to the specified wrap width.

This is useful for applications like a web browser that need to determine the minimum width for a piece of text: if you specify zero as the wrap width, the returned aSize.iWidth contains the minimum width that could be used for the text without illegal line breaks, and if you specify KMaxTInt for aWrapWidth, the returned aSize.iHeight contains the minimum height: the height when each paragraph is a single line of unlimited length.
Since
6.0
Parameters
aWrapWidthThe wrap width for the bounding box.
aSizeOn return, contains the width and height of the bounding box.

GetMinimumSizeL ( TInt, TBool, TSize & )

IMPORT_C voidGetMinimumSizeL(TIntaWrapWidth,
TBoolaAllowLegalLineBreaksOnly,
TSize &aSize
)

Gets the width and height of the bounding box of the text, including indents and margins, when formatted to the specified wrap width.

This is useful for applications like a web browser that need to determine the minimum width for a piece of text: if you specify zero as the wrap width, the returned aSize.iWidth contains the minimum width that could be used for the text, and if you specify KMaxTInt for aWrapWidth, the returned aSize.iHeight contains the minimum height: the height when each paragraph is a single line of unlimited length. Use aAllowLegalLineBreaksOnly to set whether or not illegal line breaks should be considered when determining aSize.
Since
6.0
Parameters
aWrapWidthThe wrap width for the bounding box.
aAllowLegalLineBreaksOnlyETrue to only allow legal line breaks, or EFalse to also allow illegal line breaks.
aSizeOn return, contains the width and height of the bounding box.

GetNextVisualCursorPos ( const TTmDocPosSpec &, TTmPosInfo2 &, TBool )

IMPORT_C TBoolGetNextVisualCursorPos(const TTmDocPosSpec &aDocPos,
TTmPosInfo2 &aPosInfo,
TBoolaToLeft
)const

Finds the next cursor position to aDocPos in the visually ordered line.

Parameters
aDocPosContains the document position to check.
aPosInfoOn return, stores information about the document position of the next cursor position, if ETrue is returned.
aToLeftETrue if the position to the left is to be found, or EFalse if the position to the right is to be found.
Return Value
EFalse if there is no formatting, or the position is at the end of the line already. ETrue otherwise.

GetOrigin ( TPoint & )

voidGetOrigin(TPoint &aPoint)const [inline]

GetParagraphRect ( const TTmDocPos &, TRect & )

voidGetParagraphRect(const TTmDocPos &aDocPos,
TRect &aRect
)const

HandleAdditionalCharactersAtEndL ( TInt &, TInt & )

IMPORT_C voidHandleAdditionalCharactersAtEndL(TInt &aFirstPixel,
TInt &aLastPixel
)

Reformats to reflect the addition of one or more complete paragraphs at the end of the text.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aFirstPixelOn return, the top y coordinate of the added material.
aLastPixelOn return, the bottom y coordinate of the added material.

HandleBlockChangeL ( TCursorSelection, TInt, TViewRectChanges &, TBool )

IMPORT_C voidHandleBlockChangeL(TCursorSelectionaSelection,
TIntaOldCharsChanged,
TViewRectChanges &aViewChanges,
TBoolaFormatChanged
)

Reformats to reflect changes to a block of text.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aSelectionThe start and new length of the changed block. When inserting, specify the insertion position. When deleting, specify the position of the start of the deletion. When reformatting, specify the start and length of the reformatted block.
aOldCharsChangedThe old length of the changed block. When inserting, specify zero. When deleting, specify the number of deleted characters. When reformatting, specify the number of reformatted characters.
aViewChangesOn return, contains the top of the reformatted text (iFormattedFrom), the bottom of the reformatted text (iFormattedTo), the amount by which the text above the reformatted text has scrolled (iScrollAtTop) and the amount by which the text below the reformatted text has scrolled (iScrollAtBottom) (positive values mean the text moves down).
aFormatChangedIndicates whether the paragraph format for the first or last affected paragraph has changed, meaning that the text to be reformatted must extend out to paragraph boundaries and cannot be restricted to only some lines.

HandleCharEditL ( TUint, TInt &, TInt &, TInt &, TInt &, TInt &, TBool )

IMPORT_C TBoolHandleCharEditL(TUintaType,
TInt &aCursorPos,
TInt &aGood,
TInt &aFormattedUpTo,
TInt &aFormattedFrom,
TInt &aScroll,
TBoolaFormatChanged
)

Reformats to reflect a single character edit.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aTypeIndicates the type of edit which has taken place. CTextLayout::EFCharacterInsert (the default) for a character insertion, CTextLayout::EFParagraphDelimiter for a paragraph delimiter insertion, CTextLayout::EFLeftDelete or CTextLayout::EFRightDelete for a character or paragraph delimiter deletion to the left or right of the document position.
aCursorPosThe document position at which the edit took place, before the edit. If this position is not formatted, a panic occurs; it is modified in accordance with the edit.
aGoodOn return, the y coordinate of the top of the paragraph following the paragraph which has been edited, before the edit.
aFormattedUpToOn return, the y coordinate of the bottom of the reformatted line or lines, after the edit.
aFormattedFromOn return, the vertical layout coordinate of the top of the reformatted line or lines, after the edit.
aScrollThe number of pixels by which the text had to be scrolled (positive means text moved down).
aFormatChangedETrue if text is to be reformatted from the start of the paragraph the cursor was on before the edit, EFalse if from the start of the line the cursor was on before the edit.
Return Value
EFalse if no more lines need to be reformatted. ETrue if some more lines need to be reformatted.

Highlight ( const TRangeChange &, const TRect &, const TDrawTextLayoutContext * )

IMPORT_C voidHighlight(const TRangeChange &aHighlight,
const TRect &aDrawRect,
const TDrawTextLayoutContext *aDrawTextLayoutContext
)

Sets or clears a highlight.

If the range of characters to highlight is of zero length, the function has no effect.

The function affects only those lines that intersect aDrawRect, which is specified in window coordinates. The drawing parameters, including the graphics context, are given in aDrawTextLayoutContext.

From v7.0, this function replaces InvertRangeL().

This function is not intended to be used to set any part of a highlight already set, nor to clear any piece of text not highlighted. It is intended to do either or both of: clear an existing selection, set a new selection. See the class description for TRangeChange for a code fragment showing how this function should be used.

Parameters
aHighlightSpecifies the range of characters to highlight or from which to remove the highlight.
aDrawRectOnly lines which intersect this rectangle are affected (specified in window coordinates).
aDrawTextLayoutContextProvides a graphics context and other drawing parameters, e.g. the text and background colours for the highlighted region.

HighlightExtensions ( )

const TTmHighlightExtensions &HighlightExtensions()const [inline]

HighlightUsingExtensions ( const CTextLayout::TRangeChange &, const TRangeChange &, const TRect &, const TDrawTextLayoutContext * )

voidHighlightUsingExtensions(const CTextLayout::TRangeChange &aChangeHighlight,
const TRangeChange &aFullHighlight,
const TRect &aDrawRect,
const TDrawTextLayoutContext *aDrawTextLayoutContext
)

InvertRangeL ( const TCursorSelection &, const TRect &, const TDrawTextLayoutContext * )

IMPORT_C voidInvertRangeL(const TCursorSelection &aHighlight,
const TRect &aDrawRect,
const TDrawTextLayoutContext *aDrawTextLayoutContext
)

Toggles the selection highlight for the range of text in aHighlight.

Highlights only those lines that intersect aDrawRect, which is specified in window coordinates. The drawing parameters, including the graphics context, are given in aDrawTextLayoutContext.

In v7.0 and onwards, this function is deprecated -Highlight() should be used instead. Deprecated

Parameters
aHighlightThe range of characters for which to invert the highlighting.
aDrawRectOnly lines which intersect this rectangle are affected; specified in window coordinates.
aDrawTextLayoutContextProvides a graphics context and other drawing parameters.

IsBackgroundFormatting ( )

IMPORT_C TBoolIsBackgroundFormatting()const

Tests whether background formatting is currently taking place. Background formatting is managed by CTextView, using an active object, when the CTextLayout object is owned by a CTextView object.

Not generally useful.

Return Value
ETrue if background formatting is currently taking place. EFalse if not.

IsFormattingBand ( )

IMPORT_C TBoolIsFormattingBand()const

Tests whether band formatting is on, as set by CTextLayout::SetAmountToFormat().

Return Value
ETrue if band formatting is on, EFalse if not.

IsWrapping ( )

IMPORT_C TBoolIsWrapping()const

Tests whether wrapping is on or off.

Return Value
ETrue if wrapping is on, EFalse if off.

MajorVersion ( )

IMPORT_C TIntMajorVersion()const

Return the FORM major version number. This function is not generally useful. It is used in test code and was used while making a transition between this and the former version of FORM. The return value is always 2.

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.

See also: CCoeControl::MakeVisible()

Parameters
aVisibleETrue to make the text visible, EFalse to make it invisible.

MinimumLineDescent ( )

IMPORT_C TIntMinimumLineDescent()const

Returns the minimum line descent in pixels.

Return Value
The minimum line descent in pixels.

NewL ( MLayDoc *, TInt )

IMPORT_C CTextLayout *NewL(MLayDoc *aDoc,
TIntaWrapWidth
)[static]

Allocates and constructs a CTextLayout object. By default, the formatting is set to the entire document (EFFormatAllText).

The text needs to be reformatted after a call to this function.

Parameters
aDocPointer to the MLayDoc implementation that is the source of the text and formatting information. Must not be NULL or a panic occurs.
aWrapWidthThe wrapping width in pixels.
Return Value
Pointer to the new CTextLayout object.

NonPrintingCharsVisibility ( )

IMPORT_C TNonPrintingCharVisibilityNonPrintingCharsVisibility()const

Returns which non-printing characters are drawn using symbols.

Return Value
Indicates which non-printing characters are drawn using symbols.

NotifyTerminateBackgroundFormatting ( )

IMPORT_C voidNotifyTerminateBackgroundFormatting()

CTextView calls this function when background formatting has ended. It allows the CTextLayout object to discard information used only during background formatting.

Not generally useful.

NumFormattedLines ( )

IMPORT_C TIntNumFormattedLines()const

Gets the number of formatted lines.

Return Value
The number of formatted lines in the document.

PageDownL ( TInt &, TInt & )

IMPORT_C voidPageDownL(TInt &aYCursorPos,
TInt &aPixelsScrolled
)

Scrolls down by a page (that is the band height as set by SetBandHeight(), or half that amount if scrolling over lines taller than this), moving the text upwards. The current desired vertical cursor position is passed in aYCursorPos and updated to a new suggested position as near as possible to it, but within the visible text and on a baseline.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aYCursorPosThe current desired vertical cursor position. On return, updated to a new suggested position as near as possible to it.
aPixelsScrolledOn return, contains the number of pixels scrolled - a negative value.

PageUpL ( TInt &, TInt & )

IMPORT_C voidPageUpL(TInt &aYCursorPos,
TInt &aPixelsScrolled
)

Scrolls up by a page (that is the band height as set by SetBandHeight(), or half that amount if scrolling over lines taller than this), moving the text downwards. The current desired vertical cursor position is passed in aYCursorPos and updated to a new suggested position as near as possible to it, but within the visible text and on a baseline.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aYCursorPosThe current desired vertical cursor position. On return, updated to a new suggested position as near as possible to it.
aPixelsScrolledOn return, contains the number of pixels scrolled.

Panic ( TPanicNumber )

voidPanic(TPanicNumberaNumber)[static]

ParagraphHeight ( TInt )

IMPORT_C TIntParagraphHeight(TIntaDocPos)const

Returns the height of the paragraph containing aDocPos. If the paragraph is not formatted, returns zero. If the paragraph is partially formatted, returns the height of the formatted part.

Parameters
aDocPosA document position within the paragraph of interest.
Return Value
The height in pixels of the paragraph. Zero if the paragraph is not formatted.

ParagraphRectL ( TInt )

IMPORT_C TRectParagraphRectL(TIntaDocPos)const

Returns the rectangle enclosing the paragraph containing aDocPos. If the paragraph is not formatted, returns an empty rectangle. If the paragraph is partially formatted, returns the rectangle enclosing the formatted part.

Parameters
aDocPosA document position within the paragraph.
Return Value
The rectangle which encloses the paragraph containing aDocPos.

PictureRectangleAndPosL ( const TPoint &, TRect &, TBool * )

TInt PictureRectangleAndPosL(const TPoint &aXyPos,
TRect &aPictureRect,
TBool *aCanScaleOrCrop = 0
)const

Finds if there is a picture at the position under the point aXyPos. If there is, returns the document position of it, sets the rectangle occupied in aPictureRect, and whether the picture allows scaling in aCanScaleOrCrop, if non-null. Note that aXyPos may be outside the picture found.

Return Value
The document position of the picture found, or KErrNotFound if there is none.

PictureRectangleL ( TInt, TRect &, TBool * )

IMPORT_C TBoolPictureRectangleL(TIntaDocPos,
TRect &aPictureRect,
TBool *aCanScaleOrCrop = 0
)const

Gets the bounding rectangle of the picture, if any, located at the document position or coordinates specified, and returns it in aPictureRect.

If aCanScaleOrCrop is non-null, sets aCanScaleOrCrop to indicate whether the picture can be scaled or cropped. Returns ETrue if the operation was successful. Returns EFalse otherwise; that is, if there is no picture at the position, or if the position is unformatted.

Parameters
aDocPosThe document position of interest.
aPictureRectOn return, contains the rectangle which encloses the picture located at the position specified.
aCanScaleOrCropIf non-NULL and the function returns ETrue, on return, indicates whether the picture can be scaled or cropped. By default, NULL.
Return Value
ETrue if the operation was successful, (i.e. there is a picture character at the position, it has been loaded into memory, and the position is formatted). EFalse if any of these conditions are not met.

PictureRectangleL ( const TPoint &, TRect &, TBool * )

IMPORT_C TBoolPictureRectangleL(const TPoint &aXyPos,
TRect &aPictureRect,
TBool *aCanScaleOrCrop = 0
)const

Gets the bounding rectangle of the picture (if any) at aXyPos and puts it in aPictureRect. If aCanScaleOrCrop is non-null sets *aCanScaleOrCrop to indicate whether the picture can be scaled or cropped. Note that aXyPos may be outside aPictureRect on a successful return, if the picture does not occupy the whole of the section of the line it is in.

Return Value
ETrue if the position is formatted and there is a picture there.

PixelsAboveBand ( )

IMPORT_C TIntPixelsAboveBand()const

Returns the height in pixels of any formatted text above the visible region.

Return Value
The height in pixels of any formatted text above the visible region.

PosInBand ( const TTmDocPos &, TTmLineInfo * )

IMPORT_C TBoolPosInBand(const TTmDocPos &aDocPos,
TTmLineInfo *aLineInfo = 0
)const

Tests whether the document position aDocPos is fully or partially visible. If it is, puts the baseline of the line containing aDocPos into aLineInfo.

Parameters
aDocPosThe document position of interest.
aLineInfoOn return, contains the baseline of the line containing aDocPos.
Return Value
ETrue if the document position aDocPos is fully or partially visible. If so, and if aLineInfo is non-NULL, puts information about the line in aLineInfo. Otherwise, EFalse

PosInBand ( TTmDocPos, TPoint & )

IMPORT_C TBoolPosInBand(TTmDocPosaDocPos,
TPoint &aXyPos
)const

Tests whether the document position aDocPos is fully or partially visible. If it is, puts the y coordinate of the left-hand end of the baseline of the line containing aDocPos into aXyPos.

Parameters
aDocPosThe document position of interest.
aXyPosOn return, contains the y coordinate of the left-hand end of the baseline of the line containing aDocPos.
Return Value
ETrue if the position is visible. EFalse if the position is not visible.

PosInBand ( TInt, TPoint & )

IMPORT_C TBoolPosInBand(TIntaDocPos,
TPoint &aXyPos
)const

Tests whether the document position aDocPos is fully or partially visible. If it is, puts the y coordinate of the left-hand end of the baseline of the line containing aDocPos into aXyPos.

Parameters
aDocPosThe document position of interest.
aXyPosOn return, contains the y coordinate of the left-hand end of the baseline of the line containing aDocPos.
Return Value
ETrue if the position is visible. EFalse if the position is not visible.

PosIsFormatted ( TInt )

IMPORT_C TBoolPosIsFormatted(TIntaDocPos)const

Tests whether the character aDocPos is formatted.

Note:

If a section of text contains characters p to q, it contains document positions p to q + 1; but this function returns ETrue for positions p to q only, so it refers to characters, not positions. However, it will return ETrue for q if q is the end of the document.

Parameters
aDocPosThe document position of interest.
Return Value
ETrue if the character at the document position specified is formatted. EFalse if not.

PosRangeInBand ( TInt & )

IMPORT_C TIntPosRangeInBand(TInt &aDocPos)const

Returns the number of fully or partially visible characters in the visible band.

Parameters
aDocPosOn return, contains the document position of the first fully or partially visible character in the band.
Return Value
The total number of characters in the band.

ReformatVerticalSpaceL ( )

IMPORT_C voidReformatVerticalSpaceL()

Reformats to reflect changes to the space above and below paragraphs (CParaFormat::iSpaceBeforeInTwips and iSpaceAfterInTwips).

Do not use if a Deprecated6.1 Use CTextView object owns this CTextLayout object. FormatBandL()

ResetExternalDraw ( )

voidResetExternalDraw()

RestrictScrollToTopsOfLines ( TBool )

voidRestrictScrollToTopsOfLines(TBoolaRestrict)[inline]

Dangerous function. Makes scroll operations set the top of the screen flush to the top of a line. In general this might scroll the cursor off the screen.

ScrollDocPosIntoViewL ( const TTmDocPos & )

TInt ScrollDocPosIntoViewL(const TTmDocPos &aDocPos)

ScrollLinesL ( TInt &, TAllowDisallow )

IMPORT_C TIntScrollLinesL(TInt &aNumLines,
TAllowDisallowaScrollBlankSpace = EFDisallowScrollingBlankSpace
)

Scrolls the text up or down by aNumLines lines, disallowing blank space at the bottom of the visible area if aScrollBlankSpace is CTextLayout::EFDisallowScrollingBlankSpace.

Do not use if a CTextView object owns this CTextLayout object.

Pre-condition
aLines must not scroll the display beyond the formatted range. If aLines scrolls beyond the formatted range, this method will leave with the error code CTextLayout::EPosNotFormatted
Parameters
aNumLinesThe number of lines to scroll; may be a positive or negative value. On return, contains the number of lines not scrolled; that is, the requested number, minus the number actually scrolled.
aScrollBlankSpaceOnly relevant when scrolling downwards. CTextLayout::EFAllowScrollingBlankSpace allows blank space to scroll into the visible area. CTextLayout::EFDisallowScrollingBlankSpace prevents blank space from scrolling into the visible area.
Return Value
The number of pixels actually scrolled.

ScrollParagraphsL ( TInt &, TAllowDisallow )

IMPORT_C TIntScrollParagraphsL(TInt &aNumParas,
TAllowDisallowaScrollBlankSpace
)

Scrolls the text up or down by aNumParas paragraphs, disallowing blank space at the bottom of the visible area if aScrollBlankSpace is CTextLayout::EFDisallowScrollingBlankSpace.

Do not use if a CTextView object owns this CTextLayout object.

Pre-condition
aPars must not scroll the display beyond the formatted range. If aPars scrolls beyond the formatted range, this method will leave with the error code CTextLayout::EPosNotFormatted
Parameters
aNumParasThe number of paragraphs to scroll; may be a positive or negative value. On return, contains the number of paragraphs not scrolled; that is the difference between the requested number and the number of paragraphs actually scrolled.
aScrollBlankSpaceOnly relevant when scrolling downwards. CTextLayout::EFAllowScrollingBlankSpace allows blank space to scroll into the visible area. CTextLayout::EFDisallowScrollingBlankSpace prevents blank space from scrolling into the visible area.
Return Value
The number of pixels actually scrolled.

SetAmountToFormat ( TAmountFormatted )

IMPORT_C voidSetAmountToFormat(TAmountFormattedaAmountOfFormat = EFFormatBand)

Sets whether to format all the text (if aAmountOfFormat is EFFormatAllText), or just the visible band (if aAmountOfFormat is EFFormatBand). If band formatting is selected, enough text is formatted to fill the visible height.

The text needs to be reformatted after a call to this function.

Parameters
aAmountOfFormatCTextLayout::EFFormatBand (the default) to format the visible text only. CTextLayout::EFFormatAllText to format all the text in the document.

SetBandHeight ( TInt )

IMPORT_C voidSetBandHeight(TIntaHeight)

Sets the height of the band in pixels or twips. This is the height of the visible text, or the view window, and it is also the page height for the purposes of scrolling up and down by page. If the current mode is screen mode (CLayoutData::EFScreenMode) or what-you-see-is-what-you-get mode (CLayoutData::EFWysiwygMode), aHeight is in pixels, otherwise it is in twips.

The text needs to be reformatted after a call to this function.

Note:

A valid band height (>0) must be supplied or the expected amount of formatting will not take place. This could lead to panics when trying to retrieve formatting information that does not exist.

Parameters
aHeightThe band height in pixels or twips.

SetCustomDraw ( const MFormCustomDraw * )

IMPORT_C voidSetCustomDraw(const MFormCustomDraw *aCustomDraw)
Sets the custom drawing object, for customising the way text and its background are drawn.
Since
6.0
Parameters
aCustomDrawPointer to a custom drawing object.

SetCustomInvisibleCharacterRemapper ( MFormCustomInvisibleCharacterRemapper * )

IMPORT_C voidSetCustomInvisibleCharacterRemapper(MFormCustomInvisibleCharacterRemapper *aInvisibleCharacterRemapper)

Allows Form clients to register an invisible character remapper object to customize the visible display of invisible characters such as paragraph marks.

Parameters
aInvisibleCharacterRemapperPointer to custom invisible character remapper to use

SetCustomWrap ( const MFormCustomWrap * )

IMPORT_C voidSetCustomWrap(const MFormCustomWrap *aCustomWrap)

Sets custom line breaking.

If this function is not called, default line breaking behaviour is used.

Ownership of the custom line breaking object is not transferred to this object.

Parameters
aCustomWrapA pointer to an object that implements the custom line breaking interface. Specify NULL to disable custom line breaking.

SetExcessHeightRequired ( TInt )

voidSetExcessHeightRequired(TIntaExcessHeightRequired)

Set the delta required to position the baseline so there is enough space for the highset glyph in pixels. This is the height of the highest glyph - CFont::AscentInPixels(). Only used when using TLineSpacingControl::EAttLineSpacingControl. By default zero.

Parameters
aExcessHeightRequiredExtra height above CFont::AscentInPixels() required for the highest glyph in pixels.

SetExcludePartialLines ( TBool )

IMPORT_C voidSetExcludePartialLines(TBoolaExcludePartialLines = 1)

Specifies whether partially displayed lines (at the top and bottom of the view) are to be prevented from being drawn, and whether the top of the display is to be aligned to the nearest line.

This function takes effect only when the text is next formatted or scrolled.Note:This function was designed for non-editable text in the Agenda application, and there is an important restriction: CTextView functions that reformat the text after editing must not be used while partial lines are excluded; these functions are CTextView::HandleCharEditL(), CTextView::HandleInsertDeleteL() and CTextView::HandleRangeFormatChangeL().

Deprecated7.0

Parameters
aExcludePartialLinesETrue (the default) to exclude partially displayed lines from the view. EFalse to include them.

SetExternalDraw ( const TRect & )

voidSetExternalDraw(const TRect &aRect)

SetFontHeightIncreaseFactor ( TInt )

IMPORT_C voidSetFontHeightIncreaseFactor(TIntaPercentage)

Sets the percentage by which font heights are increased in order to provide automatic extra spacing (leading) between lines. This amount is set to CLayoutData::EFFontHeightIncreaseFactor, which is 7, when a CTextLayout object is created.

The text needs to be reformatted after a call to this function.

Parameters
aPercentageFactor by which to increase font heights.

SetFormatMode ( CLayoutData::TFormatMode, TInt, MGraphicsDeviceMap * )

IMPORT_C voidSetFormatMode(CLayoutData::TFormatModeaFormatMode,
TIntaWrapWidth,
MGraphicsDeviceMap *aFormatDevice
)

Sets the format mode and wrap width and (for certain format modes only) sets the formatting device.

The text needs to be reformatted after a call to this function.

Notes:

If aFormatMode is CLayoutData::EFWysiwygMode or CLayoutData::EFPrintPreviewMode, the format device is set to aFormatDevice, which must not be NULL.

If aFormatMode is CLayoutData::EFScreenMode or CLayoutData::EFPrintMode, aFormatDevice is ignored and should be NULL; the format device is set to the image device.

The wrap width is set in either twips or pixels using the same rule as for SetWrapWidth().

Parameters
aFormatModeThe format mode.
aWrapWidthThe wrap width in pixels or twips.
aFormatDeviceThe formatting device or NULL, depending on the format mode.

SetHighlightExtensions ( TInt, TInt, TInt, TInt )

IMPORT_C voidSetHighlightExtensions(TIntaLeftExtension,
TIntaRightExtension,
TIntaTopExtension,
TIntaBottomExtension
)

Sets offsets for the edges of the selection highlight.

Parameters
aLeftExtensionNumber of pixels to move the left edge of the highlight to the left.
aRightExtensionNumber of pixels to move the right edge of the highlight to the right.
aTopExtensionNumber of pixels to move the top edge of the highlight to up.
aBottomExtensionNumber of pixels to move the bottom edge of the highlight down.

SetImageDeviceMap ( MGraphicsDeviceMap * )

IMPORT_C voidSetImageDeviceMap(MGraphicsDeviceMap *aGd)

Sets the device map used for drawing and formatting. This device map is also used for formatting and drawing paragraph labels unless a separate label device map has been set (see SetLabelsDeviceMap()).

The text needs to be reformatted after a call to this function.

Note:

Although the name of the function suggests that only the image device is set, the formatting device is also set.

Parameters
aGdThe device map used for drawing and formatting.

SetInterfaceProvider ( MFormCustomInterfaceProvider * )

IMPORT_C voidSetInterfaceProvider(MFormCustomInterfaceProvider *aProvider)

This method allows Form clients to register an object able to create or return references to customisation objects used within Form for various tasks e.g. inline text.

Parameters
aProviderReference to interface provider object to register with Formm.

SetLabelsDeviceMap ( MGraphicsDeviceMap * )

IMPORT_C voidSetLabelsDeviceMap(MGraphicsDeviceMap *aDeviceMap)

Sets the device map used for formatting and drawing paragraph labels. If not set, the device map used for labels will be the same as that used for the text.

The text needs to be reformatted after a call to this function.

Parameters
aDeviceMapThe device map used for formatting and drawing paragraph labels.

SetLabelsMarginWidth ( TInt )

IMPORT_C voidSetLabelsMarginWidth(TIntaWidth)

Sets the width in pixels of the margin in which labels are drawn.

The text needs to be reformatted after a call to this function.

Parameters
aWidthThe width in pixels of the labels margin.

SetLayDoc ( MLayDoc * )

IMPORT_C voidSetLayDoc(MLayDoc *aDoc)

Sets the layout object's source text to aDoc.

The text needs to be reformatted after a call to this function.

Parameters
aDocPointer to the MLayDoc implementation that is the source of the text and formatting information. Must not be NULL or a panic occurs.

SetMinimumLineDescent ( TInt )

IMPORT_C voidSetMinimumLineDescent(TIntaPixels)

Sets the minimum line descent in pixels. This amount is set to CLayoutData::EFMinimumLineDescent, which is 3, when a CTextLayout object is created.

The text needs to be reformatted after a call to this function.

Parameters
aPixelsThe minimum line descent in pixels.

SetNonPrintingCharsVisibility ( TNonPrintingCharVisibility )

IMPORT_C voidSetNonPrintingCharsVisibility(TNonPrintingCharVisibilityaVisibility)

Specifies which non-printing characters (e.g. space, paragraph break, etc.) are to be drawn using symbols.

The text needs to be reformatted after a call to this function.(because non-printing characters may differ in width from their visible representations).

Parameters
aVisibilityIndicates which non-printing characters are drawn using symbols.

SetOpaqueLC ( )

voidSetOpaqueLC()

Sets opaque drawing flag for CTextLayout object. It will used later when the content/background has to be drawn. Until the flag is not reseted, the opaque drawing will be used for all the content except the background - the flag has an useful meaning only for transparent editors. A TCleanupItem object will be pushed into the Cleanup Stack, which will reset the opaque flag durring its destruction.

SetReadyToRedraw ( )

voidSetReadyToRedraw()

SetTextViewCursorPos ( TCursorPosition * )

voidSetTextViewCursorPos(TCursorPosition *aPos)

INC092568: CTextView::SetPendingSelection is not honoured Sets the cursor position member added for this fix that allows the text layout object to access any pending selection made by the owning text view object

SetTruncating ( TBool )

IMPORT_C voidSetTruncating(TBoolaOn)

Sets the truncation mode. If truncation is on, lines that exceed the wrap width, either because they have no legal line break, or because wrapping is off, are truncated, and an ellipsis is inserted.

Parameters
aOnIf ETrue, lines which extend beyond the wrap width are truncated with an ellipsis character. If EFalse, no ellipsis is used.

SetTruncatingEllipsis ( TChar )

IMPORT_C voidSetTruncatingEllipsis(TCharaEllipsis)

Sets the ellipsis character to be used if truncation is on. Specify the value 0xFFFF (the illegal Unicode character) if no ellipsis character should be used. By default, the ellipsis character is 0x2026, the ordinary horizontal ellipsis.

Parameters
aEllipsisThe Unicode value of the truncating ellipsis character.

SetViewL ( const TTmDocPos &, TInt &, TViewYPosQualifier, TDiscard )

IMPORT_C TIntSetViewL(const TTmDocPos &aDocPos,
TInt &aYPos,
TViewYPosQualifieraYPosQualifier,
TDiscardaDiscardFormat = EFViewDontDiscardFormat
)

Changes the top of the visible area so that the line containing aDocPos is vertically positioned at aYPos. Which part of the line is set to appear at aYPos (top, baseline, or bottom) is controlled by the TViewYPosQualifier argument, which also specifies whether the visible area is to be filled and whether the line should be made fully visible if possible.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aDocPosA valid document position.
aYPosThe y coordinate at which to display the character at aDocPos. On return, contains the actual vertical position of the specified part of the line.
aYPosQualifierControls which part of the line is set to appear at aYPos.
aDiscardFormatIf ETrue (EFViewDiscardAllFormat), the text is reformatted to include aDocPos, otherwise text is formatted only as necessary when bringing new lines into the visible area.
Return Value
The number of pixels the text was scrolled, may be positive or negative. A value of CTextLayout::EFScrollRedrawWholeScreen indicates that the entire visible area, at least, was scrolled, and so there is no point in blitting text; a full redraw is needed.

SetViewL ( TInt, TInt &, TViewYPosQualifier, TDiscard )

IMPORT_C TIntSetViewL(TIntaDocPos,
TInt &aYPos,
TViewYPosQualifieraYPosQualifier,
TDiscardaDiscardFormat = EFViewDontDiscardFormat
)

This interface is deprecated, and is made available in version 7.0s solely to provide binary compatibility with Symbian OS v6.1. Developers are strongly advised not to make use of this API in new applications. In particular, use the other overload of this function if you need to distinguish between leading and trailing edge positions.

Do not use if a CTextView object owns this CTextLayout object.

Parameters
aDocPosA valid document position.
aYPosThe y coordinate at which to display the character at aDocPos. On return, contains the actual vertical position of the specified part of the line.
aYPosQualifierControls which part of the line is set to appear at aYPos.
aDiscardFormatIf ETrue (EFViewDiscardAllFormat), the text is reformatted to include aDocPos, otherwise text is formatted only as necessary when bringing new lines into the visible area.
Return Value
The number of pixels the text was scrolled, may be positive or negative. A value of CTextLayout::EFScrollRedrawWholeScreen indicates that the entire visible area, at least, was scrolled, and so there is no point in blitting text; a full redraw is needed.

SetWindow ( RWindow * )

voidSetWindow(RWindow *aWnd)

SetWrapWidth ( TInt )

IMPORT_C voidSetWrapWidth(TIntaWrapWidth)

Sets the wrap width. If the current format mode is screen mode (CLayoutData::EFScreenMode) aWrapWidth is in pixels, otherwise it is in twips.

The text needs to be reformatted after a call to this function.

Note:

A valid wrap width (>0) must be supplied or the expected amount of formatting will not take place. This could lead to panics when trying to retrieve formatting information that does not exist.

Parameters
aWrapWidthThe wrap width in pixels or twips.

TagmaTextLayout ( )

const CTmTextLayout &TagmaTextLayout()const [inline]

ToParagraphStart ( TInt & )

IMPORT_C TIntToParagraphStart(TInt &aDocPos)const

Sets aDocPos to the paragraph start and returns the amount by which aDocPos has changed, as a non-negative number.

Parameters
aDocPosA document position. On return, contains the document position of the first character in the paragraph.
Return Value
The number of characters skipped in moving to the new document position.

Truncating ( )

IMPORT_C TBoolTruncating()const

Tests whether truncation is on (as set by SetTruncating()).

Return Value
ETrue if truncation is on, EFalse if not.

TruncatingEllipsis ( )

IMPORT_C TCharTruncatingEllipsis()const

Returns the ellipsis character used when truncation is on. The value 0xFFFF (the illegal Unicode character) means that no ellipsis character is appended to truncated text.

Return Value
The Unicode value of the truncating ellipsis character.

WrapWidth ( )

TInt WrapWidth()const

XyPosToDocPosL ( TPoint &, TUint )

IMPORT_C TIntXyPosToDocPosL(TPoint &aPos,
TUintaFlags = 0
)const

Returns the index of the nearest character in the document to the window coordinates specified. Sets aPos to the actual position of the intersection of the line's baseline with the character's edge. If aPos is before the start of the formatted area, returns the first formatted character; if it is after the end of the formatted area, returns the position after the last formatted character, or the end of the document, whichever is less.

This function is deprecated in v7.0s. Use the more powerful FindXYPos() instead.

Parameters
aPosContains coordinates to convert to a document position. On return, contains the exact coordinates of the intersection of the line's baseline with the character edge at the document position.
aFlagsThree possible values: 0 is the default, and performs the task at full accuracy (the function returns the document position of the character edge nearest to the coordinates). CLayoutData::EFWholeLinesOnly examines lines only and returns the position at the right end of the line if aPos.iX > 0, otherwise the position at the left end.
Return Value
The document position of the nearest character to the coordinates, or of the start or end of the line, depending on the value of aFlags.

YBottomLastFormattedLine ( )

IMPORT_C TIntYBottomLastFormattedLine()const

Returns the y coordinate of the bottom of the last formatted line, relative to the top of the visible region.

Return Value
The y coordinate of the bottom of the last formatted line.