|
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: common layout window for UI interface of VKB and HWR |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 #include <coemain.h> |
|
21 |
|
22 #include <AknFepGlobalEnums.h> |
|
23 #include <aknfeppeninputenums.h> |
|
24 #include <peninputpluginutils.h> |
|
25 #include <peninputcmdparam.h> // Use global signal |
|
26 #include <peninputlayoutmultilineicf.h> |
|
27 #include <peninputeventbutton.h> |
|
28 #include <peninputmultimodebutton.h> |
|
29 #include <peninputdragbutton.h> |
|
30 #include <peninputlayoutchoicelist.h> |
|
31 #include <peninputlayout.h> |
|
32 #include <peninputrangebar.h> |
|
33 #include <bautils.h> |
|
34 #include <AknIconUtils.h> |
|
35 #include <AknLayoutDef.h> |
|
36 #include <AknUtils.h> |
|
37 #include <aknlayoutscalable_avkon.cdl.h> |
|
38 #include <AknsUtils.h> |
|
39 //#include <peninputcmdparam.h> |
|
40 #include <aknFepVietnameseInputTables.h> |
|
41 |
|
42 // User includes |
|
43 #include "peninputdataconverter.h" |
|
44 #include "peninputrangebarinfo.h" |
|
45 #include "peninputlayoutwindowext.h" |
|
46 #include "peninputclientlayoutinfo.h" |
|
47 #include "peninputdataprovider.h" |
|
48 #include "peninputlayoutcontext.h" |
|
49 #include "peninputvkbctrlext.h" |
|
50 #include "peninputnumerickeymappingmgr.h" |
|
51 #include "peninputgenericvkb.hrh" |
|
52 |
|
53 // Constants |
|
54 const TInt KIntLengthForByte = 8; |
|
55 const TInt KPeninputLayoutWindowUnitWidth = 12; |
|
56 const TInt KInvalidIndex = -1; |
|
57 |
|
58 //const TInt32 KInvalidResId = -1; |
|
59 //const TInt KInvalidImg = -1 ; |
|
60 const TUint32 KDefaultTextColor = 0x000000; |
|
61 const TUint32 KDefaultShadowTextColor = 0xffffff; |
|
62 //const TInt KNotSupportSkin = -1; |
|
63 |
|
64 const TInt KIntSizeToInt16 = 2; |
|
65 const TInt KMaxNumericString = 32; |
|
66 |
|
67 // ======== MEMBER FUNCTIONS ======== |
|
68 |
|
69 // ------------------------------------------------------------------------ |
|
70 // CPeninputLayoutWindowExt::CPeninputLayoutWindowExt |
|
71 // (other items were commented in a header) |
|
72 // ------------------------------------------------------------------------ |
|
73 // |
|
74 EXPORT_C CPeninputLayoutWindowExt::CPeninputLayoutWindowExt( |
|
75 CFepUiLayout* aUiLayout, MPeninputLayoutContext* aLayoutContext ) |
|
76 : CAknFepCtrlBaseWindowExt( aUiLayout, EPeninutWindowCtrlIdBaseWindow ), |
|
77 iConfigInfo( NULL ), iLayoutContext( aLayoutContext ), |
|
78 iLastUsedTotalColumns( KPeninputLayoutWindowUnitWidth ), |
|
79 iFirstTimeConstruct( ETrue ), |
|
80 iSwitchFontSet(EFalse), |
|
81 iUnitSizeChange(EFalse) |
|
82 { |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CPeninputLayoutWindowExt::ConstructL |
|
87 // (other items were commented in a header) |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C void CPeninputLayoutWindowExt::ConstructL() |
|
91 { |
|
92 BaseConstructL(); |
|
93 |
|
94 if( iLayoutContext->LayoutType() == EPluginInputModeVkb || |
|
95 iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
96 { |
|
97 iVkbLayout = CAknFepCtrlVkbLayout::NewL(); |
|
98 } |
|
99 else |
|
100 { |
|
101 iVkbLayout = NULL; |
|
102 } |
|
103 |
|
104 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
105 |
|
106 // Set up resources |
|
107 TFileName resFileName = GetWindowResFileName(); |
|
108 BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resFileName ); |
|
109 iWinResId = coeEnv->AddResourceFileL( resFileName ); |
|
110 |
|
111 //TResourceReader reader; |
|
112 |
|
113 //coeEnv->CreateResourceReaderLC( reader, GetWindowResId() ); |
|
114 SetResourceId( GetWindowResId() ); |
|
115 ConstructFromResourceL(); |
|
116 |
|
117 if (!iKeyMappingMgr) |
|
118 { |
|
119 // if key mapping mgr is not constructed in ConstructFromResourceL, need to |
|
120 // construct it here |
|
121 TResourceReader resReader; |
|
122 CCoeEnv::Static()->CreateResourceReaderLC(resReader, GetNumKeymappingResId()); |
|
123 iKeyMappingMgr = CPeninputNumericKepMappingMgr::NewL(resReader); |
|
124 CleanupStack::PopAndDestroy(1); |
|
125 } |
|
126 |
|
127 CreateAllControlsL(); |
|
128 SetControlsFont(); |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CPeninputLayoutWindowExt::~CPeninputLayoutWindowExt |
|
133 // (other items were commented in a header) |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C CPeninputLayoutWindowExt::~CPeninputLayoutWindowExt() |
|
137 { |
|
138 delete iConfigInfo; |
|
139 delete iKeyMappingMgr; |
|
140 delete iVkbLayout; |
|
141 // Delete resource file from CoeEnv |
|
142 CCoeEnv::Static()->DeleteResourceFile( iWinResId ); |
|
143 |
|
144 CCoeEnv::Static()->DeleteResourceFile( iConfigResId ); |
|
145 |
|
146 delete iToneSet; |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // CPeninputLayoutWindowExt::SizeChanged |
|
151 // (other items were commented in a header) |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 EXPORT_C void CPeninputLayoutWindowExt::SizeChanged( TBool /*aLandscapeStyle*/ ) |
|
155 { |
|
156 iLangOrSizeChanged = ETrue; |
|
157 ReadLafForShadow(); |
|
158 ResetLastColRow(); |
|
159 |
|
160 if ( iConfigInfo ) |
|
161 { |
|
162 ChangeClientSize(); |
|
163 } |
|
164 |
|
165 //ReadLafForShadow( rect ); |
|
166 |
|
167 TInt style = EPeninputPositionChangeBrJustify; |
|
168 TBuf<KIntSizeToInt16> bufStyle; |
|
169 bufStyle = ( TUint16* )&style; |
|
170 HandleControlEvent(EPeninputLayoutEventMovePosition, NULL, bufStyle); |
|
171 |
|
172 iLangOrSizeChanged = EFalse; |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CPeninputLayoutWindowExt::ReadLafForShadow |
|
177 // (other items were commented in a header). |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void CPeninputLayoutWindowExt::ReadLafForShadow() |
|
181 { |
|
182 TAknWindowLineLayout shadowPane; |
|
183 TAknWindowLineLayout shadowTl; |
|
184 TAknWindowLineLayout shadowBr; |
|
185 TAknLayoutRect shadowRect; |
|
186 TAknLayoutRect shadowTlRect; |
|
187 TAknLayoutRect shadowBrRect; |
|
188 |
|
189 shadowPane = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane(1).LayoutLine(); |
|
190 shadowRect.LayoutRect(TRect(), shadowPane); |
|
191 |
|
192 shadowTl = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g1().LayoutLine(); |
|
193 shadowTlRect.LayoutRect(shadowRect.Rect(), shadowTl); |
|
194 |
|
195 shadowBr = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g8().LayoutLine(); |
|
196 shadowBrRect.LayoutRect(shadowRect.Rect(), shadowBr); |
|
197 |
|
198 iShadowTlWidth = shadowTlRect.Rect().Size().iWidth; |
|
199 iShadowTlHeight = shadowTlRect.Rect().Size().iHeight; |
|
200 iShadowBrWidth = shadowBrRect.Rect().Size().iWidth; |
|
201 iShadowBrHeight = shadowBrRect.Rect().Size().iHeight; |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CPeninputLayoutWindowExt::SizeChanged |
|
206 // (other items were commented in a header). |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 EXPORT_C void CPeninputLayoutWindowExt::SizeChangedForBaseWindow( TInt /*aTotalColumns*/ ) |
|
210 { |
|
211 } |
|
212 // --------------------------------------------------------------------------- |
|
213 // CPeninputLayoutWindowExt::HandleControlEvent |
|
214 // (other items were commented in a header) |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 EXPORT_C void CPeninputLayoutWindowExt::HandleControlEvent( TInt aEventType, |
|
218 CFepUiBaseCtrl* aCtrl, const TDesC& aEventData ) |
|
219 { |
|
220 // Call this function in base class |
|
221 CAknFepCtrlBaseWindowExt::HandleControlEvent( aEventType, |
|
222 aCtrl, aEventData ); |
|
223 |
|
224 TInt* data = ( TInt* ) aEventData.Ptr(); |
|
225 |
|
226 switch ( aEventType ) |
|
227 { |
|
228 case EEventButtonUp: |
|
229 { |
|
230 // check current range |
|
231 TInt curRange = CPeninputDataConverter::AnyToInt |
|
232 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
233 if( aCtrl->ControlId() == EPeninutWindowCtrlIdShiftBtn) |
|
234 { |
|
235 if ( ( curRange == ERangeEnglish ) || ( curRange == ERangeAccent ) |
|
236 || ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) ) ) |
|
237 { |
|
238 CAknFepCtrlMultiModeButton* button = |
|
239 static_cast<CAknFepCtrlMultiModeButton*>( aCtrl ); |
|
240 TInt realCase = button->GetRealCaseByMode( button->CurrentMode() ); |
|
241 HandleMergedBtnClicked( realCase ); |
|
242 } |
|
243 else |
|
244 { |
|
245 HandleShiftAndCapslockBtnClicked(); |
|
246 TInt shiftStatus = CPeninputDataConverter::AnyToInt |
|
247 ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) ); |
|
248 ChangeMergedButtonStatus( shiftStatus, 0 ); |
|
249 } |
|
250 } |
|
251 |
|
252 } |
|
253 break; |
|
254 case EPeninputLayoutEventSwitchLanguage: |
|
255 { |
|
256 TRAP_IGNORE( ChangeInputLanguageL( *data ) ); |
|
257 } |
|
258 break; |
|
259 case EPeninputLayoutEventRange: |
|
260 { |
|
261 HandleRangeEvent( *data ); |
|
262 } |
|
263 break; |
|
264 case EPeninputLayoutEventRangeLoop: |
|
265 { |
|
266 HandleRangeLoopEvent( *data ); |
|
267 } |
|
268 break; |
|
269 case EPeninputLayoutEventShift: |
|
270 { |
|
271 HandleShiftAndCapslockBtnClicked(); |
|
272 TInt shiftStatus = CPeninputDataConverter::AnyToInt |
|
273 ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) ); |
|
274 ChangeMergedButtonStatus( shiftStatus, 0 ); |
|
275 } |
|
276 break; |
|
277 case EPeninputLayoutEventCapslock: |
|
278 { |
|
279 HandleCapslockBtnClicked(); |
|
280 } |
|
281 break; |
|
282 case EPeninputLayoutEventMovePosition: |
|
283 { |
|
284 TInt style = *( ( TUint16* ) aEventData.Ptr() ); |
|
285 ChangeLayoutPosition( style ); |
|
286 } |
|
287 break; |
|
288 case EPeninputLayoutEventSetPermittedRange: |
|
289 { |
|
290 if ( *data & ERangeNative ) |
|
291 { |
|
292 *data = *data | ERangeAccent | ERangeNativeNumber |
|
293 | ERangeMixedText | ERangeMixedNumber; |
|
294 } |
|
295 else if(*data & ERangeEnglish) |
|
296 { |
|
297 *data = *data | ERangeAccent; |
|
298 } |
|
299 |
|
300 iLayoutContext->SetData( EPeninputDataTypePermittedRange, data ); |
|
301 |
|
302 // Set range of range bar component |
|
303 CFepUiBaseCtrl* bar = |
|
304 Control( EPeninutWindowCtrlIdRangeBar ); |
|
305 if ( bar ) |
|
306 { |
|
307 CAknFepCtrlRangeBar* rangebar = |
|
308 static_cast<CAknFepCtrlRangeBar*>( bar ); |
|
309 rangebar->SetPermittedRanges( *data ); |
|
310 } |
|
311 } |
|
312 break; |
|
313 case EPeninputLayoutEventSetPermittedCase: |
|
314 { |
|
315 // Update data:case |
|
316 iLayoutContext->SetData( EPeninputDataTypePermittedCase, data ); |
|
317 |
|
318 // Set range of case |
|
319 CFepUiBaseCtrl* bar = |
|
320 Control( EPeninutWindowCtrlIdRangeBar ); |
|
321 if ( bar ) |
|
322 { |
|
323 CAknFepCtrlRangeBar* rangebar = |
|
324 static_cast<CAknFepCtrlRangeBar*>( bar ); |
|
325 |
|
326 rangebar->SetPermittedCase( ERangeEnglish, ECaseUpper, |
|
327 ( *data & ECaseUpper) != 0 ); |
|
328 rangebar->SetPermittedCase( ERangeEnglish, ECaseLower, |
|
329 ( *data & ECaseLower) != 0 ); |
|
330 rangebar->SetPermittedCase( ERangeEnglish, ECaseText, |
|
331 ( *data & ECaseText) != 0 ); |
|
332 } |
|
333 } |
|
334 break; |
|
335 case EPeninputLayoutEventSetCase: |
|
336 { |
|
337 DoCaseChange( *data ); |
|
338 } |
|
339 break; |
|
340 case EEventSizeChanged: |
|
341 { |
|
342 //if icf editor size changed, we need to inform owner |
|
343 if(aCtrl->ControlId() == EPeninutWindowCtrlIdInputContextField || |
|
344 aCtrl->ControlId() == EPeninputWindowCtrlIdMultiLineICF) |
|
345 { |
|
346 iLayoutContext->Sendkey( ESignalLayoutICFLengthChanged, KNullDesC ); |
|
347 } |
|
348 } |
|
349 break; |
|
350 default: |
|
351 break; |
|
352 } |
|
353 } |
|
354 |
|
355 // --------------------------------------------------------------------------- |
|
356 // CPeninputLayoutWindowExt::SetEditorTextL |
|
357 // (other items were commented in a header) |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 EXPORT_C void CPeninputLayoutWindowExt::SetEditorTextL( |
|
361 const TFepInputContextFieldData& aData ) |
|
362 { |
|
363 if (Control(EPeninutWindowCtrlIdInputContextField)) |
|
364 { |
|
365 static_cast<CFepInputContextField*>( Control(EPeninutWindowCtrlIdInputContextField))->SetTextL( aData ); |
|
366 return; |
|
367 } |
|
368 |
|
369 if (Control(EPeninputWindowCtrlIdMultiLineICF)) |
|
370 { |
|
371 CFepLayoutMultiLineIcf* multiIcf = |
|
372 static_cast<CFepLayoutMultiLineIcf*>( Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
373 |
|
374 multiIcf->SetTextL( aData ); |
|
375 |
|
376 if ( iLayoutContext->LayoutType() == EPluginInputModeVkb || |
|
377 iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
378 { |
|
379 TInt lang = CPeninputDataConverter::AnyToInt |
|
380 ( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) ); |
|
381 TInt curRange = CPeninputDataConverter::AnyToInt |
|
382 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
383 |
|
384 if ( lang == ELangVietnamese && curRange == ERangeEnglish ) |
|
385 { |
|
386 TBuf<1> preData; |
|
387 multiIcf->ExtractText( preData, aData.iCurSel.LowerPos()-1, 1 ); |
|
388 iVowelChar = EFalse; |
|
389 |
|
390 if ( KNullDesC() != preData ) |
|
391 { |
|
392 for (TUint i = 0; i < sizeof(VietVowelList) / sizeof(TText); ++i) |
|
393 { |
|
394 TBuf<1> buf; |
|
395 buf.Append( VietVowelList[i] ); |
|
396 if (preData == buf) |
|
397 { |
|
398 iVowelChar = ETrue; |
|
399 break; |
|
400 } |
|
401 } |
|
402 } |
|
403 CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*> |
|
404 ( Control( EPeninutWindowCtrlIdVkbCtrl ) ); |
|
405 vkbCtrl->DimKeySet( iToneSet, !iVowelChar ); |
|
406 } |
|
407 } |
|
408 } |
|
409 } |
|
410 |
|
411 // --------------------------------------------------------------------------- |
|
412 // CPeninputLayoutWindowExt::SetEditorTextL |
|
413 // (other items were commented in a header) |
|
414 // --------------------------------------------------------------------------- |
|
415 // |
|
416 EXPORT_C void CPeninputLayoutWindowExt::SetTextIsSecret( TBool aData ) |
|
417 { |
|
418 if ( Control(EPeninutWindowCtrlIdInputContextField)) |
|
419 { |
|
420 static_cast<CFepInputContextField*> |
|
421 (Control(EPeninutWindowCtrlIdInputContextField))->SetTextIsSecret( aData ); |
|
422 } |
|
423 else if (Control(EPeninputWindowCtrlIdMultiLineICF)) |
|
424 { |
|
425 static_cast<CFepLayoutMultiLineIcf*> |
|
426 (Control(EPeninputWindowCtrlIdMultiLineICF))->SetTextIsSecret( aData ); |
|
427 } |
|
428 } |
|
429 |
|
430 void CPeninputLayoutWindowExt::SetNumberGrouping( TBool aData ) |
|
431 { |
|
432 if (Control(EPeninputWindowCtrlIdMultiLineICF)) |
|
433 { |
|
434 static_cast<CFepLayoutMultiLineIcf*> |
|
435 (Control(EPeninputWindowCtrlIdMultiLineICF))->SetNumberGrouping( aData ); |
|
436 } |
|
437 } |
|
438 |
|
439 |
|
440 // --------------------------------------------------------------------------- |
|
441 // CPeninputLayoutWindowExt::DoClose |
|
442 // (other items were commented in a header) |
|
443 // --------------------------------------------------------------------------- |
|
444 // |
|
445 EXPORT_C TBool CPeninputLayoutWindowExt::DoClose() |
|
446 { |
|
447 // Send EVkbEventWindowClose to layout |
|
448 this->ReportEvent( EPeninputLayoutEventClose, KNullDesC ); |
|
449 |
|
450 // Return true which will permit the window close |
|
451 return EFalse; |
|
452 } |
|
453 |
|
454 |
|
455 // --------------------------------------------------------------------------- |
|
456 // Get layout config method. It does a lasy initialization for a instance of |
|
457 // CPeninputLayoutWindowExt::ConfigInfo |
|
458 // (other items were commented in a header) |
|
459 // --------------------------------------------------------------------------- |
|
460 // |
|
461 EXPORT_C CPeninputLayoutConfig* CPeninputLayoutWindowExt::ConfigInfo() const |
|
462 { |
|
463 return iConfigInfo; |
|
464 } |
|
465 |
|
466 // --------------------------------------------------------------------------- |
|
467 // CPeninputLayoutWindowExt::CheckResourceExist |
|
468 // (other items were commented in a header) |
|
469 // --------------------------------------------------------------------------- |
|
470 // |
|
471 TBool CPeninputLayoutWindowExt::CheckResourceExist( const TDesC& aFileName ) |
|
472 { |
|
473 RFile file; |
|
474 |
|
475 if ( !aFileName.Length() ) |
|
476 { |
|
477 return EFalse; |
|
478 } |
|
479 |
|
480 TInt rs = file.Open( CCoeEnv::Static()->FsSession(), aFileName, EFileRead ); |
|
481 |
|
482 if ( rs == KErrNotFound ) |
|
483 { |
|
484 return EFalse; |
|
485 } |
|
486 else |
|
487 { |
|
488 file.Close(); |
|
489 |
|
490 return ETrue; |
|
491 } |
|
492 } |
|
493 |
|
494 // --------------------------------------------------------------------------- |
|
495 // CPeninputLayoutWindowExt::CancelDeadKey |
|
496 // (other items were commented in a header) |
|
497 // --------------------------------------------------------------------------- |
|
498 // |
|
499 void CPeninputLayoutWindowExt::CancelDeadKey() |
|
500 { |
|
501 // Get the dead key status |
|
502 TInt latchedFlag = CPeninputDataConverter::AnyToInt( |
|
503 iLayoutContext->RequestData( EAkninputDataTypeLatchedSet )); |
|
504 // If the DeadKey is latched, cancel it |
|
505 if ( latchedFlag ) |
|
506 { |
|
507 RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo; |
|
508 RPointerArray<CPeninputVkbKeyInfo> keyInfoList; |
|
509 |
|
510 // Get the vkb layout list supportted by current writing language |
|
511 vkbListInfo = iVkbLayout->VkbLayoutInfoList(); |
|
512 TInt vkbListNum = vkbListInfo.Count(); |
|
513 |
|
514 CVirtualKey* pKey; |
|
515 TBool deadKeyChange = EFalse; |
|
516 |
|
517 // Find the latched DeadKey in all kinds of vkb layout |
|
518 // which supportted by current writing language |
|
519 for ( TInt i = 0; i < vkbListNum && !deadKeyChange ; i++ ) |
|
520 { |
|
521 // Get the key info list in one vkb layout |
|
522 keyInfoList = vkbListInfo[i]->KeyInfoList(); |
|
523 TInt keyListNum = keyInfoList.Count(); |
|
524 for ( TInt j = 0; j < keyListNum && !deadKeyChange ; j++ ) |
|
525 { |
|
526 pKey = keyInfoList[j]->Key(); |
|
527 // If the Dead key is latched |
|
528 if ( pKey->Latched()) |
|
529 { |
|
530 // Unlatch the DeadKey |
|
531 pKey->SetLatched( EFalse ); |
|
532 |
|
533 // Set the DeadKey state |
|
534 iLayoutContext->SetData( |
|
535 EAkninputDataTypeLatchedSet, &deadKeyChange ); |
|
536 |
|
537 deadKeyChange = ETrue; |
|
538 } |
|
539 } |
|
540 } |
|
541 } |
|
542 } |
|
543 |
|
544 // --------------------------------------------------------------------------- |
|
545 // CPeninputLayoutWindowExt::ChangeInputLanguageL |
|
546 // (other items were commented in a header) |
|
547 // --------------------------------------------------------------------------- |
|
548 // |
|
549 EXPORT_C void CPeninputLayoutWindowExt::ChangeInputLanguageL( TInt aLangID ) |
|
550 { |
|
551 // Determine whether a new language id is same as existing one, |
|
552 if ( ConfigInfo() ) |
|
553 { |
|
554 // If language not changed, exit this function |
|
555 if ( ConfigInfo()->Language() == aLangID ) |
|
556 { |
|
557 return; |
|
558 } |
|
559 } |
|
560 |
|
561 // First check file exist or not |
|
562 TBool found = CheckResourceExist( GetWindowConfigResFileName( aLangID ) ); |
|
563 if ( !found ) |
|
564 { |
|
565 aLangID = ELangEnglish; |
|
566 found = CheckResourceExist( GetWindowConfigResFileName( aLangID ) ); |
|
567 } |
|
568 |
|
569 if ( found ) |
|
570 { |
|
571 // Remove the dead key's latched status |
|
572 CancelDeadKey(); |
|
573 |
|
574 // Store language |
|
575 iLayoutContext->SetData( EPeninputDataTypeInputLanguage, &aLangID ); |
|
576 |
|
577 if ( iLayoutContext->LayoutType() == EPluginInputModeVkb || |
|
578 iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
579 { |
|
580 CFepUiBaseCtrl* ctrl = |
|
581 Control( EPeninutWindowCtrlIdVkbCtrl ); |
|
582 if ( ctrl ) |
|
583 { |
|
584 ( static_cast<CPeninputVkbCtrlExt*>( ctrl ) )->Reset(); |
|
585 } |
|
586 } |
|
587 |
|
588 // Re-construct config info |
|
589 if ( iConfigInfo ) |
|
590 { |
|
591 delete iConfigInfo; |
|
592 iConfigInfo = NULL; |
|
593 } |
|
594 |
|
595 if (iConfigResId) |
|
596 { |
|
597 CCoeEnv::Static()->DeleteResourceFile( iConfigResId ); |
|
598 } |
|
599 |
|
600 // construct resource utils |
|
601 |
|
602 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
603 |
|
604 // Set up resources |
|
605 TFileName resFileName = GetWindowConfigResFileName( aLangID ); |
|
606 BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resFileName ); |
|
607 iConfigResId = coeEnv->AddResourceFileL( resFileName ); |
|
608 |
|
609 TResourceReader reader; |
|
610 |
|
611 coeEnv->CreateResourceReaderLC( reader, GetWindowConfigResId() ); |
|
612 if ( iLayoutContext->LayoutType() == EPluginInputModeVkb || |
|
613 iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
614 { |
|
615 iVkbLayout->Reset(); |
|
616 } |
|
617 iConfigInfo = CPeninputLayoutConfig::NewL( *iVkbLayout, reader ); |
|
618 |
|
619 // Pop and destroy reader |
|
620 CleanupStack::PopAndDestroy( 1 ); |
|
621 |
|
622 // Re-construct rangebar |
|
623 ChangeRangeBarL(); |
|
624 |
|
625 //Reset range and layoutid |
|
626 TInt range = -1; |
|
627 iLayoutContext->SetData( EPeninputDataTypeCurrentRange, &range ); |
|
628 iLayoutContext->SetData( EPeninputDataTypeClientLayout, &range ); |
|
629 ResetLastColRow(); |
|
630 iLangOrSizeChanged = ETrue; |
|
631 |
|
632 CFepUiBaseCtrl* icfCtrl = Control( EPeninputWindowCtrlIdMultiLineICF ); |
|
633 if ( icfCtrl ) |
|
634 { |
|
635 static_cast<CFepLayoutMultiLineIcf*>(icfCtrl)->SetLanguageId( aLangID ); |
|
636 } |
|
637 |
|
638 delete iToneSet; |
|
639 iToneSet = NULL; |
|
640 |
|
641 if ( aLangID == ELangVietnamese ) |
|
642 { |
|
643 iToneSet = HBufC::NewL( KNumberOfToneMarks ); |
|
644 |
|
645 for (TInt index = 0; index < KNumberOfToneMarks; index ++) |
|
646 { |
|
647 iToneSet->Des().Append( VietToneMatrix[0][index] ); |
|
648 } |
|
649 } |
|
650 } |
|
651 } |
|
652 |
|
653 // --------------------------------------------------------------------------- |
|
654 // CPeninputLayoutWindowExt::ChangeRangeBarL |
|
655 // (other items were commented in a header) |
|
656 // --------------------------------------------------------------------------- |
|
657 // |
|
658 void CPeninputLayoutWindowExt::ChangeRangeBarL() |
|
659 { |
|
660 // Read range bar from config into and reconstruct range button |
|
661 if ( iConfigInfo ) |
|
662 { |
|
663 TInt resid = iConfigInfo->RangebarResId(); |
|
664 CFepUiBaseCtrl* bar = |
|
665 Control( EPeninutWindowCtrlIdRangeBar ); |
|
666 |
|
667 if ( bar ) |
|
668 { |
|
669 CAknFepCtrlRangeBar* rangebar = |
|
670 static_cast<CAknFepCtrlRangeBar*>( bar ); |
|
671 |
|
672 CAknFepCtrlRangeBar::TRangeBarActionStyle style = |
|
673 ( CAknFepCtrlRangeBar::TRangeBarActionStyle ) |
|
674 iConfigInfo->RangeBarInfo()->RangeStyle(); |
|
675 |
|
676 rangebar->SetActionStyle( style ); |
|
677 |
|
678 TResourceReader reader; |
|
679 |
|
680 CCoeEnv::Static()->CreateResourceReaderLC( reader, resid ); |
|
681 |
|
682 rangebar->ConstructFromResourceL( reader ); |
|
683 |
|
684 // Pop and destroy reader |
|
685 CleanupStack::PopAndDestroy( 1 ); |
|
686 } |
|
687 } |
|
688 } |
|
689 |
|
690 // --------------------------------------------------------------------------- |
|
691 // CPeninputLayoutWindowExt::ChangeRange |
|
692 // (other items were commented in a header) |
|
693 // --------------------------------------------------------------------------- |
|
694 // |
|
695 EXPORT_C void CPeninputLayoutWindowExt::ChangeRange( TInt aRange, TInt aVkbLayoutId, |
|
696 TBool aNotify ) |
|
697 { |
|
698 TInt curRange = CPeninputDataConverter::AnyToInt |
|
699 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
700 TInt curVkbLayout = CPeninputDataConverter::AnyToInt |
|
701 ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) ); |
|
702 TInt curLanguage = CPeninputDataConverter::AnyToInt |
|
703 ( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) ); |
|
704 |
|
705 CFepUiBaseCtrl* bar = |
|
706 Control( EPeninutWindowCtrlIdRangeBar ); |
|
707 CAknFepCtrlRangeBar* rangebar = |
|
708 static_cast<CAknFepCtrlRangeBar*>( bar ); |
|
709 |
|
710 if ( rangebar ) |
|
711 { |
|
712 rangebar->ActiveRange( aRange ); |
|
713 } |
|
714 |
|
715 if (curRange != aRange || curVkbLayout != aVkbLayoutId || aRange == ERangeAccent) |
|
716 { |
|
717 // Update data:range |
|
718 if (curRange != aRange) |
|
719 iLayoutContext->SetData( EPeninputDataTypeCurrentRange, &aRange ); |
|
720 |
|
721 // Change client layout |
|
722 CPeninputRangeBarInfo* rangeBarInfo = iConfigInfo->RangeBarInfo(); |
|
723 CPeninputRangeInfo* rangeInfo = rangeBarInfo->FindRange(aRange); |
|
724 |
|
725 __ASSERT_DEBUG(rangeInfo, User::Panic(_L("Commonlayout-Invalid Range"), aRange)); |
|
726 |
|
727 ChangeClientLayout(rangeInfo->ClientLayoutId()); |
|
728 |
|
729 // Notify fep the new range |
|
730 if (aNotify) |
|
731 { |
|
732 TBuf<KIntLengthForByte> buf; |
|
733 CPeninputDataConverter::IntToDesc( aRange, buf ); |
|
734 iLayoutContext->Sendkey( ESignalRange, buf ); |
|
735 |
|
736 // When change range mannually, make the entire window visible |
|
737 TInt style = EPeninputPositionChangeBrJustify; |
|
738 TBuf<KIntSizeToInt16> bufStyle; |
|
739 bufStyle = ( TUint16* )&style; |
|
740 HandleControlEvent(EPeninputLayoutEventMovePosition, NULL, bufStyle); |
|
741 } |
|
742 |
|
743 // Change vkb layout |
|
744 if ( iLayoutContext->LayoutType() == EPluginInputModeVkb || |
|
745 iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
746 { |
|
747 if ( ( aRange == ERangeEnglish ) || ( aRange == ERangeAccent ) |
|
748 || (( aRange == ERangeNativeNumber ) && (iLayoutContext->LayoutType() != EPluginInputModeFSQ )) |
|
749 || ( ConfigInfo()->CaseSensitive() |
|
750 && ( aRange == ERangeNative ) ) ) |
|
751 { |
|
752 // Change shift and capslock button status according to the current case |
|
753 TInt curCase = CPeninputDataConverter::AnyToInt |
|
754 ( iLayoutContext->RequestData( EPeninputDataTypeCase ) ); |
|
755 TInt shfit; |
|
756 TInt capslock; |
|
757 |
|
758 CPeninputDataConverter::ShiftCapslockByCase( curCase, |
|
759 shfit, capslock ); |
|
760 |
|
761 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shfit ); |
|
762 //ChangeButtonStatus( shfit, EPeninutWindowCtrlIdShiftBtn ); |
|
763 iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslock ); |
|
764 //ChangeButtonStatus( capslock, EPeninutWindowCtrlIdCapslockBtn ); |
|
765 ChangeMergedButtonStatus( shfit, capslock ); |
|
766 |
|
767 TInt caseid = CaseByShiftCapslockStatus(); |
|
768 TInt vkblayoutid = |
|
769 ConfigInfo()->ShiftCapsSingleVkbLayoutId( aRange, caseid ); |
|
770 |
|
771 if ( aRange == ERangeAccent ) |
|
772 { |
|
773 TInt curAccentIndex = CPeninputDataConverter::AnyToInt |
|
774 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) ); |
|
775 vkblayoutid = vkblayoutid + curAccentIndex * 2; |
|
776 } |
|
777 |
|
778 // Change vkb layout |
|
779 ChangeVkbLayout( vkblayoutid ); |
|
780 } |
|
781 // Deal these four language in special way |
|
782 else if((( aRange == ERangeNativeNumber ) || ( aRange == ERangeNumber )) |
|
783 && ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
784 && (( curLanguage == ELangArabic ) |
|
785 || ( curLanguage == ELangFarsi) |
|
786 || ( curLanguage == ELangUrdu ) |
|
787 || ( curLanguage == ELangThai ))) |
|
788 { |
|
789 if ( !aVkbLayoutId ) |
|
790 { |
|
791 TInt shiftFlag = ( aRange == ERangeNativeNumber )? 0:1; |
|
792 aVkbLayoutId = ( aRange == ERangeNativeNumber )? |
|
793 EPeninputVkbLayoutNativeNumberShift : EPeninputVkbLayoutLatinNumber; |
|
794 |
|
795 TInt capslockFlag = 0; |
|
796 |
|
797 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftFlag ); |
|
798 iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslockFlag ); |
|
799 |
|
800 ChangeMergedButtonStatus( shiftFlag, capslockFlag ); |
|
801 } |
|
802 ChangeVkbLayout( aVkbLayoutId ); |
|
803 } |
|
804 else |
|
805 { |
|
806 TInt flag = 0; |
|
807 |
|
808 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &flag ); |
|
809 //ChangeButtonStatus( 0, EPeninutWindowCtrlIdShiftBtn ); |
|
810 iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &flag ); |
|
811 //ChangeButtonStatus( 0, EPeninutWindowCtrlIdCapslockBtn ); |
|
812 ChangeMergedButtonStatus( 0, 0 ); |
|
813 |
|
814 // Change vkb layout |
|
815 if ( aVkbLayoutId ) |
|
816 { |
|
817 ChangeVkbLayout( aVkbLayoutId ); |
|
818 } |
|
819 else |
|
820 { |
|
821 ChangeVkbLayout( rangeInfo->VkbLayoutId() ); |
|
822 } |
|
823 } |
|
824 } |
|
825 |
|
826 } |
|
827 |
|
828 if ( ( iLayoutContext->LayoutType() == EPluginInputModeVkb || |
|
829 iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
830 && ( curRange == ERangeNumber || curRange == ERangeNativeNumber ) |
|
831 && ( curRange == aRange ) ) |
|
832 { |
|
833 // Dimmed some keys if needed |
|
834 DimKeys(); |
|
835 } |
|
836 } |
|
837 |
|
838 // --------------------------------------------------------------------------- |
|
839 // CPeninputLayoutWindowExt::ChangeClientLayout |
|
840 // (other items were commented in a header) |
|
841 // --------------------------------------------------------------------------- |
|
842 // |
|
843 EXPORT_C void CPeninputLayoutWindowExt::ChangeClientLayout( |
|
844 TInt aClientLayoutId ) |
|
845 { |
|
846 TInt curClientId = CPeninputDataConverter::AnyToInt |
|
847 ( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) ); |
|
848 |
|
849 if ( curClientId != aClientLayoutId ) |
|
850 { |
|
851 CPeninputClientLayoutInfo* clientLayout = |
|
852 ConfigInfo()->FindClientLayoutInfo( aClientLayoutId ); |
|
853 |
|
854 __ASSERT_DEBUG( clientLayout, User::Panic(_L("Commonlayout-Invalid ClientLayout"), aClientLayoutId)); |
|
855 |
|
856 SetLafLayOut( clientLayout->Rows(), clientLayout->Columns() ); |
|
857 |
|
858 //SizeChangedForBaseWindow( clientLayout->Columns() ); |
|
859 |
|
860 // Re-Orginize all controls according to the configuration |
|
861 ReorganizeControls( aClientLayoutId, ETrue ); |
|
862 |
|
863 // Update data:client layout id |
|
864 iLayoutContext->SetData( EPeninputDataTypeClientLayout, |
|
865 &aClientLayoutId ); |
|
866 } |
|
867 } |
|
868 |
|
869 // --------------------------------------------------------------------------- |
|
870 // CPeninputLayoutWindowExt::ChangeVkbLayout |
|
871 // (other items were commented in a header) |
|
872 // --------------------------------------------------------------------------- |
|
873 // |
|
874 EXPORT_C void CPeninputLayoutWindowExt::ChangeVkbLayout( TInt aVkbLayoutId ) |
|
875 { |
|
876 |
|
877 // Remove the dead key's latched status |
|
878 CancelDeadKey(); |
|
879 |
|
880 |
|
881 TInt curVkbId = CPeninputDataConverter::AnyToInt |
|
882 ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) ); |
|
883 |
|
884 if ( ( curVkbId != aVkbLayoutId ) || ( iLangOrSizeChanged ) ) |
|
885 { |
|
886 iLangOrSizeChanged = EFalse; |
|
887 // Update data : vkb layout id |
|
888 iLayoutContext->SetData( EPeninputDataTypeVkbLayout, &aVkbLayoutId ); |
|
889 |
|
890 iVkbLayout->ChangeVkbLayout( aVkbLayoutId ); |
|
891 SetVkbLayoutSize(); |
|
892 |
|
893 TInt curClientId = CPeninputDataConverter::AnyToInt |
|
894 ( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) ); |
|
895 CPeninputControlInfo* vkbInfo = iConfigInfo->FindClientLayoutInfo |
|
896 ( curClientId )->FindControlInfo( EPeninutWindowCtrlIdVkbCtrl ); |
|
897 |
|
898 TRect rect; |
|
899 CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*> |
|
900 ( Control(EPeninutWindowCtrlIdVkbCtrl)); |
|
901 |
|
902 |
|
903 CPeninputVkbLayoutInfo* vkblayout = |
|
904 ConfigInfo()->FindVkbLayoutInfo( aVkbLayoutId ); |
|
905 |
|
906 if ( vkbCtrl && vkblayout ) |
|
907 { |
|
908 DimKeys(); |
|
909 |
|
910 // Make the true draw |
|
911 UpdateArea( vkbCtrl->Rect(), EFalse ); |
|
912 } |
|
913 } |
|
914 } |
|
915 |
|
916 // -------------------------------------------------------------------------- |
|
917 // CPeninputLayoutWindowExt::HandleRangeEvent |
|
918 // (other items were commented in a header) |
|
919 // -------------------------------------------------------------------------- |
|
920 // |
|
921 EXPORT_C void CPeninputLayoutWindowExt::HandleRangeEvent( TInt aRange ) |
|
922 { |
|
923 TInt curRange = CPeninputDataConverter::AnyToInt |
|
924 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
925 |
|
926 CPeninputRangeBarInfo* rangeBar = iConfigInfo->RangeBarInfo(); |
|
927 if ( !rangeBar ) |
|
928 { |
|
929 return; |
|
930 } |
|
931 |
|
932 CPeninputRangeInfo* rangeInfo = rangeBar->FindRange( aRange ); |
|
933 |
|
934 if ( !rangeInfo ) |
|
935 { |
|
936 return; |
|
937 } |
|
938 |
|
939 TInt responseStyle = rangeInfo->ResponseStyle(); |
|
940 if ( responseStyle == EPeninputRangeResponseNoAction ) |
|
941 { |
|
942 return; |
|
943 } |
|
944 |
|
945 if (curRange != aRange && responseStyle == EPeninputRangeResponseSwitchRange) |
|
946 { |
|
947 TInt index = KInvalidIndex; |
|
948 |
|
949 if ( aRange == ERangeAccent ) |
|
950 { |
|
951 index = 0; |
|
952 } |
|
953 iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &index ); |
|
954 |
|
955 ChangeRange( aRange ); |
|
956 } |
|
957 else if ( responseStyle == EPeninputRangeResponsePopupChoiceItem ) |
|
958 { |
|
959 PopupChoiceList(); |
|
960 } |
|
961 } |
|
962 |
|
963 // -------------------------------------------------------------------------- |
|
964 // CPeninputLayoutWindowExt::HandleRangeLoopEvent |
|
965 // (other items were commented in a header) |
|
966 // -------------------------------------------------------------------------- |
|
967 // |
|
968 EXPORT_C void CPeninputLayoutWindowExt::HandleRangeLoopEvent( TInt aLoop ) |
|
969 { |
|
970 TInt curRange = CPeninputDataConverter::AnyToInt |
|
971 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
972 |
|
973 CFepUiBaseCtrl* ctrl = Control( EPeninutWindowCtrlIdRangeBar ); |
|
974 CAknFepCtrlRangeBar* rangebar = static_cast<CAknFepCtrlRangeBar*>( ctrl ); |
|
975 |
|
976 if ( rangebar ) |
|
977 { |
|
978 TRAP_IGNORE( rangebar->SetCaseL( curRange, aLoop ) ); |
|
979 |
|
980 if ( ( curRange == ERangeEnglish ) || ( ConfigInfo()->CaseSensitive() |
|
981 && ( curRange == ERangeNative ) ) ) |
|
982 { |
|
983 TInt curCase = rangebar->GetCase( curRange ); |
|
984 |
|
985 // Store case in the data manager, the engine will |
|
986 // get notice at the same time |
|
987 iLayoutContext->SetData( EPeninputDataTypeCase, &curCase ); |
|
988 |
|
989 // Notify fep the new case |
|
990 TBuf<KIntLengthForByte> buf; |
|
991 CPeninputDataConverter::IntToDesc( curCase, buf ); |
|
992 iLayoutContext->Sendkey( ESignalCaseMode, buf ); |
|
993 } |
|
994 } |
|
995 } |
|
996 |
|
997 // -------------------------------------------------------------------------- |
|
998 // CPeninputLayoutWindowExt::CaseByShiftCapslockStatus |
|
999 // (other items were commented in a header) |
|
1000 // -------------------------------------------------------------------------- |
|
1001 // |
|
1002 EXPORT_C TInt CPeninputLayoutWindowExt::CaseByShiftCapslockStatus() |
|
1003 { |
|
1004 TInt shiftStatus = CPeninputDataConverter::AnyToInt |
|
1005 ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) ); |
|
1006 TInt capslockStatus = CPeninputDataConverter::AnyToInt |
|
1007 ( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) ); |
|
1008 |
|
1009 return ( capslockStatus * 2 + shiftStatus ); |
|
1010 } |
|
1011 |
|
1012 // --------------------------------------------------------------------------- |
|
1013 // CPeninputLayoutWindow::HandleShiftBtnClicked |
|
1014 // (other items were commented in a header) |
|
1015 // --------------------------------------------------------------------------- |
|
1016 // |
|
1017 EXPORT_C void CPeninputLayoutWindowExt::HandleMergedBtnClicked( TInt aCase ) |
|
1018 { |
|
1019 switch( aCase ) |
|
1020 { |
|
1021 case ECaseLower: |
|
1022 { |
|
1023 HandleCapslockBtnClicked(); |
|
1024 } |
|
1025 break; |
|
1026 case ECaseUpper: |
|
1027 { |
|
1028 HandleShiftBtnClicked(); |
|
1029 } |
|
1030 break; |
|
1031 case ECaseText: |
|
1032 // case ECaseInverseText: |
|
1033 { |
|
1034 // Current case is Text, equals shift button |
|
1035 //HandleCapslockBtnClicked(); |
|
1036 HandleShiftAndCapslockBtnClicked(); |
|
1037 } |
|
1038 break; |
|
1039 default: |
|
1040 break; |
|
1041 } |
|
1042 |
|
1043 } |
|
1044 |
|
1045 // --------------------------------------------------------------------------- |
|
1046 // CPeninputLayoutWindowExt::HandleShiftBtnClicked |
|
1047 // (other items were commented in a header) |
|
1048 // --------------------------------------------------------------------------- |
|
1049 // |
|
1050 EXPORT_C void CPeninputLayoutWindowExt::HandleShiftBtnClicked() |
|
1051 { |
|
1052 TInt curRange = CPeninputDataConverter::AnyToInt |
|
1053 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
1054 |
|
1055 TInt shiftStatus = CPeninputDataConverter::AnyToInt |
|
1056 ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) ); |
|
1057 TInt capslockStatus = CPeninputDataConverter::AnyToInt |
|
1058 ( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) ); |
|
1059 |
|
1060 // Update data |
|
1061 if ( iLayoutContext->IsCapsLockPermitted() ) |
|
1062 { |
|
1063 if ( curRange == ERangeEnglish || curRange == ERangeAccent |
|
1064 || ( ConfigInfo()->CaseSensitive() && curRange == ERangeNative ) ) |
|
1065 { |
|
1066 capslockStatus = !capslockStatus; |
|
1067 ChangeMergedButtonStatus( shiftStatus, capslockStatus ); |
|
1068 iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslockStatus ); |
|
1069 } |
|
1070 } |
|
1071 else |
|
1072 { |
|
1073 if ( iLayoutContext->IsShiftPermitted() ) |
|
1074 { |
|
1075 shiftStatus = !shiftStatus; |
|
1076 ChangeMergedButtonStatus( shiftStatus, capslockStatus ); |
|
1077 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftStatus ); |
|
1078 } |
|
1079 } |
|
1080 |
|
1081 // Update vkb layout |
|
1082 TInt caseid = CaseByShiftCapslockStatus(); |
|
1083 |
|
1084 TInt vkbLayout = iConfigInfo->ShiftCapsSingleVkbLayoutId( curRange, |
|
1085 caseid ); |
|
1086 |
|
1087 TInt responseStyle = |
|
1088 iConfigInfo->RangeBarInfo()->FindRange( curRange )->ResponseStyle(); |
|
1089 if ( ( curRange == ERangeAccent ) |
|
1090 && ( responseStyle == EPeninputRangeResponsePopupChoiceItem ) ) |
|
1091 { |
|
1092 TInt curAccentIndex = CPeninputDataConverter::AnyToInt |
|
1093 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) ); |
|
1094 vkbLayout = vkbLayout + curAccentIndex * 2; |
|
1095 } |
|
1096 |
|
1097 ChangeVkbLayout( vkbLayout ); |
|
1098 |
|
1099 // Synchronize case if needed |
|
1100 if ( ( curRange == ERangeEnglish ) || ( curRange == ERangeAccent ) |
|
1101 || ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) ) ) |
|
1102 { |
|
1103 // Notify fep the new case |
|
1104 TBuf<KIntLengthForByte> buf; |
|
1105 TInt fepcase = CPeninputDataConverter::FepCaseByCaseId( caseid ); |
|
1106 iLayoutContext->SetData( EPeninputDataTypeCase, &fepcase ); |
|
1107 CPeninputDataConverter::IntToDesc( fepcase, buf ); |
|
1108 iLayoutContext->Sendkey( ESignalCaseMode, buf ); |
|
1109 } |
|
1110 } |
|
1111 |
|
1112 // --------------------------------------------------------------------------- |
|
1113 // CPeninputLayoutWindowExt::HandleCapslockBtnClicked |
|
1114 // (other items were commented in a header) |
|
1115 // --------------------------------------------------------------------------- |
|
1116 // |
|
1117 EXPORT_C void CPeninputLayoutWindowExt::HandleCapslockBtnClicked() |
|
1118 { |
|
1119 TInt curRange = CPeninputDataConverter::AnyToInt |
|
1120 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
1121 |
|
1122 TInt capslockStatus = CPeninputDataConverter::AnyToInt |
|
1123 ( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) ); |
|
1124 TInt shiftStatus = CPeninputDataConverter::AnyToInt |
|
1125 ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) ); |
|
1126 |
|
1127 if ( iLayoutContext->IsShiftPermitted() ) |
|
1128 { |
|
1129 if ( curRange == ERangeEnglish || curRange == ERangeAccent || |
|
1130 ( ConfigInfo()->CaseSensitive() && curRange == ERangeNative ) ) |
|
1131 { |
|
1132 shiftStatus = !shiftStatus; |
|
1133 ChangeMergedButtonStatus( shiftStatus, capslockStatus ); |
|
1134 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftStatus ); |
|
1135 } |
|
1136 } |
|
1137 else |
|
1138 { |
|
1139 if ( iLayoutContext->IsCapsLockPermitted() ) |
|
1140 { |
|
1141 capslockStatus = !capslockStatus; |
|
1142 ChangeMergedButtonStatus( shiftStatus, capslockStatus ); |
|
1143 iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslockStatus ); |
|
1144 } |
|
1145 } |
|
1146 |
|
1147 // Update vkb layout |
|
1148 TInt caseid = CaseByShiftCapslockStatus(); |
|
1149 TInt vkbLayout = iConfigInfo->ShiftCapsSingleVkbLayoutId( curRange, |
|
1150 caseid ); |
|
1151 |
|
1152 TInt responseStyle = |
|
1153 iConfigInfo->RangeBarInfo()->FindRange( curRange )->ResponseStyle(); |
|
1154 if ( ( curRange == ERangeAccent ) |
|
1155 && ( responseStyle == EPeninputRangeResponsePopupChoiceItem ) ) |
|
1156 { |
|
1157 TInt curAccentIndex = CPeninputDataConverter::AnyToInt |
|
1158 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) ); |
|
1159 vkbLayout = vkbLayout + curAccentIndex * 2; |
|
1160 } |
|
1161 |
|
1162 ChangeVkbLayout( vkbLayout ); |
|
1163 |
|
1164 // Synchronize case if needed |
|
1165 if ( ( curRange == ERangeEnglish ) || ( curRange == ERangeAccent ) |
|
1166 || ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) ) ) |
|
1167 { |
|
1168 // Notify fep the new case |
|
1169 TBuf<KIntLengthForByte> buf; |
|
1170 TInt fepcase = CPeninputDataConverter::FepCaseByCaseId( caseid ); |
|
1171 iLayoutContext->SetData( EPeninputDataTypeCase, &fepcase ); |
|
1172 CPeninputDataConverter::IntToDesc( fepcase, buf ); |
|
1173 iLayoutContext->Sendkey( ESignalCaseMode, buf ); |
|
1174 } |
|
1175 } |
|
1176 |
|
1177 EXPORT_C void CPeninputLayoutWindowExt::HandleShiftAndCapslockBtnClicked() |
|
1178 { |
|
1179 TInt curRange = CPeninputDataConverter::AnyToInt |
|
1180 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
1181 |
|
1182 TInt shiftStatus = CPeninputDataConverter::AnyToInt |
|
1183 ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) ); |
|
1184 TInt capslockStatus = CPeninputDataConverter::AnyToInt |
|
1185 ( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) ); |
|
1186 TInt languageStatus = CPeninputDataConverter::AnyToInt |
|
1187 ( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage )); |
|
1188 TInt permittedRange = CPeninputDataConverter::AnyToInt |
|
1189 ( iLayoutContext->RequestData( EPeninputDataTypePermittedRange )); |
|
1190 |
|
1191 if ( shiftStatus ) |
|
1192 { |
|
1193 shiftStatus = 0; |
|
1194 } |
|
1195 else |
|
1196 { |
|
1197 shiftStatus = 1; |
|
1198 } |
|
1199 |
|
1200 // Update data |
|
1201 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftStatus ); |
|
1202 |
|
1203 if ( iLayoutContext->IsCapsLockPermitted() ) |
|
1204 { |
|
1205 if ( curRange == ERangeEnglish || curRange == ERangeAccent |
|
1206 || ( ConfigInfo()->CaseSensitive() && curRange == ERangeNative ) ) |
|
1207 { |
|
1208 capslockStatus = !capslockStatus; |
|
1209 ChangeMergedButtonStatus( shiftStatus, capslockStatus ); |
|
1210 iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslockStatus ); |
|
1211 } |
|
1212 } |
|
1213 else |
|
1214 { |
|
1215 if ( iLayoutContext->IsShiftPermitted() ) |
|
1216 { |
|
1217 shiftStatus = !shiftStatus; |
|
1218 ChangeMergedButtonStatus( shiftStatus, capslockStatus ); |
|
1219 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftStatus ); |
|
1220 } |
|
1221 } |
|
1222 |
|
1223 // Update vkb layout |
|
1224 TInt caseid = CaseByShiftCapslockStatus(); |
|
1225 |
|
1226 TInt vkbLayout = iConfigInfo->ShiftCapsSingleVkbLayoutId( curRange, |
|
1227 caseid ); |
|
1228 |
|
1229 TInt responseStyle = |
|
1230 iConfigInfo->RangeBarInfo()->FindRange( curRange )->ResponseStyle(); |
|
1231 if ( ( curRange == ERangeAccent ) |
|
1232 && ( responseStyle == EPeninputRangeResponsePopupChoiceItem ) ) |
|
1233 { |
|
1234 TInt curAccentIndex = CPeninputDataConverter::AnyToInt |
|
1235 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) ); |
|
1236 vkbLayout = vkbLayout + curAccentIndex * 2; |
|
1237 } |
|
1238 |
|
1239 TBool bSupportNative = ( languageStatus == ELangArabic ) |
|
1240 || ( languageStatus == ELangFarsi) |
|
1241 || ( languageStatus == ELangUrdu ) |
|
1242 || ( languageStatus == ELangThai ); |
|
1243 |
|
1244 // Click shift will change number between "native number" and "latin number" |
|
1245 if (( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
1246 && ( bSupportNative ) |
|
1247 && (( ERangeNativeNumber == curRange ) || ( ERangeNumber == curRange ))) |
|
1248 { |
|
1249 if (( ERangeNumber == curRange ) |
|
1250 && ( permittedRange & ERangeNativeNumber )) |
|
1251 { |
|
1252 vkbLayout = EPeninputVkbLayoutNativeNumberShift; |
|
1253 } |
|
1254 |
|
1255 if (( ERangeNativeNumber == curRange ) |
|
1256 && ( permittedRange & ERangeNumber )) |
|
1257 { |
|
1258 vkbLayout = EPeninputVkbLayoutLatinNumber; |
|
1259 } |
|
1260 } |
|
1261 else |
|
1262 { |
|
1263 ChangeVkbLayout( vkbLayout ); |
|
1264 } |
|
1265 |
|
1266 // Synchronize case if needed |
|
1267 if ( ( curRange == ERangeEnglish ) || ( curRange == ERangeAccent ) |
|
1268 || ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) ) ) |
|
1269 { |
|
1270 // Notify fep the new case |
|
1271 TBuf<KIntLengthForByte> buf; |
|
1272 TInt fepcase = CPeninputDataConverter::FepCaseByCaseId( caseid ); |
|
1273 iLayoutContext->SetData( EPeninputDataTypeCase, &fepcase ); |
|
1274 CPeninputDataConverter::IntToDesc( fepcase, buf ); |
|
1275 iLayoutContext->Sendkey( ESignalCaseMode, buf ); |
|
1276 } |
|
1277 else if ((( curRange == ERangeNumber ) || ( curRange == ERangeNativeNumber )) |
|
1278 && ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
1279 && ( bSupportNative )) |
|
1280 { |
|
1281 // If support native number, change range to native number |
|
1282 if( curRange == ERangeNumber && ( permittedRange & ERangeNativeNumber )) |
|
1283 { |
|
1284 ChangeRange( ERangeNativeNumber, vkbLayout ); |
|
1285 } |
|
1286 // If not support native number, set shift state back |
|
1287 else if (( curRange == ERangeNumber ) && !( permittedRange & ERangeNativeNumber )) |
|
1288 { |
|
1289 TInt shiftButton = 1; |
|
1290 TInt capslockButton = 0; |
|
1291 ChangeMergedButtonStatus( shiftButton, capslockButton ); |
|
1292 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftButton ); |
|
1293 } |
|
1294 // If support latin number, change range to latin number |
|
1295 else if (( curRange == ERangeNativeNumber ) && ( permittedRange & ERangeNumber ) ) |
|
1296 { |
|
1297 ChangeRange( ERangeNumber, vkbLayout ); |
|
1298 } |
|
1299 // If not support latin number, set shift state back |
|
1300 else if (( curRange == ERangeNativeNumber ) && !( permittedRange & ERangeNumber )) |
|
1301 { |
|
1302 TInt shiftButton = 0; |
|
1303 TInt capslockButton = 0; |
|
1304 ChangeMergedButtonStatus( shiftButton, capslockButton ); |
|
1305 iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftButton ); |
|
1306 } |
|
1307 } |
|
1308 else |
|
1309 { |
|
1310 // Do nothing |
|
1311 } |
|
1312 |
|
1313 |
|
1314 } |
|
1315 |
|
1316 // --------------------------------------------------------------------------- |
|
1317 // CPeninputLayoutWindowExt::DimKeys |
|
1318 // (other items were commented in a header) |
|
1319 // --------------------------------------------------------------------------- |
|
1320 // |
|
1321 void CPeninputLayoutWindowExt::DimKeys() |
|
1322 { |
|
1323 TRAP_IGNORE(DimKeysL()); |
|
1324 } |
|
1325 void CPeninputLayoutWindowExt::DimKeysL() |
|
1326 { |
|
1327 CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*> |
|
1328 ( Control( EPeninutWindowCtrlIdVkbCtrl ) ); |
|
1329 vkbCtrl->CancelDims(); |
|
1330 TInt currentRange = CPeninputDataConverter::AnyToInt |
|
1331 ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) ); |
|
1332 TInt permitRange = CPeninputDataConverter::AnyToInt |
|
1333 ( iLayoutContext->RequestData( EPeninputDataTypePermittedRange ) ); |
|
1334 TInt keyMapping = CPeninputDataConverter::AnyToInt |
|
1335 ( iLayoutContext->RequestData( EPeninputDataTypeNumericKeymap ) ); |
|
1336 TInt inputLang = CPeninputDataConverter::AnyToInt |
|
1337 ( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) ); |
|
1338 |
|
1339 if ( currentRange == ERangeNumber && |
|
1340 (permitRange == ERangeNumber || |
|
1341 permitRange == ERangeNativeNumber || |
|
1342 permitRange == (ERangeNumber | ERangeNativeNumber)) ) |
|
1343 { |
|
1344 HBufC* rs = NULL; |
|
1345 if ( keyMapping == EKeymapFromResource ) |
|
1346 { |
|
1347 HBufC* customRes = |
|
1348 (HBufC*) iLayoutContext->RequestData(EAknFepDataTypeUseDefinedResource); |
|
1349 _LIT(KTenNumbers,"0123456789"); |
|
1350 rs = HBufC::NewL(KTenNumbers().Length() + customRes->Length()); |
|
1351 rs->Des().Copy(*customRes); |
|
1352 rs->Des().Append(KTenNumbers); |
|
1353 } |
|
1354 else |
|
1355 { |
|
1356 TRAP_IGNORE( rs = iKeyMappingMgr->KeyMappingStringL( keyMapping ); ); |
|
1357 } |
|
1358 |
|
1359 if( rs ) |
|
1360 { |
|
1361 vkbCtrl->DimKeys( rs ); |
|
1362 delete rs; |
|
1363 } |
|
1364 } |
|
1365 else if ( currentRange == ERangeNativeNumber && |
|
1366 (permitRange == ERangeNumber || |
|
1367 permitRange == ERangeNativeNumber || |
|
1368 permitRange == (ERangeNumber | ERangeNativeNumber)) ) |
|
1369 { |
|
1370 HBufC* rs = NULL; |
|
1371 TRAP_IGNORE( rs = GetKeyMappingStringL( keyMapping, inputLang ) ); |
|
1372 if( rs ) |
|
1373 { |
|
1374 vkbCtrl->DimKeys( rs ); |
|
1375 delete rs; |
|
1376 } |
|
1377 } |
|
1378 |
|
1379 else if ( (currentRange == ERangeNative || currentRange == ERangeEnglish) && CPeninputDataConverter::AnyToInt |
|
1380 ( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) ) == ELangVietnamese ) |
|
1381 { |
|
1382 vkbCtrl->DimKeySet( iToneSet, !iVowelChar ); |
|
1383 } |
|
1384 |
|
1385 vkbCtrl->Draw(); |
|
1386 } |
|
1387 |
|
1388 // --------------------------------------------------------------------------- |
|
1389 // CPeninputLayoutWindowExt::AddControlL |
|
1390 // (other items were commented in a header) |
|
1391 // --------------------------------------------------------------------------- |
|
1392 // |
|
1393 EXPORT_C void CPeninputLayoutWindowExt::AddNotOwnedControl( |
|
1394 CFepUiBaseCtrl* aControl ) |
|
1395 { |
|
1396 //do nothing if we already has the control. |
|
1397 if ( KErrNotFound != ControlList().Find( aControl ) ) |
|
1398 { |
|
1399 return; |
|
1400 } |
|
1401 |
|
1402 if ( aControl ) |
|
1403 { |
|
1404 ( const_cast<RPointerArray<CFepUiBaseCtrl>&> |
|
1405 ( ControlList() ) ).Append( aControl ); |
|
1406 } |
|
1407 } |
|
1408 // --------------------------------------------------------------------------- |
|
1409 // CPeninputLayoutWindowExt::ChangeButtonStatus |
|
1410 // (other items were commented in a header) |
|
1411 // --------------------------------------------------------------------------- |
|
1412 // |
|
1413 EXPORT_C void CPeninputLayoutWindowExt::ChangeButtonStatus( const TInt aIsDown, |
|
1414 const TInt aControlId ) |
|
1415 { |
|
1416 CAknFepCtrlEventButton* button = |
|
1417 static_cast<CAknFepCtrlEventButton*> |
|
1418 (ControlById( aControlId ) ); |
|
1419 |
|
1420 if ( button ) |
|
1421 { |
|
1422 button->SetHighlight( aIsDown == 0 ? EFalse : ETrue ); |
|
1423 } |
|
1424 } |
|
1425 |
|
1426 // --------------------------------------------------------------------------- |
|
1427 // CPeninputLayoutWindow::ChangeButtonStatus |
|
1428 // (other items were commented in a header) |
|
1429 // --------------------------------------------------------------------------- |
|
1430 // |
|
1431 EXPORT_C void CPeninputLayoutWindowExt::ChangeMergedButtonStatus( |
|
1432 const TInt aIsShiftCase, |
|
1433 const TInt aIsCapslockCase ) |
|
1434 { |
|
1435 CAknFepCtrlMultiModeButton* button = |
|
1436 static_cast<CAknFepCtrlMultiModeButton*> |
|
1437 (ControlById( EPeninutWindowCtrlIdShiftBtn ) ); |
|
1438 |
|
1439 if( !button ) |
|
1440 { |
|
1441 return; |
|
1442 } |
|
1443 switch ( aIsCapslockCase * 2 + aIsShiftCase ) |
|
1444 { |
|
1445 case 1: // text case |
|
1446 { |
|
1447 TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 1 ) ); |
|
1448 button->SetHighlight( ETrue ); |
|
1449 } |
|
1450 break; |
|
1451 case 2: // upper case |
|
1452 { |
|
1453 TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 2 ) ); |
|
1454 button->SetHighlight( ETrue ); |
|
1455 } |
|
1456 break; |
|
1457 default: |
|
1458 { |
|
1459 TRAP_IGNORE( button->SetCurrentModeL( EBtnBmpActive, 0 ) ); |
|
1460 button->SetHighlight( EFalse ); |
|
1461 } |
|
1462 break; |
|
1463 } |
|
1464 } |
|
1465 // --------------------------------------------------------------------------- |
|
1466 // CPeninputLayoutWindowExt::ChangeLayoutPosition |
|
1467 // (other items were commented in a header) |
|
1468 // --------------------------------------------------------------------------- |
|
1469 // |
|
1470 EXPORT_C void CPeninputLayoutWindowExt::ChangeLayoutPosition( TInt aJustifyStyle ) |
|
1471 { |
|
1472 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
|
1473 { |
|
1474 TopLeftJustify(); |
|
1475 return; |
|
1476 } |
|
1477 switch ( aJustifyStyle ) |
|
1478 { |
|
1479 case EPeninputPositionChangeBrJustify: |
|
1480 { |
|
1481 BottomRightJustify(); |
|
1482 } |
|
1483 break; |
|
1484 case EPeninputPositionChangeDataQuery: |
|
1485 { |
|
1486 //BottomRightJustify(); |
|
1487 DataQueryJustify(); |
|
1488 } |
|
1489 break; |
|
1490 default: |
|
1491 { |
|
1492 TopLeftJustify(); |
|
1493 } |
|
1494 break; |
|
1495 } |
|
1496 } |
|
1497 |
|
1498 // --------------------------------------------------------------------------- |
|
1499 // CPeninputLayoutWindowExt::SetWindowRect |
|
1500 // (other items were commented in a header) |
|
1501 // --------------------------------------------------------------------------- |
|
1502 // |
|
1503 EXPORT_C void CPeninputLayoutWindowExt::SetWindowRect( const TRect& aRect ) |
|
1504 { |
|
1505 //we should know the layout size now |
|
1506 if(iLayoutContext->LayoutType() == EPluginInputModeFSQ) |
|
1507 { |
|
1508 SetRect( aRect ); |
|
1509 UiLayout()->SetRect(aRect); |
|
1510 } |
|
1511 else |
|
1512 { |
|
1513 TRect rect = aRect; |
|
1514 |
|
1515 |
|
1516 TRect shadowRect = TRect( TPoint(), |
|
1517 TSize( aRect.Width() + iShadowBrWidth + iShadowTlWidth, |
|
1518 aRect.Height() + iShadowTlHeight + iShadowBrHeight) |
|
1519 ); |
|
1520 |
|
1521 rect.Move( TPoint(iShadowTlWidth, iShadowTlHeight) - rect.iTl ); |
|
1522 |
|
1523 SetRect( rect ); |
|
1524 RootControl()->SetRect( rect ); |
|
1525 UiLayout()->SetShadowRect( shadowRect ); |
|
1526 } |
|
1527 } |
|
1528 |
|
1529 |
|
1530 // ----------------------------------------------------------------------------- |
|
1531 // CPeninputLayoutWindowExt::SetSwitchBtnFont |
|
1532 // (other items were commented in a header). |
|
1533 // ----------------------------------------------------------------------------- |
|
1534 // |
|
1535 EXPORT_C void CPeninputLayoutWindowExt::SetSwitchBtnFont(CAknFepCtrlEventButton& aSwitchBtn) |
|
1536 { |
|
1537 // read switch font laf info only when need |
|
1538 if (CPeninputDataConverter::AnyToInt( |
|
1539 iLayoutContext->RequestData(EAkninputDataTypeSizeChanging)) ||(!iSwitchFontSet)) |
|
1540 { |
|
1541 TAknTextLineLayout langSwitch; |
|
1542 TAknTextLineLayout langSwitchShadow; |
|
1543 |
|
1544 switch( iLayoutContext->LayoutType() ) |
|
1545 { |
|
1546 case EPluginInputModeVkb: |
|
1547 case EPluginInputModeFSQ: |
|
1548 { |
|
1549 langSwitch = |
|
1550 AknLayoutScalable_Avkon::cell_vkb_side_pane_t1().LayoutLine(); |
|
1551 langSwitchShadow = |
|
1552 AknLayoutScalable_Avkon::cell_vkb_side_pane_t1_copy1().LayoutLine(); |
|
1553 } |
|
1554 break; |
|
1555 case EPluginInputModeHwr: |
|
1556 { |
|
1557 langSwitch = |
|
1558 AknLayoutScalable_Avkon::cell_hwr_side_pane_t1().LayoutLine(); |
|
1559 langSwitchShadow = |
|
1560 AknLayoutScalable_Avkon::cell_hwr_side_pane_t1_copy1().LayoutLine(); |
|
1561 } |
|
1562 break; |
|
1563 default: |
|
1564 { |
|
1565 return; |
|
1566 } |
|
1567 } |
|
1568 |
|
1569 iSwitchFont = langSwitch.iFont; |
|
1570 iSwitchShadowFont = langSwitchShadow.iFont; |
|
1571 } |
|
1572 |
|
1573 aSwitchBtn.SetFont(AknLayoutUtils::FontFromId(iSwitchFont, NULL)); |
|
1574 aSwitchBtn.SetShadowFont(AknLayoutUtils::FontFromId(iSwitchShadowFont, NULL)); |
|
1575 iSwitchFontSet = ETrue; |
|
1576 } |
|
1577 |
|
1578 // --------------------------------------------------------------------------- |
|
1579 // CPeninputLayoutWindowExt::TopLeftJustify |
|
1580 // (other items were commented in a header) |
|
1581 // --------------------------------------------------------------------------- |
|
1582 // |
|
1583 EXPORT_C void CPeninputLayoutWindowExt::SetSwitchBtnTextColor(CAknFepCtrlEventButton& aSwitchBtn) |
|
1584 { |
|
1585 TRgb textColor; |
|
1586 TInt error = AknsUtils::GetCachedColor(UiLayout()->SkinInstance(), |
|
1587 textColor, |
|
1588 KAknsIIDQsnTextColors, |
|
1589 EAknsCIQsnTextColorsCG59); |
|
1590 |
|
1591 if (error != KErrNone) |
|
1592 { |
|
1593 textColor = TRgb(KDefaultTextColor); |
|
1594 } |
|
1595 |
|
1596 aSwitchBtn.SetFontColor( textColor ); |
|
1597 |
|
1598 TRgb shadowTextColor; |
|
1599 error = AknsUtils::GetCachedColor(UiLayout()->SkinInstance(), |
|
1600 shadowTextColor, |
|
1601 KAknsIIDQsnTextColors, |
|
1602 EAknsCIQsnTextColorsCG62); |
|
1603 |
|
1604 if (error != KErrNone) |
|
1605 { |
|
1606 shadowTextColor = TRgb(KDefaultShadowTextColor); |
|
1607 } |
|
1608 |
|
1609 aSwitchBtn.SetShadowFontColor( shadowTextColor ); |
|
1610 } |
|
1611 |
|
1612 // --------------------------------------------------------------------------- |
|
1613 // CPeninputLayoutWindowExt::TopLeftJustify |
|
1614 // (other items were commented in a header) |
|
1615 // --------------------------------------------------------------------------- |
|
1616 // |
|
1617 void CPeninputLayoutWindowExt::TopLeftJustify() |
|
1618 { |
|
1619 // Read position from datamgr |
|
1620 TSize layoutSize = UiLayout()->Rect().Size(); |
|
1621 |
|
1622 TPoint tl = UiLayout()->Position(); |
|
1623 |
|
1624 TPoint oldBr = tl + layoutSize; |
|
1625 |
|
1626 if ( tl.iX < 0 ) |
|
1627 { |
|
1628 tl.iX = 0; |
|
1629 } |
|
1630 |
|
1631 if ( tl.iY < 0 ) |
|
1632 { |
|
1633 tl.iY = 0; |
|
1634 } |
|
1635 |
|
1636 TPoint br = tl + layoutSize; |
|
1637 |
|
1638 if ( br != oldBr ) |
|
1639 { |
|
1640 //Write the new position into CenRep |
|
1641 TInt x = 0; |
|
1642 TInt y = 0; |
|
1643 x = 0x0000FFFF & br.iX; |
|
1644 y = 0xFFFF0000 & ( br.iY << 16 ); |
|
1645 TInt pos = x | y; |
|
1646 iLayoutContext->SetData( EPeninputDataTypeWindowPosition, &pos ); |
|
1647 } |
|
1648 |
|
1649 UiLayout()->LayoutOwner()->SetPosition( tl ); |
|
1650 } |
|
1651 |
|
1652 // --------------------------------------------------------------------------- |
|
1653 // CPeninputLayoutWindowExt::BottomRightJustify |
|
1654 // (other items were commented in a header). |
|
1655 // --------------------------------------------------------------------------- |
|
1656 // |
|
1657 void CPeninputLayoutWindowExt::BottomRightJustify() |
|
1658 { |
|
1659 // Read position from datamgr |
|
1660 TSize layoutSize( UiLayout()->Rect().Size() ); |
|
1661 |
|
1662 TPoint oldbr; |
|
1663 TPoint br; |
|
1664 TPoint tl; |
|
1665 |
|
1666 TSize screenSize = *( ( TSize* ) iLayoutContext->RequestData |
|
1667 ( EPeninputDataTypeScreenSize ) ); |
|
1668 |
|
1669 TInt windowPosition = CPeninputDataConverter::AnyToInt |
|
1670 ( iLayoutContext->RequestData( EPeninputDataTypeWindowPosition ) ); |
|
1671 |
|
1672 oldbr.iX = windowPosition & 0x0000FFFF; |
|
1673 oldbr.iY = ( windowPosition & 0xFFFF0000 ) >> 16; |
|
1674 |
|
1675 br = oldbr; |
|
1676 |
|
1677 // Check the top left point is in screen |
|
1678 if (br.iX > screenSize.iWidth) |
|
1679 { |
|
1680 br.iX = screenSize.iWidth; |
|
1681 } |
|
1682 if( br.iY > screenSize.iHeight ) |
|
1683 { |
|
1684 br.iY = screenSize.iHeight; |
|
1685 } |
|
1686 |
|
1687 tl.iX = br.iX - layoutSize.iWidth; |
|
1688 tl.iY = br.iY - layoutSize.iHeight; |
|
1689 |
|
1690 if ( tl.iX < 0 ) |
|
1691 { |
|
1692 tl.iX = 0; |
|
1693 br.iX = layoutSize.iWidth; |
|
1694 } |
|
1695 |
|
1696 if ( tl.iY < 0 ) |
|
1697 { |
|
1698 tl.iY = 0; |
|
1699 br.iY = layoutSize.iHeight; |
|
1700 } |
|
1701 |
|
1702 if ( oldbr != br ) |
|
1703 { |
|
1704 //Write the new position into CenRep |
|
1705 TInt x = 0; |
|
1706 TInt y = 0; |
|
1707 x = 0x0000FFFF & br.iX; |
|
1708 y = 0xFFFF0000 & ( br.iY << 16 ); |
|
1709 TInt pos = x | y; |
|
1710 iLayoutContext->SetData( EPeninputDataTypeWindowPosition, &pos ); |
|
1711 } |
|
1712 |
|
1713 UiLayout()->LayoutOwner()->SetPosition( tl ); |
|
1714 } |
|
1715 |
|
1716 // --------------------------------------------------------------------------- |
|
1717 // CPeninputLayoutWindowExt::DataQueryJustify |
|
1718 // (other items were commented in a header) |
|
1719 // --------------------------------------------------------------------------- |
|
1720 // |
|
1721 void CPeninputLayoutWindowExt::DataQueryJustify() |
|
1722 { |
|
1723 TRect* dataQueryRect = ( TRect* )( iLayoutContext->RequestData |
|
1724 ( EPeninputDataTypeDataQueryDlgRect) ); |
|
1725 |
|
1726 TRect rect = TRect( UiLayout()->Position(), UiLayout()->Rect().Size() ); |
|
1727 |
|
1728 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1729 TPixelsTwipsAndRotation ptSize; |
|
1730 coeEnv->ScreenDevice()->GetDefaultScreenSizeAndRotation(ptSize); |
|
1731 |
|
1732 // Landscape mode: move window to the br of the screen |
|
1733 if (ptSize.iPixelSize.iWidth > ptSize.iPixelSize.iHeight) |
|
1734 { |
|
1735 rect.SetRect(ptSize.iPixelSize.iWidth - rect.Width(), |
|
1736 ptSize.iPixelSize.iHeight/2 - rect.Height()/2, |
|
1737 ptSize.iPixelSize.iWidth, |
|
1738 ptSize.iPixelSize.iHeight/2 + rect.Height()/2); |
|
1739 } |
|
1740 // Portrait mode: dodge the dataquery |
|
1741 else if ( rect.Intersects( *dataQueryRect ) ) |
|
1742 { |
|
1743 TInt Y = dataQueryRect->iTl.iY; |
|
1744 TInt height = rect.iBr.iY - rect.iTl.iY; |
|
1745 rect.iTl.iY = Y - height; |
|
1746 rect.iBr.iY = Y; |
|
1747 |
|
1748 if( rect.iTl.iY <0 ) |
|
1749 { |
|
1750 rect.iTl.iY = 0; |
|
1751 rect.iBr.iY = height; |
|
1752 } |
|
1753 } |
|
1754 |
|
1755 //Write the new position into CenRep |
|
1756 TInt x = 0; |
|
1757 TInt y = 0; |
|
1758 x = 0x0000FFFF & rect.iBr.iX; |
|
1759 y = 0xFFFF0000 & ( rect.iBr.iY << 16 ); |
|
1760 TInt pos = x | y; |
|
1761 iLayoutContext->SetData( EPeninputDataTypeWindowPosition, &pos ); |
|
1762 |
|
1763 //Set the layout position |
|
1764 UiLayout()->LayoutOwner()->SetPosition( rect.iTl ); |
|
1765 } |
|
1766 |
|
1767 TBool CPeninputLayoutWindowExt::CreateCustomControlL( TInt16 /*aControlId*/, TInt32 /*aImageId*/ ) |
|
1768 { |
|
1769 return EFalse; |
|
1770 } |
|
1771 |
|
1772 // --------------------------------------------------------------------------- |
|
1773 // CPeninputLayoutWindowExt::Draw |
|
1774 // (other items were commented in a header) |
|
1775 // --------------------------------------------------------------------------- |
|
1776 // |
|
1777 EXPORT_C void CPeninputLayoutWindowExt::Draw() |
|
1778 { |
|
1779 // Draw shadow |
|
1780 CAknFepCtrlBaseWindowExt::Draw(); |
|
1781 UpdateArea(UiLayout()->Rect(), EFalse); |
|
1782 } |
|
1783 |
|
1784 // --------------------------------------------------------------------------- |
|
1785 // CPeninputLayoutWindowExt::GetKeyMappingStringL |
|
1786 // (other items were commented in a header) |
|
1787 // --------------------------------------------------------------------------- |
|
1788 // |
|
1789 HBufC* CPeninputLayoutWindowExt::GetKeyMappingStringL(TInt aKeyMapping, |
|
1790 const TInt aLang ) |
|
1791 { |
|
1792 HBufC* rs = NULL; |
|
1793 if ( aKeyMapping == EKeymapFromResource ) |
|
1794 { |
|
1795 HBufC* customRes = (HBufC*) iLayoutContext->RequestData(EAknFepDataTypeUseDefinedResource); |
|
1796 _LIT(KTenNumbers,"0123456789"); |
|
1797 TBuf<KMaxNumericString> numbers; |
|
1798 if( aLang == ELangArabic ) |
|
1799 { |
|
1800 numbers.Format( _L("%c%c%c%c%c%c%c%c%c%c"), |
|
1801 0x0660, 0x0661, 0x0662, |
|
1802 0x0663, 0x0664, 0x0665, |
|
1803 0x0666, 0x0667, 0x0668, 0x0669 ); |
|
1804 } |
|
1805 else if( aLang == ELangUrdu || aLang == ELangFarsi ) |
|
1806 { |
|
1807 numbers.Format( _L("%c%c%c%c%c%c%c%c%c%c"), |
|
1808 0x06F0, 0x06F1, 0x06F2, |
|
1809 0x06F3, 0x06F4, 0x06F5, |
|
1810 0x06F6, 0x06F7, 0x06F8, 0x06F9 ); |
|
1811 } |
|
1812 else if( aLang == ELangHindi ) |
|
1813 { |
|
1814 numbers.Format( _L("%c%c%c%c%c%c%c%c%c%c"), |
|
1815 0x0966, 0x0967, 0x0968, |
|
1816 0x0969, 0x096a, 0x096b, |
|
1817 0x096c, 0x096d, 0x096e, 0x096f ); |
|
1818 } |
|
1819 else if( aLang == ELangThai ) |
|
1820 { |
|
1821 numbers.Format( _L("%c%c%c%c%c%c%c%c%c%c"), |
|
1822 0x0E50, 0x0E51, 0x0E52, |
|
1823 0x0E53, 0x0E54, 0x0E55, |
|
1824 0x0E56, 0x0E57, 0x0E58, 0x0E59 ); |
|
1825 } |
|
1826 else |
|
1827 { |
|
1828 numbers = KTenNumbers; |
|
1829 } |
|
1830 |
|
1831 rs = HBufC::NewL(numbers.Length() + customRes->Length()); |
|
1832 rs->Des().Copy(*customRes); |
|
1833 rs->Des().Append(numbers); |
|
1834 } |
|
1835 else |
|
1836 { |
|
1837 rs = iKeyMappingMgr->KeyMappingStringL( aKeyMapping, aLang ); |
|
1838 } |
|
1839 |
|
1840 return rs; |
|
1841 } |
|
1842 |
|
1843 // --------------------------------------------------------------------------- |
|
1844 // CPeninputLayoutWindowExt::SetEnableSwitchToHwr |
|
1845 // (other items were commented in a header) |
|
1846 // --------------------------------------------------------------------------- |
|
1847 // |
|
1848 EXPORT_C void CPeninputLayoutWindowExt::SetEnableSwitchToHwr(TBool aEnable) |
|
1849 { |
|
1850 CAknFepCtrlEventButton* switchToHwrBtn = static_cast<CAknFepCtrlEventButton*> |
|
1851 ( Control( EPeninutWindowCtrlIdSwitchToHwrBtn ) ); |
|
1852 |
|
1853 if ( aEnable ) |
|
1854 { |
|
1855 switchToHwrBtn->SetDimmed(EFalse); |
|
1856 } |
|
1857 else |
|
1858 { |
|
1859 switchToHwrBtn->SetDimmed(ETrue); |
|
1860 switchToHwrBtn->SetActive(EFalse); |
|
1861 } |
|
1862 } |
|
1863 |
|
1864 // --------------------------------------------------------------------------- |
|
1865 // CPeninputLayoutWindowExt::SetEnableSettingBtn |
|
1866 // (other items were commented in a header) |
|
1867 // --------------------------------------------------------------------------- |
|
1868 // |
|
1869 EXPORT_C void CPeninputLayoutWindowExt::SetEnableSettingBtn(TBool aEnable) |
|
1870 { |
|
1871 CAknFepCtrlEventButton* optionBtn = static_cast<CAknFepCtrlEventButton*> |
|
1872 (Control( EPeninutWindowCtrlIdOptionBtn ) ); |
|
1873 |
|
1874 if ( aEnable ) |
|
1875 { |
|
1876 optionBtn->SetDimmed(EFalse); |
|
1877 } |
|
1878 else |
|
1879 { |
|
1880 optionBtn->SetDimmed(ETrue); |
|
1881 optionBtn->SetActive(EFalse); |
|
1882 } |
|
1883 } |
|
1884 |
|
1885 // --------------------------------------------------------------------------- |
|
1886 // CPeninputLayoutWindowExt::ReconfigUnitSize |
|
1887 // (other items were commented in a header) |
|
1888 // --------------------------------------------------------------------------- |
|
1889 // |
|
1890 EXPORT_C TBool CPeninputLayoutWindowExt::ReconfigUnitSize(TInt /*aClientLayoutId*/) |
|
1891 { |
|
1892 return EFalse; |
|
1893 } |
|
1894 |
|
1895 EXPORT_C void CPeninputLayoutWindowExt::SetLafLayOut(TInt /*aRows*/, TInt /*aColumns*/) |
|
1896 { |
|
1897 |
|
1898 } |
|
1899 |
|
1900 EXPORT_C void CPeninputLayoutWindowExt::SetVkbLayoutSize() |
|
1901 { |
|
1902 |
|
1903 } |
|
1904 EXPORT_C void CPeninputLayoutWindowExt::OnInputLanguageChange() |
|
1905 { |
|
1906 if ( iLayoutContext->LayoutType() == EPluginInputModeVkb ) |
|
1907 { |
|
1908 CFepUiBaseCtrl* ctrl = |
|
1909 Control( EPeninutWindowCtrlIdVkbCtrl ); |
|
1910 if ( ctrl ) |
|
1911 { |
|
1912 ( static_cast<CPeninputVkbCtrlExt*>( ctrl ) )->Reset(); |
|
1913 } |
|
1914 } |
|
1915 } |
|
1916 |
|
1917 void CPeninputLayoutWindowExt::AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl) |
|
1918 { |
|
1919 AddControlL(aCtrl); |
|
1920 } |
|
1921 |
|
1922 void CPeninputLayoutWindowExt::ResetLastColRow() |
|
1923 { |
|
1924 iLastUsedTotalColumns = 0; |
|
1925 iLastUsedTotalRows = 0; |
|
1926 } |
|
1927 |
|
1928 |
|
1929 EXPORT_C void CPeninputLayoutWindowExt::SetTextAlignmentL( TInt aAlignment ) |
|
1930 { |
|
1931 CFepLayoutMultiLineIcf* icf = |
|
1932 static_cast<CFepLayoutMultiLineIcf*>( Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
1933 |
|
1934 if ( icf && ConfigInfo()->Language() != ELangNone ) |
|
1935 { |
|
1936 icf->SetTextAlignmentL( aAlignment, ConfigInfo()->Language() ); |
|
1937 } |
|
1938 } |
|
1939 |
|
1940 //End Of File |