95 #include <eikrted.h> |
95 #include <eikrted.h> |
96 #include <NumberGroupingCRKeys.h> |
96 #include <NumberGroupingCRKeys.h> |
97 #include <aknpointereventsuppressor.h> |
97 #include <aknpointereventsuppressor.h> |
98 #include <aknnotedialog.h> |
98 #include <aknnotedialog.h> |
99 #include <AknFepGlobalEnums.h> |
99 #include <AknFepGlobalEnums.h> |
100 #include <AknSmileyUtils.h> |
100 |
101 #include "smileymanager.h" |
101 #include "smileymanager.h" |
102 #include "smileycustomwrap.h" |
102 #include "smileycustomwrap.h" |
103 #include <touchfeedback.h> |
103 #include <touchfeedback.h> |
104 |
|
105 // for supporting TapToWrite |
|
106 #include <AvkonInternalCRKeys.h> |
|
107 #include <e32property.h> |
|
108 #include <AknFepInternalPSKeys.h> |
|
109 #include <AknFontAccess.h> |
|
110 #include <AvkonInternalCRKeys.h> // KAknQwertyInputModeActive |
|
111 |
104 |
112 // declare function |
105 // declare function |
113 void ReadSpecialCharFromSCTL( TPtr& ptr, TInt sctResourceId ); |
106 void ReadSpecialCharFromSCTL( TPtr& ptr, TInt sctResourceId ); |
114 void ReadSCTHeadPane( TResourceReader& aReader ); |
107 void ReadSCTHeadPane( TResourceReader& aReader ); |
115 |
108 |
810 // Replace all 'i' following smiley code to invisbile placeholder for |
796 // Replace all 'i' following smiley code to invisbile placeholder for |
811 // Touch Input can not recognize it as part of smiley code string. |
797 // Touch Input can not recognize it as part of smiley code string. |
812 TInt smileyEndPos( 0 ); |
798 TInt smileyEndPos( 0 ); |
813 for ( TInt i( 0 ); i < length; i++ ) |
799 for ( TInt i( 0 ); i < length; i++ ) |
814 { |
800 { |
815 if ( aEditorContent[i] == CAknSmileyManager::KCompensateChar ) |
801 if ( aEditorContent[i] == CSmileyManager::KCompensateChar ) |
816 { |
802 { |
817 // when 'i' is the first character, it is unkonwn whether it is |
803 // when 'i' is the first character, it is unkonwn whether it is |
818 // part of a smiley code string or not, so we have to use another |
804 // part of a smiley code string or not, so we have to use another |
819 // function to decide. |
805 // function to decide. |
820 if ( ( i > 0 && i < smileyEndPos ) || |
806 if ( ( i > 0 && i < smileyEndPos ) || |
821 ( i == 0 && smiley->SmileyCodeByPos( aDocumentPosition ) > 0 ) ) |
807 ( i == 0 && smiley->SmileyCodeByPos( aDocumentPosition ) > 0 ) ) |
822 { |
808 { |
823 aEditorContent[i] = CAknSmileyManager::KPlaceHolder; |
809 aEditorContent[i] = CSmileyManager::KPlaceHolder; |
824 } |
810 } |
825 } |
811 } |
826 else if ( smiley->IsSmileyCode( aEditorContent[i] ) ) |
812 else if ( smiley->IsSmileyCode( aEditorContent[i] ) ) |
827 { |
813 { |
828 smileyEndPos = i + smiley->SmileyLength( aDocumentPosition + i ); |
814 smileyEndPos = i + smiley->SmileyLength( aDocumentPosition + i ); |
1234 KAknFepClearDirection); |
1211 KAknFepClearDirection); |
1235 |
1212 |
1236 iCenRepNotifyHandler->StartListeningL(); |
1213 iCenRepNotifyHandler->StartListeningL(); |
1237 iCenRep->Get(KAknFepClearDirection, iClearDirection); |
1214 iCenRep->Get(KAknFepClearDirection, iClearDirection); |
1238 } |
1215 } |
1239 // Start listening a CenRep key indicating whether qwerty input mode is active. |
|
1240 TRAPD( error, iCenRepForQwerty = CRepository::NewL( KCRUidAvkon ) ); |
|
1241 if ( error == KErrNone ) |
|
1242 { |
|
1243 iCenRepNotifyHandlerForQwerty = CCenRepNotifyHandler::NewL( *this, |
|
1244 *iCenRepForQwerty, |
|
1245 CCenRepNotifyHandler::EIntKey, |
|
1246 KAknQwertyInputModeActive ); |
|
1247 |
|
1248 iCenRepNotifyHandlerForQwerty->StartListeningL(); |
|
1249 iCenRepForQwerty->Get( KAknQwertyInputModeActive, iQwertyStatus ); |
|
1250 } |
|
1251 |
|
1252 iSmileyWrap = new ( ELeave ) CSmileyCustomWrap; |
1216 iSmileyWrap = new ( ELeave ) CSmileyCustomWrap; |
1253 iSkinInstance = AknsUtils::SkinInstance(); |
1217 iSkinInstance = AknsUtils::SkinInstance(); |
1254 } |
1218 } |
1255 |
1219 |
1256 void CEikEdwin::CEikEdwinExtension::CreateFormExtendedInterfaceProviderIfNeededL() |
1220 void CEikEdwin::CEikEdwinExtension::CreateFormExtendedInterfaceProviderIfNeededL() |
2655 params.iDocPos = posInfo.iDocPos.iPos; |
2600 params.iDocPos = posInfo.iDocPos.iPos; |
2656 } |
2601 } |
2657 else // Need to call this method for the case where the pen is beyond the last line of text |
2602 else // Need to call this method for the case where the pen is beyond the last line of text |
2658 { |
2603 { |
2659 params.iDocPos = iTextView->XyPosToDocPosL( pos ); |
2604 params.iDocPos = iTextView->XyPosToDocPosL( pos ); |
|
2605 } |
|
2606 |
|
2607 // To check if user taps on inline editing text in partial screen mode, |
|
2608 // if so, the event has to be passed to FEP handler so FEP can display |
|
2609 // candidate words list. |
|
2610 TInt checkedFlags( EAknEditorFlagEnablePartialScreen | |
|
2611 EAknEditorFlagTouchInputModeOpened ); |
|
2612 if ( ( AknEditorFlags() & checkedFlags ) == checkedFlags ) |
|
2613 { |
|
2614 TCursorSelection inlineRange( InlineTextRange() ); |
|
2615 if ( params.iDocPos >= inlineRange.LowerPos() && |
|
2616 params.iDocPos < inlineRange.HigherPos() ) |
|
2617 { |
|
2618 // Only pass EButton1up event to FEP handler to improve performance. |
|
2619 // Ignore other events on inline text, otherwise they will cancel |
|
2620 // inline editing status. |
|
2621 if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
|
2622 iEdwinFepSupport && iEdwinFepSupport->iPointerEventHandlerDuringInlineEdit ) |
|
2623 { |
|
2624 iEdwinFepSupport->iPointerEventHandlerDuringInlineEdit-> |
|
2625 HandlePointerEventInInlineTextL( TPointerEvent::EButton1Up, |
|
2626 aPointerEvent.iModifiers, |
|
2627 params.iDocPos - inlineRange.LowerPos() ); |
|
2628 } |
|
2629 return; |
|
2630 } |
2660 } |
2631 } |
2661 |
2632 |
2662 /** The local @c destroyed variable keeps track of the object destroyed state. */ |
2633 /** The local @c destroyed variable keeps track of the object destroyed state. */ |
2663 TBool destroyed = EFalse; |
2634 TBool destroyed = EFalse; |
2664 iEdwinExtension->iDestroyedPtr = &destroyed; |
2635 iEdwinExtension->iDestroyedPtr = &destroyed; |
3474 |
3428 |
3475 if ( displayRect.Height() <= 0 ) |
3429 if ( displayRect.Height() <= 0 ) |
3476 { |
3430 { |
3477 displayRect.iBr.iY = displayRect.iTl.iY + displayRectHeight; |
3431 displayRect.iBr.iY = displayRect.iTl.iY + displayRectHeight; |
3478 } |
3432 } |
3479 |
3433 // Check if the width of view rect is changed, if it is not changed no need to global reformat. |
3480 |
3434 const TBool differentWidth = ( iTextView->ViewRect().Width() != displayRect.Width() ); |
3481 iTextView->SetViewRect(displayRect); |
3435 iTextView->SetViewRect( displayRect ); |
3482 iLayout->SetWrapWidth(LayoutWidth()); |
3436 if ( differentWidth ) |
|
3437 { |
|
3438 iLayout->SetWrapWidth( LayoutWidth() ); |
|
3439 } |
3483 TViewYPosQualifier yPosQualifier; |
3440 TViewYPosQualifier yPosQualifier; |
3484 yPosQualifier.SetFillScreen(); |
3441 yPosQualifier.SetFillScreen(); |
3485 yPosQualifier.SetMakeLineFullyVisible(); |
3442 yPosQualifier.SetMakeLineFullyVisible(); |
3486 SetAmountToFormatL( EFalse, EFalse ); // Not a new doc; Do not reformat |
3443 SetAmountToFormatL( EFalse, EFalse ); // Not a new doc; Do not reformat |
3487 if (!(iEdwinInternalFlags & ESuppressFormatting)) |
3444 if ( !( iEdwinInternalFlags & ESuppressFormatting ) && |
3488 iTextView->HandleGlobalChangeNoRedrawL(yPosQualifier); // This does the reformat |
3445 ( differentWidth || iLayout->DocumentLength() < KFullFormattingUpperThreshold ) ) |
|
3446 { |
|
3447 iTextView->HandleGlobalChangeNoRedrawL( yPosQualifier ); // This does the reformat |
|
3448 } |
3489 CalculateLineMetricsForBandFormattingL(); |
3449 CalculateLineMetricsForBandFormattingL(); |
3490 SetScrollBarsL(); |
3450 SetScrollBarsL(); |
3491 UpdateScrollBarsL(); |
3451 UpdateScrollBarsL(); |
3492 if ( condition ) |
3452 if ( condition ) |
3493 { |
3453 { |
4058 // Text view may not occupy the whole control area. So we need to draw in the gaps |
4018 // Text view may not occupy the whole control area. So we need to draw in the gaps |
4059 DrawBackgroundAroundTextView( gc, rect, viewRect, backgroundColor ); |
4019 DrawBackgroundAroundTextView( gc, rect, viewRect, backgroundColor ); |
4060 } |
4020 } |
4061 |
4021 |
4062 TrappedDraw(viewRect); |
4022 TrappedDraw(viewRect); |
4063 |
|
4064 // try to draw "tap to write" |
|
4065 if ( TextLength() == 0 && IsT2WEnabled() ) |
|
4066 { |
|
4067 TRAP_IGNORE( DrawT2WTextL() ); |
|
4068 } |
|
4069 |
4023 |
4070 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
4024 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
4071 // Workaround for clipping rect problem in multiline queries with text |
4025 // Workaround for clipping rect problem in multiline queries with text |
4072 // entries. Because of differences between CRemoteGc and CWindowGc, |
4026 // entries. Because of differences between CRemoteGc and CWindowGc, |
4073 // parts of the query wouldn't be drawn by CRemoteGc. The Reset() call |
4027 // parts of the query wouldn't be drawn by CRemoteGc. The Reset() call |
4084 { |
4038 { |
4085 CFont** fontPtr = (CFont**)aFont; |
4039 CFont** fontPtr = (CFont**)aFont; |
4086 CEikonEnv::Static()->ScreenDevice()->ReleaseFont(*fontPtr); |
4040 CEikonEnv::Static()->ScreenDevice()->ReleaseFont(*fontPtr); |
4087 } |
4041 } |
4088 |
4042 |
4089 void CEikEdwin::DrawT2WTextL() const |
4043 void CEikEdwin::DrawFirstLineTextL() const |
4090 { |
4044 { |
4091 if ( iEdwinExtension && iEdwinExtension->iT2WBuf ) |
4045 |
4092 { |
4046 HBufC* clipbuf = GetTextInHBufL(); |
4093 // rect |
4047 CleanupStack::PushL(clipbuf); |
4094 TRect edwinRect = RectForFirstLineText(); |
4048 |
4095 |
4049 TPtrC clipbufPtr = clipbuf->Des(); |
4096 // font |
|
4097 TAknTextLineLayout textLayout = |
|
4098 AknLayoutScalable_Avkon::data_form_wide_pane_t1(0).LayoutLine(); |
|
4099 const CAknLayoutFont* font = AknLayoutUtils::LayoutFontFromId( |
|
4100 textLayout.FontId()); |
|
4101 TFontSpec fontSpec = CursorFontSpec(); |
|
4102 fontSpec.iFontStyle.SetStrokeWeight( EStrokeWeightNormal ); |
|
4103 |
|
4104 CGraphicsDevice* screenDevice = iEikonEnv->ScreenDevice(); |
|
4105 CFbsFont* customFont( NULL ); |
|
4106 TInt err = screenDevice->GetNearestFontInTwips((CFont*&) customFont, |
|
4107 fontSpec); |
|
4108 |
|
4109 //color |
|
4110 TRgb textColor = iEikonEnv->ControlColor(EColorControlText, *this); |
|
4111 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
4112 if ( skin && SkinColorId() != KErrNotFound ) |
|
4113 { |
|
4114 AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, |
|
4115 SkinColorId() ); |
|
4116 } |
|
4117 |
|
4118 // reorder the buffer |
|
4119 TPtrC clipbufPtr = iEdwinExtension->iT2WBuf->Des(); |
|
4120 AknBidiTextUtils::PrepareRunInfoArray( clipbufPtr ); |
|
4121 HBufC* reorderedText = HBufC::NewLC( clipbufPtr.Length() + TBidiLogicalToVisual::KMinCharAvailable); |
|
4122 TPtr reorderedTextPtr = reorderedText->Des(); |
|
4123 TInt width = edwinRect.Size().iWidth; |
|
4124 AknBidiTextUtils::ConvertToVisualAndClip( clipbufPtr, reorderedTextPtr, *font, width, width ); |
|
4125 |
|
4126 CWindowGc& gc = SystemGc(); |
|
4127 gc.SetBrushStyle(CGraphicsContext::ENullBrush); |
|
4128 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
4129 gc.SetPenColor( FadeRgb( textColor, KBlackMap , KWhiteMap ) ); |
|
4130 gc.UseFont( customFont ); |
|
4131 gc.DrawText( reorderedTextPtr, edwinRect, font->TextPaneTopToBaseline(), |
|
4132 AlignForFirstLineText( reorderedTextPtr ) ); |
|
4133 gc.DiscardFont(); |
|
4134 screenDevice->ReleaseFont( customFont ); |
|
4135 CleanupStack::PopAndDestroy( reorderedText ); |
|
4136 } |
|
4137 } |
|
4138 |
|
4139 TRect CEikEdwin::RectForFirstLineText() const |
|
4140 { |
|
4141 TMargins8 margins = Margins(); |
4050 TMargins8 margins = Margins(); |
4142 const TRect rect(Rect()); |
4051 const TRect rect(Rect()); |
4143 TInt cursorWidth = CursorWidth(); // need to add cursor width to right hand margin |
4052 TInt cursorWidth = CursorWidth(); // need to add cursor width to right hand margin |
4144 TRect edwinRect = AknLayoutUtils::RectFromCoords(rect, margins.iLeft, margins.iTop, margins.iRight+cursorWidth, |
4053 TRect edwinRect = AknLayoutUtils::RectFromCoords(rect, margins.iLeft, margins.iTop, margins.iRight+cursorWidth, margins.iBottom, ELayoutEmpty, ELayoutEmpty); |
4145 margins.iBottom, ELayoutEmpty, ELayoutEmpty); |
4054 |
4146 return edwinRect; |
4055 TAknTextLineLayout textLayout = AknLayoutScalable_Avkon::data_form_wide_pane_t1(0).LayoutLine(); |
4147 } |
4056 const CAknLayoutFont* font = AknLayoutUtils::LayoutFontFromId( textLayout.FontId()); |
4148 |
4057 |
4149 CGraphicsContext::TTextAlign CEikEdwin::AlignForFirstLineText( const TPtr & aReorderedTextPtr ) const |
4058 // reorder the text |
4150 { |
4059 AknBidiTextUtils::PrepareRunInfoArray(clipbufPtr); |
|
4060 |
|
4061 HBufC* reorderedText = HBufC::NewLC(clipbufPtr.Length() + TBidiLogicalToVisual::KMinCharAvailable); |
|
4062 TPtr reorderedTextPtr = reorderedText->Des(); |
|
4063 TInt width = edwinRect.Size().iWidth; |
|
4064 AknBidiTextUtils::ConvertToVisualAndClip(clipbufPtr, reorderedTextPtr, *font, width, width); |
|
4065 AknTextUtils::ReplaceCharacters( reorderedTextPtr, _L("\x2029"), TChar(' ') ); |
|
4066 CleanupStack::Pop(reorderedText); |
|
4067 CleanupStack::PopAndDestroy(clipbuf); |
|
4068 CleanupStack::PushL(reorderedText); |
|
4069 |
4151 CGraphicsContext::TTextAlign alignment = CGraphicsContext::ELeft; |
4070 CGraphicsContext::TTextAlign alignment = CGraphicsContext::ELeft; |
4152 switch(CurrentAlignment()) |
4071 switch(CurrentAlignment()) |
4153 { |
4072 { |
4154 case EAknEditorAlignLeft: |
4073 case EAknEditorAlignLeft: |
4155 alignment = CGraphicsContext::ELeft; |
4074 alignment = CGraphicsContext::ELeft; |
4162 break; |
4081 break; |
4163 case EAknEditorAlignNone: // drop through to default |
4082 case EAknEditorAlignNone: // drop through to default |
4164 case EAknEditorAlignBidi: // drop through to default |
4083 case EAknEditorAlignBidi: // drop through to default |
4165 default: |
4084 default: |
4166 { |
4085 { |
4167 if ( TBidiText::TextDirectionality( aReorderedTextPtr ) == TBidiText::ELeftToRight ) |
4086 if (TBidiText::TextDirectionality(reorderedTextPtr) == TBidiText::ELeftToRight) |
4168 alignment = CGraphicsContext::ELeft; |
4087 alignment = CGraphicsContext::ELeft; |
4169 else |
4088 else |
4170 alignment = CGraphicsContext::ERight; |
4089 alignment = CGraphicsContext::ERight; |
4171 } |
4090 } |
4172 break; |
4091 break; |
4173 } |
4092 } |
4174 return alignment; |
|
4175 } |
|
4176 void CEikEdwin::DrawFirstLineTextL() const |
|
4177 { |
|
4178 // rect |
|
4179 TRect edwinRect = RectForFirstLineText(); |
|
4180 // font |
|
4181 TAknTextLineLayout textLayout = AknLayoutScalable_Avkon::data_form_wide_pane_t1(0).LayoutLine(); |
|
4182 const CAknLayoutFont* font = AknLayoutUtils::LayoutFontFromId( textLayout.FontId()); |
|
4183 // reorder the text |
|
4184 HBufC* clipbuf = GetTextInHBufL(); |
|
4185 CleanupStack::PushL(clipbuf); |
|
4186 TPtrC clipbufPtr = clipbuf->Des(); |
|
4187 AknBidiTextUtils::PrepareRunInfoArray( clipbufPtr ); |
|
4188 HBufC* reorderedText = HBufC::NewLC( clipbufPtr.Length() + TBidiLogicalToVisual::KMinCharAvailable ); |
|
4189 TPtr reorderedTextPtr = reorderedText->Des(); |
|
4190 TInt width = edwinRect.Size().iWidth; |
|
4191 AknBidiTextUtils::ConvertToVisualAndClip( clipbufPtr, reorderedTextPtr, *font, width, width ); |
|
4192 AknTextUtils::ReplaceCharacters( reorderedTextPtr, KParagraphSeparator, TChar(' ') ); |
|
4193 CleanupStack::Pop( reorderedText ); |
|
4194 CleanupStack::PopAndDestroy( clipbuf ); |
|
4195 CleanupStack::PushL( reorderedText ); |
|
4196 |
4093 |
4197 CWindowGc& gc=SystemGc(); |
4094 CWindowGc& gc=SystemGc(); |
4198 gc.UseFont( font ); |
4095 gc.UseFont(font); |
4199 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
4096 |
4200 gc.SetPenStyle( CGraphicsContext::ESolidPen ); |
4097 // Following patching up of the GC are now necessary after calling LafCustomDrawerfor background |
4201 gc.SetPenColor( iEikonEnv->ControlColor( EColorControlText, *this ) ); // Text color |
4098 gc.SetBrushStyle(CGraphicsContext::ENullBrush); |
4202 gc.DrawText( reorderedTextPtr, edwinRect, font->TextPaneTopToBaseline(), |
4099 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
4203 AlignForFirstLineText( reorderedTextPtr ) ); |
4100 TRgb textColor=iEikonEnv->ControlColor(EColorControlText,*this); |
4204 CleanupStack::PopAndDestroy(reorderedText); |
4101 |
4205 gc.DiscardFont(); |
4102 gc.SetPenColor(textColor); // Text color |
|
4103 |
|
4104 // Edwin is assumed to be laid out already with LayoutEdwin. In that case |
|
4105 // the textpane top is the top of the edwin |
|
4106 TInt ascent = font->TextPaneTopToBaseline(); |
|
4107 |
|
4108 gc.DrawText(reorderedTextPtr, edwinRect, ascent, alignment); |
|
4109 |
|
4110 CleanupStack::PopAndDestroy(reorderedText); |
|
4111 |
|
4112 gc.DiscardFont(); // So the GC will not try to use the font. |
4206 } |
4113 } |
4207 |
4114 |
4208 EXPORT_C void CEikEdwin::TrappedDraw(const TRect& aViewRect) const |
4115 EXPORT_C void CEikEdwin::TrappedDraw(const TRect& aViewRect) const |
4209 { |
4116 { |
4210 if ( iEdwinExtension && iEdwinExtension->iDrawInvoked == CEikEdwinExtension::ENotDraw ) |
4117 if ( iEdwinExtension && iEdwinExtension->iDrawInvoked == CEikEdwinExtension::ENotDraw ) |
4509 { |
4416 { |
4510 __ASSERT_DEBUG(iText,Panic(EEikPanicEdwinNoText)); |
4417 __ASSERT_DEBUG(iText,Panic(EEikPanicEdwinNoText)); |
4511 return(iText->DocumentLength()); |
4418 return(iText->DocumentLength()); |
4512 } |
4419 } |
4513 |
4420 |
4514 TBool CEikEdwin::IsT2WEnabled() const |
|
4515 { |
|
4516 /** |
|
4517 * 1,If the editor is read only or it is display only "tap to write" is disabled |
|
4518 * 2,If iEdwinExtension->iT2WBuf is NULL, "tap to write" is disabled. |
|
4519 * 3,If Qwerty key borad is opened, "tap to write" is disabled |
|
4520 * 4,If focus off, "tap to write" is disabled |
|
4521 * 5,If split input is enabled, "tap to write" is disabled |
|
4522 */ |
|
4523 return iEdwinExtension && !( iEdwinUserFlags & EReadOnly ) && |
|
4524 !( iEdwinUserFlags & EDisplayOnly ) && iEdwinExtension->iT2WBuf && |
|
4525 ( iEdwinExtension->iT2WState & CEikEdwinExtension::EFocusOn ) && |
|
4526 !( iEdwinExtension->iT2WState & CEikEdwinExtension::ESplitInputEnabled ) && |
|
4527 !( iEdwinExtension->iQwertyStatus ); |
|
4528 } |
|
4529 |
|
4530 void CEikEdwin::SetCursorVisibilityL(TBool aEmphasis) |
4421 void CEikEdwin::SetCursorVisibilityL(TBool aEmphasis) |
4531 { |
4422 { |
4532 TCursor::TVisibility textCursor=(aEmphasis? TCursor::EFCursorFlashing : TCursor::EFCursorInvisible); |
4423 TCursor::TVisibility textCursor=(aEmphasis? TCursor::EFCursorFlashing : TCursor::EFCursorInvisible); |
4533 TCursor::TVisibility lineCursor=((iEdwinUserFlags&ELineCursor && aEmphasis)? |
4424 TCursor::TVisibility lineCursor=((iEdwinUserFlags&ELineCursor && aEmphasis)? |
4534 TCursor::EFCursorVisible : TCursor::EFCursorInvisible); |
4425 TCursor::EFCursorVisible : TCursor::EFCursorInvisible); |
5013 { |
4888 { |
5014 iEdwinExtension->iSmiley->HandleInsertL( lower, undoneLength ); |
4889 iEdwinExtension->iSmiley->HandleInsertL( lower, undoneLength ); |
5015 ConvertTextForSmileyL( TCursorSelection( lower, undoneLength ), ETrue ); |
4890 ConvertTextForSmileyL( TCursorSelection( lower, undoneLength ), ETrue ); |
5016 } |
4891 } |
5017 TRAPD(err2,iTextView->HandleInsertDeleteL(TCursorSelection(lower,lower+undoneLength),newText.Length(),changed)); |
4892 TRAPD(err2,iTextView->HandleInsertDeleteL(TCursorSelection(lower,lower+undoneLength),newText.Length(),changed)); |
5018 // try to draw "tap to write" |
|
5019 TryToDrawT2W(); |
|
5020 ClearUndo(); |
4893 ClearUndo(); |
5021 if (NeedToChangeFormattingModeL()) |
4894 if (NeedToChangeFormattingModeL()) |
5022 SetAmountToFormatL(); |
4895 SetAmountToFormatL(); |
5023 ForceScrollBarUpdateL(); |
4896 ForceScrollBarUpdateL(); |
5024 User::LeaveIfError(err); |
4897 User::LeaveIfError(err); |
5097 } |
4970 } |
5098 const TInt newLength=iText->DocumentLength(); |
4971 const TInt newLength=iText->DocumentLength(); |
5099 const TInt newCursorPos=cursorPos+newLength-oldLength; |
4972 const TInt newCursorPos=cursorPos+newLength-oldLength; |
5100 iTextView->SetPendingSelection(TCursorSelection(newCursorPos,newCursorPos)); |
4973 iTextView->SetPendingSelection(TCursorSelection(newCursorPos,newCursorPos)); |
5101 if (NeedToChangeFormattingModeL()) |
4974 if (NeedToChangeFormattingModeL()) |
5102 { |
|
5103 SetAmountToFormatL(); |
4975 SetAmountToFormatL(); |
5104 } |
|
5105 else |
4976 else |
5106 { |
|
5107 iTextView->HandleInsertDeleteL(TCursorSelection(newCursorPos,cursorPos),0,ETrue); |
4977 iTextView->HandleInsertDeleteL(TCursorSelection(newCursorPos,cursorPos),0,ETrue); |
5108 // try to draw "tap to write" |
|
5109 TryToDrawT2W(); |
|
5110 } |
|
5111 DrawContents(); |
4978 DrawContents(); |
5112 UpdateScrollBarsL(); |
4979 UpdateScrollBarsL(); |
5113 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
4980 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
5114 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
4981 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
5115 iEikonEnv->BusyMsgCancel(); |
4982 iEikonEnv->BusyMsgCancel(); |
5186 const TCursorSelection pending(lower,lower); |
5053 const TCursorSelection pending(lower,lower); |
5187 iTextView->SetPendingSelection(pending); |
5054 iTextView->SetPendingSelection(pending); |
5188 selection.iAnchorPos=lower; |
5055 selection.iAnchorPos=lower; |
5189 selection.iCursorPos=lower; |
5056 selection.iCursorPos=lower; |
5190 iTextView->HandleInsertDeleteL(selection,selLength,formatHasChanged); |
5057 iTextView->HandleInsertDeleteL(selection,selLength,formatHasChanged); |
5191 // try to draw "tap to write" |
|
5192 TryToDrawT2W(); |
|
5193 reportChange=ETrue; |
5058 reportChange=ETrue; |
5194 } |
5059 } |
5195 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(); |
5060 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(); |
5196 dlg->SetTimeout( CAknNoteDialog::EShortTimeout ); |
5061 dlg->SetTimeout( CAknNoteDialog::EShortTimeout ); |
5197 dlg->SetTone( CAknNoteDialog::ENoTone ); |
5062 dlg->SetTone( CAknNoteDialog::ENoTone ); |
6687 selection.iCursorPos=selection.iAnchorPos+aModel->iReplaceText.Length(); |
6548 selection.iCursorPos=selection.iAnchorPos+aModel->iReplaceText.Length(); |
6688 } |
6549 } |
6689 const TCursorSelection pending(selection.iCursorPos,selection.iCursorPos); |
6550 const TCursorSelection pending(selection.iCursorPos,selection.iCursorPos); |
6690 iTextView->SetPendingSelection(pending); |
6551 iTextView->SetPendingSelection(pending); |
6691 iTextView->HandleInsertDeleteL(selection,aModel->iText.Length(),formatHasChanged); |
6552 iTextView->HandleInsertDeleteL(selection,aModel->iText.Length(),formatHasChanged); |
6692 // try to draw "tap to write" |
|
6693 TryToDrawT2W(); |
|
6694 if ( NeedToChangeFormattingModeL()) |
6553 if ( NeedToChangeFormattingModeL()) |
6695 SetAmountToFormatL(); |
6554 SetAmountToFormatL(); |
6696 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
6555 ReportEdwinEventL( MEikEdwinObserver::EEventTextUpdate ); |
6697 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
6556 DoReportEventL( MCoeControlObserver::EEventStateChanged ); |
6698 User::LeaveIfError(err); |
6557 User::LeaveIfError(err); |
7378 iEdwinExtension->iSmiley->HandleInsertL( aInsertPos, aText.Length() ); |
7212 iEdwinExtension->iSmiley->HandleInsertL( aInsertPos, aText.Length() ); |
7379 ConvertTextForSmileyL( TCursorSelection( aInsertPos, |
7213 ConvertTextForSmileyL( TCursorSelection( aInsertPos, |
7380 aInsertPos + aText.Length() ), ETrue ); |
7214 aInsertPos + aText.Length() ), ETrue ); |
7381 } |
7215 } |
7382 iTextView->HandleInsertDeleteL(TCursorSelection(aInsertPos,aInsertPos+aText.Length()),length,formatChanged); |
7216 iTextView->HandleInsertDeleteL(TCursorSelection(aInsertPos,aInsertPos+aText.Length()),length,formatChanged); |
7383 // try to draw "tap to write" |
|
7384 TryToDrawT2W(); |
|
7385 } |
7217 } |
7386 |
7218 |
7387 EXPORT_C void CEikEdwin::SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility) |
7219 EXPORT_C void CEikEdwin::SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility) |
7388 { |
7220 { |
7389 __ASSERT_DEBUG(iLayout,Panic(EEikPanicEdwinNoLayout)); |
7221 __ASSERT_DEBUG(iLayout,Panic(EEikPanicEdwinNoLayout)); |
8635 if ( scroll ) |
8478 if ( scroll ) |
8636 { |
8479 { |
8637 UpdateScrollBarsL(); |
8480 UpdateScrollBarsL(); |
8638 } |
8481 } |
8639 } |
8482 } |
8640 |
|
8641 // --------------------------------------------------------------------------- |
|
8642 // CEikEdwin::MoveViewToCursorLineL |
|
8643 // --------------------------------------------------------------------------- |
|
8644 // |
|
8645 void CEikEdwin::MoveViewToCursorLineL() |
|
8646 { |
|
8647 if ( !iTextView ) |
|
8648 { |
|
8649 return; |
|
8650 } |
|
8651 |
|
8652 const TInt cursorPos ( CursorPos() ); |
|
8653 const TRect viewRect( AdjustedViewRect() ); |
|
8654 |
|
8655 const TPoint startPoint ( viewRect.iTl ); |
|
8656 const TPoint endPoint ( viewRect.iBr ); |
|
8657 |
|
8658 TPoint cursorPoint; |
|
8659 iTextView->DocPosToXyPosL( cursorPos, cursorPoint ); |
|
8660 |
|
8661 if ( cursorPoint.iY > endPoint.iY ) |
|
8662 { |
|
8663 TBool exceed ( EFalse ) ; |
|
8664 TInt rest ( 0 ); |
|
8665 ScrollView ( endPoint.iY - cursorPoint.iY, exceed, rest ); |
|
8666 } |
|
8667 else if ( cursorPoint.iY < startPoint.iY ) |
|
8668 { |
|
8669 TBool exceed ( EFalse ) ; |
|
8670 TInt rest ( 0 ); |
|
8671 ScrollView ( startPoint.iY - cursorPoint.iY, exceed, rest ); |
|
8672 } |
|
8673 } |
|
8674 |
8483 |
8675 EXPORT_C void CEikEdwin::SetCursorVisible(TBool aVisible) |
8484 EXPORT_C void CEikEdwin::SetCursorVisible(TBool aVisible) |
8676 { |
8485 { |
8677 TRAP_IGNORE( SetCursorVisibilityL( aVisible ) ); |
8486 TRAP_IGNORE( SetCursorVisibilityL( aVisible ) ); |
8678 } |
8487 } |
8775 TBool partialScreenEnabled( ( aNewFlags & EAknEditorFlagEnablePartialScreen ) && |
8584 TBool partialScreenEnabled( ( aNewFlags & EAknEditorFlagEnablePartialScreen ) && |
8776 !( aOldFlags & EAknEditorFlagEnablePartialScreen ) ); |
8585 !( aOldFlags & EAknEditorFlagEnablePartialScreen ) ); |
8777 |
8586 |
8778 TBool partialScreenDisabled( !( aNewFlags & EAknEditorFlagEnablePartialScreen ) && |
8587 TBool partialScreenDisabled( !( aNewFlags & EAknEditorFlagEnablePartialScreen ) && |
8779 ( aOldFlags & EAknEditorFlagEnablePartialScreen ) ); |
8588 ( aOldFlags & EAknEditorFlagEnablePartialScreen ) ); |
8780 |
8589 |
8781 if ( IsActivated() && |
8590 if (IsActivated() && |
8782 ( ( textViewHideEnabled && !( aNewFlags & EAknEditorFlagEnablePartialScreen ) ) || |
8591 ( (textViewHideEnabled && !(aNewFlags & EAknEditorFlagEnablePartialScreen)) || |
8783 ( partialScreenDisabled && ( aNewFlags & EAknEditorFlagHideTextView ) ) ) |
8592 (partialScreenDisabled && (aNewFlags & EAknEditorFlagHideTextView)) ) |
8784 ) |
8593 ) |
8785 { |
8594 { |
8786 iTextView->MakeVisible( EFalse ); |
8595 iTextView->MakeVisible( EFalse ); |
8787 iEdwinExtension->iTextViewHidden = ETrue; |
8596 iEdwinExtension->iTextViewHidden = ETrue; |
8788 } |
8597 } |
9472 return ETrue; |
9287 return ETrue; |
9473 } |
9288 } |
9474 } |
9289 } |
9475 |
9290 |
9476 return EFalse; |
9291 return EFalse; |
|
9292 } |
|
9293 |
|
9294 // --------------------------------------------------------------------------- |
|
9295 // CEikEdwin::InlineTextRange |
|
9296 // --------------------------------------------------------------------------- |
|
9297 // |
|
9298 TCursorSelection CEikEdwin::InlineTextRange() const |
|
9299 { |
|
9300 TInt startPosOfInline( 0 ); |
|
9301 TInt endPosOfInline( 0 ); |
|
9302 if ( iEdwinFepSupport ) |
|
9303 { |
|
9304 startPosOfInline = iEdwinFepSupport->iPositionOfInlineTextInDocument; |
|
9305 endPosOfInline = iEdwinFepSupport->iPositionOfInlineTextInDocument + |
|
9306 iEdwinFepSupport->iLengthOfInlineText; |
|
9307 if ( iEdwinFepSupport->iLengthOfInlineText <= 0 ) |
|
9308 { |
|
9309 CAknEdwinState* state( EditorState() ); |
|
9310 if ( state && state->CurrentInlineEditSpan().Length() > 0 ) |
|
9311 { |
|
9312 startPosOfInline = state->CurrentInlineEditSpan().LowerPos(); |
|
9313 endPosOfInline = state->CurrentInlineEditSpan().HigherPos(); |
|
9314 } |
|
9315 } |
|
9316 } |
|
9317 return TCursorSelection( startPosOfInline, endPosOfInline ); |
9477 } |
9318 } |
9478 |
9319 |
9479 |
9320 |
9480 // --------------------------------------------------------------------------- |
9321 // --------------------------------------------------------------------------- |
9481 // ReadSpecialCharFromSCTL |
9322 // ReadSpecialCharFromSCTL |
9545 // bitmap Id, bitmap Mask Id of captioned control |
9386 // bitmap Id, bitmap Mask Id of captioned control |
9546 aReader.Advance( KTInt16Length + KTInt16Length ); |
9387 aReader.Advance( KTInt16Length + KTInt16Length ); |
9547 aReader.ReadTPtrC(); // Process ToolTip |
9388 aReader.ReadTPtrC(); // Process ToolTip |
9548 } |
9389 } |
9549 |
9390 |
9550 // returns the faded color of aColor |
|
9551 // aWhiteMap and aBlackMap parameters control the amount of fading |
|
9552 TRgb FadeRgb(TRgb aColor, TUint8 aBlackMap,TUint8 aWhiteMap) |
|
9553 { |
|
9554 TUint8 fadeMapFactor = aWhiteMap - aBlackMap + 1; |
|
9555 TUint8 fadeMapOffset = aBlackMap; |
|
9556 TInt value = aColor.Internal(); |
|
9557 TInt b = (((value & 0x000000ff) * fadeMapFactor) >> 8) + fadeMapOffset; |
|
9558 TInt g = (((value & 0x0000ff00) * fadeMapFactor) >> 16) + fadeMapOffset; |
|
9559 //the multiplication by iFadeMapFactor can overflow into the sign bit, so we shift down in two steps |
|
9560 TInt r = ((((value & 0x00ff0000) >> 16) * fadeMapFactor) >> 8) + fadeMapOffset; |
|
9561 TInt a = aColor.Alpha(); |
|
9562 return TRgb(r,g,b,a ); |
|
9563 } |
|
9564 |
|
9565 // --------------------------------------------------------------------------- |
|
9566 // CEikEdwin::EnableT2WL |
|
9567 // --------------------------------------------------------------------------- |
|
9568 // |
|
9569 EXPORT_C void CEikEdwin::EnableT2WL( TBool aEnable ) |
|
9570 { |
|
9571 if ( iEdwinExtension ) |
|
9572 { |
|
9573 if ( !aEnable && iEdwinExtension->iT2WBuf ) |
|
9574 { |
|
9575 delete iEdwinExtension->iT2WBuf; |
|
9576 iEdwinExtension->iT2WBuf = NULL; |
|
9577 if ( iTextView ) |
|
9578 { |
|
9579 TryToDrawT2W( ETrue ); |
|
9580 } |
|
9581 } |
|
9582 else if ( aEnable && !iEdwinExtension->iT2WBuf ) |
|
9583 { |
|
9584 CRepository* cenrep = NULL; |
|
9585 TInt supportT2W = 0; |
|
9586 TRAPD(error, cenrep = CRepository::NewL(KCRUidAvkon)); |
|
9587 if ( error == KErrNone ) |
|
9588 { |
|
9589 error = cenrep->Get( KAknEdwinTapToWrite, supportT2W ); |
|
9590 } |
|
9591 delete cenrep; |
|
9592 if ( supportT2W && !iEdwinExtension->iT2WBuf ) |
|
9593 { |
|
9594 iEdwinExtension->iT2WBuf = iEikonEnv->AllocReadResourceLC( R_AVKON_TAP_TO_WRITE ); |
|
9595 CleanupStack::Pop( iEdwinExtension->iT2WBuf ); |
|
9596 if ( iTextView ) |
|
9597 { |
|
9598 TryToDrawT2W(); |
|
9599 } |
|
9600 } |
|
9601 } |
|
9602 } |
|
9603 } |
|
9604 |
|
9605 // --------------------------------------------------------------------------- |
|
9606 // CEikEdwin::TryToDrawT2W |
|
9607 // --------------------------------------------------------------------------- |
|
9608 // |
|
9609 void CEikEdwin::TryToDrawT2W( TBool aClean ) |
|
9610 { |
|
9611 CAknEdwinState* edwinState = EditorState(); |
|
9612 TBool cursorVisible( EFalse ); |
|
9613 if ( edwinState ) |
|
9614 { |
|
9615 cursorVisible = ( edwinState->Flags() | EAknEditorFlagTextCursorVisible ); |
|
9616 } |
|
9617 |
|
9618 if ( iEdwinExtension ) |
|
9619 { |
|
9620 // When "tap to write" is enabled( started ) we should record the status of cursor. |
|
9621 if ( TextLength() == 0 && IsT2WEnabled() ) |
|
9622 { |
|
9623 SetCursorVisible( EFalse ); |
|
9624 iEdwinExtension->iT2WState |= CEikEdwinExtension::ERecordCursor; |
|
9625 if ( cursorVisible ) |
|
9626 { |
|
9627 iEdwinExtension->iT2WState |= CEikEdwinExtension::ECursorVisible; |
|
9628 } |
|
9629 else |
|
9630 { |
|
9631 iEdwinExtension->iT2WState &= ~CEikEdwinExtension::ECursorVisible; |
|
9632 } |
|
9633 DrawDeferred(); |
|
9634 } |
|
9635 // When "tap to write" is disabled ( ended ) we need to recover the status of cursor. |
|
9636 else if ( IsFocused() && |
|
9637 ( iEdwinExtension->iT2WState & CEikEdwinExtension::ERecordCursor ) ) |
|
9638 { |
|
9639 iEdwinExtension->iT2WState &= ~CEikEdwinExtension::ERecordCursor; |
|
9640 SetCursorVisible( iEdwinExtension->iT2WState & CEikEdwinExtension::ECursorVisible ); |
|
9641 } |
|
9642 // When focus off, we don't need to record the status anymore. So clean it. |
|
9643 else if ( !IsFocused() ) |
|
9644 { |
|
9645 iEdwinExtension->iT2WState &= ~CEikEdwinExtension::ERecordCursor; |
|
9646 } |
|
9647 } |
|
9648 |
|
9649 if ( aClean && TextLength() == 0 ) |
|
9650 { |
|
9651 DrawDeferred(); |
|
9652 } |
|
9653 } |
|
9654 |
|
9655 // End of File |
9391 // End of File |
9656 |
9392 |