|
1 /* |
|
2 * Copyright (c) 2002 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: MsgBodyControlEditor implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // ========== INCLUDE FILES ================================ |
|
21 |
|
22 #include <eikenv.h> // for CEikonEnv |
|
23 #include <txtrich.h> // for CRichText |
|
24 #include <baclipb.h> // for CClipboard |
|
25 #include <AknUtils.h> // for AknUtils |
|
26 #include <ItemFinder.h> // for automatic highlight |
|
27 |
|
28 #include <applayout.cdl.h> // LAF |
|
29 #include <aknlayoutscalable_apps.cdl.h> |
|
30 |
|
31 #ifdef RD_TACTILE_FEEDBACK |
|
32 #include <touchfeedback.h> |
|
33 #endif |
|
34 |
|
35 #include "MsgEditorCommon.h" // |
|
36 #include "MsgBodyControlEditor.h" // for CMsgBodyControlEditor |
|
37 #include "MsgBaseControl.h" // for TMsgEditPermissionFlags |
|
38 #include "MsgBaseControlObserver.h" // for MMsgBaseControlObserver |
|
39 #include "MsgEditorCustomDraw.h" // for CMsgEditorCustomDraw |
|
40 |
|
41 // ========== EXTERNAL DATA STRUCTURES ===================== |
|
42 |
|
43 // ========== EXTERNAL FUNCTION PROTOTYPES ================= |
|
44 |
|
45 // ========== CONSTANTS ==================================== |
|
46 |
|
47 // ========== MACROS ======================================= |
|
48 |
|
49 // ========== LOCAL CONSTANTS AND MACROS =================== |
|
50 |
|
51 const TInt KBodyFullFormattingLength = 500; |
|
52 |
|
53 // ========== MODULE DATA STRUCTURES ======================= |
|
54 |
|
55 // ========== LOCAL FUNCTION PROTOTYPES ==================== |
|
56 |
|
57 // ========== LOCAL FUNCTIONS ============================== |
|
58 |
|
59 // ========== MEMBER FUNCTIONS ============================= |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CMsgBodyControlEditor::CMsgBodyControlEditor |
|
63 // |
|
64 // Constructor. |
|
65 // --------------------------------------------------------- |
|
66 // |
|
67 CMsgBodyControlEditor::CMsgBodyControlEditor( const CCoeControl* aParent, |
|
68 TUint32& aFlags, |
|
69 MMsgBaseControlObserver* aBaseControlObserver ) : |
|
70 CMsgExpandableControlEditor( aParent, aFlags, aBaseControlObserver ), |
|
71 iPreviousItemStart( -1 ), |
|
72 iPreviousItemLength( -1 ) |
|
73 { |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // CMsgBodyControlEditor::~CMsgBodyControlEditor |
|
78 // |
|
79 // Destructor. |
|
80 // --------------------------------------------------------- |
|
81 // |
|
82 CMsgBodyControlEditor::~CMsgBodyControlEditor() |
|
83 { |
|
84 |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // CMsgBodyControlEditor::ConstructL |
|
89 // |
|
90 // |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 void CMsgBodyControlEditor::ConstructL() |
|
94 { |
|
95 TInt edwinFlags = ENoHorizScrolling | |
|
96 ENoAutoSelection | |
|
97 EWidthInPixels | |
|
98 EAllowUndo | |
|
99 EResizable | |
|
100 EPasteAsPlainText; |
|
101 |
|
102 iFlags |= EMsgControlModeDoNotDrawFrameBgContext; |
|
103 ResolveLayouts(); |
|
104 |
|
105 /*if ( iBaseControlObserver && |
|
106 !iBaseControlObserver->ViewInitialized() ) |
|
107 { |
|
108 SetSuppressFormatting( ETrue ); |
|
109 }*/ |
|
110 |
|
111 iItemFinder = CItemFinder::NewL( CItemFinder::EUrlAddress | |
|
112 CItemFinder::EEmailAddress | |
|
113 CItemFinder::EPhoneNumber | |
|
114 CItemFinder::EUriScheme ); |
|
115 |
|
116 iItemFinder->AddObserver( *this ); |
|
117 iFocusChangedBeforeParseFinish = EFalse; |
|
118 |
|
119 CEikRichTextEditor::ConstructL( iParentControl, 0, iMaxNumberOfChars, edwinFlags ); |
|
120 // 107-24185 : Emoticon support for SMS and MMS |
|
121 AddFlagToUserFlags(EAvkonEnableSmileySupport); |
|
122 |
|
123 // Both global text editor and edwin have it's own formatting layers. |
|
124 // CEikRichTextEditor::ConstructL call will set global formatting layers |
|
125 // into use for text. This is not correct as edwin formatting layers |
|
126 // will hold correct formatting values. Below calls will set edwin |
|
127 // formatting layers into use and prevent client based formatting from |
|
128 // being based on incorrect formatting layer. |
|
129 SetParaFormatLayer( iEikonEnv->SystemParaFormatLayerL()->CloneL() ); |
|
130 SetCharFormatLayer( iEikonEnv->SystemCharFormatLayerL()->CloneL() ); |
|
131 |
|
132 SetUpperFullFormattingLength( KBodyFullFormattingLength ); |
|
133 |
|
134 SetMaximumHeight( MsgEditorCommons::MaxBodyHeight() ); |
|
135 |
|
136 // Set the wrap width to be that of the current body text pane. |
|
137 // This will make the formatting of text safer if it is performed |
|
138 // before the editor has ever had SetSize() called. WrapWidth is |
|
139 // usually set in HandleSizeChanged() |
|
140 if ( iLayout ) |
|
141 { |
|
142 iLayout->SetWrapWidth( iTextLayout.TextRect().Width() ); |
|
143 } |
|
144 |
|
145 TRect dataPane = MsgEditorCommons::MsgDataPane(); |
|
146 |
|
147 TMargins8 edwinMargins; |
|
148 edwinMargins.iTop = 0; |
|
149 edwinMargins.iBottom = 0; |
|
150 edwinMargins.iLeft = (TInt8)( iTextLayout.TextRect().iTl.iX - dataPane.iTl.iX ); |
|
151 edwinMargins.iRight = (TInt8)( dataPane.iBr.iX - iTextLayout.TextRect().iBr.iX ); |
|
152 SetBorderViewMargins( edwinMargins ); |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------- |
|
156 // CMsgBodyControlEditor::SetAndGetSizeL |
|
157 // |
|
158 // Calculates and sets the size of the control and returns new size as |
|
159 // reference aSize. |
|
160 // --------------------------------------------------------- |
|
161 // |
|
162 void CMsgBodyControlEditor::SetAndGetSizeL( TSize& aSize ) |
|
163 { |
|
164 // This may change the heigh if the content has changed |
|
165 SetSize( aSize ); |
|
166 aSize = iSize; |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------- |
|
170 // CMsgBodyControlEditor::InsertCharacterL |
|
171 // |
|
172 // Inserts a character to the editor. |
|
173 // --------------------------------------------------------- |
|
174 // |
|
175 void CMsgBodyControlEditor::InsertCharacterL( const TChar& aCharacter ) |
|
176 { |
|
177 |
|
178 // 107-24185 : Emoticon support for SMS and MMS |
|
179 |
|
180 TBuf<1> text; |
|
181 text.Append( aCharacter ); |
|
182 InsertTextL( text ); |
|
183 |
|
184 //UpdateScrollBarsL(); |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------- |
|
188 // CMsgBodyControlEditor::InsertTextL |
|
189 // |
|
190 // Inserts text to the editor. |
|
191 // --------------------------------------------------------- |
|
192 // |
|
193 void CMsgBodyControlEditor::InsertTextL( const TDesC& aText ) |
|
194 { |
|
195 if ( iTextView ) |
|
196 { |
|
197 TCursorSelection selection = iTextView->Selection(); |
|
198 const TInt selLength = selection.Length(); |
|
199 const TInt lower = selection.LowerPos(); |
|
200 |
|
201 if ( selLength ) |
|
202 { |
|
203 // 107-24185 : Emoticon support for SMS and MMS, symbian call |
|
204 InsertDeleteCharsL( lower, aText, selection ); |
|
205 } |
|
206 else |
|
207 { |
|
208 InsertDeleteCharsL( selection.iCursorPos, aText, selection ); |
|
209 } |
|
210 |
|
211 SetCursorPosL( lower + aText.Length(), EFalse ); |
|
212 |
|
213 NotifyNewFormatL(); |
|
214 } |
|
215 else |
|
216 { |
|
217 iText->InsertL( 0, aText ); |
|
218 } |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------- |
|
222 // CMsgBodyControlEditor::ActivateL |
|
223 // |
|
224 // This function is needed for overriding |
|
225 // CMsgExpandableControlEditor::ActivateL(). |
|
226 // --------------------------------------------------------- |
|
227 // |
|
228 void CMsgBodyControlEditor::ActivateL() |
|
229 { |
|
230 if ( IsActivated() ) |
|
231 { |
|
232 return; |
|
233 } |
|
234 |
|
235 CMsgExpandableControlEditor::ActivateL(); |
|
236 |
|
237 } |
|
238 |
|
239 |
|
240 // --------------------------------------------------------- |
|
241 // CMsgBodyControlEditor::OfferKeyEventL |
|
242 // |
|
243 // |
|
244 // --------------------------------------------------------- |
|
245 // |
|
246 TKeyResponse CMsgBodyControlEditor::OfferKeyEventL( |
|
247 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
248 { |
|
249 if ( IsReadOnly() ) |
|
250 { |
|
251 switch ( aKeyEvent.iCode ) |
|
252 { |
|
253 case EKeyUpArrow: |
|
254 case EKeyDownArrow: |
|
255 break; |
|
256 |
|
257 default: |
|
258 return CEikRichTextEditor::OfferKeyEventL( aKeyEvent, aType ); |
|
259 } |
|
260 |
|
261 SetHighlightL( CursorPos(), |
|
262 ( aKeyEvent.iCode == EKeyUpArrow ) |
|
263 ? EMsgFocusUp |
|
264 : EMsgFocusDown ); |
|
265 return EKeyWasConsumed; |
|
266 } |
|
267 else |
|
268 { |
|
269 return CEikRichTextEditor::OfferKeyEventL( aKeyEvent, aType ); |
|
270 } |
|
271 } |
|
272 |
|
273 // --------------------------------------------------------- |
|
274 // CMsgBodyControlEditor::HandlePointerEventL |
|
275 // |
|
276 // Handles pointer events. |
|
277 // --------------------------------------------------------- |
|
278 // |
|
279 #ifdef RD_SCALABLE_UI_V2 |
|
280 void CMsgBodyControlEditor::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
281 { |
|
282 TBool forwardRequest( ETrue ); |
|
283 |
|
284 if ( IsActivated() && |
|
285 IsReadOnly() && |
|
286 ( aPointerEvent.iType == TPointerEvent::EButton1Down || |
|
287 aPointerEvent.iType == TPointerEvent::EButton1Up ) ) |
|
288 { |
|
289 TPoint tapPoint( aPointerEvent.iPosition ); |
|
290 TInt docPos( TextView()->XyPosToDocPosL( tapPoint ) ); |
|
291 |
|
292 TInt start( 0 ); |
|
293 TInt length( 0 ); |
|
294 MParser* parser = iItemFinder; |
|
295 |
|
296 TBool tappedOverTag( RichText()->CursorOverTag( docPos, parser, start, length ) ); |
|
297 |
|
298 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
299 { |
|
300 iPreviousItemStart = -1; |
|
301 iPreviousItemLength = -1; |
|
302 |
|
303 if ( tappedOverTag ) |
|
304 { |
|
305 TPoint relativeTapPoint( aPointerEvent.iPosition - iPosition ); |
|
306 if ( iItemFinder->ItemWasTappedL( relativeTapPoint ) ) |
|
307 { |
|
308 iPreviousItemStart = start; |
|
309 iPreviousItemLength = length; |
|
310 |
|
311 forwardRequest = EFalse; |
|
312 } |
|
313 } |
|
314 else |
|
315 { |
|
316 iItemFinder->ResetCurrentItem(); |
|
317 } |
|
318 } |
|
319 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
320 { |
|
321 if ( tappedOverTag && |
|
322 start >= iPreviousItemStart && |
|
323 length <= iPreviousItemLength ) |
|
324 { |
|
325 TKeyEvent event; |
|
326 event.iCode = EKeyDevice3; |
|
327 event.iScanCode = EStdKeyDevice3; |
|
328 event.iModifiers = 0; |
|
329 event.iRepeats = 0; |
|
330 |
|
331 iCoeEnv->WsSession().SimulateKeyEvent( event ); |
|
332 |
|
333 forwardRequest = EFalse; |
|
334 } |
|
335 } |
|
336 } |
|
337 |
|
338 if ( forwardRequest ) |
|
339 { |
|
340 CMsgExpandableControlEditor::HandlePointerEventL( aPointerEvent ); |
|
341 } |
|
342 #ifdef RD_TACTILE_FEEDBACK |
|
343 else if(aPointerEvent.iType == TPointerEvent::EButton1Down) |
|
344 { |
|
345 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
346 if ( feedback ) |
|
347 { |
|
348 feedback->InstantFeedback( this, ETouchFeedbackBasic ); |
|
349 } |
|
350 } |
|
351 #endif // RD_TACTILE_FEEDBACK |
|
352 } |
|
353 #else |
|
354 void CMsgBodyControlEditor::HandlePointerEventL( const TPointerEvent& /*aPointerEvent*/ ) |
|
355 { |
|
356 } |
|
357 #endif // RD_SCALABLE_UI_V2 |
|
358 |
|
359 |
|
360 // --------------------------------------------------------- |
|
361 // CMsgBodyControlEditor::IsFocusChangePossibleL |
|
362 // |
|
363 // |
|
364 // --------------------------------------------------------- |
|
365 // |
|
366 TBool CMsgBodyControlEditor::IsFocusChangePossibleL( |
|
367 TMsgFocusDirection aDirection ) |
|
368 { |
|
369 CItemFinder::TFindDirection direction = aDirection == EMsgFocusUp |
|
370 ? CItemFinder::ENextUp |
|
371 : CItemFinder::ENextDown; |
|
372 |
|
373 TInt cursorPos = CursorPos(); |
|
374 iItemFinder->ResolveAndSetItemTypeL( cursorPos ); |
|
375 TInt nextItem = iItemFinder->PositionOfNextItem( direction ); |
|
376 TPoint dummy; |
|
377 |
|
378 if ( nextItem < KErrNone ) |
|
379 { |
|
380 // Next item not found. |
|
381 if ( aDirection == EMsgFocusUp ) |
|
382 { |
|
383 return TextLayout()->FirstDocPosFullyInBand() == 0; |
|
384 } |
|
385 else |
|
386 { |
|
387 return TextLayout()->PosInBand( TextLength(),dummy ); |
|
388 } |
|
389 } |
|
390 else |
|
391 { |
|
392 // Next item found. -> Focus change not allowed. |
|
393 return 0; |
|
394 } |
|
395 } |
|
396 |
|
397 // --------------------------------------------------------- |
|
398 // CMsgBodyControlEditor::SetupAutomaticFindAfterFocusChangeL |
|
399 // |
|
400 // |
|
401 // --------------------------------------------------------- |
|
402 // |
|
403 void CMsgBodyControlEditor::SetupAutomaticFindAfterFocusChangeL( TBool aBeginning ) |
|
404 { |
|
405 iInitTop = aBeginning; |
|
406 if ( !iTextParsed ) |
|
407 { |
|
408 iFocusChangedBeforeParseFinish = ETrue; |
|
409 } |
|
410 else |
|
411 { |
|
412 if ( aBeginning ) |
|
413 { |
|
414 SetHighlightL( 0, EMsgFocusDown, ETrue ); |
|
415 } |
|
416 else |
|
417 { |
|
418 SetHighlightL( TextLength(), EMsgFocusUp, ETrue ); |
|
419 } |
|
420 } |
|
421 } |
|
422 |
|
423 // --------------------------------------------------------- |
|
424 // CMsgBodyControlEditor::SetHighlightL |
|
425 // |
|
426 // |
|
427 // --------------------------------------------------------- |
|
428 // |
|
429 void CMsgBodyControlEditor::SetHighlightL( |
|
430 TInt aCursorPos, TMsgFocusDirection aDirection, |
|
431 TBool aInit /*= EFalse*/ ) |
|
432 { |
|
433 // Use "link highlight" |
|
434 SetHighlightStyleL( EEikEdwinHighlightLink ); |
|
435 TInt textLength = TextLength(); |
|
436 |
|
437 TCursorPosition::TMovementType movetype = aDirection == EMsgFocusUp |
|
438 ? TCursorPosition::EFPageUp |
|
439 : TCursorPosition::EFPageDown; |
|
440 |
|
441 CItemFinder::TFindDirection direction = aDirection == EMsgFocusUp |
|
442 ? CItemFinder::ENextUp |
|
443 : CItemFinder::ENextDown; |
|
444 |
|
445 TInt nextItem = KErrNotFound; |
|
446 TPoint dummy; |
|
447 if ( iTextParsed ) |
|
448 { |
|
449 if ( aInit ) |
|
450 { |
|
451 iItemFinder->NextItemOrScrollL( aCursorPos == 0 |
|
452 ? CItemFinder::EInitDown |
|
453 : CItemFinder::EInitUp ); |
|
454 } |
|
455 else |
|
456 { |
|
457 nextItem = iItemFinder->PositionOfNextItem( direction ); |
|
458 } |
|
459 } |
|
460 |
|
461 if ( nextItem > KErrNotFound ) |
|
462 { |
|
463 if ( !aInit && |
|
464 !TextLayout()->PosInBand( nextItem ,dummy ) ) |
|
465 { |
|
466 // first move one page and then set selection |
|
467 SetCursorPosL( CursorPos(), EFalse ); |
|
468 iTextView->MoveCursorL( movetype, EFalse ); |
|
469 } |
|
470 |
|
471 if ( TextLayout()->PosInBand( nextItem ,dummy ) ) |
|
472 { |
|
473 // next item is visible, just change selection |
|
474 iItemFinder->ResolveAndSetItemTypeL( nextItem ); |
|
475 |
|
476 TInt selectionLength = iItemFinder->CurrentItemExt().iEnd - iItemFinder->CurrentItemExt().iStart + 1; |
|
477 TCursorSelection cursorSelection; |
|
478 cursorSelection.iCursorPos = nextItem; |
|
479 cursorSelection.iAnchorPos = nextItem + selectionLength; |
|
480 if ( !TextLayout()->PosInBand( nextItem + selectionLength, dummy ) ) |
|
481 { |
|
482 // Next item does not fit fully on the screen. |
|
483 // Have to move page first. |
|
484 SetCursorPosL( CursorPos(), EFalse ); |
|
485 iTextView->MoveCursorL( movetype, EFalse ); |
|
486 } |
|
487 |
|
488 iTextView->SetSelectionL( cursorSelection ); |
|
489 } |
|
490 |
|
491 } |
|
492 else |
|
493 { |
|
494 if ( !aInit ) |
|
495 { |
|
496 switch ( aDirection ) |
|
497 { |
|
498 case EMsgFocusDown: |
|
499 if ( !TextLayout()->PosInBand( textLength, dummy) ) |
|
500 { |
|
501 iTextView->MoveCursorL( movetype, EFalse ); |
|
502 |
|
503 // Following is a bit tricky since MoveCursor looses |
|
504 // selection so we have to set it again if previous |
|
505 // selection still on the screen. |
|
506 nextItem = iItemFinder->PositionOfNextItem( |
|
507 CItemFinder::ENextUp ); |
|
508 if ( nextItem > KErrNotFound ) |
|
509 { |
|
510 if ( TextLayout()->PosInBand( nextItem ,dummy ) ) |
|
511 { |
|
512 // next item is visible, change selection |
|
513 iItemFinder->ResolveAndSetItemTypeL( nextItem ); |
|
514 |
|
515 TInt selectionLength = iItemFinder->CurrentItemExt().iEnd - iItemFinder->CurrentItemExt().iStart + 1; |
|
516 TCursorSelection cursorSelection; |
|
517 cursorSelection.iCursorPos = nextItem; |
|
518 cursorSelection.iAnchorPos = nextItem + selectionLength; |
|
519 iTextView->SetSelectionL( cursorSelection ); |
|
520 } |
|
521 else |
|
522 { |
|
523 nextItem = iItemFinder->PositionOfNextItem( |
|
524 CItemFinder::ENextDown ); |
|
525 } |
|
526 } |
|
527 } |
|
528 break; |
|
529 default: |
|
530 case EMsgFocusUp: |
|
531 if ( !TextLayout()->PosInBand( 0,dummy ) ) |
|
532 { |
|
533 iTextView->MoveCursorL( movetype, EFalse ); |
|
534 } |
|
535 break; |
|
536 }; |
|
537 |
|
538 } |
|
539 } |
|
540 |
|
541 } |
|
542 |
|
543 |
|
544 // --------------------------------------------------------- |
|
545 // CMsgBodyControlEditor::CursorInLastLine |
|
546 // |
|
547 // |
|
548 // --------------------------------------------------------- |
|
549 // |
|
550 TBool CMsgBodyControlEditor::CursorInLastLine() |
|
551 { |
|
552 if (IsReadOnly()) |
|
553 { |
|
554 TPoint dummy; |
|
555 return ( iItemFinder->PositionOfNextItem( CItemFinder::ENextDown ) == KErrNotFound |
|
556 && TextLayout()->PosInBand( TextLength(), dummy ) ); |
|
557 |
|
558 } |
|
559 else |
|
560 { |
|
561 return CMsgExpandableControlEditor::CursorInLastLine(); |
|
562 } |
|
563 |
|
564 } |
|
565 |
|
566 // --------------------------------------------------------- |
|
567 // CMsgBodyControlEditor::HandleParsingComplete |
|
568 // --------------------------------------------------------- |
|
569 // |
|
570 void CMsgBodyControlEditor::HandleParsingComplete() |
|
571 { |
|
572 TRAP_IGNORE( DoHandleParsingCompleteL() ); |
|
573 } |
|
574 |
|
575 // --------------------------------------------------------- |
|
576 // CMsgBodyControlEditor::DoHandleParsingCompleteL |
|
577 // --------------------------------------------------------- |
|
578 // |
|
579 void CMsgBodyControlEditor::DoHandleParsingCompleteL() |
|
580 { |
|
581 iTextParsed = ETrue; |
|
582 // this needs to be changed so that bottom init can also be set |
|
583 if ( iFocusChangedBeforeParseFinish ) |
|
584 { |
|
585 iFocusChangedBeforeParseFinish = EFalse; // just to make sure this is done only once |
|
586 if ( iInitTop ) |
|
587 { |
|
588 SetHighlightL( 0, EMsgFocusDown, ETrue ); |
|
589 } |
|
590 else |
|
591 { |
|
592 SetHighlightL( TextLength(), EMsgFocusUp, ETrue ); |
|
593 } |
|
594 |
|
595 if ( iBaseControlObserver ) |
|
596 { |
|
597 iBaseControlObserver->HandleBaseControlEventRequestL( NULL, |
|
598 EMsgUpdateScrollbar ); |
|
599 } |
|
600 } |
|
601 else |
|
602 { |
|
603 // In some cases the text view is left to some |
|
604 // strange state. Make sure the view is in sync |
|
605 // with cursor position. |
|
606 SetCursorPosL( CursorPos(), EFalse ); |
|
607 } |
|
608 } |
|
609 |
|
610 // --------------------------------------------------------- |
|
611 // CMsgBodyControlEditor::ResolveLayouts |
|
612 // |
|
613 // |
|
614 // --------------------------------------------------------- |
|
615 // |
|
616 void CMsgBodyControlEditor::ResolveLayouts() |
|
617 { |
|
618 TRect dataPane = MsgEditorCommons::MsgDataPane(); |
|
619 |
|
620 TAknLayoutRect msgTextPane; |
|
621 msgTextPane.LayoutRect( |
|
622 dataPane, |
|
623 AknLayoutScalable_Apps::msg_text_pane( 0 ).LayoutLine() ); |
|
624 TAknLayoutRect msgBodyPane; |
|
625 msgBodyPane.LayoutRect( |
|
626 msgTextPane.Rect(), |
|
627 AknLayoutScalable_Apps::msg_body_pane().LayoutLine() ); |
|
628 |
|
629 if ( IsReadOnly() ) |
|
630 { |
|
631 iTextLayout.LayoutText( |
|
632 msgBodyPane.Rect(), |
|
633 AknLayoutScalable_Apps::msg_body_pane_t1( 0 ).LayoutLine() ); |
|
634 } |
|
635 else |
|
636 { |
|
637 iTextLayout.LayoutText( |
|
638 msgBodyPane.Rect(), |
|
639 AknLayoutScalable_Apps::msg_body_pane_t1( 1 ).LayoutLine() ); |
|
640 } |
|
641 |
|
642 |
|
643 if ( MsgEditorCustomDraw() ) |
|
644 { |
|
645 MsgEditorCustomDraw()->ResolveLayouts(); |
|
646 } |
|
647 } |
|
648 |
|
649 // --------------------------------------------------------- |
|
650 // CMsgBodyControlEditor::LayoutEdwin |
|
651 // --------------------------------------------------------- |
|
652 // |
|
653 void CMsgBodyControlEditor::LayoutEdwin() |
|
654 { |
|
655 TAknLayoutRect msgTextPane; |
|
656 msgTextPane.LayoutRect( MsgEditorCommons::MsgDataPane(), |
|
657 AknLayoutScalable_Apps::msg_text_pane( 0 ).LayoutLine() ); |
|
658 |
|
659 TAknLayoutRect msgBodyPane; |
|
660 msgBodyPane.LayoutRect( msgTextPane.Rect(), |
|
661 AknLayoutScalable_Apps::msg_body_pane().LayoutLine() ); |
|
662 |
|
663 TRect parentRect( msgBodyPane.Rect() ); |
|
664 parentRect.Move( 0, iParentControl->Position().iY ); |
|
665 |
|
666 DoLayoutEdwin( parentRect, |
|
667 AknLayoutScalable_Apps::msg_body_pane_t1( 0 ).LayoutLine() ); |
|
668 } |
|
669 |
|
670 // --------------------------------------------------------- |
|
671 // CMsgBodyControlEditor::PrepareFocusTransition |
|
672 // |
|
673 // Do not change focus when automatic find parsing has been finished |
|
674 // if focus transition out of this control has been performed. |
|
675 // --------------------------------------------------------- |
|
676 // |
|
677 void CMsgBodyControlEditor::PrepareFocusTransition() |
|
678 { |
|
679 if ( IsFocused() ) |
|
680 { |
|
681 iFocusChangedBeforeParseFinish = EFalse; |
|
682 } |
|
683 } |
|
684 |
|
685 // --------------------------------------------------------- |
|
686 // CMsgBodyControlEditor::SetTextSkinColorIdL |
|
687 // --------------------------------------------------------- |
|
688 // |
|
689 void CMsgBodyControlEditor::SetTextSkinColorIdL() |
|
690 { |
|
691 CEikEdwin::SetTextSkinColorIdL( EAknsCIQsnTextColorsCG6 ); |
|
692 } |
|
693 |
|
694 // --------------------------------------------------------- |
|
695 // CMsgBodyControlEditor::HandleResourceChange |
|
696 // |
|
697 // Sets correct highlight extension. |
|
698 // --------------------------------------------------------- |
|
699 // |
|
700 void CMsgBodyControlEditor::HandleResourceChange( TInt aType ) |
|
701 { |
|
702 CMsgExpandableControlEditor::HandleResourceChange( aType ); |
|
703 |
|
704 if ( aType == KAknsMessageSkinChange && MsgEditorCustomDraw() ) |
|
705 { |
|
706 MsgEditorCustomDraw()->SkinChanged();; |
|
707 } |
|
708 } |
|
709 |
|
710 // End of File |