Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: FRMTLAY.H
Link against: form.lib

Class CTextLayout

class CTextLayout : public CBase;

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".

Derivation

Members

Defined in CTextLayout:
AdjustVerticalAlignment(), BandHeight(), CalculateHorizontalExtremesL(), ChangeBandTopL(), CustomDraw(), CustomWrap(), DiscardFormat(), DocPosToXyPosL(), DocumentLength(), DrawBorders(), DrawL(), EBadCharacterEditType, ECharacterNotFormatted, EDrawingBorderError, EFAllParagraphsNotWrapped, EFAllowScrollingBlankSpace, EFCharacterInsert, EFDisallowScrollingBlankSpace, EFFormatAllText, EFFormatBand, EFLeftDelete, EFMaximumLineWidth, EFNoCurrentFormat, EFNotInCurrentFormat, EFParagraphDelimiter, EFParagraphsWrappedByDefault, EFRightDelete, EFScrollOnlyToTopsOfLines, EFScrollRedrawWholeScreen, EFViewDiscardAllFormat, EFViewDontDiscardFormat, EFormatDeviceNotSet, EImageDeviceNotSet, EInvalidDocPos, EInvalidLineNumber, EInvalidRedraw, EMustFormatAllText, ENoCharRangeToFormat, ENoMemory, EPageScrollError, EPixelNotInFormattedLine, EPosNotFormatted, EPrintPreviewModeError, EUnimplemented, ExcludingPartialLines(), ExtendFormattingToCoverPosL(), FindDocPos(), FindXyPos(), FirstCharOnLine(), FirstDocPosFullyInBand(), FirstFormattedPos(), FirstLineInBand(), FontHeightIncreaseFactor(), ForceNoWrapping(), FormatBandL(), FormatCharRangeL(), FormatLineL(), FormatNextLineL(), FormattedHeightInPixels(), FormattedLength(), GetCharacterHeightAndAscentL(), GetCustomInvisibleCharacterRemapper(), GetFontHeightAndAscentL(), GetLineNumber(), GetLineRect(), GetLineRectL(), GetMinimumSizeL(), GetMinimumSizeL(), GetNextVisualCursorPos(), GetOrigin(), HandleAdditionalCharactersAtEndL(), HandleBlockChangeL(), HandleCharEditL(), Highlight(), HighlightExtensions(), InvertRangeL(), IsBackgroundFormatting(), IsFormattingBand(), IsWrapping(), MajorVersion(), MakeVisible(), MinimumLineDescent(), NewL(), NonPrintingCharsVisibility(), NotifyTerminateBackgroundFormatting(), NumFormattedLines(), PageDownL(), PageUpL(), ParagraphHeight(), ParagraphRectL(), PictureRectangleL(), PictureRectangleL(), PixelsAboveBand(), PosInBand(), PosInBand(), PosInBand(), PosIsFormatted(), PosRangeInBand(), ReformatVerticalSpaceL(), RestrictScrollToTopsOfLines(), ScrollLinesL(), ScrollParagraphsL(), SetAmountToFormat(), SetBandHeight(), SetCustomDraw(), SetCustomInvisibleCharacterRemapper(), SetCustomWrap(), SetExcludePartialLines(), SetFontHeightIncreaseFactor(), SetFormatMode(), SetImageDeviceMap(), SetInterfaceProvider(), SetLabelsDeviceMap(), SetLabelsMarginWidth(), SetLayDoc(), SetMinimumLineDescent(), SetNonPrintingCharsVisibility(), SetTruncating(), SetTruncatingEllipsis(), SetViewL(), SetViewL(), SetWrapWidth(), TAllowDisallow, TAmountFormatted, TCurrentFormat, TDiscard, TPanicNumber, TRangeChange, TScrollFlags, TagmaTextLayout(), ToParagraphStart(), Truncating(), TruncatingEllipsis(), XyPosToDocPosL(), YBottomLastFormattedLine(), anonymous, anonymous, anonymous, ~CTextLayout()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

static IMPORT_C CTextLayout *NewL(MLayDoc *aDoc, TInt aWrapWidth);

Description

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

MLayDoc *aDoc

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

TInt aWrapWidth

The wrapping width in pixels.

Return value

CTextLayout *

Pointer to the new CTextLayout object.


~CTextLayout()

IMPORT_C ~CTextLayout();

Description

[Top]


Member functions


DiscardFormat()

IMPORT_C void DiscardFormat();

Description

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.


SetLayDoc()

IMPORT_C void SetLayDoc(MLayDoc *aDoc);

Description

Sets the layout object's source text to aDoc.

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

