|
1 /* |
|
2 * Copyright (c) 2005-2006 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: header file of base class for Edwin-like editing area |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_PENINPUTLAYOUTMULTILINEICF_H |
|
19 #define C_PENINPUTLAYOUTMULTILINEICF_H |
|
20 |
|
21 #include "peninputlayoutctrlgroup.h" |
|
22 #include <coecntrl.h> |
|
23 #include <AknsItemID.h> |
|
24 #include <gdi.h> |
|
25 |
|
26 class CRichText; |
|
27 class CParaFormatLayer; |
|
28 class CCharFormatLayer; |
|
29 class CTextLayout; |
|
30 class CTextView; |
|
31 class CCoeEnv; |
|
32 class TCharFormat; |
|
33 class TCharFormatMask; |
|
34 class CInsertionPoint; |
|
35 class CFepLayoutMIcfCustomDraw; |
|
36 class CFepLayoutMIcfCustomWrap; |
|
37 class CBubbleCtrl; |
|
38 class CFepUiCursor; |
|
39 |
|
40 class CAknEdwinFormExtendedInterfaceProvider; |
|
41 class CAknInlineTextSource; |
|
42 |
|
43 class CFepLayoutMultiLineIcfEditor; |
|
44 class CTooltipBubbleCtrl; |
|
45 class CPeninputSmileyManager; |
|
46 |
|
47 |
|
48 class CFepLayoutMultiLineIcf : public CControlGroup, public MEventObserver |
|
49 { |
|
50 public: |
|
51 enum TArrowBtnEvent |
|
52 { |
|
53 EArrowLeft, |
|
54 EArrowRight, |
|
55 EArrowUp, |
|
56 EArrowDown |
|
57 }; |
|
58 |
|
59 enum TIcfState |
|
60 { |
|
61 EIcfNormal, |
|
62 EIcfInline, |
|
63 EIcfAutoComplete |
|
64 }; |
|
65 public: |
|
66 |
|
67 IMPORT_C static CFepLayoutMultiLineIcf* NewL(TRect aRect, |
|
68 CFepUiLayout* aUiLayout, |
|
69 TInt aControlId, |
|
70 TInt aFontHeight, |
|
71 TInt aMaxFontHeight, |
|
72 const CFont* aFont); |
|
73 |
|
74 // EAttColor of charformat |
|
75 IMPORT_C virtual void SetTextColorL(const TRgb aColor); |
|
76 |
|
77 IMPORT_C virtual void SetAutoCompleteTextColor(const TRgb aColor); |
|
78 |
|
79 // EAttFontHighlightColor of charformat |
|
80 IMPORT_C virtual void SetTextSelColorL(const TRgb aColor); |
|
81 |
|
82 // Tests if the field has focus. |
|
83 // return ETrue if it has focus, otherwise EFalse |
|
84 IMPORT_C virtual TBool IsFocused(); |
|
85 |
|
86 // Sets the text to be displayed |
|
87 // cursorSel Current cursor selection |
|
88 // aText The text to be set in fep ui |
|
89 IMPORT_C virtual void SetTextL(const TFepInputContextFieldData& aData); |
|
90 |
|
91 // Sets dim |
|
92 // aDimFlag Dim flag, ETrue for dim |
|
93 IMPORT_C virtual void SetDimmed(TBool aDimFlag); |
|
94 |
|
95 IMPORT_C virtual void SetFontL(TInt aFontHeight, TInt aMaxFontHeight, const CFont* aFont); |
|
96 |
|
97 // Set editor focus |
|
98 IMPORT_C virtual void SetFocus(TBool aFlag = ETrue); |
|
99 |
|
100 // Set cursor visibility |
|
101 // aFlag ETrue for visisble, EFalse for invisible |
|
102 IMPORT_C virtual void SetCursorVisible( TBool aCursorVisibleFlag = ETrue ); |
|
103 |
|
104 // Get cursor visibility |
|
105 // return ETrue for visisble, EFalse for invisible |
|
106 IMPORT_C virtual TBool CursorVisible() const; |
|
107 |
|
108 IMPORT_C void SetRect(const TRect& aRect); |
|
109 |
|
110 IMPORT_C virtual void SizeChangedL(const TRect& aRect, |
|
111 TInt aFontHeight, |
|
112 TInt aMaxFontHeight, |
|
113 const CFont* aFont); |
|
114 |
|
115 IMPORT_C virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint); |
|
116 |
|
117 IMPORT_C virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint); |
|
118 |
|
119 IMPORT_C virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint); |
|
120 |
|
121 IMPORT_C virtual void CancelPointerDownL(); |
|
122 |
|
123 IMPORT_C virtual void HandlePointerLeave(const TPoint& aPoint); |
|
124 |
|
125 IMPORT_C virtual void HandleArrowBtnEventL(TArrowBtnEvent aEventType); |
|
126 |
|
127 IMPORT_C virtual void UpdateValidRegion(CFepUiBaseCtrl* aCtrl,TBool aRemoveFlag); |
|
128 |
|
129 IMPORT_C TBool Contains(const TPoint& aPt); |
|
130 |
|
131 IMPORT_C virtual void SetOverLapState(TBool aSupportOverlap, TRect aRect = TRect(0, 0, 0, 0)); |
|
132 |
|
133 IMPORT_C virtual void AddOverLapState(TRect aRect); |
|
134 |
|
135 IMPORT_C virtual TInt GetEditorFieldMaxLen(); |
|
136 |
|
137 IMPORT_C virtual void SetTextAlignmentL(TInt aAlignment, TInt aLanguage); |
|
138 |
|
139 // Move conntrol, aOffset The offset to be moved |
|
140 IMPORT_C void Move(const TPoint& aOffset); |
|
141 |
|
142 IMPORT_C virtual void SetPromptTextL(const TDesC& aPromptText, TBool aCleanContent = ETrue ); |
|
143 |
|
144 IMPORT_C virtual const HBufC* PromptText(); |
|
145 |
|
146 |
|
147 IMPORT_C virtual void InlineTextPos(TPoint& aPosBelow, TPoint& aPosRight); |
|
148 |
|
149 IMPORT_C virtual void EnableTextSelection(TBool aEnable); |
|
150 |
|
151 IMPORT_C virtual void SetTextIsSecret(TBool aIsSecret); |
|
152 |
|
153 IMPORT_C virtual TBool TextIsSecret() const; |
|
154 |
|
155 // ICF using frame as bg image |
|
156 IMPORT_C virtual void SetBgImgSkinId(TAknsItemID aSkinId); |
|
157 |
|
158 TAknsItemID BgImgSkinId() const; |
|
159 |
|
160 // set whether there is line separator between prompt text and normal text |
|
161 IMPORT_C virtual void SetLineSeparatorAfterPrompt(TBool aLineSeparator); |
|
162 |
|
163 IMPORT_C virtual void SetLanguageId( TInt aLanguageId ); |
|
164 |
|
165 IMPORT_C virtual TBool NomatchState(); |
|
166 |
|
167 IMPORT_C virtual TBool IsEmpty(); |
|
168 |
|
169 IMPORT_C virtual TBool InlineStateOn(); |
|
170 |
|
171 IMPORT_C virtual void SetTextMargin |
|
172 (TInt aLeftMargin, TInt aRightMargin, TInt aTopMargin, TInt aBottomMargin); |
|
173 |
|
174 IMPORT_C virtual void SetLineSpace( TInt aLineSpace ); |
|
175 |
|
176 IMPORT_C virtual void ExtractText(TDes &aBuf, TInt aPos, TInt aLength); |
|
177 |
|
178 IMPORT_C virtual CBubbleCtrl* MsgBubbleCtrl(); |
|
179 IMPORT_C virtual CBubbleCtrl* InfoBubbleCtrl(); |
|
180 IMPORT_C virtual void ShowBubble(const TDesC& aText, const TRect& aRect); |
|
181 IMPORT_C virtual void ShowByteWarningBubble(const TDesC& aInfo); |
|
182 IMPORT_C virtual void HideBubble(); |
|
183 IMPORT_C virtual void HideInfoBubble(); |
|
184 IMPORT_C virtual void SetMsgBubbleCtrlSize(const TSize& aSize); |
|
185 IMPORT_C virtual void SetInfoBubbleCtrlSize(const TSize& aSize); |
|
186 |
|
187 IMPORT_C virtual void SetBackgroundBitmapL(CFbsBitmap* aBmp); |
|
188 |
|
189 void DrawIcfBackground( CFbsBitGc& aGc, const TRect& aDrawnRect, |
|
190 TBool aBmpStretchFlag = ETrue ); |
|
191 IMPORT_C virtual void UpdateSecretTextL(); |
|
192 |
|
193 IMPORT_C virtual void ReDrawRect(const TRect& aRect); |
|
194 |
|
195 IMPORT_C void SetNumberGrouping(TBool aIsNumberGrouping); |
|
196 |
|
197 /** |
|
198 * Return the pointer to Toolitp control |
|
199 * |
|
200 * @return the pointer to Toolitp control |
|
201 */ |
|
202 IMPORT_C CTooltipBubbleCtrl* TooltipBubbleCtrl(); |
|
203 |
|
204 /** |
|
205 * Show tooltip of ICF |
|
206 * |
|
207 * @param aText The text to be displayed in ICF |
|
208 * @return None |
|
209 */ |
|
210 IMPORT_C void ShowTooltipL( const TDesC& aText ); |
|
211 |
|
212 |
|
213 /** |
|
214 * Hide tooltip of ICF |
|
215 * |
|
216 * @param aText The text to be displayed in ICF |
|
217 * @param aPos The position of tooltip |
|
218 * @return None |
|
219 */ |
|
220 IMPORT_C void HideTooltip(); |
|
221 |
|
222 protected: // Methods |
|
223 |
|
224 /** |
|
225 * Handle control event |
|
226 * |
|
227 * @since S60 v4.0 |
|
228 * @param aEventType The event type |
|
229 * @param aCtrl The control who sends the event |
|
230 * @param aEventData The event data |
|
231 */ |
|
232 IMPORT_C virtual void HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl, |
|
233 const TDesC& aEventData); |
|
234 |
|
235 IMPORT_C virtual void PrepareForFocusLoss(); |
|
236 |
|
237 IMPORT_C virtual TBool PrepareForFocusGain(); |
|
238 |
|
239 IMPORT_C CFepLayoutMultiLineIcf(CFepUiLayout* aUiLayout, |
|
240 TInt aControlId); |
|
241 |
|
242 IMPORT_C void BaseConstructL(TRect aRect, |
|
243 TInt aFontHeight, |
|
244 TInt aMaxFontHeight, |
|
245 const CFont* aFont); |
|
246 |
|
247 private: // Methods |
|
248 /** |
|
249 * Find what is the control of aPoint. |
|
250 * |
|
251 * @param aPoint The position to be checked |
|
252 */ |
|
253 CFepUiBaseCtrl* ControlForPoints( const TPoint& aPoint ); |
|
254 |
|
255 private: // Data |
|
256 CFepLayoutMultiLineIcfEditor* iIcfEditor; |
|
257 CBubbleCtrl* iMsgBubble; |
|
258 CTooltipBubbleCtrl* iTooltip; |
|
259 CBubbleCtrl* iInfoBubble; |
|
260 }; |
|
261 |
|
262 |
|
263 NONSHARABLE_CLASS(CFepLayoutMultiLineIcfEditor) : public CFepUiBaseCtrl |
|
264 { |
|
265 public: |
|
266 |
|
267 IMPORT_C static CFepLayoutMultiLineIcfEditor* NewL(TRect aRect, |
|
268 CFepUiLayout* aUiLayout, |
|
269 TInt aControlId, |
|
270 TInt aFontHeight, |
|
271 TInt aMaxFontHeight, |
|
272 const CFont* aFont); |
|
273 |
|
274 virtual ~CFepLayoutMultiLineIcfEditor(); |
|
275 |
|
276 // EAttColor of charformat |
|
277 void SetTextColorL(const TRgb aColor); |
|
278 |
|
279 void SetAutoCompleteTextColor(const TRgb aColor); |
|
280 |
|
281 // EAttFontHighlightColor of charformat |
|
282 void SetTextSelColorL(const TRgb aColor); |
|
283 |
|
284 // Tests if the field has focus. |
|
285 // return ETrue if it has focus, otherwise EFalse |
|
286 TBool IsFocused(); |
|
287 |
|
288 // Sets the text to be displayed |
|
289 // cursorSel Current cursor selection |
|
290 // aText The text to be set in fep ui |
|
291 void SetTextL(const TFepInputContextFieldData& aData); |
|
292 |
|
293 // Sets dim |
|
294 // aDimFlag Dim flag, ETrue for dim |
|
295 void SetDimmed(TBool aDimFlag); |
|
296 |
|
297 void SetFontL(TInt aFontHeight, TInt aMaxFontHeight, const CFont* aFont); |
|
298 |
|
299 // Set editor focus |
|
300 void SetFocus(TBool aFlag = ETrue); |
|
301 |
|
302 // Set cursor visibility |
|
303 // aFlag ETrue for visisble, EFalse for invisible |
|
304 void SetCursorVisible(TBool aCursorVisibleFlag = ETrue); |
|
305 |
|
306 // Get cursor visibility |
|
307 // return ETrue for visisble, EFalse for invisible |
|
308 TBool CursorVisible() const; |
|
309 |
|
310 void Draw(); |
|
311 |
|
312 void ReDrawRect(const TRect& aRect); |
|
313 |
|
314 void SetRectL(const TRect& aRect); |
|
315 |
|
316 void SizeChangedL(const TRect& aRect, |
|
317 TInt aFontHeight, |
|
318 TInt aMaxFontHeight, |
|
319 const CFont* aFont); |
|
320 |
|
321 virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint); |
|
322 |
|
323 virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint); |
|
324 |
|
325 virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint); |
|
326 |
|
327 virtual void CancelPointerDownL(); |
|
328 |
|
329 virtual void HandlePointerLeave(const TPoint& aPoint); |
|
330 |
|
331 void OnActivate(); |
|
332 |
|
333 void OnDeActivate(); |
|
334 |
|
335 void HandleArrowBtnEventL(CFepLayoutMultiLineIcf::TArrowBtnEvent aEventType); |
|
336 |
|
337 void UpdateValidRegion(CFepUiBaseCtrl* aCtrl,TBool aRemoveFlag); |
|
338 |
|
339 TBool Contains(const TPoint& aPt); |
|
340 |
|
341 void SetOverLapState(TBool aSupportOverlap, TRect aRect = TRect(0, 0, 0, 0)); |
|
342 |
|
343 void AddOverLapState(TRect aRect); |
|
344 |
|
345 virtual TInt GetEditorFieldMaxLen(); |
|
346 |
|
347 void SetTextAlignmentL(TInt aAlignment, TInt aLanguage); |
|
348 |
|
349 // Move conntrol, aOffset The offset to be moved |
|
350 void Move(const TPoint& aOffset); |
|
351 |
|
352 void SetPromptTextL(const TDesC& aPromptText, TBool aCleanContent ); |
|
353 |
|
354 const HBufC* PromptText(); |
|
355 |
|
356 |
|
357 void InlineTextPos(TPoint& aPosBelow, TPoint& aPosRight); |
|
358 |
|
359 inline void EnableTextSelection(TBool aEnable); |
|
360 |
|
361 inline void SetTextIsSecret(TBool aIsSecret); |
|
362 |
|
363 inline TBool TextIsSecret() const; |
|
364 |
|
365 // ICF using frame as bg image |
|
366 inline void SetBgImgSkinId(TAknsItemID aSkinId); |
|
367 |
|
368 TAknsItemID BgImgSkinId() const; |
|
369 |
|
370 // set whether there is line separator between prompt text and normal text |
|
371 inline void SetLineSeparatorAfterPrompt(TBool aLineSeparator); |
|
372 |
|
373 inline void SetLanguageId( TInt aLanguageId ); |
|
374 |
|
375 inline TBool NomatchState(); |
|
376 |
|
377 IMPORT_C TBool IsEmpty(); |
|
378 |
|
379 inline TBool InlineStateOn(); |
|
380 |
|
381 inline void SetTextMargin |
|
382 (TInt aLeftMargin, TInt aRightMargin, TInt aTopMargin, TInt aBottomMargin); |
|
383 |
|
384 inline void SetLineSpace( TInt aLineSpace ); |
|
385 |
|
386 IMPORT_C void ExtractText(TDes &aBuf, TInt aPos, TInt aLength); |
|
387 |
|
388 IMPORT_C CBubbleCtrl* MsgBubbleCtrl(); |
|
389 IMPORT_C CBubbleCtrl* InfoBubbleCtrl(); |
|
390 IMPORT_C void ShowBubble(const TDesC& aText, const TRect& aRect); |
|
391 IMPORT_C void ShowByteWarningBubble(const TDesC& aInfo); |
|
392 IMPORT_C void HideBubble(); |
|
393 IMPORT_C void HideInfoBubble(); |
|
394 IMPORT_C void SetMsgBubbleCtrlSize(const TSize& aSize); |
|
395 IMPORT_C void SetInfoBubbleCtrlSize(const TSize& aSize); |
|
396 |
|
397 // For addition of ITI features on FSQ |
|
398 void ShowTooltipL(const TDesC& aText); |
|
399 void HideTooltip(); |
|
400 /** |
|
401 * Returen the auto-completion state |
|
402 * |
|
403 * @return ETrue: AutoCompletion state is On |
|
404 * EFalse: AutoCompletion state is Off |
|
405 */ |
|
406 inline TBool AutoCompletionStateOn() const; |
|
407 |
|
408 |
|
409 void DrawIcfBackground( CFbsBitGc& aGc, const TRect& aDrawnRect, |
|
410 TBool aBmpStretchFlag = ETrue ); |
|
411 inline void SetMsgBubble(CBubbleCtrl* aCtrl); |
|
412 inline void SetInfoBubble(CBubbleCtrl* aCtrl); |
|
413 inline void SetTooltip(CTooltipBubbleCtrl* aCtrl); |
|
414 |
|
415 IMPORT_C virtual void PrepareForFocusLoss(); |
|
416 |
|
417 IMPORT_C virtual TBool PrepareForFocusGain(); |
|
418 |
|
419 /** |
|
420 * Handle pen UI graphic device size change event |
|
421 * |
|
422 * @since S60 V5.0 |
|
423 */ |
|
424 virtual IMPORT_C void GraphicDeviceSizeChanged(); |
|
425 void UpdateSecretTextL(); |
|
426 |
|
427 void SetNumberGroupingL(TBool aIsNumberGrouping); |
|
428 |
|
429 /** |
|
430 * remove padding in custom draw text. |
|
431 * |
|
432 * @since S60 v5.0 |
|
433 * @param aText text to be drawn |
|
434 * @return None |
|
435 */ |
|
436 void TrimCustomDrawText( TDes& aText ); |
|
437 |
|
438 /** |
|
439 * test if smiley is enabled |
|
440 * |
|
441 * @since S60 v5.0 |
|
442 * @return ETrue if smiley is enabled |
|
443 */ |
|
444 TBool SmileyEnabled(); |
|
445 |
|
446 /** |
|
447 * Get smiley manager |
|
448 * |
|
449 * @since S60 v5.0 |
|
450 * @return smiley manager |
|
451 */ |
|
452 CPeninputSmileyManager* SmileyManager(); |
|
453 |
|
454 |
|
455 /** |
|
456 * Calculate draw region, excluding smiley icons |
|
457 * |
|
458 * @since S60 v5.0 |
|
459 * @param aRgn clip region |
|
460 * @param aGc graphic context |
|
461 * @param aFont font to draw text |
|
462 * @param aText text to be drawn |
|
463 * @param aBasePoint base point if text (left,bottom) |
|
464 * @param aTopLine top margin of text |
|
465 * @param aBottomLine bottom margin of text |
|
466 */ |
|
467 void CalcSmileyClipRegionL( RRegion& aRgn, CGraphicsContext& aGc, |
|
468 CFont& aFont, const TDesC& aText, |
|
469 TPoint& aBasePoint, |
|
470 TInt aTopLine, TInt aBottomLine ); |
|
471 |
|
472 /** |
|
473 * Draw smiley icons, called by custom draw interface |
|
474 * |
|
475 * @since S60 v5.0 |
|
476 * @param aGc graphic context |
|
477 * @param aFont font to draw text |
|
478 * @param aText text to be drawn |
|
479 * @param aBasePoint base point if text (left,bottom) |
|
480 * @param aTopLine top margin of text |
|
481 * @param aBottomLine bottom margin of text |
|
482 */ |
|
483 void CustomDrawSmileyL( CGraphicsContext& aGc, CFont& aFont, |
|
484 const TDesC& aText, TPoint& aBasePoint, |
|
485 TInt aTopLine, TInt aBottomLine ); |
|
486 |
|
487 private: // Methods |
|
488 |
|
489 CFepLayoutMultiLineIcfEditor(TRect aRect, |
|
490 CFepUiLayout* aUiLayout, |
|
491 TInt aControlId); |
|
492 |
|
493 void BaseConstructL(TInt aFontHeight, |
|
494 TInt aMaxFontHeight, |
|
495 const CFont* aFont); |
|
496 |
|
497 void InitTextLayoutL(); |
|
498 |
|
499 // set text margin to view rect |
|
500 //void SetTextMarginL(); |
|
501 |
|
502 void RecalcualteTextPositionL(); |
|
503 |
|
504 inline TBool TextSelectionOn(); |
|
505 |
|
506 void SetInlineStateL(TBool aInline, |
|
507 TInt aStartPos = 0, |
|
508 TInt aEndPos = 0, |
|
509 TBool aNoMatchState = EFalse, |
|
510 const TDesC& aNoMatchText = KNullDesC); |
|
511 |
|
512 void SetAutoCompleteStateL(TBool aAutoComplete, |
|
513 TInt aStartPos = 0, |
|
514 TInt aMidPos = 0, |
|
515 TInt aEndPos = 0); |
|
516 |
|
517 void SetSpecialStateL(TBool aStateOn, |
|
518 TInt aStartPos, |
|
519 TInt aEndPos, |
|
520 TInt& aPreStartPos, |
|
521 TInt& aPreEndPos, |
|
522 TTextFormatAttribute aAttribute, |
|
523 TBool aNoMatchState = EFalse, |
|
524 const TDesC& aNoMatchText = KNullDesC); |
|
525 |
|
526 inline TBool AutoCompleteStateOn(); |
|
527 |
|
528 /** |
|
529 * Save current cursor state |
|
530 * |
|
531 * @since S60 v4.0 |
|
532 * @param aCtrl The control which may affects the cursor shown state |
|
533 */ |
|
534 void SaveCursorState(CFepUiBaseCtrl* aCtrl); |
|
535 |
|
536 /** |
|
537 * Restore cursor state when overlapped area is removed. |
|
538 * |
|
539 * @since S60 v4.0 |
|
540 * @param aCtrl The control which may affects the cursor shown state |
|
541 */ |
|
542 void RestoreCursorState(CFepUiBaseCtrl* aCtrl); |
|
543 |
|
544 /** |
|
545 * Restore cursor state when overlapped area is removed. |
|
546 * |
|
547 * @since S60 v4.0 |
|
548 * @param aIndex The control index in the list which may affects the cursor shown state |
|
549 */ |
|
550 void RestoreCursorState(TInt aIndex); |
|
551 |
|
552 /** |
|
553 * Find whether the given control is one of the overlapped control. |
|
554 * |
|
555 * @since S60 v4.0 |
|
556 * @return The index in the list. KErrNotFound if not fouond |
|
557 */ |
|
558 TInt FindOverlappedCtrl(CFepUiBaseCtrl* aCtrl); |
|
559 |
|
560 TBool IsTextPosValid(TInt aPos); |
|
561 |
|
562 void UpdateTextL(const TFepInputContextFieldData& aData); |
|
563 |
|
564 static TInt UpdateSecretTextL(TAny* aEditArea); |
|
565 |
|
566 void SetSelectionL(TCursorSelection aCurSel); |
|
567 |
|
568 void UpdateNoMatchTextL(TInt aPos, const TDesC& aNoMatchText, TBool aNoMatchState); |
|
569 |
|
570 void RemoveOverlappedCtrlIfNeeded(); |
|
571 |
|
572 void DeletePromptTextL(); |
|
573 |
|
574 void RecalculatePosByNewPromptTextL(const TDesC& aNewPromptText); |
|
575 |
|
576 void AdjustIcfDataForPromptText(TFepInputContextFieldData& aData); |
|
577 |
|
578 // used when need to set cursor pos to fep |
|
579 void AdjustFepCursorPosForPromptText( TBool aSyncCursor = EFalse ); |
|
580 |
|
581 // judge if a given pos belong to prompt text |
|
582 TBool BelongToPromptText(TInt aPos); |
|
583 |
|
584 void SetPromptTextFormatL(TInt aPromptTextLen); |
|
585 |
|
586 void SetCursorSizeAndType(); |
|
587 |
|
588 TFontSpec CursorFontSpec(); |
|
589 |
|
590 // convert current cursor pos to TPoint, aCaretPos carry |
|
591 // the TPoint info on return |
|
592 void CalculateCursorPos(TPoint& aCaretPos); |
|
593 |
|
594 void AdjustBmpDeviceIfNeeded(); |
|
595 |
|
596 void ApplyFormatL(); |
|
597 |
|
598 void AdjustPromptTextL(); |
|
599 |
|
600 TInt TextWidth( const TDesC& aText ); |
|
601 |
|
602 void ResetApplyFont(); |
|
603 |
|
604 void TryDisplayMaxTextL(TInt aCursorPos); |
|
605 |
|
606 TBool MoveCursorL( const TPoint& aPt, TInt& aCursorPos ); |
|
607 |
|
608 void ResetViewHeightL(); |
|
609 |
|
610 void SetMfneTextL(const TFepInputContextFieldData& aData); |
|
611 |
|
612 void DrawMfneText(); |
|
613 |
|
614 void SetMsgBubbleRect(); |
|
615 void SetInfoBubbleRect(); |
|
616 |
|
617 void HideBubbleTemp(); |
|
618 |
|
619 TBool HighlightOverlapWithBubble( const TRect& aRect ); |
|
620 |
|
621 void AdjustSelectionL( const TCursorSelection& aCurSel ); |
|
622 |
|
623 void ApplyLineSpaceFormatL( TInt aLineHeight ); |
|
624 void CalcPromptTextRectL(); |
|
625 |
|
626 inline void SetCursorSelVisibility( TBool aCursorSelVisible ); |
|
627 |
|
628 private: // Data |
|
629 |
|
630 struct TOverlappedInfo |
|
631 { |
|
632 /* |
|
633 * The control overlapped with ICF cursor |
|
634 */ |
|
635 CFepUiBaseCtrl* iCtrl; |
|
636 |
|
637 /* |
|
638 * keep the cursor on state. |
|
639 */ |
|
640 TBool iCursorStateBeforeOverlapped; |
|
641 } ; |
|
642 |
|
643 /** |
|
644 * list of controls which overlapped with ICF |
|
645 */ |
|
646 RArray<TOverlappedInfo> iOverlappedCtrlList; |
|
647 |
|
648 TBool iHasFocus; |
|
649 |
|
650 // The control which captures the pointer before |
|
651 CFepUiBaseCtrl* iPreCaptureCtrl; |
|
652 |
|
653 // Cursor visibility |
|
654 TBool iCursorVisible; |
|
655 |
|
656 // Cursor selection |
|
657 TBool iCursorSelVisible; |
|
658 |
|
659 // Editor is dimmed |
|
660 TBool iDimmed; |
|
661 |
|
662 CRichText* iRichText; |
|
663 CParaFormatLayer* iParaFormatLayer; |
|
664 CCharFormatLayer* iCharFormatLayer; |
|
665 // text layout and view stuff |
|
666 CTextLayout* iLayout; |
|
667 CTextView* iTextView; |
|
668 |
|
669 TBool iEnableTextSelection; |
|
670 RWindow* iWin; |
|
671 CCoeEnv* iCoeEnv; |
|
672 |
|
673 TRgb iTextColor; |
|
674 TRgb iTextSelColor; |
|
675 TRgb iTextAutoColor; |
|
676 |
|
677 TCharFormat iCharFormat; |
|
678 TCharFormatMask iCharFormatMask; |
|
679 |
|
680 TRect iViewRect; |
|
681 TBool iTextSelectionOn; |
|
682 RArray<TRect> iOverLapRects; |
|
683 TBool iSupportOverLap; |
|
684 |
|
685 TBool iTextIsSecret; |
|
686 TBool iAutoComplete; |
|
687 |
|
688 CFepUiCursor* iInsertionPoint; |
|
689 |
|
690 TBool iTextInited; |
|
691 TInt iMaxFontHeight; |
|
692 TInt iFontHeight; |
|
693 |
|
694 CPeriodic* iSecretTextTimer; |
|
695 |
|
696 TBool iPntDownOnInline; |
|
697 |
|
698 TInt iPreInlineStartPos; |
|
699 TInt iPreInlineEndPos; |
|
700 TInt iPreAutoStartPos; |
|
701 TInt iPreAutoEndPos; |
|
702 TInt iPreTextSelStartPos; |
|
703 TInt iPreTextSelEndPos; |
|
704 TAknsItemID iBgSkinId; |
|
705 TBool iSkinIdSet; |
|
706 |
|
707 CFepLayoutMIcfCustomDraw* iCustomDraw; |
|
708 CFepLayoutMIcfCustomWrap* iTextWrapper; |
|
709 |
|
710 TBool iNoMatchState; |
|
711 const CFont* iFont; |
|
712 HBufC* iInitPromptText; |
|
713 HBufC* iPromptText; |
|
714 TInt iPromptTextLen; |
|
715 TBool iLineSeparator; |
|
716 TInt iHorizontalMargin; |
|
717 |
|
718 // following member variable used to calculate curosr position |
|
719 TInt iWeight; // width of vertical cursors, height of horizontal ones |
|
720 |
|
721 TBool iLeadingEdge; |
|
722 |
|
723 TCursorSelection iCursorSel; |
|
724 |
|
725 /** |
|
726 * The last cursor position |
|
727 */ |
|
728 TInt iLastCursorPos; |
|
729 |
|
730 TInt iState; |
|
731 |
|
732 TInt iLeftMargin; |
|
733 CBubbleCtrl* iMsgBubble; |
|
734 CBubbleCtrl* iInfoBubble; |
|
735 TInt iRightMargin; |
|
736 TInt iTopMargin; |
|
737 TInt iBottomMargin; |
|
738 |
|
739 TInt iLineSpace; |
|
740 TSize iLastDeviceSize; |
|
741 TBool iFormatChange; |
|
742 TInt iFormatLineHeight; |
|
743 HBufC* iMfneIcfData; |
|
744 TBool iRtlMfneEditor; |
|
745 |
|
746 TInt iLineNumber; |
|
747 TInt iLineMaxCount; |
|
748 |
|
749 TBool iHideBubbleTemp; |
|
750 TBool iHideInfoBubbleTemp; |
|
751 TBool iSycnFepData; |
|
752 TInt iPreLanguageID; |
|
753 |
|
754 CGraphicsContext::TTextAlign iTextAlign; |
|
755 TInt iAlignment; |
|
756 |
|
757 CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; |
|
758 CAknInlineTextSource* iPhoneNumberFormatter; |
|
759 |
|
760 TInt iOffset; |
|
761 TRect iPromptTextRect; |
|
762 TInt iMaxIcfEditorHeight; |
|
763 TBool iSynCursor; |
|
764 RBuf iOldMfneText; |
|
765 CTooltipBubbleCtrl* iTooltip; |
|
766 |
|
767 /** |
|
768 * Smiley manager |
|
769 * own |
|
770 */ |
|
771 CPeninputSmileyManager* iSmileyManager; |
|
772 }; |
|
773 |
|
774 inline void CFepLayoutMultiLineIcfEditor::EnableTextSelection(TBool aEnable) |
|
775 { |
|
776 iTextSelectionOn = aEnable; |
|
777 } |
|
778 |
|
779 inline TBool CFepLayoutMultiLineIcfEditor::TextSelectionOn() |
|
780 { |
|
781 return iTextSelectionOn; |
|
782 } |
|
783 |
|
784 inline TBool CFepLayoutMultiLineIcfEditor::InlineStateOn() |
|
785 { |
|
786 return iState == CFepLayoutMultiLineIcf::EIcfInline; |
|
787 } |
|
788 |
|
789 inline void CFepLayoutMultiLineIcfEditor::SetTextIsSecret(TBool aIsSecret) |
|
790 { |
|
791 iTextIsSecret = aIsSecret; |
|
792 } |
|
793 |
|
794 inline TBool CFepLayoutMultiLineIcfEditor::TextIsSecret() const |
|
795 { |
|
796 return iTextIsSecret; |
|
797 } |
|
798 |
|
799 inline TBool CFepLayoutMultiLineIcfEditor::AutoCompleteStateOn() |
|
800 { |
|
801 return iAutoComplete; |
|
802 } |
|
803 |
|
804 inline void CFepLayoutMultiLineIcfEditor::SetBgImgSkinId(TAknsItemID aSkinId) |
|
805 { |
|
806 iBgSkinId = aSkinId; |
|
807 iSkinIdSet = ETrue; |
|
808 } |
|
809 |
|
810 inline void CFepLayoutMultiLineIcfEditor::SetLineSeparatorAfterPrompt(TBool aLineSeparator) |
|
811 { |
|
812 if ( aLineSeparator ) |
|
813 { |
|
814 iLineSeparator = aLineSeparator; |
|
815 } |
|
816 else |
|
817 { |
|
818 iLineSeparator = ( iPreLanguageID == ELangUrdu || iPreLanguageID == ELangArabic || |
|
819 iPreLanguageID == ELangFarsi || iPreLanguageID == ELangHebrew ); |
|
820 } |
|
821 } |
|
822 |
|
823 inline void CFepLayoutMultiLineIcfEditor::SetLanguageId( TInt aLanguageId ) |
|
824 { |
|
825 if (iPreLanguageID == aLanguageId) |
|
826 return; |
|
827 iPreLanguageID = aLanguageId; |
|
828 iLineSeparator = ( aLanguageId == ELangUrdu || aLanguageId == ELangArabic || |
|
829 aLanguageId == ELangFarsi || aLanguageId == ELangHebrew ); |
|
830 } |
|
831 |
|
832 inline TBool CFepLayoutMultiLineIcfEditor::NomatchState() |
|
833 { |
|
834 return iNoMatchState; |
|
835 } |
|
836 |
|
837 inline void CFepLayoutMultiLineIcfEditor::SetTextMargin |
|
838 (TInt aLeftMargin, TInt aRightMargin, TInt aTopMargin, TInt aBottomMargin) |
|
839 { |
|
840 if( iLeftMargin == aLeftMargin && |
|
841 iRightMargin == aRightMargin && |
|
842 iTopMargin == aTopMargin && |
|
843 iBottomMargin == aBottomMargin ) |
|
844 { |
|
845 return; |
|
846 } |
|
847 |
|
848 //iFormatChange = ETrue; |
|
849 iLeftMargin = aLeftMargin; |
|
850 iRightMargin = aRightMargin; |
|
851 iTopMargin = aTopMargin; |
|
852 iBottomMargin = ( aBottomMargin >= 0 )? aBottomMargin : 0; |
|
853 } |
|
854 |
|
855 inline void CFepLayoutMultiLineIcfEditor::SetLineSpace( TInt aLineSpace ) |
|
856 { |
|
857 if( iLineSpace != aLineSpace ) |
|
858 { |
|
859 iLineSpace = aLineSpace; |
|
860 //iFormatChange = ETrue; |
|
861 } |
|
862 } |
|
863 |
|
864 inline void CFepLayoutMultiLineIcfEditor::SetMsgBubble(CBubbleCtrl* aCtrl) |
|
865 { |
|
866 iMsgBubble = aCtrl; |
|
867 } |
|
868 |
|
869 inline void CFepLayoutMultiLineIcfEditor::SetInfoBubble(CBubbleCtrl* aCtrl) |
|
870 { |
|
871 iInfoBubble = aCtrl; |
|
872 } |
|
873 inline void CFepLayoutMultiLineIcfEditor::SetTooltip(CTooltipBubbleCtrl* aCtrl) |
|
874 { |
|
875 iTooltip = aCtrl; |
|
876 } |
|
877 |
|
878 inline TBool CFepLayoutMultiLineIcfEditor::AutoCompletionStateOn() const |
|
879 { |
|
880 return iState == CFepLayoutMultiLineIcf::EIcfAutoComplete; |
|
881 } |
|
882 |
|
883 inline void CFepLayoutMultiLineIcfEditor::SetCursorSelVisibility( TBool aCursorSelVisible ) |
|
884 { |
|
885 iCursorSelVisible = aCursorSelVisible; |
|
886 } |
|
887 |
|
888 #endif // C_PENINPUTLAYOUTMULTILINEICF_H |