author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:55:58 +0300 | |
branch | RCL_3 |
changeset 56 | 8152b1f1763a |
parent 44 | ecbabf52600f |
permissions | -rw-r--r-- |
44 | 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: Layout UI interface base class implementation |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
||
22 |
||
23 |
||
24 |
||
25 |
||
26 |
||
27 |
||
28 |
||
29 |
// System includes |
|
30 |
#include <w32std.h> |
|
31 |
#include <s32mem.h> |
|
32 |
#include <aknedsts.h> // CAknEdwinState |
|
33 |
#include <centralrepository.h> |
|
34 |
#include <AknUtils.h> |
|
35 |
||
36 |
#include <peninputclient.h> |
|
37 |
#include <aknfeppeninputenums.h> |
|
38 |
#include <AknFepInternalCRKeys.h> |
|
39 |
#include <peninputcommonlayoutglobalenum.h> |
|
40 |
||
41 |
// User includes |
|
42 |
#include "pluginfepmanagerbase.h" |
|
43 |
#include "peninputimeplugingeneric.h" |
|
44 |
||
45 |
// ======== MEMBER FUNCTIONS ======== |
|
46 |
||
47 |
||
48 |
// ----------------------------------------------------------------------------- |
|
49 |
// CPluginFepManagerBase::CPluginFepManagerBase |
|
50 |
// Destructor |
|
51 |
// (other items were commented in a header). |
|
52 |
// ----------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
CPluginFepManagerBase::~CPluginFepManagerBase() |
|
55 |
{ |
|
56 |
delete iRepository; |
|
57 |
} |
|
58 |
||
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// CPluginFepManagerBase::OnInit |
|
61 |
// Initalize UI. |
|
62 |
// (other items were commented in a header). |
|
63 |
// ----------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
void CPluginFepManagerBase::OnInit() |
|
66 |
{ |
|
67 |
} |
|
68 |
||
69 |
// ----------------------------------------------------------------------------- |
|
70 |
// CPluginFepManagerBase::RetrieveEditorMaxLength |
|
71 |
// Explicitly get ICF max length from layout UI . |
|
72 |
// (other items were commented in a header). |
|
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// |
|
75 |
void CPluginFepManagerBase::RetrieveEditorMaxLength() |
|
76 |
{ |
|
77 |
} |
|
78 |
||
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// CPluginFepManagerBase::UpdateCaseMode |
|
81 |
// Update local copy of case mode. |
|
82 |
// (other items were commented in a header). |
|
83 |
// ----------------------------------------------------------------------------- |
|
84 |
// |
|
85 |
void CPluginFepManagerBase::UpdateCaseMode( TInt aCaseMode ) |
|
86 |
{ |
|
87 |
iLastCase = aCaseMode; |
|
88 |
} |
|
89 |
||
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// CPluginFepManagerBase::SetNumberModeKeyMappingL |
|
92 |
// Set layout UI current number mode. |
|
93 |
// (other items were commented in a header). |
|
94 |
// ----------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
void CPluginFepManagerBase::SetNumberModeKeyMappingL( |
|
97 |
TAknEditorNumericKeymap aAknEditorNumericKeymap ) |
|
98 |
{ |
|
99 |
SendCommandToServer( ECmdPenInputEditorNumericKeyMap, |
|
100 |
aAknEditorNumericKeymap ); |
|
101 |
} |
|
102 |
||
103 |
// ----------------------------------------------------------------------------- |
|
104 |
// CPluginFepManagerBase::HandleKeyL |
|
105 |
// Handle key event. |
|
106 |
// (other items were commented in a header). |
|
107 |
// ----------------------------------------------------------------------------- |
|
108 |
// |
|
109 |
TBool CPluginFepManagerBase::HandleKeyL( TInt aKey, TKeyPressLength aLength, TEventCode /*aEventCode*/ ) |
|
110 |
{ |
|
111 |
return iHkbUi->HandleKeyL( aKey, aLength ); |
|
112 |
} |
|
113 |
||
114 |
// ----------------------------------------------------------------------------- |
|
115 |
// CPluginFepManagerBase::HandleCommandL |
|
116 |
// Handle command come from FEP. |
|
117 |
// (other items were commented in a header). |
|
118 |
// ----------------------------------------------------------------------------- |
|
119 |
// |
|
120 |
void CPluginFepManagerBase::HandleCommandL( TInt aCommandId ) |
|
121 |
{ |
|
122 |
SendCommandToServer( aCommandId ); |
|
123 |
} |
|
124 |
||
125 |
// ----------------------------------------------------------------------------- |
|
126 |
// CPluginFepManagerBase::HandleCommandL |
|
127 |
// Handle command come from FEP. |
|
128 |
// (other items were commented in a header). |
|
129 |
// ----------------------------------------------------------------------------- |
|
130 |
// |
|
131 |
void CPluginFepManagerBase::HandleCommandL(TInt aCommandId,TInt aParam) |
|
132 |
{ |
|
133 |
switch ( aCommandId ) |
|
134 |
{ |
|
135 |
case ECmdPenInputRange: |
|
136 |
{ |
|
137 |
iHkbMode = aParam; |
|
138 |
if ( iHkbMode == ENativeNumber && !SupportNativeNumberRange() ) |
|
139 |
{ |
|
140 |
iHkbMode = ENumber; |
|
141 |
} |
|
142 |
} |
|
143 |
break; |
|
144 |
case ECmdPenInputPermittedRange: |
|
145 |
{ |
|
146 |
iLastCase = ECaseInvalide; |
|
147 |
SetLayoutPermitedRanges( aParam ); |
|
148 |
} |
|
149 |
break; |
|
150 |
case ECmdPenInputEditorState: |
|
151 |
{ |
|
152 |
CAknEdwinState* state = |
|
153 |
reinterpret_cast<CAknEdwinState*>( aParam ); |
|
154 |
SetLayoutRange( state ); |
|
155 |
} |
|
156 |
break; |
|
157 |
case ECmdPenInputSetWindowPos: |
|
158 |
{ |
|
159 |
TRect* rect = reinterpret_cast<TRect*>( aParam ); |
|
160 |
ASSERT( rect ); |
|
161 |
SetLayoutPosition( *rect ); |
|
162 |
} |
|
163 |
break; |
|
164 |
case ECmdPenInputCaseMode: |
|
165 |
//if( aParam != iLastCase ) |
|
166 |
{ |
|
167 |
SendCommandToServer( ECmdPenInputCase, aParam ); |
|
168 |
iLastCase = aParam; |
|
169 |
} |
|
170 |
break; |
|
171 |
case ECmdPenInputEditorCustomNumericKeyMap: |
|
172 |
{ |
|
173 |
TDesC* res = (TDesC*)aParam; |
|
174 |
TPtrC8 param; |
|
175 |
param.Set((TUint8*)res->Ptr(), res->Size()); |
|
176 |
SendCommandToServer( aCommandId, param ); |
|
177 |
SetNumberModeKeyMappingL((TAknEditorNumericKeymap)EKeymapFromResource); |
|
178 |
} |
|
179 |
break; |
|
180 |
case ECmdPenInputSuggestRange: |
|
181 |
iSuggestedRange = aParam; |
|
182 |
if( iSuggestedRange == ERangeAccent ) |
|
183 |
{ |
|
184 |
iSuggestedRange = ERangeEnglish; |
|
185 |
} |
|
186 |
break; |
|
187 |
case ECmdPenInputSendEditorTextAndCurPos: |
|
188 |
{ |
|
189 |
TFepInputContextFieldData* pIcfData = |
|
190 |
reinterpret_cast<TFepInputContextFieldData*>( aParam ); |
|
191 |
||
192 |
TInt dataSize = sizeof( TFepInputContextFieldData ); |
|
193 |
TInt textSize = pIcfData->iText.Size(); |
|
194 |
||
195 |
HBufC8* buf = HBufC8::NewLC(dataSize + textSize + 2*sizeof(TInt)); |
|
196 |
TPtr8 bufPtr = buf->Des(); |
|
197 |
||
198 |
RDesWriteStream writeStream; |
|
199 |
writeStream.Open(bufPtr); |
|
200 |
CleanupClosePushL(writeStream); |
|
201 |
||
202 |
writeStream.WriteInt32L(dataSize); |
|
203 |
writeStream.WriteInt32L(textSize); |
|
204 |
||
205 |
const TUint8* pData = reinterpret_cast<const TUint8*>( pIcfData ); |
|
206 |
writeStream.WriteL( pData, dataSize ); |
|
207 |
||
208 |
const TUint8* pText = reinterpret_cast<const TUint8*>( pIcfData->iText.Ptr() ); |
|
209 |
writeStream.WriteL( pText, textSize ); |
|
210 |
||
211 |
writeStream.CommitL(); |
|
212 |
||
213 |
SendCommandToServer( aCommandId, bufPtr ); |
|
214 |
||
215 |
CleanupStack::PopAndDestroy(&writeStream); |
|
216 |
CleanupStack::PopAndDestroy(buf); |
|
217 |
} |
|
218 |
break; |
|
219 |
case ECmdPenInputSetPromptText: |
|
220 |
{ |
|
221 |
TFepPromptText* pPromptData = |
|
222 |
reinterpret_cast<TFepPromptText*>( aParam ); |
|
223 |
||
224 |
TInt dataSize = sizeof( TFepPromptText ); |
|
225 |
TInt textSize = 0; |
|
226 |
||
227 |
if (pPromptData->iText.Length()) |
|
228 |
{ |
|
229 |
textSize = pPromptData->iText.Size(); |
|
230 |
} |
|
231 |
||
232 |
HBufC8* buf = HBufC8::NewLC(dataSize + textSize + 2*sizeof(TInt)); |
|
233 |
TPtr8 bufPtr = buf->Des(); |
|
234 |
||
235 |
RDesWriteStream writeStream; |
|
236 |
writeStream.Open(bufPtr); |
|
237 |
CleanupClosePushL(writeStream); |
|
238 |
||
239 |
writeStream.WriteInt32L(dataSize); |
|
240 |
writeStream.WriteInt32L(textSize); |
|
241 |
||
242 |
const TUint8* pData = reinterpret_cast<const TUint8*>( pPromptData ); |
|
243 |
writeStream.WriteL( pData, dataSize ); |
|
244 |
||
245 |
if (textSize != 0) |
|
246 |
{ |
|
247 |
const TUint16* pText = pPromptData->iText.Ptr(); |
|
248 |
writeStream.WriteL( pText, textSize/2 ); |
|
249 |
} |
|
250 |
||
251 |
writeStream.CommitL(); |
|
252 |
||
253 |
SendCommandToServer( aCommandId, bufPtr ); |
|
254 |
||
255 |
CleanupStack::PopAndDestroy(&writeStream); |
|
256 |
CleanupStack::PopAndDestroy(buf); |
|
257 |
} |
|
258 |
break; |
|
259 |
case ECmdPeninputSpellICFDisplayContent: |
|
260 |
{ |
|
261 |
// for set icf text before enter spell mode |
|
262 |
} |
|
263 |
break; |
|
264 |
case ECmdPenInputPopupTooltip: |
|
265 |
{ |
|
266 |
TPtrC* tooltipTextPtr = reinterpret_cast<TPtrC*>( aParam ); |
|
267 |
HBufC8* buf8 = HBufC8::NewLC |
|
268 |
( sizeof( TInt ) + tooltipTextPtr->Size() ); |
|
269 |
TPtr8 buf8Ptr = buf8->Des(); |
|
270 |
RDesWriteStream writeStream; |
|
271 |
CleanupClosePushL(writeStream); |
|
272 |
writeStream.Open( buf8Ptr ); |
|
273 |
writeStream.WriteInt32L( tooltipTextPtr->Size() ); |
|
274 |
writeStream.WriteL( tooltipTextPtr->Ptr(), tooltipTextPtr->Length() ); |
|
275 |
writeStream.CommitL(); |
|
276 |
CleanupStack::PopAndDestroy( &writeStream ); |
|
277 |
SendCommandToServer( aCommandId, buf8Ptr ); |
|
278 |
CleanupStack::PopAndDestroy( buf8 ); |
|
279 |
break; |
|
280 |
} |
|
281 |
case ECmdPenInputPopupCandidateList: |
|
282 |
{ |
|
283 |
TFepITICandidateList* candidatelist |
|
284 |
= reinterpret_cast<TFepITICandidateList*>( aParam ); |
|
285 |
CDesCArray* itemArray = candidatelist->iItemArray; |
|
286 |
if ( itemArray && itemArray->Count() > 0 ) |
|
287 |
{ |
|
288 |
TInt sumSize = 0; |
|
289 |
for ( TInt i = 0; i < itemArray->Count(); i++ ) |
|
290 |
{ |
|
291 |
sumSize += (*itemArray)[i].Size(); |
|
292 |
} |
|
293 |
HBufC8* buf8 = HBufC8::NewLC( sizeof(TInt) // For active index |
|
294 |
+ sizeof(TInt) // For the count of item array |
|
295 |
+ sizeof(TInt) // for langcode |
|
296 |
+ sizeof(TInt)*( itemArray->Count() ) // For the size of each item |
|
297 |
+ sumSize// For all of char data |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
298 |
+ 4*sizeof(TInt) // For the Rect |
44 | 299 |
); |
300 |
TPtr8 buf8Ptr = buf8->Des(); |
|
301 |
RDesWriteStream writeStream; |
|
302 |
CleanupClosePushL(writeStream); |
|
303 |
writeStream.Open( buf8Ptr ); |
|
304 |
writeStream.WriteInt32L( candidatelist->iActiveIndex ); |
|
305 |
writeStream.WriteInt32L( itemArray->Count() ); |
|
306 |
writeStream.WriteInt32L(candidatelist->iLangCode); |
|
307 |
||
308 |
for ( TInt i = 0; i < itemArray->Count(); i++ ) |
|
309 |
{ |
|
310 |
writeStream.WriteInt32L( (*itemArray)[i].Size() ); |
|
311 |
writeStream.WriteL( (*itemArray)[i].Ptr(), (*itemArray)[i].Length() ); |
|
312 |
} |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
313 |
|
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
314 |
writeStream.WriteInt32L( candidatelist->iRect.iTl.iX); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
315 |
writeStream.WriteInt32L( candidatelist->iRect.iTl.iY ); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
316 |
writeStream.WriteInt32L( candidatelist->iRect.iBr.iX); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
317 |
writeStream.WriteInt32L( candidatelist->iRect.iBr.iY ); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
318 |
|
44 | 319 |
writeStream.CommitL(); |
320 |
CleanupStack::PopAndDestroy( &writeStream ); |
|
321 |
SendCommandToServer( aCommandId, buf8Ptr ); |
|
322 |
CleanupStack::PopAndDestroy( buf8 ); |
|
323 |
} |
|
324 |
break; |
|
325 |
} |
|
326 |
case ECmdPenInputFingerMatchIndicator: |
|
327 |
{ |
|
328 |
TFepIndicatorInfo* pIndicatorData = |
|
329 |
reinterpret_cast<TFepIndicatorInfo*>( aParam ); |
|
330 |
||
331 |
HBufC8* buf = HBufC8::NewLC(4 * sizeof(TInt)); |
|
332 |
TPtr8 bufPtr = buf->Des(); |
|
333 |
||
334 |
RDesWriteStream writeStream; |
|
335 |
writeStream.Open(bufPtr); |
|
336 |
CleanupClosePushL(writeStream); |
|
337 |
||
338 |
writeStream.WriteInt32L(pIndicatorData->iIndicatorImgID); |
|
339 |
writeStream.WriteInt32L(pIndicatorData->iIndicatorMaskID); |
|
340 |
writeStream.WriteInt32L(pIndicatorData->iIndicatorTextImgID); |
|
341 |
writeStream.WriteInt32L(pIndicatorData->iIndicatorTextMaskID); |
|
342 |
||
343 |
writeStream.CommitL(); |
|
344 |
||
345 |
SendCommandToServer( aCommandId, bufPtr ); |
|
346 |
||
347 |
CleanupStack::PopAndDestroy(&writeStream); |
|
348 |
CleanupStack::PopAndDestroy(buf); |
|
349 |
} |
|
350 |
break; |
|
351 |
default: |
|
352 |
SendCommandToServer( aCommandId, aParam ); |
|
353 |
break; |
|
354 |
} |
|
355 |
} |
|
356 |
||
357 |
// ----------------------------------------------------------------------------- |
|
358 |
// CPluginFepManagerBase::CloseUI |
|
359 |
// Close plugin layout UI. |
|
360 |
// (other items were commented in a header). |
|
361 |
// ----------------------------------------------------------------------------- |
|
362 |
// |
|
363 |
void CPluginFepManagerBase::CloseUI() |
|
364 |
{ |
|
365 |
if (iPenInputServer->IsVisible()) |
|
366 |
{ |
|
367 |
iPenInputServer->ActivateLayout( EFalse ); |
|
368 |
} |
|
369 |
} |
|
370 |
||
371 |
// ----------------------------------------------------------------------------- |
|
372 |
// CPluginFepManagerBase::ActivateUI |
|
373 |
// Activate plugin layout UI. |
|
374 |
// (other items were commented in a header). |
|
375 |
// ----------------------------------------------------------------------------- |
|
376 |
// |
|
377 |
void CPluginFepManagerBase::ActivateUI() |
|
378 |
{ |
|
379 |
if(iPenInputServer) |
|
380 |
{ |
|
381 |
iPenInputServer->ActivateLayout( ETrue ); |
|
382 |
} |
|
383 |
} |
|
384 |
||
385 |
// ----------------------------------------------------------------------------- |
|
386 |
// CPluginFepManagerBase::EditorMaxLength |
|
387 |
// Get max text length of layout UI ICF control. |
|
388 |
// (other items were commented in a header). |
|
389 |
// ----------------------------------------------------------------------------- |
|
390 |
// |
|
391 |
TInt CPluginFepManagerBase::EditorMaxLength() |
|
392 |
{ |
|
393 |
return iMaxEditorLength; |
|
394 |
} |
|
395 |
||
396 |
// ----------------------------------------------------------------------------- |
|
397 |
// CPluginFepManagerBase::SizeChanged |
|
398 |
// Handle screen size changed. |
|
399 |
// (other items were commented in a header). |
|
400 |
// ----------------------------------------------------------------------------- |
|
401 |
// |
|
402 |
void CPluginFepManagerBase::ResourceChanged(TInt aType) |
|
403 |
{ |
|
404 |
iPenInputServer->ResourceChanged(aType); |
|
405 |
} |
|
406 |
||
407 |
// ----------------------------------------------------------------------------- |
|
408 |
// CPluginFepManagerBase::SetNextFepUI |
|
409 |
// Set underlining UI. |
|
410 |
// (other items were commented in a header). |
|
411 |
// ----------------------------------------------------------------------------- |
|
412 |
// |
|
413 |
void CPluginFepManagerBase::SetNextFepUI( MAknFepManagerInterface* aNextUi ) |
|
414 |
{ |
|
415 |
iHkbUi = aNextUi; |
|
416 |
} |
|
417 |
||
418 |
// ----------------------------------------------------------------------------- |
|
419 |
// CPluginFepManagerBase::SupportLanguage |
|
420 |
// Get support language in sepecfied mode. |
|
421 |
// (other items were commented in a header). |
|
422 |
// ----------------------------------------------------------------------------- |
|
423 |
// |
|
424 |
TInt CPluginFepManagerBase::SupportLanguage( TInt /*aMode*/ ) const |
|
425 |
{ |
|
426 |
return iLanguage; |
|
427 |
} |
|
428 |
||
429 |
// ----------------------------------------------------------------------------- |
|
430 |
// CPluginFepManagerBase::SetInputLanguageL |
|
431 |
// Set current language. |
|
432 |
// (other items were commented in a header). |
|
433 |
// ----------------------------------------------------------------------------- |
|
434 |
// |
|
435 |
void CPluginFepManagerBase::SetInputLanguageL( TLanguage aLanguage ) |
|
436 |
{ |
|
437 |
iLanguage = aLanguage; |
|
438 |
//maybe language check is needed. |
|
439 |
TInt lang = (TInt)aLanguage; |
|
440 |
ASSERT( lang >=0 ); |
|
441 |
SendCommandToServer( ECmdPenInputLanguage, lang ); |
|
442 |
} |
|
443 |
||
444 |
TInt CPluginFepManagerBase::InputLanguage() |
|
445 |
{ |
|
446 |
return iLanguage; |
|
447 |
} |
|
448 |
||
449 |
// ----------------------------------------------------------------------------- |
|
450 |
// CPluginFepManagerBase::SetFepAwareEditorText |
|
451 |
// Set editor text and cursor information to layout UI ICF control. |
|
452 |
// (other items were commented in a header). |
|
453 |
// ----------------------------------------------------------------------------- |
|
454 |
// |
|
455 |
void CPluginFepManagerBase::SetFepAwareEditorText( |
|
456 |
const TFepInputContextFieldData& aIcfData ) |
|
457 |
{ |
|
458 |
} |
|
459 |
||
460 |
// ----------------------------------------------------------------------------- |
|
461 |
// CPluginFepManagerBase::SetMode |
|
462 |
// Set layout UI mode. |
|
463 |
// (other items were commented in a header). |
|
464 |
// ----------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
467 |
void CPluginFepManagerBase::SetMode( TInt aMode, TBool aPredictive, |
|
468 |
TBool aQwertyInputMode, TInt aKeyboardType) |
|
469 |
#else |
|
470 |
void CPluginFepManagerBase::SetMode( TInt aMode, TBool aPredictive, |
|
471 |
TBool aQwertyInputMode ) |
|
472 |
#endif |
|
473 |
{ |
|
474 |
iHkbUi->SetMode( aMode, aPredictive, aQwertyInputMode ); |
|
475 |
} |
|
476 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
477 |
TBool CPluginFepManagerBase::IsValidFnKeyPress() const |
|
478 |
{ |
|
479 |
return EFalse; |
|
480 |
} |
|
481 |
TBool CPluginFepManagerBase::IsValidLongChrKeyPress() const |
|
482 |
{ |
|
483 |
return EFalse; |
|
484 |
} |
|
485 |
#endif |
|
486 |
||
487 |
// ----------------------------------------------------------------------------- |
|
488 |
// CPluginFepManagerBase::SetMode |
|
489 |
// Set layout UI current case. |
|
490 |
// (other items were commented in a header). |
|
491 |
// ----------------------------------------------------------------------------- |
|
492 |
// |
|
493 |
void CPluginFepManagerBase::SetCase( TCase aCase ) |
|
494 |
{ |
|
495 |
iHkbUi->SetCase( aCase ); |
|
496 |
} |
|
497 |
||
498 |
// ----------------------------------------------------------------------------- |
|
499 |
// CPluginFepManagerBase::ExpireMultitapTimer |
|
500 |
// Compatibile with HKB UI. |
|
501 |
// (other items were commented in a header). |
|
502 |
// ----------------------------------------------------------------------------- |
|
503 |
// |
|
504 |
void CPluginFepManagerBase::ExpireMultitapTimer() |
|
505 |
{ |
|
506 |
} |
|
507 |
||
508 |
// ----------------------------------------------------------------------------- |
|
509 |
// CPluginFepManagerBase::IsValidNumericLongKeyPress |
|
510 |
// Compatibile with HKB UI. |
|
511 |
// (other items were commented in a header). |
|
512 |
// ----------------------------------------------------------------------------- |
|
513 |
// |
|
514 |
TBool CPluginFepManagerBase::IsValidNumericLongKeyPress( TInt /*aKey*/ ) const |
|
515 |
{ |
|
516 |
return EFalse; |
|
517 |
} |
|
518 |
||
519 |
// ----------------------------------------------------------------------------- |
|
520 |
// CPluginFepManagerBase::AddTextToUserDictionaryL |
|
521 |
// Compatibile with HKB UI. |
|
522 |
// (other items were commented in a header). |
|
523 |
// ----------------------------------------------------------------------------- |
|
524 |
// |
|
525 |
void CPluginFepManagerBase::AddTextToUserDictionaryL( const TDesC& /*aText*/ ) |
|
526 |
{ |
|
527 |
} |
|
528 |
||
529 |
// ----------------------------------------------------------------------------- |
|
530 |
// CPluginFepManagerBase::GetFormatOfFepInlineText |
|
531 |
// Compatibile with HKB UI. |
|
532 |
// (other items were commented in a header). |
|
533 |
// ----------------------------------------------------------------------------- |
|
534 |
// |
|
535 |
void CPluginFepManagerBase::GetFormatOfFepInlineText( |
|
536 |
TCharFormat& /*aFormat*/, |
|
537 |
TInt& /*aNumberOfCharactersWithSameFormat*/, |
|
538 |
TInt /*aPositionOfCharacter*/ ) const |
|
539 |
{ |
|
540 |
} |
|
541 |
||
542 |
// ----------------------------------------------------------------------------- |
|
543 |
// CPluginFepManagerBase::IsValidShiftKeyPress |
|
544 |
// Compatibile with HKB UI. |
|
545 |
// (other items were commented in a header). |
|
546 |
// ----------------------------------------------------------------------------- |
|
547 |
// |
|
548 |
TBool CPluginFepManagerBase::IsValidShiftKeyPress() const |
|
549 |
{ |
|
550 |
return EFalse; |
|
551 |
} |
|
552 |
||
553 |
// ----------------------------------------------------------------------------- |
|
554 |
// CPluginFepManagerBase::SetEditorContext |
|
555 |
// Compatibile with HKB UI. |
|
556 |
// (other items were commented in a header). |
|
557 |
// ----------------------------------------------------------------------------- |
|
558 |
// |
|
559 |
void CPluginFepManagerBase::SetEditorContext( TInt /*aContext*/ ) |
|
560 |
{ |
|
561 |
} |
|
562 |
||
563 |
// ----------------------------------------------------------------------------- |
|
564 |
// CPluginFepManagerBase::SetEditorContext |
|
565 |
// Compatibile with HKB UI. |
|
566 |
// (other items were commented in a header). |
|
567 |
// ----------------------------------------------------------------------------- |
|
568 |
// |
|
569 |
void CPluginFepManagerBase::SetStarKeyFlag( TBool /*aSet*/ ) |
|
570 |
{ |
|
571 |
} |
|
572 |
||
573 |
// ----------------------------------------------------------------------------- |
|
574 |
// CPluginFepManagerBase::CPluginFepManagerBase |
|
575 |
// C++ default constructor. |
|
576 |
// (other items were commented in a header). |
|
577 |
// ----------------------------------------------------------------------------- |
|
578 |
// |
|
579 |
CPluginFepManagerBase::CPluginFepManagerBase( CPenInputImePluginGeneric& aOwner, |
|
580 |
RPeninputServer* aPenInputServer ) |
|
581 |
:iOwner( aOwner ), iPenInputServer( aPenInputServer ) |
|
582 |
{ |
|
583 |
iSuggestedRange = ERangeInvalid; |
|
584 |
} |
|
585 |
||
586 |
// ----------------------------------------------------------------------------- |
|
587 |
// CPluginFepManagerBase::BaseConstructL |
|
588 |
// Symbian 2nd phase constructor. |
|
589 |
// (other items were commented in a header). |
|
590 |
// ----------------------------------------------------------------------------- |
|
591 |
// |
|
592 |
void CPluginFepManagerBase::BaseConstructL() |
|
593 |
{ |
|
594 |
iRepository = CRepository::NewL( KCRUidAknFep ); |
|
595 |
} |
|
596 |
||
597 |
// ----------------------------------------------------------------------------- |
|
598 |
// CPluginFepManagerBase::SetLayoutPermitedRanges |
|
599 |
// Set layout permited ranges. |
|
600 |
// (other items were commented in a header). |
|
601 |
// ----------------------------------------------------------------------------- |
|
602 |
// |
|
603 |
void CPluginFepManagerBase::SetLayoutPermitedRanges( TInt aPermittedMode ) |
|
604 |
{ |
|
605 |
iPermittedMode = aPermittedMode; |
|
606 |
||
607 |
// Not derived from edwin |
|
608 |
if ( aPermittedMode == EAknEditorNumericInputMode ) |
|
609 |
{ |
|
610 |
if ( SupportNativeNumberRange() ) |
|
611 |
{ |
|
612 |
iPermittedRange = ERangeNativeNumber; |
|
613 |
} |
|
614 |
iPermittedRange |= ERangeNumber; |
|
615 |
} |
|
616 |
else if(aPermittedMode == (EAknEditorNumericInputMode | EAknEditorFullWidthNumericInputMode)) |
|
617 |
{ |
|
618 |
if ( SupportNativeNumberRange() ) |
|
619 |
{ |
|
620 |
iPermittedRange = ERangeNativeNumber; |
|
621 |
} |
|
622 |
iPermittedRange |= ERangeNumber; |
|
623 |
} |
|
624 |
else if ( aPermittedMode & EAknEditorTextInputMode ) |
|
625 |
{ |
|
626 |
// Derived from edwin and EAknEditorTextInputMode |
|
627 |
iPermittedRange = ERangeNative | |
|
628 |
ERangeNumber | |
|
629 |
ERangeEnglish | |
|
630 |
ERangeSymbol | |
|
631 |
ERangeNativeNumber; |
|
632 |
} |
|
633 |
else if ( aPermittedMode & EAknEditorSecretAlphaInputMode ) |
|
634 |
{ |
|
635 |
// Derived from EAknEditorSecretAlphaInputMode |
|
636 |
iPermittedRange = ERangeNumber | |
|
637 |
ERangeEnglish | |
|
638 |
ERangeSymbol; |
|
639 |
} |
|
640 |
else |
|
641 |
{ |
|
642 |
iPermittedRange = ERangeNative | |
|
643 |
ERangeNumber | |
|
644 |
ERangeEnglish | |
|
645 |
ERangeSymbol | |
|
646 |
ERangeNativeNumber; |
|
647 |
} |
|
648 |
} |
|
649 |
||
650 |
// ----------------------------------------------------------------------------- |
|
651 |
// CPluginFepManagerBase::SetLayoutRange |
|
652 |
// Set layout primary range. |
|
653 |
// (other items were commented in a header). |
|
654 |
// ----------------------------------------------------------------------------- |
|
655 |
// |
|
656 |
void CPluginFepManagerBase::SetLayoutRange( |
|
657 |
const CAknEdwinState* aEditorState ) |
|
658 |
{ |
|
659 |
//calculate permitted ranges |
|
660 |
if(aEditorState) |
|
661 |
{ |
|
662 |
if( aEditorState->Flags() & EAknEditorFlagLatinInputModesOnly ) |
|
663 |
{ |
|
664 |
iPermittedRange &= ~ERangeNative; |
|
665 |
iPermittedRange &= ~ERangeNativeNumber; |
|
666 |
} |
|
667 |
if ( iPermittedMode != EAknEditorNumericInputMode |
|
668 |
&& !SupportLatinRange() |
|
669 |
&& !( aEditorState->Flags() & EAknEditorFlagLatinInputModesOnly ) ) |
|
670 |
{ |
|
671 |
iPermittedRange &= ~ERangeEnglish; |
|
672 |
} |
|
673 |
} |
|
674 |
else |
|
675 |
{ |
|
676 |
if ( iPermittedMode == EAknEditorNumericInputMode ) |
|
677 |
{ |
|
678 |
if( iHkbMode == ENumber ) |
|
679 |
{ |
|
680 |
iPermittedRange = ERangeNumber; |
|
681 |
} |
|
682 |
else if ( iHkbMode == ENativeNumber ) |
|
683 |
{ |
|
684 |
iPermittedRange = ERangeNativeNumber; |
|
685 |
} |
|
686 |
} |
|
687 |
else if( iPermittedMode == |
|
688 |
(EAknEditorNumericInputMode | EAknEditorFullWidthNumericInputMode)) |
|
689 |
{ |
|
690 |
iPermittedRange = ERangeNumber | ERangeNativeNumber; |
|
691 |
} |
|
692 |
} |
|
693 |
||
694 |
SendCommandToServer( ECmdPenInputPermittedRange, iPermittedRange ); |
|
695 |
||
696 |
TInt priRange; |
|
697 |
||
698 |
switch( iHkbMode ) |
|
699 |
{ |
|
700 |
case ECangJie: |
|
701 |
case EStrokeFind: |
|
702 |
case EStroke: |
|
703 |
case EPinyin: |
|
704 |
case EZhuyin: |
|
705 |
case EZhuyinFind: |
|
706 |
case EHindi: |
|
707 |
{ |
|
708 |
priRange = ERangeNative; |
|
709 |
} |
|
710 |
break; |
|
711 |
case ENumber: |
|
712 |
{ |
|
713 |
priRange = ERangeNumber; |
|
714 |
} |
|
715 |
break; |
|
716 |
case ENativeNumber: |
|
717 |
{ |
|
718 |
priRange = ERangeNativeNumber; |
|
719 |
} |
|
720 |
break; |
|
721 |
case EPRCFind: |
|
722 |
case ELatin: |
|
723 |
case ELatinText: |
|
724 |
case ELatinUpper: |
|
725 |
case ELatinLower: |
|
726 |
if ( iLanguage == ELangHindi) |
|
727 |
{ |
|
728 |
priRange = ERangeEnglish; |
|
729 |
} |
|
730 |
else |
|
731 |
{ |
|
732 |
priRange = iPermittedRange & ERangeNative ? ERangeNative : ERangeEnglish; |
|
733 |
} |
|
734 |
break; |
|
735 |
default: |
|
736 |
{ |
|
737 |
priRange = iPermittedRange & ERangeNative ? ERangeNative : ERangeEnglish; |
|
738 |
} |
|
739 |
break; |
|
740 |
} |
|
741 |
||
742 |
if( iSuggestedRange != ERangeInvalid && (iSuggestedRange & iPermittedRange) ) |
|
743 |
{ |
|
744 |
priRange = iSuggestedRange; |
|
745 |
iSuggestedRange = ERangeInvalid; |
|
746 |
} |
|
747 |
SendCommandToServer( ECmdPenInputRange, priRange ); |
|
748 |
} |
|
749 |
||
750 |
// ----------------------------------------------------------------------------- |
|
751 |
// CPluginFepManagerBase::SendCommandToServer |
|
752 |
// Send command to pen input server utility function. |
|
753 |
// (other items were commented in a header). |
|
754 |
// ----------------------------------------------------------------------------- |
|
755 |
// |
|
756 |
void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId ) |
|
757 |
{ |
|
758 |
iPenInputServer->HandleCommand( aCommandId ); |
|
759 |
} |
|
760 |
||
761 |
// ----------------------------------------------------------------------------- |
|
762 |
// CPluginFepManagerBase::SendCommandToServer |
|
763 |
// Send command to pen input server utility function. |
|
764 |
// (other items were commented in a header). |
|
765 |
// ----------------------------------------------------------------------------- |
|
766 |
// |
|
767 |
void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId, TInt aParam ) |
|
768 |
{ |
|
769 |
TBuf8<sizeof(TInt)> buf; |
|
770 |
buf.Append( (TUint8*)&aParam, sizeof(TInt) ); |
|
771 |
SendCommandToServer( aCommandId, buf ); |
|
772 |
} |
|
773 |
||
774 |
// ----------------------------------------------------------------------------- |
|
775 |
// CPluginFepManagerBase::SendCommandToServer |
|
776 |
// Send command to pen input server utility function. |
|
777 |
// (other items were commented in a header). |
|
778 |
// ----------------------------------------------------------------------------- |
|
779 |
// |
|
780 |
void CPluginFepManagerBase::SendCommandToServer( TInt aCommandId, |
|
781 |
const TDesC8& aParam ) |
|
782 |
{ |
|
783 |
iPenInputServer->HandleCommand( aCommandId, aParam ); |
|
784 |
} |
|
785 |
||
786 |
// ----------------------------------------------------------------------------- |
|
787 |
// CPluginFepManagerBase::LayoutLastUsedRange |
|
788 |
// Get layout UI last used range. |
|
789 |
// (other items were commented in a header). |
|
790 |
// ----------------------------------------------------------------------------- |
|
791 |
// |
|
792 |
TInt CPluginFepManagerBase::LayoutLastUsedRange() |
|
793 |
{ |
|
794 |
TInt value = 0; |
|
795 |
if ( iRepository ) |
|
796 |
{ |
|
797 |
iRepository->Get( KAknFepLastUsedRange, value ); |
|
798 |
} |
|
799 |
||
800 |
return value; |
|
801 |
} |
|
802 |
||
803 |
// ----------------------------------------------------------------------------- |
|
804 |
// CPluginFepManagerBase::SetLayoutPosition |
|
805 |
// Set layout UI position. |
|
806 |
// (other items were commented in a header). |
|
807 |
// ----------------------------------------------------------------------------- |
|
808 |
// |
|
809 |
void CPluginFepManagerBase::SetLayoutPosition( const TRect& pParam ) |
|
810 |
{ |
|
811 |
TBuf8<sizeof( TRect )> buf; |
|
812 |
buf.Append( (TUint8*)&pParam, sizeof( pParam ) ); |
|
813 |
||
814 |
SendCommandToServer( ECmdPenInputSetWindowPos, buf ); |
|
815 |
} |
|
816 |
||
817 |
// ----------------------------------------------------------------------------- |
|
818 |
// CPluginFepManagerBase::GetLocalLanguage |
|
819 |
// (other items were commented in a header). |
|
820 |
// ----------------------------------------------------------------------------- |
|
821 |
// |
|
822 |
TLanguage CPluginFepManagerBase::GetLocalLanguage( |
|
823 |
const CAknEdwinState* aEditorState ) const |
|
824 |
{ |
|
825 |
TLanguage language = ELangTest; |
|
826 |
// Check for a local language override |
|
827 |
if ( aEditorState ) |
|
828 |
{ |
|
829 |
TInt aknEditorFlags = aEditorState->Flags() ; |
|
830 |
if ( aknEditorFlags & EAknEditorFlagLatinInputModesOnly ) |
|
831 |
{ |
|
832 |
language = ELangEnglish; |
|
833 |
} |
|
834 |
else |
|
835 |
{ |
|
836 |
language = aEditorState->LocalLanguage(); |
|
837 |
} |
|
838 |
} |
|
839 |
||
840 |
return language; |
|
841 |
} |
|
842 |
||
843 |
TBool CPluginFepManagerBase::SupportLatinRange() |
|
844 |
{ |
|
845 |
if ( iLanguage == ELangRussian || iLanguage == ELangBulgarian || |
|
846 |
iLanguage == ELangUkrainian || iLanguage == ELangHebrew ) |
|
847 |
{ |
|
848 |
return EFalse; |
|
849 |
} |
|
850 |
||
851 |
if ( iLanguage == ELangGreek ) |
|
852 |
{ |
|
853 |
return EFalse; |
|
854 |
} |
|
855 |
||
856 |
if ( iLanguage == ELangArabic || iLanguage == ELangFarsi || |
|
857 |
iLanguage == ELangUrdu || iLanguage == ELangThai ) |
|
858 |
{ |
|
859 |
return EFalse; |
|
860 |
} |
|
861 |
||
862 |
if ( iLanguage == ELangHindi || iLanguage == ELangMarathi ) |
|
863 |
{ |
|
864 |
return ETrue; |
|
865 |
} |
|
866 |
||
867 |
return ETrue; |
|
868 |
} |
|
869 |
||
870 |
||
871 |
TBool CPluginFepManagerBase::SupportNativeNumberRange() |
|
872 |
{ |
|
873 |
if ( iLanguage == ELangArabic || iLanguage == ELangFarsi || |
|
874 |
iLanguage == ELangUrdu || iLanguage == ELangHindi || |
|
875 |
iLanguage == ELangThai ) |
|
876 |
{ |
|
877 |
return ETrue; |
|
878 |
} |
|
879 |
||
880 |
return EFalse; |
|
881 |
} |
|
882 |
// End Of File |