Parameters

MLayDoc *aDoc

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


SetWrapWidth()

IMPORT_C void SetWrapWidth(TInt aWrapWidth);

Description

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

TInt aWrapWidth

The wrap width in pixels or twips.


SetBandHeight()

IMPORT_C void SetBandHeight(TInt aHeight);

Description

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

TInt aHeight

The band height in pixels or twips.


BandHeight()

IMPORT_C TInt BandHeight() const;

Description

Gets the height of the band in pixels or twips.

Return value

TInt

The height of the band in pixels or twips.


SetImageDeviceMap()

IMPORT_C void SetImageDeviceMap(MGraphicsDeviceMap *aGd);

Description

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

MGraphicsDeviceMap *aGd

The device map used for drawing and formatting.


SetLabelsDeviceMap()

IMPORT_C void SetLabelsDeviceMap(MGraphicsDeviceMap *aDeviceMap);

Description

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

MGraphicsDeviceMap *aDeviceMap

The device map used for formatting and drawing paragraph labels.


SetAmountToFormat()

IMPORT_C void SetAmountToFormat(TAmountFormatted aAmountOfFormat=EFFormatBand);

Description

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

TAmountFormatted aAmountOfFormat

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


IsFormattingBand()

IMPORT_C TBool IsFormattingBand() const;

Description

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

Return value

TBool

ETrue if band formatting is on, EFalse if not.


SetFormatMode()

IMPORT_C void SetFormatMode(CLayoutData::TFormatMode aFormatMode, TInt aWrapWidth, MGraphicsDeviceMap *aFormatDevice);

Description

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

CLayoutData::TFormatMode aFormatMode

The format mode.

TInt aWrapWidth

The wrap width in pixels or twips.

MGraphicsDeviceMap *aFormatDevice

The formatting device or NULL, depending on the format mode.


ForceNoWrapping()

IMPORT_C void ForceNoWrapping(TBool aNoWrapping=EFAllParagraphsNotWrapped);

Description

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

TBool aNoWrapping

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


IsWrapping()

IMPORT_C TBool IsWrapping() const;

Description

Tests whether wrapping is on or off.

Return value

TBool

ETrue if wrapping is on, EFalse if off.


SetTruncating()

IMPORT_C void SetTruncating(TBool aOn);

Description

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

TBool aOn

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


Truncating()

IMPORT_C TBool Truncating() const;

Description

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

Return value

TBool

ETrue if truncation is on, EFalse if not.


SetTruncatingEllipsis()

IMPORT_C void SetTruncatingEllipsis(TChar aEllipsis);

Description

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

TChar aEllipsis

The Unicode value of the truncating ellipsis character.


TruncatingEllipsis()

IMPORT_C TChar TruncatingEllipsis() const;

Description

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

TChar

The Unicode value of the truncating ellipsis character.


SetLabelsMarginWidth()

IMPORT_C void SetLabelsMarginWidth(TInt aWidth);

Description

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

TInt aWidth

The width in pixels of the labels margin.


SetNonPrintingCharsVisibility()

IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility);

Description

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

TNonPrintingCharVisibility aVisibility

Indicates which non-printing characters are drawn using symbols.


NonPrintingCharsVisibility()

IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;

Description

Returns which non-printing characters are drawn using symbols.

Return value

TNonPrintingCharVisibility

Indicates which non-printing characters are drawn using symbols.


IsBackgroundFormatting()

IMPORT_C TBool IsBackgroundFormatting() const;

Description

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

TBool

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


NotifyTerminateBackgroundFormatting()

IMPORT_C void NotifyTerminateBackgroundFormatting();

Description

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.


SetExcludePartialLines()

IMPORT_C void SetExcludePartialLines(TBool aExcludePartialLines=1);

Description

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().

Parameters

TBool aExcludePartialLines

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


ExcludingPartialLines()

IMPORT_C TBool ExcludingPartialLines() const;

Description

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

Return value

TBool

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


SetFontHeightIncreaseFactor()

IMPORT_C void SetFontHeightIncreaseFactor(TInt aPercentage);

Description

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

TInt aPercentage

Factor by which to increase font heights.


FontHeightIncreaseFactor()

IMPORT_C TInt FontHeightIncreaseFactor() const;

Description

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

TInt

Factor by which font heights are increased.


SetMinimumLineDescent()

IMPORT_C void SetMinimumLineDescent(TInt aPixels);

Description

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

TInt aPixels

The minimum line descent in pixels.


MinimumLineDescent()

IMPORT_C TInt MinimumLineDescent() const;

Description

Returns the minimum line descent in pixels.

