williamr@4: /* williamr@4: * Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: williamr@4: * The main header file for TAGMA, the low-level text formatting engine for EPOC. williamr@4: * 'Tm' stands for 'TAGMA' and is the standard prefix for TAGMA classes, after williamr@4: * the C, T, or whatever. williamr@4: * williamr@4: */ williamr@2: williamr@2: williamr@2: #ifndef __TAGMA_H__ williamr@2: #define __TAGMA_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // forward declarations williamr@2: class TTmLineInfo; williamr@2: class CTmTextImp; williamr@2: class RWindow; williamr@2: class RWsSession; williamr@2: class RParagraphStyleInfo; williamr@2: class CStyleList; williamr@2: class TTmDocPosSpec; williamr@2: class TTmDocPos; williamr@2: class TCursorSelection; williamr@2: class TTmHighlightExtensions; williamr@2: class TBidirectionalContext; williamr@4: class TTmLineInfo; williamr@4: class CTmTextLayout; williamr@2: williamr@2: /** williamr@2: A character format; all dimensions are in twips. A character format object williamr@2: stores all text style attributes that can differ from any one character to the williamr@2: next. Attributes that affect an entire paragraph only are kept in RTmParFormat williamr@2: objects. williamr@4: The class should only be used internally by FORM component. williamr@2: @internalComponent williamr@2: */ williamr@2: class TTmCharFormat williamr@2: { williamr@2: public: williamr@2: /** Bit assignments for effects */ williamr@2: enum williamr@2: { williamr@2: EBackground = 1, ///< Text background is drawn in the background colour williamr@2: ERounded = 2, ///< Text background (if any) has rounded corners williamr@2: EUnderline = 4, ///< Text is underlined williamr@2: EStrikethrough = 8, ///< Text is struck through with a horizontal line. williamr@2: EShadow = 16, ///< Text has a drop shadow. williamr@2: /** Bits 24-31 are reserved for styles defined by the custom drawer. */ williamr@2: EUserDefinedMask = 0xFF000000, williamr@2: /** Shift TCharFormat highlight styles left by this to get the williamr@2: TTmCharFormat effects portion. */ williamr@2: EUserDefinedShift = 24, williamr@2: /** For custom drawers: draw whatever is wanted for "no matches" in the FEP. */ williamr@2: ENoMatchesIndicator = 0x4000000, williamr@2: /** Reset if the effect in bits 24-30 is defined defined by Symbian, williamr@2: set if it is defined externally. */ williamr@2: ECustomDrawEffectIsExternallyDefined = 0x80000000 williamr@2: }; williamr@2: williamr@2: /** Picture alignment */ williamr@2: enum TPictureAlignment williamr@2: { williamr@2: EPictureAlignBaseline, williamr@2: EPictureAlignTop, williamr@2: EPictureAlignBottom, williamr@2: EPictureAlignCenter williamr@2: }; williamr@2: williamr@2: IMPORT_C TTmCharFormat(); williamr@2: IMPORT_C TTmCharFormat(const TDesC& aFontName,TInt aFontHeight); williamr@2: IMPORT_C void operator=(const TCharFormat& aFormat); williamr@2: inline TTmCharFormat(const TCharFormat& aFormat); williamr@2: IMPORT_C void GetTCharFormat(TCharFormat& aFormat) const; williamr@2: IMPORT_C TBool operator==(const TTmCharFormat& aFormat) const; williamr@2: inline TBool operator!=(const TTmCharFormat& aFormat) const; williamr@2: williamr@2: TOpenFontSpec iFontSpec; williamr@2: TLogicalRgb iTextColor; williamr@2: TLogicalRgb iBackgroundColor; // used only when EBackground flag is set in iEffects williamr@2: TUint iEffects; // bit flags as defined above; williamr@2: // note that effects NEVER change character metrics and so can williamr@2: // be ignored when measuring text williamr@2: TUint iLanguage; // language used for proofing williamr@2: TPictureAlignment iPictureAlignment;// vertical alignment of embedded objects williamr@2: TUint iTag; // tag for use by URL parsers, etc.; a way of marking a range of williamr@2: // text without using any typographic attributes williamr@2: }; williamr@2: williamr@2: /** williamr@2: The text customization interface. You can customize the colors, word williamr@2: spacing, line breaking, line height calculation, background drawing, and text williamr@2: appearance, of a text object by supplying an implementation of the MTmCustom williamr@2: class, either directly (as in CTmText::CustomizeL, which takes a pointer to williamr@2: MTmCustom) or indirectly, making use of the fact that MTmSource is derived from williamr@2: MTmCustom (as in CTmTextLayout::SetTextL, which takes a reference to williamr@2: MTmSource). williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class MTmCustom williamr@2: : public MLineBreaker williamr@2: { williamr@2: public: williamr@2: /** williamr@2: TLineHeightParam structure is used in MTmCustom::SetLineHeight() method to set williamr@2: text line height related parameters such as max character height, max ascent and descent, williamr@2: height and depth of the tallest pictures (top-aligned, bottom-aligned or centered). williamr@2: @see MTmCustom::SetLineHeight() williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TLineHeightParam williamr@2: { williamr@2: public: williamr@2: inline TLineHeightParam(); williamr@2: /** Height of the highest character in the line. */ williamr@2: TInt iMaxCharHeight; williamr@2: /** Depth of the deepest character in the line. */ williamr@2: TInt iMaxCharDepth; williamr@2: /** Height plus depth of the tallest top-aligned picture. */ williamr@2: TInt iMaxTopPictureHeight; williamr@2: /** Height plus depth of the tallest bottom-aligned picture. */ williamr@2: TInt iMaxBottomPictureHeight; williamr@2: /** Height plus depth of the tallest centred picture. */ williamr@2: TInt iMaxCenterPictureHeight; williamr@2: /** Height of the tallest character of any in the fonts in the line. */ williamr@2: TInt iFontMaxCharHeight; williamr@2: /** Depth of the deepest character of any in the fonts in the line. */ williamr@2: TInt iFontMaxCharDepth; williamr@2: /** Maximum ascent of the fonts in the line. */ williamr@2: TInt iFontMaxAscent; williamr@2: /** Maximum descent of the fonts in the line. */ williamr@2: TInt iFontMaxDescent; williamr@2: /** Desired precise or minimum line height. */ williamr@2: TInt iDesiredLineHeight; williamr@2: /** True if the line height must be precise. */ williamr@2: TBool iExactLineHeight; williamr@2: }; williamr@2: williamr@2: /** The Unicode line breaking classes; see Unicode Technical Report 14. williamr@2: Not a named enumerated type, so that overriding applications can add new williamr@2: line breaking classes freely. williamr@2: The description of each constant gives the name of the line-breaking williamr@2: class, an example and a brief, imprecise description of the default williamr@2: behaviour of characters of that class. williamr@2: */ williamr@2: enum williamr@2: { williamr@2: /** Opening Punctuation (e.g. '['). Breaking after prohibited. */ williamr@2: EOpLineBreakClass, williamr@2: /** Closing Punctuation (e.g. ']'). Breaking before prohibited. */ williamr@2: EClLineBreakClass, williamr@2: /** Ambiguous Quotes (e.g. '"'). Breaking before and after prohibited. */ williamr@2: EQuLineBreakClass, williamr@2: /** Glue (e.g. Non-breaking space). Breaking before and after prohibited williamr@2: unless spaces are present. */ williamr@2: EGlLineBreakClass, williamr@2: /** Non-Starter (e.g. small Japanese kana). Breaking before prohibited williamr@2: if no spaces present. */ williamr@2: ENsLineBreakClass, williamr@2: /** Exclamation or Interrogation (e.g. '?'). Like closing punctuation williamr@2: except before Postfix or Non-starter. */ williamr@2: EExLineBreakClass, williamr@2: /** Symbol (e.g. '/'. Like Alphabetic, but allows breaking before williamr@2: Alphabetic. */ williamr@2: ESyLineBreakClass, williamr@2: /** Numeric Infix Separator (e.g. ','). Forbids breaking after any and before williamr@2: Numeric. */ williamr@2: EIsLineBreakClass, williamr@2: /** Numeric Prefix (e.g. '$'). Forbids breaking before Numeric. */ williamr@2: EPrLineBreakClass, williamr@2: /** Numeric Postfix (e.g. '%'). Forbids breaking after Numeric. */ williamr@2: EPoLineBreakClass, williamr@2: /** Numeric (e.g. '1'). */ williamr@2: ENuLineBreakClass, williamr@2: /** Alphabetic (e.g. 'a'). */ williamr@2: EAlLineBreakClass, williamr@2: /** Ideographic (e.g. Japanese Kanji). Generally break before or after */ williamr@2: EIdLineBreakClass, williamr@2: /** Inseparable (e.g. ellipsis). Forbid breaks between Inseparables. */ williamr@2: EInLineBreakClass, williamr@2: /** Hyphen (e.g. '-'). Allows a break after except before Numeric. */ williamr@2: EHyLineBreakClass, williamr@2: /** Break After. Generally allow a break after. Breaking between Break williamr@2: Afters not separated by spaces is prohibited. */ williamr@2: EBaLineBreakClass, williamr@2: /** Break Before. Generally allow a break before. Breaking between Break williamr@2: Befores not separated by spaces is prohibited. */ williamr@2: EBbLineBreakClass, williamr@2: /** Break Before and After. Generally allow a break before or after. williamr@2: Breaking between Break Before and Afters is prohibited, even if spaces williamr@2: are present. */ williamr@2: EB2LineBreakClass, williamr@2: /** Zero-Width Space. Allow a break. */ williamr@2: EZwLineBreakClass, williamr@2: /** Combining Mark. Takes on the class of its base class. */ williamr@2: ECmLineBreakClass, williamr@2: /** Mandatory Break. */ williamr@2: EBkLineBreakClass, williamr@2: /** Carriage Return. Break after unless part of a CRLF pair. */ williamr@2: ECrLineBreakClass, williamr@2: /** Line Feed. Break after. */ williamr@2: ELfLineBreakClass, williamr@2: /** Surrogate. Half of a surrogate pair. */ williamr@2: ESgLineBreakClass, williamr@2: /** Contingent Break (e.g. embedded pictures). Uses external williamr@2: information */ williamr@2: ECbLineBreakClass, williamr@2: williamr@2: /** Space. Intervening characters of class Space are indicated by williamr@2: aHaveSpaces in LineBreakPossible. */ williamr@2: ESpLineBreakClass, williamr@2: williamr@2: /** Complex Context (e.g. Thai). Runs of Complex Context are passed to williamr@2: GetLineBreakInContext. */ williamr@2: ESaLineBreakClass, williamr@2: williamr@2: /** Ambiguous. Characters of ambiguous East Asian width are treated williamr@2: as Alphabetic, unless they are resolved as being "Wide", in which case williamr@2: they are treated as Ideographic. */ williamr@2: EAiLineBreakClass, williamr@2: williamr@2: /** The Xx class is used when the class is unknown; e.g.; outside the provided context. */ williamr@2: EXxLineBreakClass, williamr@2: williamr@2: /** The number of Unicode line break classes. */ williamr@2: ELineBreakClasses williamr@2: }; williamr@2: williamr@2: IMPORT_C virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const; williamr@2: IMPORT_C virtual TInt Stretch(TUint aChar) const; williamr@2: IMPORT_C virtual TUint Map(TUint aChar) const; williamr@2: IMPORT_C virtual void SetLineHeight(const TLineHeightParam& aParam,TInt& aAscent,TInt& aDescent) const; williamr@2: IMPORT_C virtual void DrawBackground(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect, williamr@2: const TLogicalRgb& aBackground,TRect& aRectDrawn) const; williamr@2: IMPORT_C virtual void DrawLineGraphics(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect, williamr@2: const TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C virtual void DrawText(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aRect, williamr@2: const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat, williamr@2: const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const; williamr@2: IMPORT_C virtual void DrawPicture(CGraphicsContext& aGc, williamr@2: const TPoint& aTextLayoutTopLeft, const TRect& aRect, williamr@2: MGraphicsDeviceMap& aDevice, const CPicture& aPicture) const; williamr@2: IMPORT_C virtual TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const; williamr@2: IMPORT_C virtual TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const; williamr@2: IMPORT_C virtual TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos, williamr@2: TBool aForwards,TInt& aBreakPos) const; williamr@2: IMPORT_C virtual TBool IsHangingCharacter(TUint aChar) const; williamr@2: williamr@2: // non-virtuals williamr@2: IMPORT_C void SetPenColor(CGraphicsContext& aGc,TLogicalRgb aColor) const; williamr@2: IMPORT_C void SetBrushColor(CGraphicsContext& aGc,TLogicalRgb aColor) const; williamr@2: IMPORT_C TRgb SystemColor(TLogicalRgb aColor) const; williamr@2: }; williamr@2: williamr@4: /* MTmSource extension interface****************************************************/ williamr@4: williamr@4: williamr@4: const TUid KTmCustomExtensionUid = {0x10285BB5}; williamr@4: williamr@4: /** MTmSource Extension Interface abstract base class to enable further customisation of the source. williamr@4: williamr@4: MTmSource derivers should also derive from this interface to enable drawing text in context williamr@4: williamr@4: This interface should be returned by the overridden williamr@4: MTmSource::GetExtendedInterface function when KUidMTmSourceExtension is williamr@4: supplied as the UID. williamr@4: williamr@4: @see MTmSource williamr@4: @see KUidMTmSourceExtension williamr@4: @publishedAll williamr@4: @released williamr@2: */ williamr@4: class MTmCustomExtension williamr@2: { williamr@2: public: williamr@4: IMPORT_C virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const; williamr@4: IMPORT_C virtual void DrawText(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aRect, williamr@4: const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat, williamr@4: const TDesC& aText, const TInt aStart, const TInt aEnd,const TPoint& aTextOrigin,TInt aExtraPixels) const; williamr@4: // non-virtuals williamr@4: IMPORT_C void SetPenColor(CGraphicsContext& aGc,TLogicalRgb aColor) const; williamr@4: IMPORT_C void SetBrushColor(CGraphicsContext& aGc,TLogicalRgb aColor) const; williamr@4: IMPORT_C TRgb SystemColor(TLogicalRgb aColor) const; williamr@2: }; williamr@2: williamr@2: /** williamr@2: A structure for returning information about a line. One of these is williamr@2: returned by all hit-detection functions. Typically, after finding the position williamr@2: in the document that corresponds to given x-y coordinates, you will want some williamr@2: more information like the line's bounding rectangle. When you call, for williamr@2: example, CTmTextLayout::FindXyPos you will receive a TTmLineInfo object that williamr@2: will tell you this, and much more. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TTmLineInfo williamr@2: williamr@2: { williamr@2: public: williamr@2: // bit values for iFlags williamr@2: enum williamr@2: { williamr@2: EParStart = 1, williamr@2: EParEnd = 2, williamr@2: EParRightToLeft = 4, williamr@2: ELineEndsInForcedLineBreak = 8, williamr@2: EPictureButtsLowerEdge = 16, /**< @deprecated - no effect, present for compatibility only */ williamr@2: EPictureButtsUpperEdge = 32 /**< @deprecated - no effect, present for compatibility only */ williamr@2: }; williamr@2: williamr@2: inline TTmLineInfo(); williamr@2: williamr@2: /** Outer enclosing rectangle including margins */ williamr@2: TRect iOuterRect; williamr@2: williamr@2: /** Inner enclosing rectangle: the text only */ williamr@2: TRect iInnerRect; williamr@2: williamr@2: /** y coordinate of the baseline */ williamr@2: TInt iBaseline; williamr@2: williamr@2: /** Start document position */ williamr@2: TInt iStart; williamr@2: williamr@2: /** End document position */ williamr@2: TInt iEnd; williamr@2: williamr@2: /** Line number */ williamr@2: TInt iLineNumber; williamr@2: williamr@2: /** Paragraph number */ williamr@2: TInt iParNumber; williamr@2: williamr@2: /** Line number in the paragraph */ williamr@2: TInt iLineInPar; williamr@2: williamr@2: /** y coordinate of the top of the paragraph */ williamr@2: TInt iParTop; williamr@2: williamr@2: /** Start of paragraph, end of paragraph, etc. */ williamr@2: TUint iFlags; williamr@2: }; williamr@2: williamr@2: /** williamr@2: A structure to hold a logical document position that can be converted to a raw williamr@2: document position or an x-y position. williamr@2: williamr@2: A document position can specify a leading or trailing edge or a text williamr@2: directionality so that bidirectional hit testing can use both these williamr@2: distinctions. williamr@2: williamr@2: The leading edge at position N is the position before character N in logical williamr@2: order, and the trailing edge is the position after character in logical order. williamr@2: williamr@2: Specification by directionality works differently. Character N in left-to-right williamr@2: text is preceded by position N (left-to-right) and followed by position N+1 williamr@2: (left-to-right). Character N in right-to-left text is preceded (in display williamr@2: order) by position N+1 (right-to-left) and followed by position N williamr@2: (right-to-left). williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TTmDocPosSpec williamr@2: williamr@2: { williamr@2: public: williamr@2: /** williamr@2: The cursor type. williamr@2: */ williamr@2: enum TType williamr@2: { williamr@2: /** trailing edge */ williamr@2: ETrailing, williamr@2: williamr@2: /** leading edge */ williamr@2: ELeading, williamr@2: williamr@2: /** left-to-right */ williamr@2: ELeftToRight, williamr@2: williamr@2: /** right-to-left */ williamr@2: ERightToLeft williamr@2: }; williamr@2: williamr@2: inline TTmDocPosSpec(); williamr@2: inline TTmDocPosSpec(TInt aPos,TType aType); williamr@2: inline TTmDocPosSpec(const TTmDocPos& aRawDocPos); williamr@2: williamr@2: /** the edge position in the document; 0 ... document length */ williamr@2: TInt iPos; williamr@2: /** the type as specified above */ williamr@2: TType iType; williamr@2: }; williamr@2: williamr@2: /** williamr@2: A structure for holding a raw document position that can be converted to or williamr@2: from an x-y position and compared ordinally, which cannot be done with the more williamr@2: abstract TTmDocPosSpec class. Leading edges are distinguished from trailing williamr@2: edges so that bidirectional hit testing and cursor positioning can distinguish williamr@2: between 'after character N', and 'before character N + 1', which may be some williamr@2: distance apart if N and N + 1 are in runs of opposite directionality. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TTmDocPos williamr@2: williamr@2: { williamr@2: public: williamr@2: inline TTmDocPos(); williamr@2: inline TTmDocPos(TInt aPos,TBool aLeadingEdge); williamr@2: IMPORT_C TBool operator==(const TTmDocPos& aPos) const; williamr@2: inline TBool operator!=(const TTmDocPos& aPos) const; williamr@2: IMPORT_C TBool operator>(const TTmDocPos& aPos) const; williamr@2: IMPORT_C TBool operator>=(const TTmDocPos& aPos) const; williamr@2: inline TBool operator<(const TTmDocPos& aPos) const; williamr@2: inline TBool operator<=(const TTmDocPos& aPos) const; williamr@2: williamr@2: /** the edge position in the document; 0 ... document length */ williamr@2: TInt iPos; williamr@2: /** true if the position is a leading edge */ williamr@2: TBool iLeadingEdge; williamr@2: }; williamr@2: williamr@2: /** williamr@2: Holds information about a position in a document. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TTmPosInfo2 williamr@2: williamr@2: { williamr@2: public: williamr@2: /** Document position. */ williamr@2: TTmDocPos iDocPos; williamr@2: /** True if the position is attatched to text flowing right-to-left. */ williamr@2: TBool iRightToLeft; williamr@2: /** Intersection of the character edge with the baseline. */ williamr@2: TPoint iEdge; williamr@2: }; williamr@2: williamr@2: /** williamr@2: A structure for returning information about a position in a line. williamr@4: The class should only be used internally by FORM component. williamr@2: @deprecated 7.0s williamr@2: @internalComponent williamr@2: */ williamr@2: class TTmPosInfo williamr@2: williamr@2: { williamr@2: public: williamr@2: TTmPosInfo() {} williamr@2: TTmPosInfo(const TTmPosInfo2& a) : iDocPos(a.iDocPos), iEdge(a.iEdge) {} williamr@2: TTmDocPos iDocPos; // the document position williamr@2: TPoint iEdge; // intersection of the character edge at iDocPos with the baseline williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: Cursor placement. Used as an argument to CTextView::SetCursorPlacement(). williamr@2: @see CTextView::SetCursorPlacement() williamr@2: @publishedAll williamr@4: @released williamr@2: */ williamr@2: enum TTmCursorPlacement williamr@2: { williamr@2: /** The text cursor is a vertical line at the insertion position, with its height williamr@2: and depth based on the metrics of the previous character in the paragraph williamr@2: or if none, the next character. */ williamr@2: ECursorVertical, williamr@2: /** The text cursor is an underline below the character logically after the insertion williamr@2: position. */ williamr@2: ECursorUnderlineNext, williamr@2: /** The text cursor is an underline below the character logically before the insertion williamr@2: position. */ williamr@2: ECursorUnderlinePrev williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: A mixin class to make it easy for higher-level classes that own a CTmTextLayout williamr@2: object to have enquiry functions without it being necessary to implement them williamr@2: all as forwarding functions. The owner class just implements TextLayout and williamr@2: overrides GetOrigin if necessary. williamr@2: williamr@2: Non-const CTmTextLayout functions like Clear are not included because allowing williamr@2: them to be called on owner classes would probably put the owner class into an williamr@2: inconsistent state. williamr@2: williamr@2: The word Layout is prefixed, suffixed or infixed to functions with names that williamr@2: would usually conflict with owner class names. For example, we have DrawLayout, williamr@2: not Draw, and GetMinimumLayoutSizeL, not GetMinimumSizeL. williamr@4: williamr@4: The class should only be used internally by FORM component. williamr@2: @internalComponent williamr@2: */ williamr@2: class MTmTextLayoutForwarder williamr@2: williamr@2: { williamr@2: public: williamr@2: IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect, williamr@2: const TLogicalRgb* aDocBackground,TBool aDrawParBackground) const; williamr@2: IMPORT_C void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect, williamr@2: const TLogicalRgb& aBackground) const; williamr@2: IMPORT_C void InvertLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,TInt aStartDocPos,TInt aEndDocPos); williamr@2: IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C TBool FindXyPosWithDisambiguation(const TPoint& aXyPos, williamr@2: TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight, williamr@2: TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C TBool DocPosToLine(const TTmDocPosSpec& aDocPos,TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C TBool LineNumberToLine(TInt aLineNumber,TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C TBool ParNumberToLine(TInt aParNumber,TInt aLineInPar,TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C TBool YPosToLine(TInt aYPos,TTmLineInfo& aLineInfo) const; williamr@2: IMPORT_C TInt WidthOfWidestLine(TInt aTop = 0,TInt aBottom = KMaxTInt) const; williamr@2: IMPORT_C void HorizontalExtremes(TInt &aLeft, TInt &aRight, williamr@2: TInt aTopY = 0, TInt aBottomY = KMaxTInt) const; williamr@2: IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aInfo,TBool aToLeft) const; williamr@2: IMPORT_C TBool GetNextPosLeftWithDisambiguation(const TTmDocPosSpec& aDocPos, williamr@2: TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const; williamr@2: IMPORT_C TBool GetNextPosRightWithDisambiguation(const TTmDocPosSpec& aDocPos, williamr@2: TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const; williamr@2: IMPORT_C TBool GetCursor(const TTmDocPosSpec& aDocPos,TTmCursorPlacement aPlacement, williamr@2: TTmLineInfo& aLineInfo,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const; williamr@2: williamr@2: IMPORT_C TInt Lines() const; williamr@2: IMPORT_C TInt Paragraphs() const; williamr@2: IMPORT_C TBool GetDisplayedText(TInt aLineNumber,TDes& aText,TInt& aNeeded) const; williamr@2: IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TSize& aSize) const; williamr@2: IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize) const; williamr@2: IMPORT_C TInt StartChar() const; williamr@2: IMPORT_C TInt EndChar() const; williamr@2: IMPORT_C TInt LayoutWidth() const; williamr@2: IMPORT_C TInt LayoutHeight() const; williamr@2: williamr@2: // deprecated functions williamr@2: // deprecated 7.0s williamr@2: IMPORT_C TBool FindDocPos(const TTmDocPos& aDocPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const; williamr@2: // deprecated 7.0s williamr@2: IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const; williamr@2: // deprecated 7.0s williamr@2: IMPORT_C TBool DocPosToLine(const TTmDocPos& aDocPos,TTmLineInfo& aLineInfo) const; williamr@2: // deprecated 7.0s williamr@2: IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPos& aDocPos,TTmPosInfo& aInfo,TBool aToLeft) const; williamr@2: // deprecated 7.0s williamr@2: IMPORT_C TBool GetCursor(const TTmDocPos& aDocPos, williamr@2: TTmCursorPlacement aPlacement, TTmLineInfo& aLineInfo, williamr@2: TPoint& aOrigin, TInt& aWidth, TInt& aAscent, TInt& aDescent) const; williamr@2: private: williamr@2: /** Returns a reference to the CTmTextLayoutObject this williamr@2: MTmTextLayoutForwarder forwards inquiries to. */ williamr@2: virtual const CTmTextLayout& TextLayout() const = 0; williamr@2: williamr@2: /** The origin is subtracted from coordinates passed in and added to those williamr@2: passed out. */ williamr@2: IMPORT_C virtual void GetOrigin(TPoint& aPoint) const; williamr@2: williamr@2: void FixUpLineInfo(TTmLineInfo& aInfo,const TPoint* aOrigin = NULL) const; williamr@2: }; williamr@2: williamr@2: /** Constructs a TTmLineInfo object, setting all data members to 0. */ williamr@2: TTmLineInfo::TTmLineInfo() williamr@2: { williamr@2: Mem::FillZ(this,sizeof(*this)); williamr@2: } williamr@2: williamr@2: /** Constructs a TTmDocPos object, setting iPos to 0 and iLeadingEdge to false. williamr@2: This is the lowest legal value for a TTmDocPos object. A trailing edge comes williamr@2: before a leading edge because it is the trailing edge of the character before williamr@2: the position, while the leading edge is that of the character after the williamr@2: position. ('Leading' means the first to be encountered when traversing the williamr@2: document in logical order). */ williamr@2: TTmDocPos::TTmDocPos(): williamr@2: iPos(0), williamr@2: iLeadingEdge(FALSE) williamr@2: { williamr@2: } williamr@2: williamr@2: /** Constructs a TTmDocPos object, setting iPos to aPos and iLeadingEdge to williamr@2: aLeadingEdge. williamr@2: */ williamr@2: TTmDocPos::TTmDocPos(TInt aPos,TBool aLeadingEdge): williamr@2: iPos(aPos), williamr@2: iLeadingEdge(aLeadingEdge) williamr@2: { williamr@2: } williamr@2: williamr@2: /** Constructs a TTmDocPosSpec, setting the position to 0 and the type to williamr@2: trailing. */ williamr@2: TTmDocPosSpec::TTmDocPosSpec(): williamr@2: iPos(0), williamr@2: iType(ETrailing) williamr@2: { williamr@2: } williamr@2: williamr@2: williamr@2: /** williamr@2: The not equal operator. williamr@2: @return True if both sides have different values. williamr@2: */ williamr@2: TBool TTmDocPos::operator!=(const TTmDocPos& aPos) const { return !((*this)==aPos); } williamr@2: williamr@2: /** williamr@2: Smaller than operator. williamr@2: @return williamr@2: True if the right side of the operator is further on in the document than williamr@2: the left hand side. williamr@2: */ williamr@2: TBool TTmDocPos::operator<(const TTmDocPos& aPos) const { return !((*this)>=aPos); } williamr@2: williamr@2: /** williamr@2: Smaller than or equal to operator. williamr@2: @return williamr@2: True if the right side of the operator is further on in the document than williamr@2: the left hand side or if both sides are identical. williamr@2: */ williamr@2: TBool TTmDocPos::operator<=(const TTmDocPos& aPos) const { return !((*this)>aPos); } williamr@2: williamr@2: /** Constructs a TTmDocPosSpec, setting the position to aPos and the type to williamr@2: aType. williamr@2: */ williamr@2: TTmDocPosSpec::TTmDocPosSpec(TInt aPos,TType aType): williamr@2: iPos(aPos), williamr@2: iType(aType) williamr@2: { williamr@2: } williamr@2: williamr@2: /** Constructs a TTmDocPosSpec from a TTmDocPos. */ williamr@2: TTmDocPosSpec::TTmDocPosSpec(const TTmDocPos& aDocPos): williamr@2: iPos(aDocPos.iPos), williamr@2: iType(aDocPos.iLeadingEdge ? ELeading : ETrailing) williamr@2: { williamr@2: } williamr@2: williamr@4: /** Constructs a TTmCharFormat by converting the information in a TCharFormat. */ williamr@4: TTmCharFormat::TTmCharFormat(const TCharFormat& aFormat) williamr@2: { williamr@4: *this = aFormat; williamr@2: } williamr@2: williamr@4: /** The inequality operator. Return TRUE if this object and aFormat differ in any way. */ williamr@4: TBool TTmCharFormat::operator!=(const TTmCharFormat& aFormat) const williamr@2: { williamr@4: return !operator==(aFormat); williamr@2: } williamr@2: williamr@4: /** Constructs a line height parameter structure, setting all the data members williamr@4: to zero. */ williamr@4: MTmCustom::TLineHeightParam::TLineHeightParam() williamr@2: { williamr@4: Mem::FillZ(this,sizeof(*this)); williamr@2: } williamr@2: williamr@4: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS williamr@4: #include williamr@4: #include williamr@4: #endif williamr@2: williamr@2: #endif // __TAGMA_H__