wvuing/wvuiave/AppSrc/CCASmileyUtil.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Utility for selecting smile icon and converting
       
    15 *                between smile id and smile string.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CCASMILEYUTIL_H
       
    21 #define CCASMILEYUTIL_H
       
    22 
       
    23 // INCLUDE
       
    24 
       
    25 #include "MCAMessageExtension.h"
       
    26 #include "CCASmileIconUtility.h"
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <gdi.h> // TPictureHeader
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 
       
    33 class CCASmileIconUtility;
       
    34 class MCASkinVariant;
       
    35 class MCAAppUi;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 
       
    40 /**
       
    41 * CCASmileyUtil
       
    42 *
       
    43 * Utility for dealing with smileys in editor
       
    44 */
       
    45 class CCASmileyUtil : public CBase, public MCAMessageExtension
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48 
       
    49         /**
       
    50         * Two-phased constructor.
       
    51         */
       
    52         static CCASmileyUtil* NewL(  MCASkinVariant& aSkinVariant,
       
    53                                      MCAAppUi& aAppUi, TMessageExtensionTypes aType );
       
    54 
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         virtual ~CCASmileyUtil();
       
    59 
       
    60     private: // From MCAMessageExtension
       
    61 
       
    62         /**
       
    63         * Inserts icon to editor
       
    64         * @param anEditor Reference to editor
       
    65         */
       
    66         void InsertExtensionL( CEikRichTextEditor& anEditor,
       
    67                                TBool& aCancelled );
       
    68 
       
    69         /**
       
    70         * Deletes icon from editor
       
    71         * @param aEditor Reference to editor
       
    72         * @param aPos Position where icon is located
       
    73         */
       
    74         void DeleteExtensionL( CEikRichTextEditor& aEditor, TInt aPos );
       
    75 
       
    76         /**
       
    77         * Converts smiley icons to string smileys
       
    78         * @param anEditor Reference to editor
       
    79         * @param aDes Text from editor
       
    80         */
       
    81         void ExtensionToStringL( CEikRichTextEditor& anEditor, TDes& aDes );
       
    82 
       
    83         /**
       
    84          *  @see MCAMessageExtension
       
    85          */
       
    86         void ConvertSelectionToExtensionL( CEikRichTextEditor& aEditor );
       
    87 
       
    88         /**
       
    89          *  Converts all the extensions in selection area from strings to extensions.
       
    90          *  @since 3.0
       
    91          *  @param aRichText Rich text to be converted
       
    92          *  @param aSelection Selection area
       
    93          */
       
    94         void ConvertSelectionToExtensionL( CRichText& aRichText, TCursorSelection& aSelection );
       
    95 
       
    96         /**
       
    97          *  @see MCAMessageExtension
       
    98          */
       
    99         void ConvertSelectionToStringL( CEikRichTextEditor& aEditor, TBool aPreserve );
       
   100 
       
   101         /**
       
   102          *	@see MCAMessageExtension
       
   103          */
       
   104         void Reset();
       
   105 
       
   106         /**
       
   107          * Informs the extensions about changed size
       
   108          * @param aSize
       
   109          * @since 3.0
       
   110          */
       
   111         void SizeChanged( TSize& aSize );
       
   112 
       
   113         /**
       
   114          *	@see MCAMessageExtension
       
   115          */
       
   116         void ConvertSelectionToStringL(
       
   117             CEikRichTextEditor& aEditor,
       
   118             TDes& aResultString,
       
   119             TCursorSelection& aSelectionAfterConversion,
       
   120             TBool aPreserve );
       
   121 
       
   122     private:  // Constructors and destructor
       
   123 
       
   124         /**
       
   125         * C++ constructor.
       
   126         */
       
   127         CCASmileyUtil( TMessageExtensionTypes aType );
       
   128 
       
   129         /**
       
   130         * Second-phased constructor
       
   131         */
       
   132         void ConstructL( MCASkinVariant& aSkinVariant,
       
   133                          MCAAppUi& aAppUi );
       
   134 
       
   135     private: // New methods
       
   136 
       
   137     private: // Data
       
   138 
       
   139         //util for icon/string convertings
       
   140         CCASmileIconUtility* iSmileUtil;
       
   141 
       
   142         // Doesn't own
       
   143         CEikRichTextEditor* iEditor;
       
   144 
       
   145         // Count of current smiley icons in editor
       
   146         TInt iCurrentCount;
       
   147 
       
   148         // Is smiley converted or not
       
   149         RPointerArray< CCASmileyInformation > iConvertArray;
       
   150     };
       
   151 
       
   152 #endif  // CCASMILEYUTIL_H