Return value

TInt

The minimum line descent in pixels.


DocumentLength()

IMPORT_C TInt DocumentLength() const;

Description

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

TInt

The number of characters in the document


ToParagraphStart()

IMPORT_C TInt ToParagraphStart(TInt &aDocPos) const;

Description

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

Parameters

TInt &aDocPos

A document position. On return, contains the document position of the first character in the paragraph.

Return value

TInt

The number of characters skipped in moving to the new document position.


PixelsAboveBand()

IMPORT_C TInt PixelsAboveBand() const;

Description

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

Return value

TInt

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


YBottomLastFormattedLine()

IMPORT_C TInt YBottomLastFormattedLine() const;

Description

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

Return value

TInt

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


FormattedHeightInPixels()

IMPORT_C TInt FormattedHeightInPixels() const;

Description

Returns the height in pixels of the formatted text.

Return value

TInt

The height in pixels of all the formatted text.


PosRangeInBand()

IMPORT_C TInt PosRangeInBand(TInt &aDocPos) const;

Description

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

Parameters

TInt &aDocPos

On return, contains the document position of the first fully or partially visible character in the band.

Return value

TInt

The total number of characters in the band.


PosInBand()

IMPORT_C TBool PosInBand(const TTmDocPos &aDocPos, TTmLineInfo *aLineInfo=0) const;

Description

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

const TTmDocPos &aDocPos

The document position of interest.

TTmLineInfo *aLineInfo

On return, contains the baseline of the line containing aDocPos.

Return value

TBool

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()

IMPORT_C TBool PosInBand(TTmDocPos aDocPos, TPoint &aXyPos) const;

Description

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

TTmDocPos aDocPos

The document position of interest.

TPoint &aXyPos

On return, contains the y coordinate of the left-hand end of the baseline of the line containing aDocPos.

Return value

TBool

ETrue if the position is visible. EFalse if the position is not visible.


PosInBand()

IMPORT_C TBool PosInBand(TInt aDocPos, TPoint &aXyPos) const;

Description

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

TInt aDocPos

The document position of interest.

TPoint &aXyPos

On return, contains the y coordinate of the left-hand end of the baseline of the line containing aDocPos.

Return value

TBool

ETrue if the position is visible. EFalse if the position is not visible.


PosIsFormatted()

IMPORT_C TBool PosIsFormatted(TInt aDocPos) const;

Description

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

TInt aDocPos

The document position of interest.

Return value

TBool

ETrue if the character at the document position specified is formatted. EFalse if not.


FirstCharOnLine()

IMPORT_C TInt FirstCharOnLine(TInt aLineNo) const;

Description

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

TInt aLineNo

Line number in formatted text, counting the first line as line one.

Return value

TInt

The document position of the first character on the line.


FormattedLength()

IMPORT_C TInt FormattedLength() const;

Description

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

TInt

The number of formatted characters in the document.


FirstFormattedPos()

IMPORT_C TInt FirstFormattedPos() const;

Description

Returns the document position of the first formatted character.

Return value

TInt

The document position of the first formatted character.


NumFormattedLines()

IMPORT_C TInt NumFormattedLines() const;

Description

Gets the number of formatted lines.

Return value

TInt

The number of formatted lines in the document.


FirstLineInBand()

IMPORT_C TInt FirstLineInBand() const;

Description

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

Return value

TInt

The line number of the first fully visible line.


GetLineRect()

IMPORT_C TInt GetLineRect(TInt aYPos, TRect &aLine) const;

Description

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

TInt aYPos

The y coordinate of the line of interest.

TRect &aLine

On return, contains the rectangle which encloses the line at aYPos.

Return value

TInt

The line width in pixels.


ParagraphHeight()

IMPORT_C TInt ParagraphHeight(TInt aDocPos) const;

Description

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

TInt aDocPos

A document position within the paragraph of interest.

Return value

TInt

The height in pixels of the paragraph. Zero if the paragraph is not formatted.


ParagraphRectL()

IMPORT_C TRect ParagraphRectL(TInt aDocPos) const;

Description

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

TInt aDocPos

A document position within the paragraph.

Return value

TRect

The rectangle which encloses the paragraph containing aDocPos.


CalculateHorizontalExtremesL()

IMPORT_C TBool CalculateHorizontalExtremesL(TInt &aLeftX, TInt &aRightX, TBool aOnlyVisibleLines, TBool aIgnoreWrapCharacters=0) const;

Description

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

Parameters

TInt &aLeftX

On return, contains the x coordinate of the leftmost point of the formatted text.

TInt &aRightX

