webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp
branchRCL_3
changeset 92 e1bea15f9a39
parent 84 800203832575
child 93 79859ed3eea9
equal deleted inserted replaced
91:30342f40acbf 92:e1bea15f9a39
   158                     state->SetPermittedInputModes(EAknEditorSecretAlphaInputMode | EAknEditorNumericInputMode);
   158                     state->SetPermittedInputModes(EAknEditorSecretAlphaInputMode | EAknEditorNumericInputMode);
   159                     state->SetDefaultCase(EAknEditorLowerCase);
   159                     state->SetDefaultCase(EAknEditorLowerCase);
   160                     state->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_LATIN_ONLY);
   160                     state->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_LATIN_ONLY);
   161                     state->SetNumericKeymap(EAknEditorStandardNumberModeKeymap);
   161                     state->SetNumericKeymap(EAknEditorStandardNumberModeKeymap);
   162                     state->SetCcpuState(NULL);
   162                     state->SetCcpuState(NULL);
   163                     TLanguage language = User::Language();
   163                     TRAP_IGNORE( state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate ) );
   164                     if (language == ELangPrcChinese ) {
       
   165                        TRAP_IGNORE( state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate ) );
       
   166                     }
       
   167                 }
   164                 }
   168             }
   165             }
   169             else {
   166             else {
   170                     CreateTextFormatMask();
   167                     CreateTextFormatMask();
   171                     TUint currentCase ( EAknEditorLowerCase ) ;
   168                     TUint currentCase ( EAknEditorLowerCase ) ;
   257             // Set up the input capabilities, based on the <input> box
   254             // Set up the input capabilities, based on the <input> box
   258             TUint caps = TCoeInputCapabilities::ENavigation;
   255             TUint caps = TCoeInputCapabilities::ENavigation;
   259 
   256 
   260             if ( sc->isInPasswordField() ) {
   257             if ( sc->isInPasswordField() ) {
   261                 caps |= TCoeInputCapabilities::ESecretText;
   258                 caps |= TCoeInputCapabilities::ESecretText;
   262                 UpdateFlagsState(EAknEditorFlagNoT9);
   259                 UpdateFlagsState(EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly);
   263             }
   260             }
   264             else {
   261             else {
   265 
   262 
   266                 CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
   263                 CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
   267                 if ( state ) {
   264                 if ( state ) {
   443 {
   440 {
   444     // The other part of the rather hackish way to check if we are at the end of the editing field
   441     // The other part of the rather hackish way to check if we are at the end of the editing field
   445     // see WebEditorClient::handleKeypress
   442     // see WebEditorClient::handleKeypress
   446     Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
   443     Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
   447     Node*  focusedNode = frame->document()->focusedNode();
   444     Node*  focusedNode = frame->document()->focusedNode();
   448     if ( frame && focusedNode) {
   445     if ( focusedNode ) {
   449         TInt lowPos = aCursorSelection.LowerPos();
   446         TInt lowPos = aCursorSelection.LowerPos();
   450         TInt highPos = aCursorSelection.HigherPos();
   447         TInt highPos = aCursorSelection.HigherPos();
   451         if (focusedNode->hasTagName(HTMLNames::textareaTag)) {
   448         if (focusedNode->hasTagName(HTMLNames::textareaTag)) {
   452             HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(focusedNode);
   449             HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(focusedNode);
   453             textArea->setSelectionRange(lowPos, highPos);
   450             textArea->setSelectionRange(lowPos, highPos);
   470 {
   467 {
   471     aCursorSelection.SetSelection(0,0);
   468     aCursorSelection.SetSelection(0,0);
   472 
   469 
   473     Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
   470     Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
   474     Node*  focusedNode = frame->document()->focusedNode();
   471     Node*  focusedNode = frame->document()->focusedNode();
   475     if (frame && focusedNode) {
   472     if (focusedNode) {
   476         if (focusedNode->hasTagName(HTMLNames::textareaTag)) {
   473         if (focusedNode->hasTagName(HTMLNames::textareaTag)) {
   477             HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(focusedNode);
   474             HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(focusedNode);
   478             TInt anchorPos = textArea->selectionStart();
   475             TInt anchorPos = textArea->selectionStart();
   479             TInt cursorPos = textArea->selectionEnd();
   476             TInt cursorPos = textArea->selectionEnd();
   480             aCursorSelection.SetSelection(cursorPos, anchorPos);
   477             aCursorSelection.SetSelection(cursorPos, anchorPos);
   553 		int xPos(0);
   550 		int xPos(0);
   554 		int yPos(0);
   551 		int yPos(0);
   555 		if ( sc ){
   552 		if ( sc ){
   556 			IntRect rect = sc->caretRect();
   553 			IntRect rect = sc->caretRect();
   557 			Node* editNode = sc->focusNode();
   554 			Node* editNode = sc->focusNode();
   558 			TPoint viewPoint = kit(frame)->frameView()->frameCoordsInViewCoords(editNode->getRect().Rect().iBr);
   555 			if ( editNode && editNode->isTextNode() ) {
   559 			xPos = viewPoint.iX;
   556                 TPoint viewPoint = kit(frame)->frameView()->frameCoordsInViewCoords(editNode->getRect().Rect().iBr);
   560 			yPos = frame->document()->focusedNode()->getRect().bottomLeft().y() + rect.height();
   557 	            xPos = viewPoint.iX;
   561 			String str;
   558 	            yPos = frame->document()->focusedNode()->getRect().bottomLeft().y() + rect.height();
   562 			if ( editNode &&
   559 	            
   563 				 editNode->isTextNode() ) {
   560 	            String str;				
   564 				WebCore::Text* aText = (WebCore::Text*)editNode;
   561 	            WebCore::Text* aText = (WebCore::Text*)editNode;
   565 				str = aText->data();
   562 				str = aText->data();
   566 				aDocumentPosition =  aText->length();
   563 				aDocumentPosition =  aText->length();
   567 				TInt position = aDocumentPosition - ( str.reverseFind(KBlankDesC(), aDocumentPosition )+1);
   564 				TInt position = aDocumentPosition - ( str.reverseFind(KBlankDesC(), aDocumentPosition )+1);
   568 				String word(str);
   565 				String word(str);
   569 				if( position > 0 ){
   566 				if( position > 0 ){
  1123 //
  1120 //
  1124 //
  1121 //
  1125 // -----------------------------------------------------------------------------
  1122 // -----------------------------------------------------------------------------
  1126 TBool CWebFepTextEditor::CcpuIsFocused() const
  1123 TBool CWebFepTextEditor::CcpuIsFocused() const
  1127 {
  1124 {
  1128     return ETrue;
  1125     return (IsTextAreaFocused() || IsInputElementFocused());
  1129 }
  1126 }
  1130 
  1127 
  1131 // -----------------------------------------------------------------------------
  1128 // -----------------------------------------------------------------------------
  1132 // CcpuCanCut
  1129 // CcpuCanCut
  1133 //
  1130 //