fep/aknfep/inc/AknFepInlineTextDecorator.h
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:           
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 #ifndef _AKNFEP_INLINE_TEXT_DECORATOR_H__
       
    30 #define _AKNFEP_INLINE_TEXT_DECORATOR_H__
       
    31 
       
    32 #include <e32base.h>
       
    33 
       
    34 class CAknFepInlineTextDecorator : public CBase
       
    35 	{
       
    36 public:
       
    37 	enum
       
    38 		{
       
    39 		ELeftToRightMark = 0x200E,		// LRM
       
    40 		ERightToLeftMark = 0x200F		// RLM
       
    41 		};
       
    42 private:
       
    43 	enum
       
    44 		{
       
    45 		ENullChar = 0,
       
    46 		ESingleCharacter = 1,
       
    47 		ETwoCharacters = 2
       
    48 		};
       
    49 
       
    50 public:
       
    51 	/**
       
    52 	* Applies required markup to a piece of bidirectional text to ensure correct
       
    53 	* rendering for Averell
       
    54 	* 
       
    55 	* @param aInlineText original inline text
       
    56 	* @param aDecoratedText descriptor which will hold the original text plus
       
    57 	*				any decoration
       
    58 	* @param aPositionOfInsertionPointInInlineText position of insertion point 
       
    59 	*				(cursor) in the original inline text
       
    60 	* @param aPreviousCharacter the character immediately prior to the inline
       
    61 	*				text
       
    62 	* @param aRTLParagraph set to true if the inline text is being inserted into
       
    63 	*				a paragraph with RTL directionality in the CParaFormat
       
    64 	* @param aInputDirectionIsRtl is to be set to ETrue if the current input direction is RTL
       
    65 	*/
       
    66 	void DecorateInlineText(
       
    67 		const TDesC& aInlineText, 
       
    68 		TDes& aDecoratedText,
       
    69 		TInt& aPositionOfInsertionPointInInlineText,
       
    70 		TChar aPreviousCharacter,
       
    71 		TBool aRTLParagraph,
       
    72         TBool aInputDirectionIsRTL);
       
    73 	
       
    74 	/**
       
    75 	* Resolves any decorated text + any surrounding text that has been added to the beginning
       
    76     * or end to remove unnecessary directional markers.
       
    77 	*
       
    78 	* @param aDecoratedTextPlusSurroundings descriptor to hold a piece of text to be parsed
       
    79 	*				and resolved; new text, optionally with accreted surrounding text
       
    80 	* @param aDecoratedTextSpan span of text originally inspected and decorated (must be subset of descriptor)
       
    81 	* 
       
    82 	* @return   EFalse if and only if no change was made to aDecoratedTextPlusSurroundings 
       
    83 	*/
       
    84 	TBool ResolveDecoratedText(
       
    85 		TDes& aDecoratedTextPlusSurroundings,
       
    86 		TCursorSelection aDecoratedTextSpan);
       
    87 
       
    88 	/**
       
    89 	* Determines if a character is an LRM (0x200e) or an RLM (0x200f)
       
    90 	* 
       
    91 	* @param aChar the character to be inspected
       
    92 	* @return ETrue if the character has the value 0x200e or 0x200f
       
    93 	*/
       
    94 	TBool CharacterIsDirectionalMarker(TChar aChar);
       
    95 
       
    96 	/**
       
    97 	* Determines if a character has strong LTR directionality
       
    98 	* 
       
    99 	* @param	aChar the character to be inspected
       
   100 	* @return	ETrue if the character has bidi category of TChar::ELeftToRight
       
   101 	*				or is an LRM
       
   102 	*/
       
   103 	TBool CharacterIsStrongLeftToRight(TChar aChar);
       
   104 
       
   105 	/**
       
   106 	* Determines if a character has strong RTL directionality
       
   107 	* 
       
   108 	* @param	aChar the character to be inspected
       
   109 	* @return	ETrue if the character has bidi category of TChar::ERightToLeft
       
   110 	*				or is an RLM
       
   111 	*/
       
   112 	TBool CharacterIsStrongRightToLeft(TChar aChar);
       
   113 
       
   114 	/**
       
   115 	* Determines if two characters share the same strong directionality
       
   116 	* 
       
   117 	* @param aCh1 the first character to be compared
       
   118 	* @param aCh2 the second character to be compared
       
   119 	* @return ETrue if aCh1 and aCh2 share the same strong directionality
       
   120 	*/
       
   121 	TBool CharactersHaveSameStrongDirection(TChar aCh1, TChar aCh2);
       
   122 
       
   123 	/**
       
   124 	* Determines if a character has weak directionality
       
   125 	* 
       
   126 	* @param	aChar the character to be inspected
       
   127 	* @return	ETrue if the character has any of the following bidi categories
       
   128 	*					TChar::EEuropeanNumber
       
   129 	*					TChar::EEuropeanNumberSeparator
       
   130 	*					TChar::EEuropeanNumberTerminator
       
   131 	*					TChar::EArabicNumber
       
   132 	*					TChar::ECommonNumberSeparator
       
   133 	*/
       
   134 	TBool CharacterIsWeaklyDirectional(TChar aChar);
       
   135 
       
   136 	/**
       
   137 	* Determines if a character is a separator character
       
   138 	* 
       
   139 	* @param	aChar the character to be inspected
       
   140 	* @return	ETrue if the character has any of the following bidi categories
       
   141 	*					TChar::EParagraphSeparator
       
   142 	*					TChar::ESegmentSeparator
       
   143 	*/
       
   144 	TBool CharacterIsSeparator(TChar aChar);
       
   145 
       
   146 	/**
       
   147 	* Determines if a character has neutral directionlaity
       
   148 	* 
       
   149 	* @param	aChar the character to be inspected
       
   150 	* @return	ETrue if the character has any of the following bidi categories
       
   151 	*					TChar::EWhitespace
       
   152 	*					TChar::EOtherNeutral
       
   153 	*/
       
   154 	TBool CharacterIsNeutral(TChar aChar);
       
   155 
       
   156 private:
       
   157 	void DecorateNeutralCharacters(
       
   158 		const TDesC& aInlineText, 
       
   159 		TDes& aDecoratedText,
       
   160 		TInt& aPositionOfInsertionPointInInlineText,
       
   161 		TChar aPreviousCharacter,
       
   162 		TBool aRTLParagraph,
       
   163         TBool aInputDirectionIsRTL);
       
   164 	};
       
   165 
       
   166 #endif