On return, contains the x coordinate of the rightmost point of the formatted text.

TBool aOnlyVisibleLines

If ETrue, only scans partially or fully visible lines. If EFalse, scans all the formatted text.

TBool aIgnoreWrapCharacters

If ETrue, does not include wrap characters in the measurement (paragraph delimiters, forced line breaks, etc.). If EFalse, includes them.

Return value

TBool

EFalse if there is no formatted text, otherwise ETrue.


GetCharacterHeightAndAscentL()

IMPORT_C void GetCharacterHeightAndAscentL(TInt aDocPos, TInt &aHeight, TInt &aAscent) const;

Description

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

TInt aDocPos

A document position.

TInt &aHeight

On return contains the height in pixels of the character at aDocPos.

TInt &aAscent

On return, contains the ascent in pixels of the character at aDocPos.


GetFontHeightAndAscentL()

IMPORT_C void GetFontHeightAndAscentL(const TFontSpec &aFontSpec, TInt &aHeight, TInt &aAscent) const;

Description

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

const TFontSpec &aFontSpec

Font specification.

TInt &aHeight

On return, contains the height in pixels of the font.

TInt &aAscent

On return, contains the ascent in pixels of the font.


XyPosToDocPosL()

IMPORT_C TInt XyPosToDocPosL(TPoint &aPos, TUint aFlags=0) const;

Description

Returns the document position of the nearest character edge to aPos. 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

TPoint &aPos

Contains 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.

TUint aFlags

Three 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

TInt

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.


DocPosToXyPosL()

IMPORT_C TBool DocPosToXyPosL(TInt aDocPos, TPoint &aPos, TUint aFlags=0) const;

Description

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

TInt aDocPos

The document position.

TPoint &aPos

On return, contains the x-y coordinates of aDocPos.

TUint aFlags

Two 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

TBool

ETrue if the document position is formatted, EFalse if not.


FindXyPos()

IMPORT_C TBool FindXyPos(const TPoint &aXyPos, TTmPosInfo2 &aPosInfo, TTmLineInfo *aLineInfo=0) const;

Description

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

const TPoint &aXyPos

Contains coordinates to convert to a document position.

TTmPosInfo2 &aPosInfo

Buffer to store information about the document position if the specified coordinates are located in the formatted text.

TTmLineInfo *aLineInfo

Buffer to store information about the line if the specified coordinates are located in the formatted text.

Return value

TBool

ETrue if aXyPos is a formatted position, otherwise EFalse.


FindDocPos()

IMPORT_C TBool FindDocPos(const TTmDocPosSpec &aDocPos, TTmPosInfo2 &aPosInfo, TTmLineInfo *aLineInfo=0) const;

Description

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

const TTmDocPosSpec &aDocPos

Contains the document position to check.

TTmPosInfo2 &aPosInfo

On return, stores information about the document position if the position is formatted.

TTmLineInfo *aLineInfo

Buffer to store the line information if the document position is formatted.

Return value

TBool

ETrue if aDocPos is in the formatted text, otherwise EFalse.


GetLineRectL()

IMPORT_C TRect GetLineRectL(TInt aDocPos1, TInt aDocPos2) const;

Description

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.

Parameters

TInt aDocPos1

The first document position on the line.

TInt aDocPos2

The second document position on the line.

Return value

TRect

The minimal rectangle, which bounds both positions.


PictureRectangleL()

IMPORT_C TBool PictureRectangleL(TInt aDocPos, TRect &aPictureRect, TBool *aCanScaleOrCrop=0) const;

Description

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

TInt aDocPos

The document position of interest.

TRect &aPictureRect

On return, contains the rectangle which encloses the picture located at the position specified.

TBool *aCanScaleOrCrop

If non-NULL and the function returns ETrue, on return, indicates whether the picture can be scaled or cropped. By default, NULL.

Return value

TBool

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()

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

Description

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.

Parameters

const TPoint &aXyPos

TRect &aPictureRect

TBool *aCanScaleOrCrop

Return value

TBool

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


FirstDocPosFullyInBand()

IMPORT_C TInt FirstDocPosFullyInBand() const;

Description

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

TInt

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


GetMinimumSizeL()

IMPORT_C void GetMinimumSizeL(TInt aWrapWidth, TSize &aSize);

Description

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.

Parameters

TInt aWrapWidth

The wrap width for the bounding box.

TSize &aSize

On return, contains the width and height of the bounding box.


GetMinimumSizeL()

IMPORT_C void GetMinimumSizeL(TInt aWrapWidth, TBool aAllowLegalLineBreaksOnly, TSize &aSize);

