00001 /* 00002 * ============================================================================== 00003 * Name : AknBidiTextUtils.h 00004 * Part of : Avkon 00005 * Interface : UI Framework APIs / Utility APIs 00006 * Description : Text utilities e.g. truncating and wrapping to be used in code 00007 * that needs to support text that requires conversion from logical 00008 * to visual order, e.g. Arabic/Hebrew. 00009 * Logical text is given as input to all methods. 00010 * Output text is in visual order. 00011 * 00012 * Version : 1 00013 * 00014 * Copyright (c) 2002 Nokia Corporation. 00015 * This material, including documentation and any related 00016 * computer programs, is protected by copyright controlled by 00017 * Nokia Corporation. All rights are reserved. Copying, 00018 * including reproducing, storing, adapting or translating, any 00019 * or all of this material requires the prior written consent of 00020 * Nokia Corporation. This material also contains confidential 00021 * information which may not be disclosed to others without the 00022 * prior written consent of Nokia Corporation. 00023 * ============================================================================== 00024 */ 00025 00026 00027 #ifndef AKN_BIDI_TEXT_UTILS_H 00028 #define AKN_BIDI_TEXT_UTILS_H 00029 00030 // INCLUDES 00031 #include <e32base.h> 00032 #include <uikon.hrh> // KEllipsis 00033 #start_since SINCE_3_1_SDK 00034 #include <gdi.h> // For CCFont::TMeasureTextInput::TFlags 00035 #end_since SINCE_3_1_SDK 00036 00037 // CONSTANTS 00038 00039 const TInt KAknBidiExtraSpacePerLine = 4; 00040 00041 // FORWARD DECLARATIONS 00042 00043 00044 // CLASS DECLARATION 00045 00058 class AknBidiTextUtils 00059 { 00060 public: 00061 00065 enum TParagraphDirectionality 00066 { 00067 EImplicit = 0, // implicit directionality of input text 00068 ELeftToRight = 1, 00069 ERightToLeft = 2 00070 }; 00071 00072 public: // New functions 00073 00100 IMPORT_C static TBool ConvertToVisualAndClipL( 00101 TDes& aLogicalText, 00102 const CFont& aFont, 00103 TInt aMaxWidthInPixels, 00104 TInt aMaxClippedWidthInPixels, 00105 AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit, 00106 TChar aClipChar = KEllipsis ); 00107 00139 IMPORT_C static TBool ConvertToVisualAndClip( 00140 const TDesC& aLogicalText, 00141 TDes& aVisualText, 00142 const CFont& aFont, 00143 TInt aMaxWidthInPixels, 00144 TInt aMaxClippedWidthInPixels, 00145 AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit, 00146 TChar aClipChar = KEllipsis ); 00147 00167 IMPORT_C static TInt PrepareRunInfoArray( const TDesC& aLogicalText ); 00168 00199 IMPORT_C static void ConvertToVisualAndWrapToArrayL( 00200 TDes& aLogicalText, 00201 const CArrayFix<TInt>& aLineWidthArray, 00202 const CFont& aFont, 00203 CArrayFix<TPtrC>& aWrappedArray, 00204 TBool aInsertTruncationChar, 00205 AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit ); 00206 00233 IMPORT_C static HBufC* ConvertToVisualAndWrapToArrayL( 00234 const TDesC& aLogicalText, 00235 TInt aLineWidth, 00236 const CFont& aFont, 00237 CArrayFix<TPtrC>& aWrappedArray, 00238 AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit ); 00239 00269 IMPORT_C static void ConvertToVisualAndChopToArrayL( 00270 TDes& aLogicalText, 00271 const CArrayFix<TInt>& aLineWidthArray, 00272 const CFont& aFont, 00273 CArrayFix<TPtrC>& aChoppedArray, 00274 AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit ); 00275 00306 IMPORT_C static HBufC* ConvertToVisualAndChopToArrayL( 00307 const TDesC& aLogicalText, 00308 TInt aLineWidth, 00309 const CFont& aFont, 00310 CArrayFix<TPtrC>& aChoppedArray, 00311 TParagraphDirectionality aDirectionality = EImplicit ); 00312 00344 IMPORT_C static void ConvertToVisualAndWrapToStringL( 00345 const TDesC& aLogicalText, 00346 const CArrayFix<TInt>& aLineWidthArray, 00347 const CFont& aFont, 00348 TDes& aWrappedString, 00349 TBool aInsertTruncationChar, 00350 AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit ); 00351 00352 // ------------------------------------------------------------------------- 00353 // The following methods are introduced in release 2.1 00354 // ------------------------------------------------------------------------- 00355 00387 IMPORT_C static HBufC* ConvertToVisualAndWrapToArrayWholeTextL( 00388 const TDesC& aLogicalText, 00389 const CArrayFix<TInt>& aLineWidthArray, 00390 const CFont& aFont, 00391 CArrayFix<TPtrC>& aWrappedArray, 00392 AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit ); 00393 00394 #start_since SINCE_3_1_SDK 00395 00431 IMPORT_C static TInt AknBidiTextUtils::MeasureTextBoundsWidth( 00432 const CFont& aFont, 00433 const TDesC& aText, 00434 CFont::TMeasureTextInput::TFlags aOrder); 00435 #end_since SINCE_3_1_SDK 00436 00437 private: 00438 00439 static TBool DoConvertToVisualAndClip( 00440 const TDesC& aLogicalText, 00441 TDes& aVisualText, 00442 const CFont& aFont, 00443 TInt aMaxWidthInPixels, 00444 TInt aMaxClippedWidthInPixels, 00445 AknBidiTextUtils::TParagraphDirectionality aDirectionality, 00446 TChar aClipChar ); 00447 00451 AknBidiTextUtils(); 00452 }; 00453 00454 // AKN_BIDI_TEXT_UTILS_H 00455 #endif 00456 00457 // End of File