|
1 /* |
|
2 * Copyright (c) 2004-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: Message extension handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCAMESSAGEEXTENSIONSHANDLER_H |
|
20 #define CCAMESSAGEEXTENSIONSHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "MCAMessageExtension.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CEikRichTextEditor; |
|
30 class TCursorSelection; |
|
31 class MCASkinVariant; |
|
32 class MCAAppUi; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Message extensions handler |
|
38 * |
|
39 * @lib chat.app |
|
40 * @since 2.1 |
|
41 */ |
|
42 class CCAMessageExtensionsHandler : public CBase |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Two-phased constructor |
|
48 * @param aAddSmileyHandler |
|
49 * @since 2.1 |
|
50 */ |
|
51 static CCAMessageExtensionsHandler* NewL( MCASkinVariant& aSkinVariant, |
|
52 MCAAppUi& aAppUi, TBool aAddSmileyHandler = ETrue ); |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 * @since 2.1 |
|
57 */ |
|
58 ~CCAMessageExtensionsHandler(); |
|
59 |
|
60 private: |
|
61 /** |
|
62 * Symbian OS Constructor |
|
63 * @since 2.1 |
|
64 */ |
|
65 void ConstructL( MCASkinVariant& aSkinVariant, |
|
66 MCAAppUi& aAppUi, TBool aAddSmileyHandler ); |
|
67 |
|
68 /** |
|
69 * Constructor |
|
70 * @since 2.1 |
|
71 */ |
|
72 CCAMessageExtensionsHandler(); |
|
73 |
|
74 public: |
|
75 /** |
|
76 * Process editor messages for sending them as characters. |
|
77 * Resets extensions. |
|
78 * @param aEditor Editor which contains message. |
|
79 * @since 2.1 |
|
80 * @return Ownership of message returned is passed to caller. |
|
81 */ |
|
82 HBufC* ProcessMessageLC( CEikRichTextEditor& aEditor ); |
|
83 |
|
84 /** |
|
85 * Convert extensions to characters. |
|
86 * @param aEditor Editor which contains message. |
|
87 * @since 2.1 |
|
88 * @return Ownership of message returned is passed to caller. |
|
89 */ |
|
90 HBufC* ExtensionToStringLC( CEikRichTextEditor& aEditor ); |
|
91 |
|
92 /** |
|
93 * Insert extension to editor |
|
94 * @param aEditor Editor which contains message. |
|
95 * @param aType Type of extension needed. |
|
96 * @param aCancelled ETrue after method returns if |
|
97 * extension insertion was cancelled, |
|
98 * EFalse otherwise |
|
99 * @since 2.1 |
|
100 */ |
|
101 void InsertExtensionL( CEikRichTextEditor& aEditor, |
|
102 TMessageExtensionTypes aType, |
|
103 TBool& aCancelled ); |
|
104 |
|
105 /** |
|
106 * Delete extension from editor |
|
107 * @param aEditor Editor which contains message. |
|
108 * @since 2.1 |
|
109 */ |
|
110 void DeleteExtensionL( CEikRichTextEditor& aEditor, |
|
111 TMessageExtensionTypes aType, TInt aPos ); |
|
112 |
|
113 /** |
|
114 * Converts all the extensions in selection area from |
|
115 * strings to extensions. |
|
116 * @since 2.6 |
|
117 * @param aEditor, used editor |
|
118 */ |
|
119 void ConvertSelectionToExtensionL( CEikRichTextEditor& aEditor ); |
|
120 |
|
121 /** |
|
122 * Converts all the extensions in selection area from |
|
123 * strings to extensions. |
|
124 * @since 3.0 |
|
125 * @param aRichText Rich text to be converted |
|
126 * @param aSelection Selection area |
|
127 */ |
|
128 void ConvertSelectionToExtensionL( CRichText& aRichText, |
|
129 TCursorSelection& aSelection ); |
|
130 |
|
131 /** |
|
132 * Converts all the extensions in selection area from |
|
133 * extensions to strings |
|
134 * @since 2.6 |
|
135 * @param aEditor, used editor |
|
136 * @param aPreserve, should we preserve original extension status. |
|
137 * Are they strings or extensions. |
|
138 */ |
|
139 void ConvertSelectionToStringL( CEikRichTextEditor& aEditor, |
|
140 TBool aPreserve = EFalse ); |
|
141 |
|
142 /** |
|
143 * Informs the extensions about changed size |
|
144 * @param aSize |
|
145 * @since 3.0 |
|
146 */ |
|
147 void SizeChanged( TSize& aSize ); |
|
148 |
|
149 /** |
|
150 * Converts all the extensions in selection area from |
|
151 * extensions to strings. |
|
152 * @since S60 v3.1 |
|
153 * @param aEditor Used editor. |
|
154 * @param aResultString Descriptor for converted string, |
|
155 * caller is responsible to provide |
|
156 * large enough descriptor. |
|
157 * @param aSelectionAfterConversion Cursor selection after |
|
158 * extensions are converted to strings. |
|
159 * @param aPreserve Should we preserve original extension status. |
|
160 */ |
|
161 void ConvertSelectionToStringL( |
|
162 CEikRichTextEditor& aEditor, |
|
163 TDes& aResultString, |
|
164 TCursorSelection& aSelectionAfterConversion, |
|
165 TBool aPreserve ); |
|
166 |
|
167 private: |
|
168 |
|
169 //Array of extensions |
|
170 RPointerArray<MCAMessageExtension> iExtensionArray; |
|
171 }; |
|
172 |
|
173 #endif // CCAMESSAGEEXTENSIONSHANDLER_H |
|
174 |
|
175 // End of File |