Description

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.

Parameters

TInt aWrapWidth

The wrap width for the bounding box.

TBool aAllowLegalLineBreaksOnly

ETrue to only allow legal line breaks, or EFalse to also allow illegal line breaks.

TSize &aSize

On return, contains the width and height of the bounding box.


MajorVersion()

IMPORT_C TInt MajorVersion() const;

Description

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.

Return value

TInt


SetViewL()

IMPORT_C TInt SetViewL(const TTmDocPos &aDocPos, TInt &aYPos, TViewYPosQualifier aYPosQualifier, TDiscard aDiscardFormat=EFViewDontDiscardFormat);

Description

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

const TTmDocPos &aDocPos

A valid document position.

TInt &aYPos

The y coordinate at which to display the character at aDocPos. On return, contains the actual vertical position of the specified part of the line.

TViewYPosQualifier aYPosQualifier

Controls which part of the line is set to appear at aYPos.

TDiscard aDiscardFormat

If 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

TInt

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()

IMPORT_C TInt SetViewL(TInt aDocPos, TInt &aYPos, TViewYPosQualifier aYPosQualifier, TDiscard aDiscardFormat=EFViewDontDiscardFormat);

Description

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

TInt aDocPos

A valid document position.

TInt &aYPos

The y coordinate at which to display the character at aDocPos. On return, contains the actual vertical position of the specified part of the line.

TViewYPosQualifier aYPosQualifier

Controls which part of the line is set to appear at aYPos.

TDiscard aDiscardFormat

If 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

TInt

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.


FormatBandL()

IMPORT_C void FormatBandL();

Description

Formats enough text to fill the visible band.

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


FormatCharRangeL()

IMPORT_C void FormatCharRangeL(TInt aStartDocPos, TInt aEndDocPos);

Description

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

TInt aStartDocPos

A document position within the paragraph from which to begin formatting.

TInt aEndDocPos

Document position at which to end formatting.


FormatNextLineL()

IMPORT_C TBool FormatNextLineL(TInt &aBotPixel);

Description

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

TInt &aBotPixel

On entry, contains the y coordinate of the bottom of the formatted text; this is updated by the function.

Return value

TBool

ETrue if there is more formatting to do. EFalse if not.


FormatLineL()

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

Description

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

CParaFormat *aParaFormat

Contains paragraph formatting.

TInt &aDocPos

A document position. On return, contains the document position of the end of the line.

TInt &aHeight

On return, contains the height of the formatted line containing aDocPos.

TBool &aPageBreak

On return, ETrue if the last character on the line is a page break. EFalse if not.

Return value

TBool

ETrue if the line is not the last line in the paragraph. EFalse if it is the last line.


ScrollParagraphsL()

IMPORT_C TInt ScrollParagraphsL(TInt &aNumParas, TAllowDisallow aScrollBlankSpace);

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

Description

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.

Parameters

TInt &aNumParas

The 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.

TAllowDisallow aScrollBlankSpace

Only 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

TInt

The number of pixels actually scrolled.


ScrollLinesL()

IMPORT_C TInt ScrollLinesL(TInt &aNumLines, TAllowDisallow aScrollBlankSpace=EFDisallowScrollingBlankSpace);

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

Description

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.

Parameters

TInt &aNumLines

The 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.

TAllowDisallow aScrollBlankSpace

Only 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

TInt

The number of pixels actually scrolled.


ChangeBandTopL()

IMPORT_C TInt ChangeBandTopL(TInt &aPixels, TAllowDisallow aScrollBlankSpace=EFDisallowScrollingBlankSpace);

Description

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

TInt &aPixels

The number of pixels to scroll; may be a positive or negative value. On return, contains the number of pixels actually scrolled.

TAllowDisallow aScrollBlankSpace

Only 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

TInt

The difference between the requested number of pixels to scroll and the number of pixels actually scrolled.


PageUpL()

IMPORT_C void PageUpL(TInt &aYCursorPos, TInt &aPixelsScrolled);

Description

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

TInt &aYCursorPos

The current desired vertical cursor position. On return, updated to a new suggested position as near as possible to it.

TInt &aPixelsScrolled

On return, contains the number of pixels scrolled.


PageDownL()

IMPORT_C void PageDownL(TInt &aYCursorPos, TInt &aPixelsScrolled);

Description

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

TInt &aYCursorPos

The current desired vertical cursor position. On return, updated to a new suggested position as near as possible to it.

TInt &aPixelsScrolled

On return, contains the number of pixels scrolled - a negative value.


HandleCharEditL()

