580 { |
580 { |
581 iCursorSel.iCursorPos = icfdata.iCurSel.iCursorPos + iPromptTextLen; |
581 iCursorSel.iCursorPos = icfdata.iCurSel.iCursorPos + iPromptTextLen; |
582 iCursorSel.iAnchorPos = icfdata.iCurSel.iAnchorPos + iPromptTextLen; |
582 iCursorSel.iAnchorPos = icfdata.iCurSel.iAnchorPos + iPromptTextLen; |
583 DrawMfneText(); |
583 DrawMfneText(); |
584 iSynCursor = EFalse; |
584 iSynCursor = EFalse; |
|
585 iOldMfneText.Close(); |
585 iOldMfneText.CreateL(ptr); |
586 iOldMfneText.CreateL(ptr); |
586 } |
587 } |
587 |
588 |
588 iInsertionPoint->SetVisible( EFalse ); |
589 iInsertionPoint->SetVisible( EFalse ); |
589 |
590 |
1057 if( InlineStateOn() || AutoCompletionStateOn() ) |
1058 if( InlineStateOn() || AutoCompletionStateOn() ) |
1058 { |
1059 { |
1059 iCharFormatMask.ClearAll(); |
1060 iCharFormatMask.ClearAll(); |
1060 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
1061 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
1061 iCharFormat.iFontPresentation.iUnderline = EUnderlineOn ; |
1062 iCharFormat.iFontPresentation.iUnderline = EUnderlineOn ; |
1062 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, iPreInlineStartPos, |
1063 if( iPreInlineStartPos >= 0 && iPreInlineEndPos <= iRichText->DocumentLength() + 1 ) |
1063 iPreInlineEndPos - iPreInlineStartPos); |
1064 { |
|
1065 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, iPreInlineStartPos, |
|
1066 iPreInlineEndPos - iPreInlineStartPos); |
|
1067 } |
1064 } |
1068 } |
1065 |
1069 |
1066 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, iRichText->DocumentLength() - iPromptTextLen); |
1070 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, iRichText->DocumentLength() - iPromptTextLen); |
1067 |
1071 |
1068 SetPromptTextFormatL( iPromptTextLen ); |
1072 SetPromptTextFormatL( iPromptTextLen ); |
1720 if( ready ) |
1724 if( ready ) |
1721 { |
1725 { |
1722 SetReady( ETrue ); |
1726 SetReady( ETrue ); |
1723 } |
1727 } |
1724 |
1728 |
1725 if ( iFormatChange ) |
1729 // if ( iFormatChange ) |
1726 { |
1730 // { |
1727 iTextView->SetSelectionL( iTextView->Selection() ); |
1731 // iTextView->SetSelectionL( iTextView->Selection() ); |
1728 RecalcualteTextPositionL(); |
1732 // RecalcualteTextPositionL(); |
1729 SetMsgBubbleRect(); |
1733 // SetMsgBubbleRect(); |
1730 Draw(); |
1734 // Draw(); |
1731 } |
1735 // } |
|
1736 iTextView->HandleGlobalChangeNoRedrawL(); |
|
1737 iTextView->SetSelectionL( iTextView->Selection() ); |
|
1738 RecalcualteTextPositionL(); |
|
1739 SetMsgBubbleRect(); |
|
1740 Draw(); |
1732 } |
1741 } |
1733 |
1742 |
1734 TBool CFepLayoutMultiLineIcfEditor::BelongToPromptText(TInt aPos) |
1743 TBool CFepLayoutMultiLineIcfEditor::BelongToPromptText(TInt aPos) |
1735 { |
1744 { |
1736 if (!iPromptText || iPromptText->Length() == 0 ) |
1745 if (!iPromptText || iPromptText->Length() == 0 ) |
2472 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
2481 iCharFormatMask.SetAttrib( EAttFontUnderline ); |
2473 iCharFormatMask.SetAttrib( EAttColor ); |
2482 iCharFormatMask.SetAttrib( EAttColor ); |
2474 iCharFormat.iFontPresentation.iTextColor = iTextColor; |
2483 iCharFormat.iFontPresentation.iTextColor = iTextColor; |
2475 |
2484 |
2476 // set prompt text as bold |
2485 // set prompt text as bold |
2477 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, aPromptTextLen );//- 1 |
2486 if( aPromptTextLen <= iRichText->DocumentLength() + 1) |
|
2487 { |
|
2488 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, 0, aPromptTextLen );//- 1 |
|
2489 } |
2478 iTextView->HandleRangeFormatChangeL(TCursorSelection(0, aPromptTextLen ), ETrue);//- 1 |
2490 iTextView->HandleRangeFormatChangeL(TCursorSelection(0, aPromptTextLen ), ETrue);//- 1 |
2479 |
2491 |
2480 // set remain text as non-bold |
2492 // set remain text as non-bold |
2481 iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); |
2493 iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal); |
2482 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, aPromptTextLen - 1); |
2494 //iRichText->SetInsertCharFormatL(iCharFormat, iCharFormatMask, aPromptTextLen - 1); |
2536 { |
2548 { |
2537 iCharFormat.iFontPresentation.iTextColor = iTextAutoColor; |
2549 iCharFormat.iFontPresentation.iTextColor = iTextAutoColor; |
2538 } |
2550 } |
2539 iCharFormatMask.SetAttrib(aAttribute); |
2551 iCharFormatMask.SetAttrib(aAttribute); |
2540 |
2552 |
|
2553 TInt aPos = Min( aStartPos, aEndPos ); |
|
2554 TInt aLength = Abs( aEndPos - aStartPos ); |
2541 if (aNoMatchState) |
2555 if (aNoMatchState) |
2542 { |
2556 { |
2543 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, |
2557 if ( aPos >= 0 && aPos + aLength <= iRichText->DocumentLength()) |
2544 Min(aStartPos,aEndPos), Abs( aEndPos - aStartPos ) + 1); |
2558 { |
2545 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos + 1), ETrue); |
2559 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, aPos, aLength + 1); |
|
2560 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos + 1), ETrue); |
|
2561 } |
2546 } |
2562 } |
2547 else |
2563 else |
2548 { |
2564 { |
2549 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, |
2565 if ( aPos >= 0 && aPos + aLength <= iRichText->DocumentLength() + 1 ) |
2550 Min(aStartPos,aEndPos), Abs( aEndPos - aStartPos ) ); |
2566 { |
2551 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos), ETrue); |
2567 iRichText->ApplyCharFormatL(iCharFormat, iCharFormatMask, aStartPos, aLength ); |
|
2568 iTextView->HandleRangeFormatChangeL(TCursorSelection(aStartPos, aEndPos), ETrue); |
|
2569 } |
2552 } |
2570 } |
2553 |
2571 |
2554 aPreStartPos = aStartPos; |
2572 aPreStartPos = aStartPos; |
2555 aPreEndPos = aEndPos; |
2573 aPreEndPos = aEndPos; |
2556 } |
2574 } |
2691 |
2709 |
2692 void CFepLayoutMultiLineIcfEditor::ApplyFormatL() |
2710 void CFepLayoutMultiLineIcfEditor::ApplyFormatL() |
2693 { |
2711 { |
2694 if( !iFormatChange ) |
2712 if( !iFormatChange ) |
2695 { |
2713 { |
2696 return; |
2714 return ; |
2697 } |
2715 } |
2698 //apply line space |
2716 //apply line space |
2699 CParaFormat* paraFormat=CParaFormat::NewL(); |
2717 CParaFormat* paraFormat=CParaFormat::NewL(); |
2700 CleanupStack::PushL( paraFormat ); |
2718 CleanupStack::PushL( paraFormat ); |
2701 TParaFormatMask paraFormatMask; |
2719 TParaFormatMask paraFormatMask; |
2812 |
2830 |
2813 iCursorSel = aCurSel; |
2831 iCursorSel = aCurSel; |
2814 |
2832 |
2815 if ( BelongToPromptText(aCurSel.iCursorPos) ) |
2833 if ( BelongToPromptText(aCurSel.iCursorPos) ) |
2816 { |
2834 { |
2817 //pls refer to bug: ELWG-7MZ5EZ, why to use iPromptText->Length() instead of iPromptTextLen |
2835 //why to use iPromptText->Length() instead of iPromptTextLen |
2818 //iCursorSel.iCursorPos = iPromptTextLen; |
2836 //iCursorSel.iCursorPos = iPromptTextLen; |
2819 iCursorSel.iCursorPos = iPromptText->Length(); |
2837 iCursorSel.iCursorPos = iPromptText->Length(); |
2820 } |
2838 } |
2821 if ( BelongToPromptText(aCurSel.iAnchorPos) ) |
2839 if ( BelongToPromptText(aCurSel.iAnchorPos) ) |
2822 { |
2840 { |
2823 //pls refer to bug: ELWG-7MZ5EZ, why to use iPromptText->Length() instead of iPromptTextLen |
2841 //why to use iPromptText->Length() instead of iPromptTextLen |
2824 //iCursorSel.iAnchorPos = iPromptTextLen; |
2842 //iCursorSel.iAnchorPos = iPromptTextLen; |
2825 iCursorSel.iAnchorPos = iPromptText->Length(); |
2843 iCursorSel.iAnchorPos = iPromptText->Length(); |
2826 } |
2844 } |
2827 |
2845 |
2828 iTextView->SetSelectionL( iCursorSel ); |
2846 iTextView->SetSelectionL( iCursorSel ); |