1 /* |
|
2 * Copyright (c) 2007-2008 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 CIMCVAPPSMILEYUTIL_H |
|
21 #define CIMCVAPPSMILEYUTIL_H |
|
22 |
|
23 // INCLUDE |
|
24 |
|
25 #include "mimcvappmessageextension.h" |
|
26 #include "cimcvappsmileiconutility.h" |
|
27 #include <e32base.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 |
|
31 class CIMCVAppSmileIconUtility; |
|
32 class MIMCVAppUi; |
|
33 class MIMCVUiAppSkinVariant; |
|
34 class CIMCVEngine; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 |
|
39 /** |
|
40 * CIMCVAPPSmileyUtil |
|
41 * |
|
42 * Utility for dealing with smileys in editor |
|
43 */ |
|
44 class CIMCVAppSmileyUtil : public CBase, public MIMCVAppMessageExtension |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * aAppUi CIMCVAppUI reference |
|
51 * @param aType message extension type |
|
52 */ |
|
53 static CIMCVAppSmileyUtil* NewL( MIMCVUiAppSkinVariant& aSkinVariant, |
|
54 MIMCVAppUi& aAppUi, |
|
55 TMessageExtensionTypes aType, |
|
56 CIMCVEngine& aServiceEngine); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 virtual ~CIMCVAppSmileyUtil(); |
|
62 |
|
63 private: // From MIMCVAPPMessageExtension |
|
64 |
|
65 |
|
66 |
|
67 /** |
|
68 * Inserts icon to editor |
|
69 * @param anEditor Reference to editor |
|
70 */ |
|
71 void InsertExtensionL( CEikRichTextEditor& anEditor, |
|
72 TBool& aCancelled, TSize size ); |
|
73 |
|
74 /** |
|
75 * Deletes icon from editor |
|
76 * @param aEditor Reference to editor |
|
77 * @param aPos Position where icon is located |
|
78 */ |
|
79 void DeleteExtensionL( CEikRichTextEditor& aEditor, TInt aPos ); |
|
80 |
|
81 /** |
|
82 * Converts smiley icons to string smileys |
|
83 * @param anEditor Reference to editor |
|
84 * @param aDes Text from editor |
|
85 */ |
|
86 void ExtensionToStringL( CEikRichTextEditor& anEditor, TDes& aDes ); |
|
87 |
|
88 /** |
|
89 * @see MIMCVAPPMessageExtension |
|
90 */ |
|
91 void ConvertSelectionToExtensionL( CEikRichTextEditor& aEditor ); |
|
92 |
|
93 /** |
|
94 * Converts all the extensions in selection area from strings to extensions. |
|
95 * @since 3.0 |
|
96 * @param aRichText Rich text to be converted |
|
97 * @param aSelection Selection area |
|
98 */ |
|
99 void ConvertSelectionToExtensionL( CRichText& aRichText, TCursorSelection& aSelection ); |
|
100 |
|
101 /** |
|
102 * @see MIMCVAPPMessageExtension |
|
103 */ |
|
104 void ConvertSelectionToStringL( CEikRichTextEditor& aEditor, TBool aPreserve ); |
|
105 |
|
106 /** |
|
107 * @see MIMCVAPPMessageExtension |
|
108 */ |
|
109 void Reset(); |
|
110 |
|
111 /** |
|
112 * Informs the extensions about changed size |
|
113 * @param aSize |
|
114 */ |
|
115 void SizeChanged( TSize& aSize ); |
|
116 |
|
117 /** |
|
118 * @see MIMCVAPPMessageExtension |
|
119 */ |
|
120 void ConvertSelectionToStringL( |
|
121 CEikRichTextEditor& aEditor, |
|
122 TDes& aResultString, |
|
123 TCursorSelection& aSelectionAfterConversion, |
|
124 TBool aPreserve ); |
|
125 |
|
126 |
|
127 TInt ServiceId() const ; |
|
128 |
|
129 private: // Constructors and destructor |
|
130 |
|
131 /** |
|
132 * C++ constructor. |
|
133 * @param aType Type of TMessageExtensionTypes |
|
134 */ |
|
135 CIMCVAppSmileyUtil( TMessageExtensionTypes aType ); |
|
136 |
|
137 /** |
|
138 * Second-phased constructor |
|
139 */ |
|
140 void ConstructL( MIMCVUiAppSkinVariant& aSkinVariant, |
|
141 MIMCVAppUi& aAppUi, |
|
142 CIMCVEngine& aServiceEngine ); |
|
143 |
|
144 private: // Data |
|
145 |
|
146 //util for icon/string convertings |
|
147 CIMCVAppSmileIconUtility* iSmileUtil; |
|
148 |
|
149 // Doesn't own |
|
150 CEikRichTextEditor* iEditor; |
|
151 |
|
152 // Count of current smiley icons in editor |
|
153 TInt iCurrentCount; |
|
154 |
|
155 // Is smiley converted or not |
|
156 RPointerArray< CIMCVAppSmileyInformation > iConvertArray; |
|
157 |
|
158 // service id |
|
159 TInt iServiceId; |
|
160 |
|
161 }; |
|
162 |
|
163 #endif // CIMCVAPPSMILEYUTIL_H |
|