IMPORT_C TBool HandleCharEditL(TUint aType, TInt &aCursorPos, TInt &aGood, TInt &aFormattedUpTo, TInt &aFormattedFrom, TInt &aScroll, TBool aFormatChanged);

Description

Reformats to reflect a single character edit.

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

Parameters

TUint aType

Indicates 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.

TInt &aCursorPos

The 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.

TInt &aGood

On return, the y coordinate of the top of the paragraph following the paragraph which has been edited, before the edit.

TInt &aFormattedUpTo

On return, the y coordinate of the bottom of the reformatted line or lines, after the edit.

TInt &aFormattedFrom

On return, the vertical layout coordinate of the top of the reformatted line or lines, after the edit.

TInt &aScroll

The number of pixels by which the text had to be scrolled (positive means text moved down).

TBool aFormatChanged

ETrue 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

TBool

EFalse if no more lines need to be reformatted. ETrue if some more lines need to be reformatted.


HandleBlockChangeL()

IMPORT_C void HandleBlockChangeL(TCursorSelection aSelection, TInt aOldCharsChanged, TViewRectChanges &aViewChanges, TBool aFormatChanged);

Description

Reformats to reflect changes to a block of text.

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

Parameters

TCursorSelection aSelection

The 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.

TInt aOldCharsChanged

The 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.

TViewRectChanges &aViewChanges

On 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).

TBool aFormatChanged

Indicates 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.


HandleAdditionalCharactersAtEndL()

IMPORT_C void HandleAdditionalCharactersAtEndL(TInt &aFirstPixel, TInt &aLastPixel);

Description

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

TInt &aFirstPixel

On return, the top y coordinate of the added material.

TInt &aLastPixel

On return, the bottom y coordinate of the added material.


ReformatVerticalSpaceL()

IMPORT_C void ReformatVerticalSpaceL();

Description

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

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


AdjustVerticalAlignment()

IMPORT_C void AdjustVerticalAlignment(CParaFormat::TAlignment aVerticalAlignment);

Description

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

CParaFormat::TAlignment aVerticalAlignment

Specifies 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).


DrawBorders()

static IMPORT_C void DrawBorders(const MGraphicsDeviceMap *aGd, CGraphicsContext &aGc, const TRect &aRect, const TParaBorderArray &aBorder, const TRgb *aBackground=0, TRegion *aClipRegion=0,const TRect *aDrawRect=0);

Description

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

const MGraphicsDeviceMap *aGd

Provides twip-to-pixel conversion.

CGraphicsContext &aGc

Graphics 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.

const TRect &aRect

The outer bounds of the border.

const TParaBorderArray &aBorder

Specifies the four sides of the border.

const TRgb *aBackground

If not null, the background colour, (used between double border lines, or between dots or dashes).

TRegion *aClipRegion

If non-null, specifies a clip region.

const TRect *aDrawRect

If non-null, and if aClipRegion is non-null, specifies a rectangle to be subtracted from the clip region.


DrawL()

IMPORT_C void DrawL(const TRect &aDrawRect, const TDrawTextLayoutContext *aDrawTextLayoutContext, const TCursorSelection *aHighlight=0);

Description

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

const TRect &aDrawRect

The function draw the lines within the visible area, which intersect this rectangle (which is specified in window coordinates).

const TDrawTextLayoutContext *aDrawTextLayoutContext

Provides a graphics context and other parameters for the function.

const TCursorSelection *aHighlight

If not NULL, this range of text is drawn highlighted.


GetNextVisualCursorPos()

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

Description

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

Parameters

const TTmDocPosSpec &aDocPos

Contains the document position to check.

TTmPosInfo2 &aPosInfo

On return, stores information about the document position of the next cursor position, if ETrue is returned.

TBool aToLeft

ETrue if the position to the left is to be found, or EFalse if the position to the right is to be found.

Return value

TBool

EFalse if there is no formatting, or the position is at the end of the line already. ETrue otherwise.


InvertRangeL()

IMPORT_C void InvertRangeL(const TCursorSelection &aHighlight, const TRect &aDrawRect, const TDrawTextLayoutContext *aDrawTextLayoutContext);

Description

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.

Parameters

const TCursorSelection &aHighlight

The range of characters for which to invert the highlighting.

const TRect &aDrawRect

Only lines which intersect this rectangle are affected; specified in window coordinates.

const TDrawTextLayoutContext *aDrawTextLayoutContext

Provides a graphics context and other drawing parameters.


Highlight()

IMPORT_C void Highlight(const TRangeChange &aHighlight, const TRect &aDrawRect, const TDrawTextLayoutContext *aDrawTextLayoutContext);

