aknbiditextutils.h

Go to the documentation of this file.
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 #include <gdi.h>     // For CCFont::TMeasureTextInput::TFlags
00034 
00035 // CONSTANTS
00036 
00037 const TInt KAknBidiExtraSpacePerLine = 4;
00038 
00039 // FORWARD DECLARATIONS
00040 
00041 
00042 // CLASS DECLARATION
00043 
00056 class AknBidiTextUtils
00057     {
00058     public:
00059 
00063     enum TParagraphDirectionality
00064         {
00065         EImplicit = 0, // implicit directionality of input text
00066         ELeftToRight = 1,
00067         ERightToLeft = 2
00068         };
00069 
00070     public: // New functions
00071 
00098     IMPORT_C static TBool ConvertToVisualAndClipL(
00099         TDes& aLogicalText,
00100         const CFont& aFont,
00101         TInt aMaxWidthInPixels,
00102         TInt aMaxClippedWidthInPixels,
00103         AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit,
00104         TChar aClipChar = KEllipsis );
00105 
00137     IMPORT_C static TBool ConvertToVisualAndClip(
00138         const TDesC& aLogicalText,
00139         TDes& aVisualText,
00140         const CFont& aFont,
00141         TInt aMaxWidthInPixels,
00142         TInt aMaxClippedWidthInPixels,
00143         AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit,
00144         TChar aClipChar = KEllipsis );
00145 
00165     IMPORT_C static TInt PrepareRunInfoArray( const TDesC& aLogicalText );
00166 
00197     IMPORT_C static void ConvertToVisualAndWrapToArrayL(
00198         TDes& aLogicalText,
00199         const CArrayFix<TInt>& aLineWidthArray,
00200         const CFont& aFont,
00201         CArrayFix<TPtrC>& aWrappedArray,
00202         TBool aInsertTruncationChar,
00203         AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit );
00204 
00231     IMPORT_C static HBufC* ConvertToVisualAndWrapToArrayL( 
00232         const TDesC& aLogicalText,
00233         TInt aLineWidth,
00234         const CFont& aFont,
00235         CArrayFix<TPtrC>& aWrappedArray,
00236         AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit );
00237     
00267     IMPORT_C static void ConvertToVisualAndChopToArrayL(
00268         TDes& aLogicalText,
00269         const CArrayFix<TInt>& aLineWidthArray, 
00270         const CFont& aFont,                    
00271         CArrayFix<TPtrC>& aChoppedArray,
00272         AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit );
00273 
00304     IMPORT_C static HBufC* ConvertToVisualAndChopToArrayL(
00305         const TDesC& aLogicalText,
00306         TInt aLineWidth,
00307         const CFont& aFont,
00308         CArrayFix<TPtrC>& aChoppedArray,
00309         TParagraphDirectionality aDirectionality = EImplicit );
00310 
00342     IMPORT_C static void ConvertToVisualAndWrapToStringL( 
00343         const TDesC& aLogicalText,
00344         const CArrayFix<TInt>& aLineWidthArray,
00345         const CFont& aFont,
00346         TDes& aWrappedString,
00347         TBool aInsertTruncationChar,
00348         AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit );
00349 
00350     // -------------------------------------------------------------------------
00351     // The following methods are introduced in release 2.1
00352     // -------------------------------------------------------------------------
00353 
00385     IMPORT_C static HBufC* ConvertToVisualAndWrapToArrayWholeTextL( 
00386         const TDesC& aLogicalText,
00387         const CArrayFix<TInt>& aLineWidthArray,
00388         const CFont& aFont,
00389         CArrayFix<TPtrC>& aWrappedArray,
00390         AknBidiTextUtils::TParagraphDirectionality aDirectionality = EImplicit );
00391 
00427     IMPORT_C static TInt AknBidiTextUtils::MeasureTextBoundsWidth(
00428         const CFont& aFont,
00429         const TDesC& aText,
00430         CFont::TMeasureTextInput::TFlags aOrder);
00431 
00432     private:
00433 
00434         static TBool DoConvertToVisualAndClip(
00435             const TDesC& aLogicalText,
00436             TDes& aVisualText,
00437             const CFont& aFont,
00438             TInt aMaxWidthInPixels,
00439             TInt aMaxClippedWidthInPixels,
00440             AknBidiTextUtils::TParagraphDirectionality aDirectionality,
00441             TChar aClipChar );
00442 
00446         AknBidiTextUtils();
00447     };
00448 
00449 // AKN_BIDI_TEXT_UTILS_H
00450 #endif
00451             
00452 // End of File

Copyright © Nokia Corporation 2001-2008
Back to top