21
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0""
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* Provides the CAknFepUICtrlPinyinEEP definition
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
#include <eikenv.h>
|
|
31 |
#include <eikappui.h>
|
|
32 |
#include <AknsSkinInstance.h>
|
|
33 |
#include <AknsUtils.h>
|
|
34 |
#include <AknsDrawUtils.h>
|
|
35 |
#include <skinlayout.cdl.h>
|
|
36 |
|
|
37 |
#include "aknlayoutscalable_avkon.cdl.h"
|
|
38 |
#include "aknfepuictrlpinyineep.h"
|
|
39 |
#include "aknfepuilayoutdatamgr.h"
|
|
40 |
#include "aknfepchineseuidataconv.h"
|
|
41 |
|
|
42 |
_LIT(KFullStop, "\x002E");
|
|
43 |
|
|
44 |
_LIT( KToneMark1, "\x0020");
|
|
45 |
_LIT( KToneMark2, "\x02CA");
|
|
46 |
_LIT( KToneMark3, "\x02C7");
|
|
47 |
_LIT( KToneMark4, "\x02CB");
|
|
48 |
_LIT( KToneMark5, "\x02D9");
|
|
49 |
_LIT( KLeftBracket, "\x0028");
|
|
50 |
const TInt KControlNum = 1;
|
|
51 |
const TInt KMaxCharNum = 200;
|
|
52 |
const TInt KMaxDispNum = 200;
|
|
53 |
|
|
54 |
// ---------------------------------------------------------
|
|
55 |
// NewL function.
|
|
56 |
// ---------------------------------------------------------
|
|
57 |
//
|
|
58 |
CAknFepUICtrlPinyinEEP* CAknFepUICtrlPinyinEEP::NewL( RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr )
|
|
59 |
{
|
|
60 |
CAknFepUICtrlPinyinEEP* self=CAknFepUICtrlPinyinEEP::NewLC( aParent, aLafDataMgr );
|
|
61 |
CleanupStack::Pop(self); // self;
|
|
62 |
return self;
|
|
63 |
}
|
|
64 |
|
|
65 |
// ---------------------------------------------------------
|
|
66 |
// NewLC function.
|
|
67 |
// ---------------------------------------------------------
|
|
68 |
//
|
|
69 |
CAknFepUICtrlPinyinEEP* CAknFepUICtrlPinyinEEP::NewLC( RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr )
|
|
70 |
{
|
|
71 |
CAknFepUICtrlPinyinEEP* self = new(ELeave)CAknFepUICtrlPinyinEEP( aLafDataMgr );
|
|
72 |
CleanupStack::PushL( self );
|
|
73 |
self->ConstructL( aParent, aLafDataMgr);
|
|
74 |
return self;
|
|
75 |
}
|
|
76 |
|
|
77 |
// ---------------------------------------------------------
|
|
78 |
// Destructor.
|
|
79 |
// ---------------------------------------------------------
|
|
80 |
//
|
|
81 |
CAknFepUICtrlPinyinEEP::~CAknFepUICtrlPinyinEEP()
|
|
82 |
{
|
|
83 |
if ( iEditableEntryPane )
|
|
84 |
{
|
|
85 |
delete iEditableEntryPane;
|
|
86 |
iEditableEntryPane = NULL;
|
|
87 |
}
|
|
88 |
// if ( iBgContext )
|
|
89 |
// {
|
|
90 |
// delete iBgContext;
|
|
91 |
// iBgContext = NULL;
|
|
92 |
// }
|
|
93 |
if ( iAbsoluteBuffer )
|
|
94 |
{
|
|
95 |
delete iAbsoluteBuffer;
|
|
96 |
iAbsoluteBuffer = NULL;
|
|
97 |
}
|
|
98 |
if ( iVisualBuffer )
|
|
99 |
{
|
|
100 |
delete iVisualBuffer;
|
|
101 |
iVisualBuffer = NULL;
|
|
102 |
}
|
|
103 |
iArray.ResetAndDestroy();
|
|
104 |
delete iKeystrokeArray;
|
|
105 |
delete iShowKeystrokeArray;
|
|
106 |
delete iPhraseArray;
|
|
107 |
delete iPhraseShowKeyStrokeArray;
|
|
108 |
delete iTempArray;
|
|
109 |
delete iPhraseZhuYinSpellingArray;
|
|
110 |
}
|
|
111 |
|
|
112 |
// ---------------------------------------------------------
|
|
113 |
// From CCoeControl.
|
|
114 |
// ---------------------------------------------------------
|
|
115 |
//
|
|
116 |
TInt CAknFepUICtrlPinyinEEP::CountComponentControls() const
|
|
117 |
{
|
|
118 |
return KControlNum;
|
|
119 |
}
|
|
120 |
|
|
121 |
// ---------------------------------------------------------
|
|
122 |
// From CCoeControl.
|
|
123 |
// ---------------------------------------------------------
|
|
124 |
//
|
|
125 |
CCoeControl* CAknFepUICtrlPinyinEEP::ComponentControl( TInt aIndex ) const
|
|
126 |
{
|
|
127 |
switch ( aIndex )
|
|
128 |
{
|
|
129 |
case EEditableEntryPane:
|
|
130 |
return iEditableEntryPane;
|
|
131 |
default:
|
|
132 |
return NULL;
|
|
133 |
}
|
|
134 |
}
|
|
135 |
|
|
136 |
// ---------------------------------------------------------
|
|
137 |
// From CCoeControl.
|
|
138 |
// ---------------------------------------------------------
|
|
139 |
//
|
|
140 |
void CAknFepUICtrlPinyinEEP::Draw( const TRect& /*aRect*/) const
|
|
141 |
{
|
|
142 |
}
|
|
143 |
|
|
144 |
// ---------------------------------------------------------
|
|
145 |
// From CCoeControl.
|
|
146 |
// ---------------------------------------------------------
|
|
147 |
//
|
|
148 |
void CAknFepUICtrlPinyinEEP::SizeChanged()
|
|
149 |
{
|
|
150 |
LayoutContainedControls();
|
|
151 |
}
|
|
152 |
|
|
153 |
// ---------------------------------------------------------
|
|
154 |
// Set the text buffer and posit the cursor index.
|
|
155 |
// ---------------------------------------------------------
|
|
156 |
//
|
|
157 |
void CAknFepUICtrlPinyinEEP::SetText( const TDesC& aDes, TInt aCursorIndex, TBool aMiniQwertyZhuyin )
|
|
158 |
{
|
|
159 |
iMiniQwertyZhuyin = aMiniQwertyZhuyin;
|
|
160 |
iAbsoluteUnderlineBeg = -1;
|
|
161 |
iAbsoluteUnderlineEnd = -1;
|
|
162 |
iAbsoluteHighlightBeg = -1;
|
|
163 |
iAbsoluteHighlightEnd = -1;
|
|
164 |
iArray.ResetAndDestroy();
|
|
165 |
TInt absoluteBufferLen = iAbsoluteBuffer->Length();
|
|
166 |
TInt desLen = aDes.Length();
|
|
167 |
|
|
168 |
if ( aCursorIndex > aDes.Length() )
|
|
169 |
{
|
|
170 |
aCursorIndex = aDes.Length();
|
|
171 |
}
|
|
172 |
else if ( aCursorIndex < 0 )
|
|
173 |
{
|
|
174 |
aCursorIndex = 0;
|
|
175 |
}
|
|
176 |
|
|
177 |
// cursor is at the end of buffer and add a character
|
|
178 |
if ( aDes.Left( iAbsoluteBuffer->Length() ) == *iAbsoluteBuffer
|
|
179 |
&& iAbsoluteCursorPos == iAbsoluteBuffer->Length() && aCursorIndex
|
|
180 |
== aDes.Length() )
|
|
181 |
{
|
|
182 |
Append( aDes.Right( aDes.Length() - iAbsoluteBuffer->Length() ) );
|
|
183 |
}
|
|
184 |
// delete one character
|
|
185 |
else if ( iAbsoluteBuffer->Left( aCursorIndex ).Compare(aDes.Left(aCursorIndex)) == 0
|
|
186 |
&& aCursorIndex < iAbsoluteCursorPos
|
|
187 |
&& iAbsoluteBuffer->Compare( aDes ) != 0
|
|
188 |
&& 0 == iAbsoluteBuffer->Right( absoluteBufferLen - iAbsoluteCursorPos ).Compare(
|
|
189 |
aDes.Right( desLen - aCursorIndex)) )
|
|
190 |
{
|
|
191 |
Delete( iAbsoluteCursorPos - (iAbsoluteBuffer->Length()
|
|
192 |
- aDes.Length()), iAbsoluteBuffer->Length() - aDes.Length() );
|
|
193 |
}
|
|
194 |
else if ( iAbsoluteBuffer->Length() < aDes.Length()
|
|
195 |
&& iAbsoluteBuffer->Left( iAbsoluteCursorPos )
|
|
196 |
== aDes.Left( iAbsoluteCursorPos )
|
|
197 |
&& iAbsoluteBuffer->Right( iAbsoluteBuffer->Length()
|
|
198 |
- iAbsoluteCursorPos ) == aDes.Right( iAbsoluteBuffer->Length()
|
|
199 |
- iAbsoluteCursorPos ) && aCursorIndex - iAbsoluteCursorPos
|
|
200 |
== aDes.Length() - iAbsoluteBuffer->Length() )
|
|
201 |
{
|
|
202 |
TPtrC tmp = aDes.Mid( iAbsoluteCursorPos, aDes.Length()
|
|
203 |
- iAbsoluteBuffer->Length() );
|
|
204 |
Insert( iAbsoluteCursorPos, tmp );
|
|
205 |
}
|
|
206 |
else
|
|
207 |
{
|
|
208 |
SetText( aDes );
|
|
209 |
SetCursor( aCursorIndex );
|
|
210 |
}
|
|
211 |
}
|
|
212 |
|
|
213 |
// ---------------------------------------------------------
|
|
214 |
// Set the text buffer and posit the cursor index for zhuyin.
|
|
215 |
// ---------------------------------------------------------
|
|
216 |
//
|
|
217 |
void CAknFepUICtrlPinyinEEP::SetTextForZhuyin(
|
|
218 |
const TDesC& aDes,
|
|
219 |
TInt aCursor,
|
|
220 |
TInt aChineseCount,
|
|
221 |
const TDesC& aJudgeSeed,
|
|
222 |
TInt aKeystroke,
|
|
223 |
TBool aInvalid,
|
|
224 |
TBool aMiniQwertyZhuyin)
|
|
225 |
{
|
|
226 |
iMiniQwertyZhuyin = aMiniQwertyZhuyin;
|
|
227 |
TInt actionType = EZhuyinNULL;
|
|
228 |
if ( aKeystroke == 0 && aJudgeSeed.Compare(iJudgeSeed) == 0)
|
|
229 |
{
|
|
230 |
actionType = EZhuyinMoveCursor;
|
|
231 |
}
|
|
232 |
else if ( aChineseCount == iChineseCount + 1 )
|
|
233 |
{
|
|
234 |
actionType = EZhuyinNULL;
|
|
235 |
}
|
|
236 |
else if ( aKeystroke == 0 && aJudgeSeed.Length() <= iJudgeSeed.Length() - 1)
|
|
237 |
{
|
|
238 |
actionType = EZhuyinDelete;
|
|
239 |
}
|
|
240 |
else
|
|
241 |
{
|
|
242 |
if ( aJudgeSeed.Length() == iJudgeSeed.Length())
|
|
243 |
{
|
|
244 |
if ( aJudgeSeed.Left(aKeystroke - 1).Compare(iJudgeSeed.Left(aKeystroke - 1)) == 0
|
|
245 |
&& aJudgeSeed.Mid(aKeystroke - 1,1).Compare(iJudgeSeed.Mid(aKeystroke - 1,1)) != 0 )
|
|
246 |
{
|
|
247 |
actionType = EZhuyinReplace;
|
|
248 |
}
|
|
249 |
else if ( aCursor == GetCursor() )
|
|
250 |
{
|
|
251 |
actionType = EZhuyinReplace;
|
|
252 |
}
|
|
253 |
else
|
|
254 |
{
|
|
255 |
actionType = EZhuyinMoveCursor;
|
|
256 |
}
|
|
257 |
}
|
|
258 |
else if ( aJudgeSeed.Length() == iJudgeSeed.Length() + 1)
|
|
259 |
{
|
|
260 |
actionType = EZhuyinInsert;
|
|
261 |
}
|
|
262 |
else if ( aJudgeSeed.Length() == iJudgeSeed.Length() - 1)
|
|
263 |
{
|
|
264 |
actionType = EZhuyinDelete;
|
|
265 |
}
|
|
266 |
else if ( KErrNotFound != iJudgeSeed.Find( aJudgeSeed ) )
|
|
267 |
{
|
|
268 |
actionType = EZhuyinDelete;
|
|
269 |
}
|
|
270 |
else
|
|
271 |
{
|
|
272 |
actionType = EZhuyinNULL;
|
|
273 |
}
|
|
274 |
}
|
|
275 |
iArray.ResetAndDestroy();
|
|
276 |
iJudgeSeed = aJudgeSeed;
|
|
277 |
iChineseCount = aChineseCount;
|
|
278 |
if ( iLastValid && aInvalid )
|
|
279 |
{
|
|
280 |
TInt newOffset = 0;
|
|
281 |
TPtrC ptr = iAbsoluteBuffer->Des();
|
|
282 |
for ( TInt i = 0; i < iOffset; i++ )
|
|
283 |
{
|
|
284 |
if ( ptr.Mid(i,1).Compare(KFullStop) == 0 )
|
|
285 |
{
|
|
286 |
continue;
|
|
287 |
}
|
|
288 |
newOffset++;
|
|
289 |
}
|
|
290 |
iOffset = newOffset;
|
|
291 |
}
|
|
292 |
else if ( !iLastValid && !aInvalid )
|
|
293 |
{
|
|
294 |
TInt newOffset = 0;
|
|
295 |
TInt i = 0;
|
|
296 |
TPtrC ptr = aDes;
|
|
297 |
for ( i = 0; i < iOffset && newOffset < ptr.Length(); )
|
|
298 |
{
|
|
299 |
if ( ptr.Mid(newOffset,1).Compare(KFullStop) != 0 )
|
|
300 |
{
|
|
301 |
i++;
|
|
302 |
}
|
|
303 |
newOffset++;
|
|
304 |
}
|
|
305 |
iOffset = newOffset;
|
|
306 |
}
|
|
307 |
iLastValid = !aInvalid;
|
|
308 |
switch ( actionType )
|
|
309 |
{
|
|
310 |
case EZhuyinInsert:
|
|
311 |
{
|
|
312 |
*iAbsoluteBuffer = aDes;
|
|
313 |
iAbsoluteCursorPos = aCursor;
|
|
314 |
this->CalculateVisualTextForInsert( 0, aDes );
|
|
315 |
this->iEditableEntryPane->SetText( *iVisualBuffer );
|
|
316 |
this->CalculateVisualIndex();
|
|
317 |
iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos
|
|
318 |
- iOffset );
|
|
319 |
}
|
|
320 |
break;
|
|
321 |
case EZhuyinReplace:
|
|
322 |
{
|
|
323 |
TRect panerect = iEditableEntryPane->Rect();
|
|
324 |
TAknTextLineLayout textPaneTextLayout =
|
|
325 |
CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
|
|
326 |
const CFont* font = AknLayoutUtils::FontFromId(
|
|
327 |
textPaneTextLayout.iFont,
|
|
328 |
NULL );
|
|
329 |
TInt lenToCursor = font->TextWidthInPixels( aDes.Mid( iOffset,
|
|
330 |
aCursor - iOffset ) );
|
|
331 |
if ( lenToCursor < panerect.Width() - panerect.Width()
|
|
332 |
*KLROffset/KDenominator * 2 )
|
|
333 |
{
|
|
334 |
*iAbsoluteBuffer = aDes;
|
|
335 |
iAbsoluteCursorPos = aCursor;
|
|
336 |
TInt stride = 0;
|
|
337 |
for (stride = 1;; stride ++ )
|
|
338 |
{
|
|
339 |
if ( iOffset + stride > aDes.Length() )
|
|
340 |
{
|
|
341 |
break;
|
|
342 |
}
|
|
343 |
TInt tmpFontLen = font->TextWidthInPixels( aDes.Mid(
|
|
344 |
iOffset, stride ) );
|
|
345 |
if ( tmpFontLen > panerect.Width() - panerect.Width()
|
|
346 |
*KLROffset/KDenominator * 2 )
|
|
347 |
{
|
|
348 |
break;
|
|
349 |
}
|
|
350 |
}
|
|
351 |
*iVisualBuffer = aDes.Mid( iOffset, stride - 1 );
|
|
352 |
iEditableEntryPane->SetText( *iVisualBuffer );
|
|
353 |
iEditableEntryPane->SetCursorPosition( aCursor-iOffset );
|
|
354 |
}
|
|
355 |
else
|
|
356 |
{
|
|
357 |
SetText( aDes, aCursor );
|
|
358 |
}
|
|
359 |
CalculateVisualIndex();
|
|
360 |
break;
|
|
361 |
}
|
|
362 |
case EZhuyinDelete:
|
|
363 |
{
|
|
364 |
*iAbsoluteBuffer = aDes;
|
|
365 |
iAbsoluteCursorPos = aCursor;
|
|
366 |
this->CalculateVisualTextForDelete( 0, 0 );
|
|
367 |
this->iEditableEntryPane->SetText( *iVisualBuffer );
|
|
368 |
this->CalculateVisualIndex();
|
|
369 |
iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos
|
|
370 |
- iOffset );
|
|
371 |
}
|
|
372 |
break;
|
|
373 |
default:
|
|
374 |
SetText( aDes, aCursor );
|
|
375 |
}
|
|
376 |
}
|
|
377 |
|
|
378 |
// ---------------------------------------------------------
|
|
379 |
// Set the text buffer and maintain the current cursor position.
|
|
380 |
// ---------------------------------------------------------
|
|
381 |
//
|
|
382 |
void CAknFepUICtrlPinyinEEP::SetText( const TDesC& aDes )
|
|
383 |
{
|
|
384 |
iAbsoluteCursorPos = 0;
|
|
385 |
iOffset = 0;
|
|
386 |
iAbsoluteBuffer->Des().Zero();
|
|
387 |
iVisualBuffer->Des().Zero();
|
|
388 |
*iAbsoluteBuffer = aDes;
|
|
389 |
CalculateVisualTextForMoveRight();
|
|
390 |
iEditableEntryPane->SetText( *iVisualBuffer );
|
|
391 |
CalculateVisualIndex();
|
|
392 |
}
|
|
393 |
|
|
394 |
// ---------------------------------------------------------
|
|
395 |
// Set the cursor position.
|
|
396 |
// ---------------------------------------------------------
|
|
397 |
//
|
|
398 |
void CAknFepUICtrlPinyinEEP::SetCursor( const TInt aIndex )
|
|
399 |
{
|
|
400 |
SetCursorForMoveRight( aIndex );
|
|
401 |
}
|
|
402 |
|
|
403 |
// ---------------------------------------------------------
|
|
404 |
// get the position index of cursor.The max cursor index must
|
|
405 |
// be larger than the length of text buffer by 1.
|
|
406 |
// ---------------------------------------------------------
|
|
407 |
//
|
|
408 |
TInt CAknFepUICtrlPinyinEEP::GetCursor()
|
|
409 |
{
|
|
410 |
return iAbsoluteCursorPos;
|
|
411 |
}
|
|
412 |
|
|
413 |
// ---------------------------------------------------------
|
|
414 |
// move cursor to the left by a 1 stride.
|
|
415 |
// ---------------------------------------------------------
|
|
416 |
//
|
|
417 |
TBool CAknFepUICtrlPinyinEEP::MoveCursorLeft( TInt aStride )
|
|
418 |
{
|
|
419 |
if ( iAbsoluteCursorPos - aStride < 0 )
|
|
420 |
{
|
|
421 |
return EFalse;
|
|
422 |
}
|
|
423 |
if ( iEditableEntryPane->MoveCursorLeft( aStride ) == 0 )
|
|
424 |
{
|
|
425 |
iAbsoluteCursorPos = iAbsoluteCursorPos - aStride;
|
|
426 |
}
|
|
427 |
else
|
|
428 |
{
|
|
429 |
iAbsoluteCursorPos = iAbsoluteCursorPos - aStride;
|
|
430 |
SetCursorForMoveLeft( iAbsoluteCursorPos );
|
|
431 |
}
|
|
432 |
return ETrue;
|
|
433 |
}
|
|
434 |
|
|
435 |
// ---------------------------------------------------------
|
|
436 |
// move cursor to the right by a 1 stride.
|
|
437 |
// ---------------------------------------------------------
|
|
438 |
//
|
|
439 |
TBool CAknFepUICtrlPinyinEEP::MoveCursorRight( TInt aStride )
|
|
440 |
{
|
|
441 |
if ( iAbsoluteCursorPos + aStride > iAbsoluteBuffer->Length() )
|
|
442 |
{
|
|
443 |
return EFalse;
|
|
444 |
}
|
|
445 |
if ( iEditableEntryPane->MoveCursorRight( aStride ) == 0 )
|
|
446 |
{
|
|
447 |
iAbsoluteCursorPos = iAbsoluteCursorPos + aStride;
|
|
448 |
}
|
|
449 |
else
|
|
450 |
{
|
|
451 |
iAbsoluteCursorPos = iAbsoluteCursorPos + aStride;
|
|
452 |
SetCursorForMoveRight( iAbsoluteCursorPos );
|
|
453 |
}
|
|
454 |
return ETrue;
|
|
455 |
}
|
|
456 |
|
|
457 |
// ---------------------------------------------------------
|
|
458 |
// active the cursor,the cursor will be black and with a wink
|
|
459 |
// this cursor state represent this control is focused.
|
|
460 |
// ---------------------------------------------------------
|
|
461 |
//
|
|
462 |
void CAknFepUICtrlPinyinEEP::ActiveCursor()
|
|
463 |
{
|
|
464 |
iEditableEntryPane->ActiveCursor();
|
|
465 |
}
|
|
466 |
|
|
467 |
// ---------------------------------------------------------
|
|
468 |
// deactive the cursor, the cursor will be gray and no wink this cursor
|
|
469 |
// state represent this control with no focus.
|
|
470 |
// ---------------------------------------------------------
|
|
471 |
//
|
|
472 |
void CAknFepUICtrlPinyinEEP::DeactiveCursor()
|
|
473 |
{
|
|
474 |
iEditableEntryPane->DeactiveCursor();
|
|
475 |
}
|
|
476 |
|
|
477 |
// ---------------------------------------------------------
|
|
478 |
// enable the cursor,the cursor will be drawn.
|
|
479 |
// ---------------------------------------------------------
|
|
480 |
//
|
|
481 |
void CAknFepUICtrlPinyinEEP::EnableCursor()
|
|
482 |
{
|
|
483 |
iEditableEntryPane->EnableCursor();
|
|
484 |
}
|
|
485 |
|
|
486 |
// ---------------------------------------------------------
|
|
487 |
// deactive the cursor, the cursor will not be drawn.
|
|
488 |
// ---------------------------------------------------------
|
|
489 |
//
|
|
490 |
void CAknFepUICtrlPinyinEEP::DisableCursor()
|
|
491 |
{
|
|
492 |
iEditableEntryPane->DisableCursor();
|
|
493 |
}
|
|
494 |
|
|
495 |
// ---------------------------------------------------------
|
|
496 |
// set the beginning and ending index for the underline text.
|
|
497 |
// ---------------------------------------------------------
|
|
498 |
//
|
|
499 |
void CAknFepUICtrlPinyinEEP::SetUnderline( TInt aBeg, TInt aEnd )
|
|
500 |
{
|
|
501 |
CAknFepUICtrlEEPControl::TSegment* tmp =
|
|
502 |
new CAknFepUICtrlEEPControl::TSegment ( aBeg, aEnd, CAknFepUICtrlEEPControl::EUnderline );
|
|
503 |
iArray.Append( tmp );
|
|
504 |
|
|
505 |
TInt visualUnderlineBeg = aBeg - iOffset;
|
|
506 |
TInt visualUnderlineEnd = aEnd - iOffset;
|
|
507 |
|
|
508 |
if (
|
|
509 |
visualUnderlineBeg < 0 &&
|
|
510 |
visualUnderlineEnd < 0
|
|
511 |
||
|
|
512 |
visualUnderlineBeg> iVisualBuffer->Length() - 1 &&
|
|
513 |
visualUnderlineEnd> iVisualBuffer->Length() - 1
|
|
514 |
)
|
|
515 |
{
|
|
516 |
visualUnderlineBeg = -1;
|
|
517 |
visualUnderlineEnd = -1;
|
|
518 |
}
|
|
519 |
else
|
|
520 |
{
|
|
521 |
if ( visualUnderlineBeg < 0 )
|
|
522 |
{
|
|
523 |
visualUnderlineBeg = 0;
|
|
524 |
}
|
|
525 |
if ( visualUnderlineEnd> iVisualBuffer->Length() - 1 )
|
|
526 |
{
|
|
527 |
visualUnderlineEnd = iVisualBuffer->Length() - 1;
|
|
528 |
}
|
|
529 |
}
|
|
530 |
iEditableEntryPane->SetUnderline( visualUnderlineBeg, visualUnderlineEnd );
|
|
531 |
|
|
532 |
iAbsoluteUnderlineBeg = aBeg;
|
|
533 |
iAbsoluteUnderlineEnd = aEnd;
|
|
534 |
}
|
|
535 |
|
|
536 |
// ---------------------------------------------------------
|
|
537 |
// get the indexes for text with underline.
|
|
538 |
// ---------------------------------------------------------
|
|
539 |
//
|
|
540 |
void CAknFepUICtrlPinyinEEP::GetUnderlineIndex( TInt& aBeg, TInt& aEnd )
|
|
541 |
{
|
|
542 |
aBeg = iAbsoluteUnderlineBeg;
|
|
543 |
aEnd = iAbsoluteUnderlineEnd;
|
|
544 |
}
|
|
545 |
|
|
546 |
// ---------------------------------------------------------
|
|
547 |
// set the indexes for the text with highlight
|
|
548 |
// ---------------------------------------------------------
|
|
549 |
//
|
|
550 |
void CAknFepUICtrlPinyinEEP::SetHighlight( TInt aBeg, TInt aEnd )
|
|
551 |
{
|
|
552 |
CAknFepUICtrlEEPControl::TSegment* tmp =
|
|
553 |
new CAknFepUICtrlEEPControl::TSegment ( aBeg, aEnd, CAknFepUICtrlEEPControl::EHighlight );
|
|
554 |
iArray.Append( tmp );
|
|
555 |
|
|
556 |
TInt visualHighlightBeg = aBeg - iOffset;
|
|
557 |
TInt visualHighlightEnd = aEnd - iOffset;
|
|
558 |
|
|
559 |
if (
|
|
560 |
visualHighlightBeg < 0 &&
|
|
561 |
visualHighlightEnd < 0
|
|
562 |
||
|
|
563 |
visualHighlightBeg> iVisualBuffer->Length() - 1 &&
|
|
564 |
visualHighlightEnd> iVisualBuffer->Length() - 1
|
|
565 |
)
|
|
566 |
{
|
|
567 |
visualHighlightBeg = -1;
|
|
568 |
visualHighlightEnd = -1;
|
|
569 |
}
|
|
570 |
else
|
|
571 |
{
|
|
572 |
if ( visualHighlightBeg < 0 )
|
|
573 |
{
|
|
574 |
visualHighlightBeg = 0;
|
|
575 |
}
|
|
576 |
if ( visualHighlightEnd> iVisualBuffer->Length() - 1 )
|
|
577 |
{
|
|
578 |
visualHighlightEnd = iVisualBuffer->Length() - 1;
|
|
579 |
}
|
|
580 |
}
|
|
581 |
iEditableEntryPane->SetHighlight( visualHighlightBeg, visualHighlightEnd );
|
|
582 |
|
|
583 |
iAbsoluteHighlightBeg = aBeg;
|
|
584 |
iAbsoluteHighlightEnd = aEnd;
|
|
585 |
}
|
|
586 |
|
|
587 |
// ---------------------------------------------------------
|
|
588 |
// get the indexes for the text with highlight
|
|
589 |
// ---------------------------------------------------------
|
|
590 |
//
|
|
591 |
void CAknFepUICtrlPinyinEEP::GetHighlightIndex( TInt& aBeg, TInt& aEnd )
|
|
592 |
{
|
|
593 |
aBeg = iAbsoluteHighlightBeg;
|
|
594 |
aEnd = iAbsoluteHighlightEnd;
|
|
595 |
}
|
|
596 |
|
|
597 |
// ---------------------------------------------------------
|
|
598 |
// set keystroke index.
|
|
599 |
// ---------------------------------------------------------
|
|
600 |
//
|
|
601 |
void CAknFepUICtrlPinyinEEP::SetCursorIndexOfKeystroke( const TInt aStartIndex )
|
|
602 |
{
|
|
603 |
iIndex = aStartIndex;
|
|
604 |
}
|
|
605 |
|
|
606 |
// ---------------------------------------------------------
|
|
607 |
// get the keystroke index
|
|
608 |
// ---------------------------------------------------------
|
|
609 |
//
|
|
610 |
TInt CAknFepUICtrlPinyinEEP::GetCursorIndexOfKeystroke()
|
|
611 |
{
|
|
612 |
return iIndex;
|
|
613 |
}
|
|
614 |
|
|
615 |
// ---------------------------------------------------------
|
|
616 |
// whether this control will be actived.ETrue represent enable
|
|
617 |
// otherwise disable.
|
|
618 |
// ---------------------------------------------------------
|
|
619 |
//
|
|
620 |
void CAknFepUICtrlPinyinEEP::Enable( TBool aEnable )
|
|
621 |
{
|
|
622 |
iEnabled = aEnable;
|
|
623 |
if ( aEnable == EFalse )
|
|
624 |
{
|
|
625 |
Reset();
|
|
626 |
DrawNow();
|
|
627 |
}
|
|
628 |
iEditableEntryPane->MakeVisible( aEnable );
|
|
629 |
MakeVisible( aEnable );
|
|
630 |
}
|
|
631 |
|
|
632 |
// ---------------------------------------------------------
|
|
633 |
// return whether this control is enabled.
|
|
634 |
// ---------------------------------------------------------
|
|
635 |
//
|
|
636 |
TBool CAknFepUICtrlPinyinEEP::IsEnabled() const
|
|
637 |
{
|
|
638 |
return iEnabled;
|
|
639 |
}
|
|
640 |
|
|
641 |
// ---------------------------------------------------------
|
|
642 |
// Get the info before cursor.
|
|
643 |
// ---------------------------------------------------------
|
|
644 |
//
|
|
645 |
void CAknFepUICtrlPinyinEEP::GetText( TDes& aText )
|
|
646 |
{
|
|
647 |
aText = *iAbsoluteBuffer;
|
|
648 |
}
|
|
649 |
|
|
650 |
// ---------------------------------------------------------
|
|
651 |
// Get the info before cursor.
|
|
652 |
// ---------------------------------------------------------
|
|
653 |
//
|
|
654 |
TBool CAknFepUICtrlPinyinEEP::GetDesBeforeCursor( TDes& aOut )
|
|
655 |
{
|
|
656 |
if ( iAbsoluteCursorPos == 0 )
|
|
657 |
{
|
|
658 |
return EFalse;
|
|
659 |
}
|
|
660 |
else
|
|
661 |
{
|
|
662 |
aOut = iAbsoluteBuffer->Mid( (iAbsoluteCursorPos - 1 ), 1 );
|
|
663 |
return ETrue;
|
|
664 |
}
|
|
665 |
}
|
|
666 |
|
|
667 |
// ---------------------------------------------------------
|
|
668 |
// From MAknFepUICtrlEditPane.
|
|
669 |
// ---------------------------------------------------------
|
|
670 |
//
|
|
671 |
void CAknFepUICtrlPinyinEEP::SetToneMark( const TDesC& /*aToneMark*/)
|
|
672 |
{
|
|
673 |
}
|
|
674 |
|
|
675 |
// ---------------------------------------------------------
|
|
676 |
// From MAknFepUICtrlEditPane.
|
|
677 |
// ---------------------------------------------------------
|
|
678 |
//
|
|
679 |
void CAknFepUICtrlPinyinEEP::SetToneMarkValidity( TBool /*aValid*/)
|
|
680 |
{
|
|
681 |
}
|
|
682 |
|
|
683 |
// ---------------------------------------------------------
|
|
684 |
// From MAknFepUICtrlEditPane.
|
|
685 |
// ---------------------------------------------------------
|
|
686 |
//
|
|
687 |
void CAknFepUICtrlPinyinEEP::SetOverrideFontId( TInt /*aFontId*/)
|
|
688 |
{
|
|
689 |
}
|
|
690 |
|
|
691 |
// ---------------------------------------------------------
|
|
692 |
// From MAknFepUICtrlEditPane.
|
|
693 |
// ---------------------------------------------------------
|
|
694 |
//
|
|
695 |
void CAknFepUICtrlPinyinEEP::SetFlag( TInt /*aFlag*/)
|
|
696 |
{
|
|
697 |
}
|
|
698 |
|
|
699 |
// ---------------------------------------------------------
|
|
700 |
// From MAknFepUICtrlEditPane.
|
|
701 |
// ---------------------------------------------------------
|
|
702 |
//
|
|
703 |
void CAknFepUICtrlPinyinEEP::ClearFlag( TInt /*aFlag*/)
|
|
704 |
{
|
|
705 |
}
|
|
706 |
|
|
707 |
// ---------------------------------------------------------
|
|
708 |
// From MAknFepUICtrlEditPane.
|
|
709 |
// ---------------------------------------------------------
|
|
710 |
//
|
|
711 |
TBool CAknFepUICtrlPinyinEEP::IsFlagSet( TInt /*aFlag*/) const
|
|
712 |
{
|
|
713 |
return EFalse;
|
|
714 |
}
|
|
715 |
|
|
716 |
// ---------------------------------------------------------
|
|
717 |
// Set the cursor index for moving to the left.
|
|
718 |
// ---------------------------------------------------------
|
|
719 |
//
|
|
720 |
void CAknFepUICtrlPinyinEEP::SetCursorForMoveLeft( const TInt aIndex )
|
|
721 |
{
|
|
722 |
iAbsoluteCursorPos = aIndex;
|
|
723 |
CalculateVisualTextForMoveLeft();
|
|
724 |
iEditableEntryPane->SetText( *iVisualBuffer );
|
|
725 |
iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
|
|
726 |
CalculateVisualIndex();
|
|
727 |
}
|
|
728 |
|
|
729 |
// ---------------------------------------------------------
|
|
730 |
// Set the cursor index for moving to the right.
|
|
731 |
// ---------------------------------------------------------
|
|
732 |
//
|
|
733 |
void CAknFepUICtrlPinyinEEP::SetCursorForMoveRight( const TInt aIndex )
|
|
734 |
{
|
|
735 |
iAbsoluteCursorPos = aIndex;
|
|
736 |
CalculateVisualTextForMoveRight();
|
|
737 |
iEditableEntryPane->SetText( *iVisualBuffer );
|
|
738 |
iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
|
|
739 |
CalculateVisualIndex();
|
|
740 |
}
|
|
741 |
|
|
742 |
// ---------------------------------------------------------
|
|
743 |
// Add some text at the end of buffer.
|
|
744 |
// ---------------------------------------------------------
|
|
745 |
//
|
|
746 |
TBool CAknFepUICtrlPinyinEEP::Append( const TDesC& aDes )
|
|
747 |
{
|
|
748 |
if ( this->iAbsoluteCursorPos != this->iAbsoluteBuffer->Length() )
|
|
749 |
{
|
|
750 |
return EFalse;
|
|
751 |
}
|
|
752 |
else
|
|
753 |
{
|
|
754 |
if ( iAbsoluteBuffer->Length() + aDes.Length()
|
|
755 |
> iAbsoluteBuffer->Des().MaxLength() )
|
|
756 |
{
|
|
757 |
return EFalse;
|
|
758 |
}
|
|
759 |
iAbsoluteBuffer->Des().Append( aDes );
|
|
760 |
iAbsoluteCursorPos = iAbsoluteCursorPos + aDes.Length();
|
|
761 |
this->CalculateVisualTextForAppend( aDes );
|
|
762 |
this->iEditableEntryPane->SetText( *iVisualBuffer );
|
|
763 |
this->CalculateVisualIndex();
|
|
764 |
iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
|
|
765 |
return ETrue;
|
|
766 |
}
|
|
767 |
}
|
|
768 |
|
|
769 |
// ---------------------------------------------------------
|
|
770 |
// delete the content begin with aBeg index, and with an aLen length.
|
|
771 |
// ---------------------------------------------------------
|
|
772 |
//
|
|
773 |
TBool CAknFepUICtrlPinyinEEP::Delete( TInt aBeg, TInt aLen )
|
|
774 |
{
|
|
775 |
if ( aBeg < 0 || aLen < 0 || aBeg + aLen> iAbsoluteBuffer->Length() )
|
|
776 |
{
|
|
777 |
return EFalse;
|
|
778 |
}
|
|
779 |
else
|
|
780 |
{
|
|
781 |
iAbsoluteBuffer->Des().Delete( aBeg, aLen );
|
|
782 |
iAbsoluteCursorPos = aBeg;
|
|
783 |
this->CalculateVisualTextForDelete( aBeg, aLen );
|
|
784 |
this->iEditableEntryPane->SetText( *iVisualBuffer );
|
|
785 |
this->CalculateVisualIndex();
|
|
786 |
iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
|
|
787 |
return ETrue;
|
|
788 |
}
|
|
789 |
}
|
|
790 |
|
|
791 |
// ---------------------------------------------------------
|
|
792 |
// Insert some text after aIndex character.
|
|
793 |
// ---------------------------------------------------------
|
|
794 |
//
|
|
795 |
TBool CAknFepUICtrlPinyinEEP::Insert( TInt aIndex, const TDesC& aDes )
|
|
796 |
{
|
|
797 |
if ( iAbsoluteBuffer->Length() + aDes.Length() > iAbsoluteBuffer->Des().MaxLength() )
|
|
798 |
{
|
|
799 |
return EFalse;
|
|
800 |
}
|
|
801 |
iAbsoluteBuffer->Des().Insert( aIndex, aDes );
|
|
802 |
iAbsoluteCursorPos = iAbsoluteCursorPos + aDes.Length();
|
|
803 |
this->CalculateVisualTextForInsert( aIndex, aDes );
|
|
804 |
this->iEditableEntryPane->SetText( *iVisualBuffer );
|
|
805 |
this->CalculateVisualIndex();
|
|
806 |
iEditableEntryPane->SetCursorPosition( iAbsoluteCursorPos - iOffset );
|
|
807 |
return ETrue;
|
|
808 |
}
|
|
809 |
|
|
810 |
// ---------------------------------------------------------
|
|
811 |
// Replace text from aBeg index to aBeg + aLen with aDes.
|
|
812 |
// ---------------------------------------------------------
|
|
813 |
//
|
|
814 |
TBool CAknFepUICtrlPinyinEEP::Replace( TInt /*aBeg*/, TInt /*aLen*/,
|
|
815 |
const TDesC& /*aDes*/)
|
|
816 |
{
|
|
817 |
return EFalse;
|
|
818 |
}
|
|
819 |
|
|
820 |
// ---------------------------------------------------------
|
|
821 |
// Reset private member viariable.
|
|
822 |
// ---------------------------------------------------------
|
|
823 |
//
|
|
824 |
void CAknFepUICtrlPinyinEEP::Reset()
|
|
825 |
{
|
|
826 |
iIndex = 0;
|
|
827 |
iEnabled = EFalse;
|
|
828 |
iAbsoluteCursorPos = 0;
|
|
829 |
iOffset = 0;
|
|
830 |
iAbsoluteUnderlineBeg = -1;
|
|
831 |
iAbsoluteUnderlineEnd = -1;
|
|
832 |
iAbsoluteHighlightBeg = -1;
|
|
833 |
iAbsoluteHighlightEnd = -1;
|
|
834 |
iAbsoluteBuffer->Des().Zero();
|
|
835 |
iVisualBuffer->Des().Zero();
|
|
836 |
iEditableEntryPane->ResetAll();
|
|
837 |
iArray.ResetAndDestroy();
|
|
838 |
iJudgeSeed.Zero();
|
|
839 |
iLastValid = ETrue;
|
|
840 |
iChineseCount = 0;
|
|
841 |
}
|
|
842 |
|
|
843 |
// ---------------------------------------------------------
|
|
844 |
// Layout contained controls.
|
|
845 |
// ---------------------------------------------------------
|
|
846 |
//
|
|
847 |
void CAknFepUICtrlPinyinEEP::LayoutContainedControls()
|
|
848 |
{
|
|
849 |
TRect outerRect;
|
|
850 |
TRect innerRect;
|
|
851 |
CalculateFrameRects( outerRect, innerRect );
|
|
852 |
TRect rect = Rect();
|
|
853 |
iEditableEntryPane->SetRect( rect );
|
|
854 |
}
|
|
855 |
|
|
856 |
// ---------------------------------------------------------
|
|
857 |
// layout the background frames.
|
|
858 |
// ---------------------------------------------------------
|
|
859 |
//
|
|
860 |
void CAknFepUICtrlPinyinEEP::LayoutFrames()
|
|
861 |
{
|
|
862 |
TRect outerRect;
|
|
863 |
TRect innerRect;
|
|
864 |
// CalculateFrameRects( outerRect, innerRect );
|
|
865 |
// iBgContext->SetFrameRects( outerRect, innerRect );
|
|
866 |
// iBgContext->SetParentPos( PositionRelativeToScreen() );
|
|
867 |
}
|
|
868 |
|
|
869 |
// ---------------------------------------------------------
|
|
870 |
// layout its rectangles
|
|
871 |
// ---------------------------------------------------------
|
|
872 |
//
|
|
873 |
void CAknFepUICtrlPinyinEEP::LayoutRects()
|
|
874 |
{
|
|
875 |
TRect windowRect =
|
|
876 |
CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EEEPWindowRect ));
|
|
877 |
TInt height = windowRect.Height();
|
|
878 |
TInt width = windowRect.Width();
|
|
879 |
windowRect.iTl.iY = 0;
|
|
880 |
windowRect.iTl.iX = 0;
|
|
881 |
windowRect.SetHeight( height );
|
|
882 |
windowRect.SetWidth( width );
|
|
883 |
iSize.SetSize( width, Rect().Height() );
|
|
884 |
}
|
|
885 |
|
|
886 |
// ---------------------------------------------------------
|
|
887 |
// C++ constructor
|
|
888 |
// ---------------------------------------------------------
|
|
889 |
//
|
|
890 |
CAknFepUICtrlPinyinEEP::CAknFepUICtrlPinyinEEP( CAknFepUiLayoutDataMgr* aLafDataMgr )
|
|
891 |
{
|
|
892 |
iIndex = 0;
|
|
893 |
iEnabled = EFalse;
|
|
894 |
iAbsoluteCursorPos = 0;
|
|
895 |
iAbsoluteUnderlineBeg = -1;
|
|
896 |
iAbsoluteUnderlineEnd = -1;
|
|
897 |
iAbsoluteHighlightBeg = -1;
|
|
898 |
iAbsoluteHighlightEnd = -1;
|
|
899 |
iOffset = 0;
|
|
900 |
iJudgeSeed.Zero();
|
|
901 |
iLastValid = ETrue;
|
|
902 |
iChineseCount = 0;
|
|
903 |
iChangeFlag = 0;
|
|
904 |
iAutoChangeFlag = 1;
|
|
905 |
iAllValidFlag = 1;
|
|
906 |
iInvalidKeystrokeIndex = 0;
|
|
907 |
iCandidateRefreshFlag = 0;
|
|
908 |
iDelimiterCount = 0;
|
|
909 |
iLafDataMgr = aLafDataMgr;
|
|
910 |
}
|
|
911 |
|
|
912 |
// ---------------------------------------------------------
|
|
913 |
// Two-phrase constructor.
|
|
914 |
// ---------------------------------------------------------
|
|
915 |
//
|
|
916 |
void CAknFepUICtrlPinyinEEP::ConstructL( RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr )
|
|
917 |
{
|
|
918 |
SetContainerWindowL( aParent );
|
|
919 |
iEditableEntryPane = CAknFepUICtrlEEPControl::NewL( Window(), aLafDataMgr );
|
|
920 |
iAbsoluteBuffer = HBufC::New( KMaxCharNum );
|
|
921 |
iVisualBuffer = HBufC::New( KMaxDispNum );
|
|
922 |
TRect outerRect = TRect();
|
|
923 |
TRect innerRect = TRect();
|
|
924 |
CalculateFrameRects( outerRect, innerRect );
|
|
925 |
// iBgContext = CAknsFrameBackgroundControlContext::NewL(
|
|
926 |
// KAknsIIDQsnFrPopupSub, outerRect, innerRect, ETrue );
|
|
927 |
iKeystrokeArray = new(ELeave)CDesCArrayFlat(1);
|
|
928 |
iShowKeystrokeArray = new(ELeave)CDesCArrayFlat(1);
|
|
929 |
iPhraseArray = new(ELeave)CDesCArrayFlat(1);
|
|
930 |
iPhraseShowKeyStrokeArray = new(ELeave)CDesCArrayFlat(1);
|
|
931 |
iTempArray = new(ELeave)CDesCArrayFlat(1);
|
|
932 |
iMiniQwertyZhuyin = EFalse;
|
|
933 |
iNeedClearDeliberateSelection = EFalse;
|
|
934 |
iPhraseZhuYinSpellingArray =new(ELeave)CDesCArrayFlat(1);
|
|
935 |
}
|
|
936 |
|
|
937 |
// ---------------------------------------------------------
|
|
938 |
// Calculate visual text for appending.
|
|
939 |
// ---------------------------------------------------------
|
|
940 |
//
|
|
941 |
void CAknFepUICtrlPinyinEEP::CalculateVisualTextForAppend( const TDesC& aDes )
|
|
942 |
{
|
|
943 |
TRect panerect = iEditableEntryPane->Rect();
|
|
944 |
TAknTextLineLayout textPaneTextLayout =
|
|
945 |
CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
|
|
946 |
const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont,
|
|
947 |
NULL );
|
|
948 |
|
|
949 |
TInt lenToEnd = font->TextWidthInPixels( iAbsoluteBuffer->Right( iVisualBuffer->Length()
|
|
950 |
+ aDes.Length() ) );
|
|
951 |
if ( lenToEnd <= panerect.Width() - panerect.Width()*KLROffset
|
|
952 |
/KDenominator * 2 )
|
|
953 |
{
|
|
954 |
*iVisualBuffer = iAbsoluteBuffer->Right( iVisualBuffer->Length()
|
|
955 |
+ aDes.Length() );
|
|
956 |
}
|
|
957 |
else
|
|
958 |
{
|
|
959 |
this->CalculateVisualTextForMoveRight();
|
|
960 |
}
|
|
961 |
}
|
|
962 |
|
|
963 |
// ---------------------------------------------------------
|
|
964 |
// Calculate visual text for deleting.
|
|
965 |
// ---------------------------------------------------------
|
|
966 |
//
|
|
967 |
void CAknFepUICtrlPinyinEEP::CalculateVisualTextForDelete( TInt /*aBeg*/,
|
|
968 |
TInt /*aLen*/)
|
|
969 |
{
|
|
970 |
TRect panerect = iEditableEntryPane->Rect();
|
|
971 |
TAknTextLineLayout textPaneTextLayout =
|
|
972 |
CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
|
|
973 |
const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont,
|
|
974 |
NULL );
|
|
975 |
iOffset = iOffset > iAbsoluteBuffer->Length()?iAbsoluteBuffer->Length():iOffset;
|
|
976 |
TInt lenToEnd = font->TextWidthInPixels( iAbsoluteBuffer->Right( iAbsoluteBuffer->Length()
|
|
977 |
- iOffset ) );
|
|
978 |
|
|
979 |
TInt offsetLen = iAbsoluteCursorPos - iOffset;
|
|
980 |
if ( offsetLen < 0 )
|
|
981 |
{
|
|
982 |
offsetLen = 0;
|
|
983 |
}
|
|
984 |
TInt LenOffsetToCursor = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
|
|
985 |
iOffset, offsetLen ) );
|
|
986 |
|
|
987 |
if ( lenToEnd > 0 && iAbsoluteCursorPos >= iOffset && LenOffsetToCursor > panerect.Width()*KLROffset/KDenominator )
|
|
988 |
{
|
|
989 |
TInt stride = 0;
|
|
990 |
for (stride = 1;; stride ++ )
|
|
991 |
{
|
|
992 |
if ( iOffset + stride > iAbsoluteBuffer->Length() )
|
|
993 |
{
|
|
994 |
break;
|
|
995 |
}
|
|
996 |
TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
|
|
997 |
iOffset, stride ) );
|
|
998 |
if ( tmpFontLen > panerect.Width() - panerect.Width()
|
|
999 |
*KLROffset/KDenominator * 2 )
|
|
1000 |
{
|
|
1001 |
break;
|
|
1002 |
}
|
|
1003 |
}
|
|
1004 |
*iVisualBuffer = iAbsoluteBuffer->Mid( iOffset, stride - 1 );
|
|
1005 |
}
|
|
1006 |
else
|
|
1007 |
{
|
|
1008 |
this->CalculateVisualTextForMoveLeft();
|
|
1009 |
}
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
// ---------------------------------------------------------
|
|
1013 |
// Calculate visual text for inserting.
|
|
1014 |
// ---------------------------------------------------------
|
|
1015 |
//
|
|
1016 |
void CAknFepUICtrlPinyinEEP::CalculateVisualTextForInsert( TInt /*aIndex*/,
|
|
1017 |
const TDesC& /*aDes*/)
|
|
1018 |
{
|
|
1019 |
TRect panerect = iEditableEntryPane->Rect();
|
|
1020 |
TAknTextLineLayout textPaneTextLayout =
|
|
1021 |
CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
|
|
1022 |
const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont,
|
|
1023 |
NULL );
|
|
1024 |
|
|
1025 |
TInt offsetLen = iAbsoluteCursorPos - iOffset;
|
|
1026 |
if ( offsetLen < 0 )
|
|
1027 |
{
|
|
1028 |
offsetLen = 0;
|
|
1029 |
}
|
|
1030 |
|
|
1031 |
TInt lenToCursor = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
|
|
1032 |
iOffset, offsetLen ) );
|
|
1033 |
if ( lenToCursor < panerect.Width()* KCursorResetStartOffset / KDenominator
|
|
1034 |
|| iAbsoluteCursorPos == iAbsoluteBuffer->Length()
|
|
1035 |
&& lenToCursor <= panerect.Width() - panerect.Width()*KLROffset/KDenominator * 2)
|
|
1036 |
{
|
|
1037 |
TInt stride = 0;
|
|
1038 |
for (stride = 1;; stride ++ )
|
|
1039 |
{
|
|
1040 |
if ( iOffset + stride > iAbsoluteBuffer->Length() )
|
|
1041 |
{
|
|
1042 |
break;
|
|
1043 |
}
|
|
1044 |
TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
|
|
1045 |
iOffset, stride ) );
|
|
1046 |
if ( tmpFontLen > panerect.Width() - panerect.Width()
|
|
1047 |
*KLROffset/KDenominator * 2 )
|
|
1048 |
{
|
|
1049 |
break;
|
|
1050 |
}
|
|
1051 |
}
|
|
1052 |
*iVisualBuffer = iAbsoluteBuffer->Mid( iOffset, stride - 1 );
|
|
1053 |
}
|
|
1054 |
else
|
|
1055 |
{
|
|
1056 |
this->CalculateVisualTextForMoveRight();
|
|
1057 |
}
|
|
1058 |
}
|
|
1059 |
|
|
1060 |
// ---------------------------------------------------------
|
|
1061 |
// Calculate visual text for replacing.
|
|
1062 |
// ---------------------------------------------------------
|
|
1063 |
//
|
|
1064 |
void CAknFepUICtrlPinyinEEP::CalculateVisualTextForReplace( TInt /*aBeg*/,
|
|
1065 |
TInt /*aLen*/, const TDesC& /*aDes*/)
|
|
1066 |
{
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
// ---------------------------------------------------------
|
|
1070 |
// Calculate visual text for moving to left.
|
|
1071 |
// ---------------------------------------------------------
|
|
1072 |
//
|
|
1073 |
void CAknFepUICtrlPinyinEEP::CalculateVisualTextForMoveLeft()
|
|
1074 |
{
|
|
1075 |
TRect panerect = iEditableEntryPane->Rect();
|
|
1076 |
TAknTextLineLayout textPaneTextLayout =
|
|
1077 |
CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
|
|
1078 |
const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont,
|
|
1079 |
NULL );
|
|
1080 |
TInt absolutelength = font->TextWidthInPixels( *iAbsoluteBuffer );
|
|
1081 |
TInt
|
|
1082 |
cursorToBegLength =
|
|
1083 |
font->TextWidthInPixels( iAbsoluteBuffer->Left( iAbsoluteCursorPos ) );
|
|
1084 |
if ( iAbsoluteCursorPos > iAbsoluteBuffer->Length() + 1 )
|
|
1085 |
{
|
|
1086 |
iAbsoluteCursorPos = iAbsoluteBuffer->Length() + 1;
|
|
1087 |
}
|
|
1088 |
TInt lenPixelToVisualBeg = panerect.Width() * KCursorResetOffset
|
|
1089 |
/ KDenominator;
|
|
1090 |
TInt stride = 0;
|
|
1091 |
TInt visualBeg = 0;
|
|
1092 |
TInt visualEnd = 0;
|
|
1093 |
for (stride = 1;; stride ++ )
|
|
1094 |
{
|
|
1095 |
if ( 0 > iAbsoluteCursorPos - stride )
|
|
1096 |
{
|
|
1097 |
visualBeg = 0;
|
|
1098 |
break;
|
|
1099 |
}
|
|
1100 |
TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
|
|
1101 |
iAbsoluteCursorPos - stride, stride ) );
|
|
1102 |
if ( tmpFontLen > lenPixelToVisualBeg )
|
|
1103 |
{
|
|
1104 |
visualBeg = iAbsoluteCursorPos - stride + 1;
|
|
1105 |
break;
|
|
1106 |
}
|
|
1107 |
}
|
|
1108 |
|
|
1109 |
//let adjustment of visualBeg before caculation of visualEnd.
|
|
1110 |
//For one, calculation always start before "(" for miniqwertyzhuyin
|
|
1111 |
//For two, because characters(markers) might have different length in pixel, it's better recalculate visualEnd
|
|
1112 |
// after changing visualBeg, therefore move changing visualBeg ahead of caculation take effect too.
|
|
1113 |
if ( iMiniQwertyZhuyin &&
|
|
1114 |
iAbsoluteBuffer->Length() > 0 &&
|
|
1115 |
visualBeg >= iPhraseArray->Count() )
|
|
1116 |
{
|
|
1117 |
while ( visualBeg > 0 &&
|
|
1118 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KLeftBracket ) != 0 &&
|
|
1119 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark1 ) != 0 &&
|
|
1120 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark2 ) != 0 &&
|
|
1121 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark3 ) != 0 &&
|
|
1122 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark4 ) != 0 &&
|
|
1123 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark5 ) != 0 )
|
|
1124 |
{
|
|
1125 |
visualBeg--;
|
|
1126 |
}
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
for (stride = 1;; stride ++ )
|
|
1130 |
{
|
|
1131 |
if ( visualBeg + stride > iAbsoluteBuffer->Length() )
|
|
1132 |
{
|
|
1133 |
visualEnd = visualBeg + stride - 1;
|
|
1134 |
break;
|
|
1135 |
}
|
|
1136 |
TPtrC tempString = iAbsoluteBuffer->Mid(visualBeg, stride );
|
|
1137 |
TInt tmpFontLen = font->TextWidthInPixels( tempString );
|
|
1138 |
if ( tmpFontLen > panerect.Width() - panerect.Width() *KLROffset
|
|
1139 |
/KDenominator * 2 )
|
|
1140 |
{
|
|
1141 |
visualEnd = visualBeg + stride - 1;
|
|
1142 |
//visualEnd = visualBeg + stride;
|
|
1143 |
break;
|
|
1144 |
}
|
|
1145 |
}
|
|
1146 |
*iVisualBuffer = iAbsoluteBuffer->Mid( visualBeg, visualEnd - visualBeg );
|
|
1147 |
this->iOffset = visualBeg;
|
|
1148 |
}
|
|
1149 |
|
|
1150 |
// ---------------------------------------------------------
|
|
1151 |
// Calculate visual text for moving to the right.
|
|
1152 |
// ---------------------------------------------------------
|
|
1153 |
//
|
|
1154 |
void CAknFepUICtrlPinyinEEP::CalculateVisualTextForMoveRight()
|
|
1155 |
{
|
|
1156 |
TRect panerect = iEditableEntryPane->Rect();
|
|
1157 |
TAknTextLineLayout textPaneTextLayout =
|
|
1158 |
CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
|
|
1159 |
const CFont* font = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont,
|
|
1160 |
NULL );
|
|
1161 |
TInt absolutelength = font->TextWidthInPixels( *iAbsoluteBuffer );
|
|
1162 |
TInt cursorToEndLength =
|
|
1163 |
font->TextWidthInPixels( iAbsoluteBuffer->Mid( iAbsoluteCursorPos,
|
|
1164 |
iAbsoluteBuffer->Length() - iAbsoluteCursorPos ) );
|
|
1165 |
if ( iAbsoluteCursorPos > iAbsoluteBuffer->Length() + 1 )
|
|
1166 |
{
|
|
1167 |
iAbsoluteCursorPos = iAbsoluteBuffer->Length() + 1;
|
|
1168 |
}
|
|
1169 |
if ( absolutelength <= panerect.Width() - panerect.Width()*KLROffset
|
|
1170 |
/KDenominator * 2 )
|
|
1171 |
{
|
|
1172 |
*iVisualBuffer = *iAbsoluteBuffer;
|
|
1173 |
}
|
|
1174 |
else if ( cursorToEndLength < panerect.Width() * KCursorResetOffset
|
|
1175 |
/ KDenominator )
|
|
1176 |
{
|
|
1177 |
TInt tmp70VisualEnd = iAbsoluteCursorPos;
|
|
1178 |
TInt visualBeg = 0;
|
|
1179 |
TInt visualEnd = 0;
|
|
1180 |
TInt stride = 0;
|
|
1181 |
visualEnd = iAbsoluteBuffer->Length();
|
|
1182 |
for (stride = 1;; stride ++ )
|
|
1183 |
{
|
|
1184 |
TInt tmpFontLen = font->TextWidthInPixels( iAbsoluteBuffer->Mid(
|
|
1185 |
tmp70VisualEnd - stride, stride ) );
|
|
1186 |
if ( tmpFontLen > panerect.Width() * (KDenominator -
|
|
1187 |
KLROffset * 2 - KCursorResetOffset ) / KDenominator )
|
|
1188 |
{
|
|
1189 |
visualBeg = tmp70VisualEnd - stride + 1;
|
|
1190 |
break;
|
|
1191 |
}
|
|
1192 |
}
|
|
1193 |
if ( iMiniQwertyZhuyin &&
|
|
1194 |
iAbsoluteBuffer->Length( ) > 0 &&
|
|
1195 |
visualBeg >= iPhraseArray->Count() )
|
|
1196 |
{
|
|
1197 |
while ( iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KLeftBracket ) != 0 &&
|
|
1198 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark1 ) != 0 &&
|
|
1199 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark2 ) != 0 &&
|
|
1200 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark3 ) != 0 &&
|
|
1201 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark4 ) != 0 &&
|
|
1202 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark5 ) != 0 )
|
|
1203 |
{
|
|
1204 |
visualBeg++;
|
|
1205 |
// visualEnd++;
|
|
1206 |
}
|
|
1207 |
}
|
|
1208 |
*iVisualBuffer = iAbsoluteBuffer->Right( visualEnd - visualBeg );
|
|
1209 |
this->iOffset = visualBeg;
|
|
1210 |
}
|
|
1211 |
else
|
|
1212 |
{
|
|
1213 |
TInt absoluteOffset = font->TextWidthInPixels(
|
|
1214 |
iAbsoluteBuffer->Left( iAbsoluteCursorPos ) );
|
|
1215 |
if ( absoluteOffset < panerect.Width() *
|
|
1216 |
KCursorResetStartOffset / KDenominator)
|
|
1217 |
{
|
|
1218 |
TInt stride = 0;
|
|
1219 |
for (stride = 1;; stride ++ )
|
|
1220 |
{
|
|
1221 |
TInt tmpFontLen = font->TextWidthInPixels(
|
|
1222 |
iAbsoluteBuffer->Left( stride ) );
|
|
1223 |
if ( tmpFontLen > panerect.Width() - panerect.Width()
|
|
1224 |
*KLROffset /KDenominator * 2 )
|
|
1225 |
{
|
|
1226 |
*iVisualBuffer = iAbsoluteBuffer->Left( stride - 1 );
|
|
1227 |
this->iOffset = 0;
|
|
1228 |
break;
|
|
1229 |
}
|
|
1230 |
}
|
|
1231 |
}
|
|
1232 |
else
|
|
1233 |
{
|
|
1234 |
TInt lenPixelToVisualEnd = panerect.Width() * KCursorResetOffset
|
|
1235 |
/ KDenominator;
|
|
1236 |
TInt stride = 0;
|
|
1237 |
TInt visualBeg = 0;
|
|
1238 |
TInt visualEnd = 0;
|
|
1239 |
for (stride = 1;; stride ++ )
|
|
1240 |
{
|
|
1241 |
if ( iAbsoluteBuffer->Length() < iAbsoluteCursorPos + stride )
|
|
1242 |
{
|
|
1243 |
visualEnd = iAbsoluteBuffer->Length();
|
|
1244 |
break;
|
|
1245 |
}
|
|
1246 |
TInt tmpFontLen = font->TextWidthInPixels(
|
|
1247 |
iAbsoluteBuffer->Mid( iAbsoluteCursorPos, stride ) );
|
|
1248 |
if ( tmpFontLen > lenPixelToVisualEnd )
|
|
1249 |
{
|
|
1250 |
visualEnd = iAbsoluteCursorPos + stride - 1;
|
|
1251 |
break;
|
|
1252 |
}
|
|
1253 |
}
|
|
1254 |
for (stride = 1;; stride ++ )
|
|
1255 |
{
|
|
1256 |
TInt tmpFontLen = font->TextWidthInPixels(
|
|
1257 |
iAbsoluteBuffer->Mid( visualEnd - stride, stride ) );
|
|
1258 |
if ( tmpFontLen > panerect.Width() - panerect.Width()
|
|
1259 |
*KLROffset /KDenominator * 2 )
|
|
1260 |
{
|
|
1261 |
visualBeg = visualEnd - stride + 1;
|
|
1262 |
break;
|
|
1263 |
}
|
|
1264 |
}
|
|
1265 |
if ( iMiniQwertyZhuyin &&
|
|
1266 |
iAbsoluteBuffer->Length( ) > 0 &&
|
|
1267 |
visualBeg >= iPhraseArray->Count() )
|
|
1268 |
{
|
|
1269 |
while ( iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KLeftBracket ) != 0 &&
|
|
1270 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark1 ) != 0 &&
|
|
1271 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark2 ) != 0 &&
|
|
1272 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark3 ) != 0 &&
|
|
1273 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark4 ) != 0 &&
|
|
1274 |
iAbsoluteBuffer->Mid( visualBeg, 1 ).Compare( KToneMark5 ) != 0 )
|
|
1275 |
{
|
|
1276 |
visualBeg++;
|
|
1277 |
// visualEnd++;
|
|
1278 |
}
|
|
1279 |
}
|
|
1280 |
*iVisualBuffer = iAbsoluteBuffer->Mid( visualBeg, visualEnd
|
|
1281 |
- visualBeg );
|
|
1282 |
this->iOffset = visualBeg;
|
|
1283 |
}
|
|
1284 |
}
|
|
1285 |
}
|
|
1286 |
|
|
1287 |
// ---------------------------------------------------------
|
|
1288 |
// Calculate the underline indexes and highlight indexes according to the
|
|
1289 |
// absolute value.
|
|
1290 |
// ---------------------------------------------------------
|
|
1291 |
//
|
|
1292 |
void CAknFepUICtrlPinyinEEP::CalculateVisualIndex()
|
|
1293 |
{
|
|
1294 |
for (TInt i = 0; i < iArray.Count(); i++ )
|
|
1295 |
{
|
|
1296 |
TInt left = iArray[i]->iBegin - iOffset;
|
|
1297 |
TInt right = iArray[i]->iEnd - iOffset;
|
|
1298 |
if (
|
|
1299 |
left < 0 &&
|
|
1300 |
right < 0
|
|
1301 |
||
|
|
1302 |
left> iVisualBuffer->Length() - 1 &&
|
|
1303 |
right> iVisualBuffer->Length() - 1
|
|
1304 |
)
|
|
1305 |
{
|
|
1306 |
left = -1;
|
|
1307 |
right = -1;
|
|
1308 |
}
|
|
1309 |
else
|
|
1310 |
{
|
|
1311 |
if ( left < 0 )
|
|
1312 |
{
|
|
1313 |
left = 0;
|
|
1314 |
}
|
|
1315 |
if ( right> iVisualBuffer->Length() - 1 )
|
|
1316 |
{
|
|
1317 |
right = iVisualBuffer->Length() - 1;
|
|
1318 |
}
|
|
1319 |
}
|
|
1320 |
if ( iArray[i]->iStyle == CAknFepUICtrlEEPControl::EHighlight )
|
|
1321 |
{
|
|
1322 |
iEditableEntryPane->SetHighlight( left, right );
|
|
1323 |
}
|
|
1324 |
else if ( iArray[i]->iStyle == CAknFepUICtrlEEPControl::EUnderline )
|
|
1325 |
{
|
|
1326 |
iEditableEntryPane->SetUnderline( left, right );
|
|
1327 |
}
|
|
1328 |
}
|
|
1329 |
}
|
|
1330 |
|
|
1331 |
// ---------------------------------------------------------
|
|
1332 |
// layout the background frames.
|
|
1333 |
// ---------------------------------------------------------
|
|
1334 |
//
|
|
1335 |
void CAknFepUICtrlPinyinEEP::CalculateFrameRects( TRect& aOuterRect,
|
|
1336 |
TRect& aInnerRect ) const
|
|
1337 |
{
|
|
1338 |
TRect windowRect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEEP ));
|
|
1339 |
TAknLayoutRect eepFirstHorizLineLayoutRect = CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( EEEPFirstHorizLine ));
|
|
1340 |
TRect eepFirstHorizLineRect = eepFirstHorizLineLayoutRect.Rect();
|
|
1341 |
TInt rectHeight = eepFirstHorizLineRect.iBr.iY - windowRect.iTl.iY + 2;
|
|
1342 |
TInt rectWidth = windowRect.Width( );
|
|
1343 |
windowRect.iTl.iX = 0;
|
|
1344 |
windowRect.iTl.iY = 0;
|
|
1345 |
windowRect.SetHeight( rectHeight );
|
|
1346 |
windowRect.SetWidth( rectWidth );
|
|
1347 |
|
|
1348 |
TAknLayoutRect topLeft;
|
|
1349 |
topLeft.LayoutRect( windowRect,
|
|
1350 |
SkinLayout::Submenu_skin_placing_Line_2() );
|
|
1351 |
|
|
1352 |
TAknLayoutRect bottomRight;
|
|
1353 |
bottomRight.LayoutRect( windowRect,
|
|
1354 |
SkinLayout::Submenu_skin_placing_Line_5() );
|
|
1355 |
|
|
1356 |
aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
|
|
1357 |
aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
|
|
1358 |
}
|
|
1359 |
|
|
1360 |
// ---------------------------------------------------------
|
|
1361 |
// Return kestroke array.
|
|
1362 |
// ---------------------------------------------------------
|
|
1363 |
//
|
|
1364 |
CDesCArrayFlat* CAknFepUICtrlPinyinEEP::KeystrokeArray()
|
|
1365 |
{
|
|
1366 |
return iKeystrokeArray;
|
|
1367 |
}
|
|
1368 |
|
|
1369 |
// ---------------------------------------------------------
|
|
1370 |
// Return kescode array.
|
|
1371 |
// ---------------------------------------------------------
|
|
1372 |
//
|
|
1373 |
RArray<TInt>* CAknFepUICtrlPinyinEEP::KeycodeArray()
|
|
1374 |
{
|
|
1375 |
return &iKeycodeArray;
|
|
1376 |
}
|
|
1377 |
|
|
1378 |
// ---------------------------------------------------------
|
|
1379 |
// Return kescode array.
|
|
1380 |
// ---------------------------------------------------------
|
|
1381 |
//
|
|
1382 |
RArray<TInt>* CAknFepUICtrlPinyinEEP::PhraseKeycodeArray()
|
|
1383 |
{
|
|
1384 |
return &iPhraseKeycodeArray;
|
|
1385 |
}
|
|
1386 |
|
|
1387 |
// ---------------------------------------------------------
|
|
1388 |
// Return show kestroke array.
|
|
1389 |
// ---------------------------------------------------------
|
|
1390 |
//
|
|
1391 |
CDesCArrayFlat* CAknFepUICtrlPinyinEEP::ShowKeystrokeArray()
|
|
1392 |
{
|
|
1393 |
return iShowKeystrokeArray;
|
|
1394 |
}
|
|
1395 |
|
|
1396 |
// ---------------------------------------------------------
|
|
1397 |
// Return choose chinese charater array.
|
|
1398 |
// ---------------------------------------------------------
|
|
1399 |
//
|
|
1400 |
CDesCArrayFlat* CAknFepUICtrlPinyinEEP::PhraseArray()
|
|
1401 |
{
|
|
1402 |
return iPhraseArray;
|
|
1403 |
}
|
|
1404 |
|
|
1405 |
// ---------------------------------------------------------
|
|
1406 |
// Return choose chinese charater show keystroke array.
|
|
1407 |
// ---------------------------------------------------------
|
|
1408 |
//
|
|
1409 |
CDesCArrayFlat* CAknFepUICtrlPinyinEEP::PhraseShowKeyStrokeArray()
|
|
1410 |
{
|
|
1411 |
return iPhraseShowKeyStrokeArray;
|
|
1412 |
}
|
|
1413 |
// ---------------------------------------------------------
|
|
1414 |
// Return temp array.
|
|
1415 |
// ---------------------------------------------------------
|
|
1416 |
//
|
|
1417 |
CDesCArrayFlat* CAknFepUICtrlPinyinEEP::TempArray()
|
|
1418 |
{
|
|
1419 |
return iTempArray;
|
|
1420 |
}
|
|
1421 |
|
|
1422 |
// ---------------------------------------------------------
|
|
1423 |
// Reset private member viariable array.
|
|
1424 |
// ---------------------------------------------------------
|
|
1425 |
//
|
|
1426 |
void CAknFepUICtrlPinyinEEP::ResetAllArray()
|
|
1427 |
{
|
|
1428 |
iKeystrokeArray->Reset();
|
|
1429 |
iKeystrokeArray->Compress();
|
|
1430 |
iKeycodeArray.Reset();
|
|
1431 |
iShowKeystrokeArray->Reset();
|
|
1432 |
iShowKeystrokeArray->Compress();
|
|
1433 |
iPhraseArray->Reset();
|
|
1434 |
iPhraseArray->Compress();
|
|
1435 |
iPhraseKeycodeArray.Reset();
|
|
1436 |
iPhraseShowKeyStrokeArray->Reset();
|
|
1437 |
iPhraseShowKeyStrokeArray->Compress();
|
|
1438 |
iTempArray->Reset();
|
|
1439 |
iTempArray->Compress();
|
|
1440 |
iAllValidFlag = 1;
|
|
1441 |
iInvalidKeystrokeIndex = 0;
|
|
1442 |
iCandidateRefreshFlag = 0;
|
|
1443 |
iDelimiterCount = 0;
|
|
1444 |
iPhraseZhuYinSpellingArray->Reset();
|
|
1445 |
iPhraseZhuYinSpellingArray->Compress();
|
|
1446 |
}
|
|
1447 |
|
|
1448 |
// ---------------------------------------------------------
|
|
1449 |
// change state flag.
|
|
1450 |
// ---------------------------------------------------------
|
|
1451 |
//
|
|
1452 |
void CAknFepUICtrlPinyinEEP::SetChangeState( TBool aState )
|
|
1453 |
{
|
|
1454 |
iChangeFlag = aState;
|
|
1455 |
}
|
|
1456 |
|
|
1457 |
// ---------------------------------------------------------
|
|
1458 |
// check change state flag.
|
|
1459 |
// ---------------------------------------------------------
|
|
1460 |
//
|
|
1461 |
TBool CAknFepUICtrlPinyinEEP::IsChangeState()
|
|
1462 |
{
|
|
1463 |
return iChangeFlag;
|
|
1464 |
}
|
|
1465 |
|
|
1466 |
// ---------------------------------------------------------
|
|
1467 |
// Set auto change state flag.
|
|
1468 |
// ---------------------------------------------------------
|
|
1469 |
//
|
|
1470 |
void CAknFepUICtrlPinyinEEP::SetAutoChangeStateFlag( TBool aState )
|
|
1471 |
{
|
|
1472 |
iAutoChangeFlag = aState;
|
|
1473 |
}
|
|
1474 |
|
|
1475 |
// ---------------------------------------------------------
|
|
1476 |
// Set auto change state flag.
|
|
1477 |
// ---------------------------------------------------------
|
|
1478 |
//
|
|
1479 |
TBool CAknFepUICtrlPinyinEEP::GetAutoChangeStateFlag()
|
|
1480 |
|
|
1481 |
{
|
|
1482 |
return iAutoChangeFlag;
|
|
1483 |
}
|
|
1484 |
|
|
1485 |
// ---------------------------------------------------------
|
|
1486 |
// Set all the keystroke valid flag.
|
|
1487 |
// ---------------------------------------------------------
|
|
1488 |
//
|
|
1489 |
void CAknFepUICtrlPinyinEEP::SetAllValidFlag( TBool aState )
|
|
1490 |
{
|
|
1491 |
iAllValidFlag = aState;
|
|
1492 |
}
|
|
1493 |
|
|
1494 |
// ---------------------------------------------------------
|
|
1495 |
// Set all the keystroke valid flag.
|
|
1496 |
// ---------------------------------------------------------
|
|
1497 |
//
|
|
1498 |
TBool CAknFepUICtrlPinyinEEP::GetAllValidFlag()
|
|
1499 |
{
|
|
1500 |
return iAllValidFlag;
|
|
1501 |
}
|
|
1502 |
|
|
1503 |
// ---------------------------------------------------------
|
|
1504 |
// Set is Phrase creation.
|
|
1505 |
// ---------------------------------------------------------
|
|
1506 |
//
|
|
1507 |
void CAknFepUICtrlPinyinEEP::SetPhraseCreationFlag( TBool aState )
|
|
1508 |
{
|
|
1509 |
iPhraseCreation = aState;
|
|
1510 |
}
|
|
1511 |
|
|
1512 |
// ---------------------------------------------------------
|
|
1513 |
// Is Phrase creation.
|
|
1514 |
// ---------------------------------------------------------
|
|
1515 |
//
|
|
1516 |
TBool CAknFepUICtrlPinyinEEP::GetPhraseCreationFlag()
|
|
1517 |
{
|
|
1518 |
return iPhraseCreation;
|
|
1519 |
}
|
|
1520 |
|
|
1521 |
// ---------------------------------------------------------
|
|
1522 |
// Set the keystroke invalid index.
|
|
1523 |
// ---------------------------------------------------------
|
|
1524 |
//
|
|
1525 |
void CAknFepUICtrlPinyinEEP::SetInvalidIndex( TInt aInvalidIndex )
|
|
1526 |
{
|
|
1527 |
iInvalidKeystrokeIndex = aInvalidIndex;
|
|
1528 |
}
|
|
1529 |
|
|
1530 |
// ---------------------------------------------------------
|
|
1531 |
// Get all the invalid keystroke index.
|
|
1532 |
// ---------------------------------------------------------
|
|
1533 |
//
|
|
1534 |
TInt CAknFepUICtrlPinyinEEP::GetInvalidIndex()
|
|
1535 |
{
|
|
1536 |
return iInvalidKeystrokeIndex;
|
|
1537 |
}
|
|
1538 |
|
|
1539 |
// ---------------------------------------------------------
|
|
1540 |
// Set Phrase Candidate state need refresh UI flag.
|
|
1541 |
// ---------------------------------------------------------
|
|
1542 |
//
|
|
1543 |
void CAknFepUICtrlPinyinEEP::SetCandidateRefreshFlag( TBool aState )
|
|
1544 |
{
|
|
1545 |
iCandidateRefreshFlag = aState;
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
// ---------------------------------------------------------
|
|
1549 |
// Get Phrase Candidate state need refresh UI flag.
|
|
1550 |
// ---------------------------------------------------------
|
|
1551 |
//
|
|
1552 |
TInt CAknFepUICtrlPinyinEEP::GetCandidateRefreshFlag()
|
|
1553 |
{
|
|
1554 |
return iCandidateRefreshFlag;
|
|
1555 |
}
|
|
1556 |
|
|
1557 |
// ---------------------------------------------------------
|
|
1558 |
// Set the delimiter count of keystroke.
|
|
1559 |
// ---------------------------------------------------------
|
|
1560 |
//
|
|
1561 |
void CAknFepUICtrlPinyinEEP::SetDelimiterCount( TInt aCount )
|
|
1562 |
{
|
|
1563 |
iDelimiterCount = aCount;
|
|
1564 |
}
|
|
1565 |
|
|
1566 |
// ---------------------------------------------------------
|
|
1567 |
// Get the delimiter count of keystroke.
|
|
1568 |
// ---------------------------------------------------------
|
|
1569 |
//
|
|
1570 |
TInt CAknFepUICtrlPinyinEEP::GetDelimiterCount()
|
|
1571 |
{
|
|
1572 |
return iDelimiterCount;
|
|
1573 |
}
|
|
1574 |
|
|
1575 |
// ---------------------------------------------------------
|
|
1576 |
// Get current cba resource id.
|
|
1577 |
// ---------------------------------------------------------
|
|
1578 |
//
|
|
1579 |
TInt CAknFepUICtrlPinyinEEP::GetCurrentCBAResID()
|
|
1580 |
{
|
|
1581 |
return iCurrentCBAResId;
|
|
1582 |
}
|
|
1583 |
|
|
1584 |
// ---------------------------------------------------------
|
|
1585 |
// Set current cba resource id.
|
|
1586 |
// ---------------------------------------------------------
|
|
1587 |
//
|
|
1588 |
void CAknFepUICtrlPinyinEEP::SetCurrentCBAResID( TInt aResourceId )
|
|
1589 |
{
|
|
1590 |
iCurrentCBAResId = aResourceId;
|
|
1591 |
}
|
|
1592 |
|
|
1593 |
void CAknFepUICtrlPinyinEEP::SetEffictiveLength( TInt aLength )
|
|
1594 |
{
|
|
1595 |
iEffictiveLength = aLength;
|
|
1596 |
}
|
|
1597 |
|
|
1598 |
TInt CAknFepUICtrlPinyinEEP::GetEffictiveLength()
|
|
1599 |
{
|
|
1600 |
return iEffictiveLength;
|
|
1601 |
}
|
|
1602 |
|
|
1603 |
void CAknFepUICtrlPinyinEEP::AddEffictiveLength()
|
|
1604 |
{
|
|
1605 |
iEffictiveLength++;
|
|
1606 |
}
|
|
1607 |
|
|
1608 |
void CAknFepUICtrlPinyinEEP::DecEffictiveLength()
|
|
1609 |
{
|
|
1610 |
iEffictiveLength--;
|
|
1611 |
}
|
|
1612 |
|
|
1613 |
void CAknFepUICtrlPinyinEEP::SetNeedClearDeliberateSelection( TBool aNeedClearDeliberateSelection )
|
|
1614 |
{
|
|
1615 |
iNeedClearDeliberateSelection = aNeedClearDeliberateSelection;
|
|
1616 |
}
|
|
1617 |
|
|
1618 |
TBool CAknFepUICtrlPinyinEEP::NeedClearDeliberateSelection()
|
|
1619 |
{
|
|
1620 |
return iNeedClearDeliberateSelection;
|
|
1621 |
}
|
|
1622 |
CDesCArrayFlat* CAknFepUICtrlPinyinEEP::PhraseZhuYinSpellingArray()
|
|
1623 |
{
|
|
1624 |
return iPhraseZhuYinSpellingArray;
|
|
1625 |
}
|
|
1626 |
// End of file
|
|
1627 |
|