Description

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

const TRangeChange &aHighlight

Specifies the range of characters to highlight or from which to remove the highlight.

const TRect &aDrawRect

Only lines which intersect this rectangle are affected (specified in window coordinates).

const TDrawTextLayoutContext *aDrawTextLayoutContext

Provides a graphics context and other drawing parameters, e.g. the text and background colours for the highlighted region.


SetCustomDraw()

IMPORT_C void SetCustomDraw(const MFormCustomDraw *aCustomDraw);

Description

Sets the custom drawing object, for customising the way text and its background are drawn.

Parameters

const MFormCustomDraw *aCustomDraw

Pointer to a custom drawing object.


CustomDraw()

IMPORT_C const MFormCustomDraw *CustomDraw() const;

Description

Returns a pointer to the current custom drawing implementation. Returns NULL if custom drawing is not in force.

Return value

const MFormCustomDraw *

Pointer to the custom drawing object.


SetCustomWrap()

IMPORT_C void SetCustomWrap(const MFormCustomWrap *aCustomWrap);

Description

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

const MFormCustomWrap *aCustomWrap

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


CustomWrap()

IMPORT_C const MFormCustomWrap *CustomWrap() const;

Description

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

Return value

const MFormCustomWrap *

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


ExtendFormattingToCoverPosL()

IMPORT_C void ExtendFormattingToCoverPosL(TInt aDocPos);

Pre-Condition

aDocPos is in the range 0...DocumentLength

Description

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.

Post-Condition

aDocPos has been formatted

Parameters

TInt aDocPos

Position 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.


GetLineNumber()

IMPORT_C TInt GetLineNumber(TInt aDocPos);

Description

Parameters

TInt aDocPos

Return value

TInt


SetInterfaceProvider()

IMPORT_C void SetInterfaceProvider(MFormCustomInterfaceProvider *aProvider);

Description

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

MFormCustomInterfaceProvider *aProvider

Reference to interface provider object to register with Formm.


TagmaTextLayout()

inline const CTmTextLayout &TagmaTextLayout() const;

Description

Return value

const CTmTextLayout &


GetOrigin()

inline void GetOrigin(TPoint &aPoint) const;

Description

Parameters

TPoint &aPoint


RestrictScrollToTopsOfLines()

inline void RestrictScrollToTopsOfLines(TBool aRestrict);

Description

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.

Parameters

TBool aRestrict


HighlightExtensions()

inline const TTmHighlightExtensions &HighlightExtensions() const;

Description

Return value

const TTmHighlightExtensions &


SetCustomInvisibleCharacterRemapper()

IMPORT_C void SetCustomInvisibleCharacterRemapper(MFormCustomInvisibleCharacterRemapper *aInvisibleCharacterRemapper);

Description

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

Parameters

MFormCustomInvisibleCharacterRemapper *aInvisibleCharacterRemapper

Pointer to custom invisible character remapper to use


GetCustomInvisibleCharacterRemapper()

IMPORT_C MFormCustomInvisibleCharacterRemapper *GetCustomInvisibleCharacterRemapper();

Description

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

Return value

MFormCustomInvisibleCharacterRemapper *


MakeVisible()

IMPORT_C void MakeVisible(TBool aVisible);

Description

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

ETrue to make the text visible, EFalse to make it invisible.

[Top]


Member classes


Class TRangeChange

class TRangeChange;

Description

Specifies the range of characters involved when setting or clearing a text selection.

This class is used in the CTextLayout::Highlight() function. The following code demonstrates how it should be used to clear an existing highlight and set a new one:

    CTextLayout::TRangeChange oldHighlight(anchorPos, old_cursorPos,
    CTextLayout::TRangeChange::EClear); // existing highlight
    CTextLayout::TRangeChange newHighlight(anchorPos, new_cursorPos,
    CTextLayout::TRangeChange::ESet); // new one
    newHighlight.OptimizeWith(oldHighlight); // doesn't matter which range is
    the parameter and which is the calling object
    layout.Highlight(oldHighlight,drawRect,context); // doesn't matter in which
    order this and following line occur
    layout.Highlight(newHighlight,drawRect,context);

Members

Defined in CTextLayout::TRangeChange:
Clip(), EClear, ESet, Get(), NonNull(), OptimizeWith(), Set(), TChangeType, TRangeChange(), TRangeChange()

See also:

Construction and destruction


TRangeChange()

IMPORT_C TRangeChange(TInt aStart, TInt aEnd, TChangeType aChange);

Description

Constructor with a start and end position and whether the highlighting in the range should be set or cleared.

The start and end positions can be specified in any order.

Parameters

TInt aStart

The start position.

TInt aEnd

The end position.

TChangeType aChange

Specifies whether the highlighting should be set or cleared.


TRangeChange()

IMPORT_C TRangeChange();

Description

Default constructor.

The start and end positions are set to zero - Set() should be called to initialise the object.

Member functions


Set()

IMPORT_C void Set(TInt aStart, TInt aEnd, TChangeType aChange);

Description

Sets the start and end positions and whether the highlighting should be set or cleared.

Called by the non-default constructor. The start and end positions can be specified in any order.

Parameters

TInt aStart

The start of the range.

TInt aEnd

The end of the range.

TChangeType aChange

Whether the highlighting should be set or cleared.


Get()

IMPORT_C TChangeType Get(TInt &aStart, TInt &aEnd) const;

Description

Gets the start and end of the range and whether the highlighting should be set or cleared.

Parameters

TInt &aStart

On return, the start of the range. This is always the lesser of the two positions.

TInt &aEnd

On return, the end of the range. This is always the greater of the two positions.

Return value

TChangeType

Specifies whether the highlighting should be set or cleared.


OptimizeWith()

IMPORT_C void OptimizeWith(TRangeChange &aBuddy);

Description

Try to cancel out sections of the ranges that overlap Merges two ranges of characters.

Two successive calls to CTextLayout::Highlight() could cause unecessary flicker or redrawing if the arguments to each call overlap. For example, if extending a highlight involved removing the old highlight and then drawing the new one, this would cause visible flicker. This can be eliminated by calling this function to remove any overlap between the two ranges. If there is overlap, this range is set to the result of the merge, and the other range (aBuddy) is set to zero.

When calling this function, it does not matter whether or not the two ranges overlap. Also it does not matter which range is the parameter and which is the calling object. After calling OptimizeWith(), it is guaranteed that the resulting ranges will not overlap, and they will represent the same change to the highlight as the original two ranges.

See the code fragment in the class description for TRangeChange for an example of how this function is used.

Parameters

TRangeChange &aBuddy

The range of characters to combine with this range.


NonNull()

IMPORT_C TBool NonNull() const;

Description

Tests whether the range is not null.

Return value

TBool

ETrue if the range is not of zero length, EFalse if the range is of zero length.


Clip()

IMPORT_C TBool Clip(TInt aMin, TInt aMax);

Description

Clips the range so that its start and end positions are within the minimum and maximum positions specified.

Parameters

TInt aMin

The minimum value for the start and end of the range.

TInt aMax

The maximum value for the start and end of the range.

Return value

TBool

ETrue if the resulting range is not of zero length, EFalse if it is of zero length.

Member enumerations


Enum TChangeType

TChangeType

Description

Enumerates the possible change types.

ESet

The object is being used to set a range.

EClear

The object is being used to clear a range.

[Top]


Member enumerations


Enum TDiscard

TDiscard

Description

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

EFViewDiscardAllFormat

Discard all formatting; redraw.

EFViewDontDiscardFormat

Do not discard all formatting; redraw.


Enum TAllowDisallow

TAllowDisallow

Description

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

EFAllowScrollingBlankSpace

Allow blank space to scroll.

EFDisallowScrollingBlankSpace

Disallow blank space from scrolling.


Enum anonymous

n/a

Description

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

n/a

Description

EFScrollRedrawWholeScreen

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.

EFMaximumLineWidth

The maximum line width when wrapping is unset.


Enum anonymous

n/a

Description

EFAllParagraphsNotWrapped

Wrapping off; overrides the paragraph format.

EFParagraphsWrappedByDefault

Wrapping on, unless CParaFormat::iWrap is false.


Enum TAmountFormatted

TAmountFormatted

Description

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

EFFormatAllText

Format the whole document.

EFFormatBand

Format the visible band only.


Enum TScrollFlags

TScrollFlags

Description

EFScrollOnlyToTopsOfLines


Enum TCurrentFormat

TCurrentFormat

Description

Formatting information.

EFNoCurrentFormat

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

EFNotInCurrentFormat

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


Enum TPanicNumber

TPanicNumber

Description

EUnimplemented

ENoMemory

EDrawingBorderError

EFormatDeviceNotSet

EImageDeviceNotSet

EPixelNotInFormattedLine

EInvalidDocPos

ENoCharRangeToFormat

ECharacterNotFormatted

EPrintPreviewModeError

EBadCharacterEditType

EInvalidLineNumber

EPosNotFormatted

EMustFormatAllText

EPageScrollError

EInvalidRedraw