webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp
changeset 65 5bfc169077b2
parent 38 6297cdf66332
child 68 92a765b5b3e7
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
    13 *
    13 *
    14 * Description:   WebFepTextEditor.cpp
    14 * Description:   WebFepTextEditor.cpp
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 
       
    20 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    18 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    21 #include <txtetext_internal.h>
    19 #include <txtetext_internal.h>
    22 #include <txtclipboard.h>
    20 #include <txtclipboard.h>
    23 #include <txtetext_internal.h>
    21 #include <txtetext_internal.h>
    24 #endif
    22 #endif
    52 #include <eikpanic.h>
    50 #include <eikpanic.h>
    53 #include <aknedsts.h>
    51 #include <aknedsts.h>
    54 #include <aknutils.h>
    52 #include <aknutils.h>
    55 #include "Text.h"
    53 #include "Text.h"
    56 
    54 
    57 #define KLineEnterChar 0x21b2
       
    58 
       
    59 using namespace WebCore;
    55 using namespace WebCore;
    60 
    56 
    61 static const int kInfinite = -1;
    57 static const int kInfinite = -1;
    62 _LIT(KBlankDesC," ");
    58 _LIT(KBlankDesC," ");
    63 
    59 
    73 //
    69 //
    74 // -----------------------------------------------------------------------------
    70 // -----------------------------------------------------------------------------
    75 CWebFepTextEditor::CWebFepTextEditor(WebView* aView)
    71 CWebFepTextEditor::CWebFepTextEditor(WebView* aView)
    76     : m_webView(aView),
    72     : m_webView(aView),
    77       m_textFormatMask(NULL),
    73       m_textFormatMask(NULL),
    78       m_inlineEditText(NULL),
    74       m_inlineEditText(NULL)
    79       m_longKeyPress(EFalse)
       
    80 {
    75 {
    81     // Set up the extended capabilities
    76     // Set up the extended capabilities
    82     TRAP_IGNORE(
    77     TRAP_IGNORE(
    83         m_ExtendedInputCapabilities = CAknExtendedInputCapabilities::NewL();
    78         m_ExtendedInputCapabilities = CAknExtendedInputCapabilities::NewL();
    84         );
    79         );
    86     // Set alignment on m_ExtendedInputCapabilities, yes it checks if NULL
    81     // Set alignment on m_ExtendedInputCapabilities, yes it checks if NULL
    87     // The EInputEditorAlignXXX flags are defined for 5.0+ platforms
    82     // The EInputEditorAlignXXX flags are defined for 5.0+ platforms
    88 #if defined(BRDO_BROWSER_50_FF)
    83 #if defined(BRDO_BROWSER_50_FF)
    89     SetAlignment( CAknExtendedInputCapabilities::EInputEditorAlignBidi );
    84     SetAlignment( CAknExtendedInputCapabilities::EInputEditorAlignBidi );
    90 #endif
    85 #endif
    91     TRAP_IGNORE( EnableCcpuL() );
    86 	EnableCcpu(ETrue);
    92 }
    87 }
    93 
    88 
    94 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
    95 // ~CWebFepTextEditor
    90 // ~CWebFepTextEditor
    96 //
    91 //
   100     {
    95     {
   101     delete m_state;
    96     delete m_state;
   102     delete m_inlineEditText;
    97     delete m_inlineEditText;
   103     delete m_textFormatMask;
    98     delete m_textFormatMask;
   104 	delete m_ExtendedInputCapabilities;
    99 	delete m_ExtendedInputCapabilities;
   105 	delete m_CcpuSupport;
       
   106     }
   100     }
   107 
   101 
   108 // -----------------------------------------------------------------------------
   102 // -----------------------------------------------------------------------------
   109 // CreateTextFormatMask
   103 // CreateTextFormatMask
   110 //
   104 //
   133 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
   134 void CWebFepTextEditor::UpdateEditingMode()
   128 void CWebFepTextEditor::UpdateEditingMode()
   135 {
   129 {
   136     Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
   130     Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
   137     if (frame) {
   131     if (frame) {
   138         Node *node = frame->document()->focusedNode(); 
   132         Node *node = frame->document()->focusedNode();
   139         if (frame && frame->document() && node) {
   133         if (frame && frame->document() && node) {
   140             if (node->hasTagName(HTMLNames::inputTag) 
   134             if (node->hasTagName(HTMLNames::inputTag)
   141                     && (static_cast<HTMLInputElement*>(node)->inputType() == HTMLInputElement::PASSWORD) 
   135                     && (static_cast<HTMLInputElement*>(node)->inputType() == HTMLInputElement::PASSWORD)
   142                         && !static_cast<HTMLInputElement*>(node)->readOnly()) {            
   136                         && !static_cast<HTMLInputElement*>(node)->readOnly()) {
   143                 // Set the state as if it was the CEikSecretEditor
   137                 // Set the state as if it was the CEikSecretEditor
   144                 CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
   138                 CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
   145                 if (state) {
   139                 if (state) {
   146                     state->SetFlags( EAknEditorFlagNoLRNavigation |
   140                     state->SetFlags( EAknEditorFlagNoLRNavigation |
   147                                         EAknEditorFlagLatinInputModesOnly |
   141                                         EAknEditorFlagLatinInputModesOnly |
   163                     TUint permittedCase ( EAknEditorAllCaseModes ) ;
   157                     TUint permittedCase ( EAknEditorAllCaseModes ) ;
   164                     TUint inputMode( EAknEditorNullInputMode );
   158                     TUint inputMode( EAknEditorNullInputMode );
   165                     TUint permittedInputModes( EAknEditorAllInputModes );
   159                     TUint permittedInputModes( EAknEditorAllInputModes );
   166                     TUint flags( EAknEditorFlagDefault );
   160                     TUint flags( EAknEditorFlagDefault );
   167                     TUint numericKeyMap( EAknEditorStandardNumberModeKeymap );
   161                     TUint numericKeyMap( EAknEditorStandardNumberModeKeymap );
   168     
   162 
   169                     if (GetStateFromFormatMask(currentCase, permittedCase, inputMode, permittedInputModes, flags, numericKeyMap)) {
   163                     if (GetStateFromFormatMask(currentCase, permittedCase, inputMode, permittedInputModes, flags, numericKeyMap)) {
   170                         UpdateFlagsState(flags);
   164                         UpdateFlagsState(flags);
   171                         UpdateInputModeState(inputMode, permittedInputModes, numericKeyMap);
   165                         UpdateInputModeState(inputMode, permittedInputModes, numericKeyMap);
   172                         UpdateCaseState(currentCase, permittedCase);
   166                         UpdateCaseState(currentCase, permittedCase);
   173                     }
   167                     }
   194     delete m_textFormatMask;
   188     delete m_textFormatMask;
   195     m_textFormatMask = NULL;
   189     m_textFormatMask = NULL;
   196 
   190 
   197     delete m_inlineEditText;
   191     delete m_inlineEditText;
   198     m_inlineEditText = NULL;
   192     m_inlineEditText = NULL;
   199     
       
   200     m_longKeyPress = EFalse ;
       
   201 
   193 
   202     UpdateInputModeState(EAknEditorNullInputMode, EAknEditorAllInputModes,EAknEditorStandardNumberModeKeymap);
   194     UpdateInputModeState(EAknEditorNullInputMode, EAknEditorAllInputModes,EAknEditorStandardNumberModeKeymap);
   203     UpdateFlagsState(EAknEditorFlagDefault);        
   195     UpdateFlagsState(EAknEditorFlagDefault);
   204     UpdateCaseState(EAknEditorLowerCase, EAknEditorAllCaseModes);
   196     UpdateCaseState(EAknEditorLowerCase, EAknEditorAllCaseModes);
   205 
   197 
   206     CancelFepInlineEdit();
   198     CancelFepInlineEdit();
   207     }
   199     }
   208 
   200 
   345 //
   337 //
   346 //
   338 //
   347 // -----------------------------------------------------------------------------
   339 // -----------------------------------------------------------------------------
   348 void CWebFepTextEditor::CancelFepInlineEdit()
   340 void CWebFepTextEditor::CancelFepInlineEdit()
   349 {
   341 {
   350     if (IsTextAreaFocused()) {
       
   351         if (m_inlineEditText && DocumentLengthForFep() < DocumentMaximumLengthForFep()) {
       
   352             HBufC* tempBuf = HBufC::NewLC(DocumentLengthForFep());
       
   353             TPtr ptr(tempBuf->Des());
       
   354             GetEditorContentForFep(ptr, 0, DocumentLengthForFep());
       
   355             TInt position = ptr.Locate(KLineEnterChar);
       
   356             if(position != KErrNotFound){
       
   357                 TRAP_IGNORE(m_webView->fepTextEditor()->DoCommitFepInlineEditL());
       
   358                 Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
       
   359 				if(frame){
       
   360                 	frame->editor()->execCommand("BackwardDelete");
       
   361 				}
       
   362             }
       
   363             CleanupStack::PopAndDestroy();
       
   364         }
       
   365     }
       
   366 }
   342 }
   367 
   343 
   368 // -----------------------------------------------------------------------------
   344 // -----------------------------------------------------------------------------
   369 // DocumentLengthForFep
   345 // DocumentLengthForFep
   370 //
   346 //
   410 
   386 
   411 	// Override the length if a text format mask is set
   387 	// Override the length if a text format mask is set
   412 	if ( m_textFormatMask && m_textFormatMask->getMultitude() > 0 )
   388 	if ( m_textFormatMask && m_textFormatMask->getMultitude() > 0 )
   413         length = m_textFormatMask->getMultitude();
   389         length = m_textFormatMask->getMultitude();
   414 
   390 
   415     if (IsLongKeyPress() && 
       
   416         (KMaxTInt != length))
       
   417         length += 1 ;
       
   418     // TextArea node has no member function maxLength(), so return KMaxTInt
   391     // TextArea node has no member function maxLength(), so return KMaxTInt
   419     return length;
   392     return length;
   420 }
   393 }
   421 
   394 
   422 // -----------------------------------------------------------------------------
   395 // -----------------------------------------------------------------------------
   582         if (frame){
   555         if (frame){
   583             if(IsWapMaskedModeInput(frame)) {
   556             if(IsWapMaskedModeInput(frame)) {
   584                 HandleMaskedInsertText(frame, (String(*m_inlineEditText)));
   557                 HandleMaskedInsertText(frame, (String(*m_inlineEditText)));
   585             }
   558             }
   586             else {
   559             else {
   587                 frame->editor()->insertTextWithoutSendingTextEvent(String(*m_inlineEditText), false);  
   560                 frame->editor()->insertTextWithoutSendingTextEvent(String(*m_inlineEditText), false);
   588             }
   561             }
   589         }
   562         }
   590     }
   563     }
   591     //delete the m_inlineEditText since text is commited
   564     //delete the m_inlineEditText since text is commited
   592     delete m_inlineEditText;
   565     delete m_inlineEditText;
   593     m_inlineEditText = NULL;
   566     m_inlineEditText = NULL;
   594     
       
   595     m_longKeyPress = EFalse;
       
   596 
   567 
   597     HandleUpdateCursor();
   568     HandleUpdateCursor();
   598     UpdateEditingMode();
   569     UpdateEditingMode();
   599 }
   570 }
   600 
   571 
   662         MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
   633         MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,
   663         MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit)
   634         MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit)
   664 {
   635 {
   665     aSetToTrue=ETrue;
   636     aSetToTrue=ETrue;
   666     SetCursorSelectionForFepL(aCursorSelection);
   637     SetCursorSelectionForFepL(aCursorSelection);
   667     m_longKeyPress = ETrue ;
       
   668     StartFepInlineEditL(aInitialInlineText, aPositionOfInsertionPointInInlineText, aCursorVisibility, aCustomDraw, aInlineTextFormatRetriever, aPointerEventHandlerDuringInlineEdit);
   638     StartFepInlineEditL(aInitialInlineText, aPositionOfInsertionPointInInlineText, aCursorVisibility, aCustomDraw, aInlineTextFormatRetriever, aPointerEventHandlerDuringInlineEdit);
   669 }
   639 }
   670 
   640 
   671 // -----------------------------------------------------------------------------
   641 // -----------------------------------------------------------------------------
   672 // SetCursorType
   642 // SetCursorType
   730     else {
   700     else {
   731         state->SetFlags(flags | EAknEditorFlagUseSCTNumericCharmap);
   701         state->SetFlags(flags | EAknEditorFlagUseSCTNumericCharmap);
   732     	}
   702     	}
   733 
   703 
   734     state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate);
   704     state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate);
   735     if (m_CcpuSupport)
       
   736     {
       
   737         TRAP_IGNORE(m_CcpuSupport->HandleFocusChangeL());
       
   738     }
       
   739 }
   705 }
   740 
   706 
   741 // -----------------------------------------------------------------------------
   707 // -----------------------------------------------------------------------------
   742 // UpdateInputModeState
   708 // UpdateInputModeState
   743 //
   709 //
   803     // MAknEdStateObserver::EAknCursorPositionChanged
   769     // MAknEdStateObserver::EAknCursorPositionChanged
   804 
   770 
   805     CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
   771     CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
   806     if ( state ) {
   772     if ( state ) {
   807         TRAP_IGNORE( state->ReportAknEdStateEventL( MAknEdStateObserver::EAknCursorPositionChanged ) );
   773         TRAP_IGNORE( state->ReportAknEdStateEventL( MAknEdStateObserver::EAknCursorPositionChanged ) );
   808 		if (m_CcpuSupport)
       
   809 		{
       
   810 			TRAP_IGNORE(m_CcpuSupport->HandleSelectionChangeL());
       
   811 		}
       
   812     }
   774     }
   813 }
   775 }
   814 
   776 
   815 // -----------------------------------------------------------------------------
   777 // -----------------------------------------------------------------------------
   816 // GetStateFromFormatMask
   778 // GetStateFromFormatMask
   829 
   791 
   830         TInt cursorpos = DocumentLengthForFep();
   792         TInt cursorpos = DocumentLengthForFep();
   831         TInputFormatMaskType fm = m_textFormatMask->getInputFormatMaskType(frame, cursorpos);
   793         TInputFormatMaskType fm = m_textFormatMask->getInputFormatMaskType(frame, cursorpos);
   832         if (!cursorpos) {
   794         if (!cursorpos) {
   833             while(fm == EStatic) {
   795             while(fm == EStatic) {
   834                 fm = m_textFormatMask->getInputFormatMaskType(frame, ++cursorpos); 
   796                 fm = m_textFormatMask->getInputFormatMaskType(frame, ++cursorpos);
   835             }
   797             }
   836         }
   798         }
   837         setSCTAvailability(true);
   799         setSCTAvailability(true);
   838         switch( fm ) {
   800         switch( fm ) {
   839             case ELeUpSymPuc:       //A any upper case letter or symbolic
   801             case ELeUpSymPuc:       //A any upper case letter or symbolic
   941 
   903 
   942         if (!m_textFormatMask->checkText(input->value(), eb)) {
   904         if (!m_textFormatMask->checkText(input->value(), eb)) {
   943             style->setProperty(CSS_PROP_COLOR, "red", false, ec);
   905             style->setProperty(CSS_PROP_COLOR, "red", false, ec);
   944             return false;
   906             return false;
   945         }
   907         }
   946         else if ( m_textFormatMask->acceptAll() )
       
   947         {
       
   948             return true;
       
   949         }
       
   950         else
   908         else
   951         {
   909         {
   952             style->setProperty(CSS_PROP_COLOR, m_inputTextColor, false, ec);
   910             style->setProperty(CSS_PROP_COLOR, m_inputTextColor, false, ec);
   953             CancelEditingMode();
   911             CancelEditingMode();
   954             return true;
   912             return true;
  1107 // -----------------------------------------------------------------------------
  1065 // -----------------------------------------------------------------------------
  1108 TBool CWebFepTextEditor::CcpuCanCut() const
  1066 TBool CWebFepTextEditor::CcpuCanCut() const
  1109 {
  1067 {
  1110     TCursorSelection selection;
  1068     TCursorSelection selection;
  1111     GetCursorSelectionForFep(selection);
  1069     GetCursorSelectionForFep(selection);
  1112     return m_CcpuSupport && selection.Length();
  1070     return selection.Length();
  1113 }
  1071 }
  1114 
  1072 
  1115 // -----------------------------------------------------------------------------
  1073 // -----------------------------------------------------------------------------
  1116 // CcpuCutL
  1074 // CcpuCutL
  1117 //
  1075 //
  1120 void CWebFepTextEditor::CcpuCutL()
  1078 void CWebFepTextEditor::CcpuCutL()
  1121 {
  1079 {
  1122     PlaceDataOnClipboardL();
  1080     PlaceDataOnClipboardL();
  1123     TCursorSelection selection;
  1081     TCursorSelection selection;
  1124     GetCursorSelectionForFep(selection);
  1082     GetCursorSelectionForFep(selection);
  1125     Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
       
  1126     if (frame) {      
       
  1127         frame->editor()->deleteWithDirection(SelectionController::BACKWARD,
       
  1128             CharacterGranularity, false, true);
       
  1129         }
       
  1130     HandleUpdateCursor();
       
  1131 }
  1083 }
  1132 
  1084 
  1133 // -----------------------------------------------------------------------------
  1085 // -----------------------------------------------------------------------------
  1134 // CcpuCanCopy
  1086 // CcpuCanCopy
  1135 //
  1087 //
  1137 // -----------------------------------------------------------------------------
  1089 // -----------------------------------------------------------------------------
  1138 TBool CWebFepTextEditor::CcpuCanCopy() const
  1090 TBool CWebFepTextEditor::CcpuCanCopy() const
  1139 {
  1091 {
  1140     TCursorSelection selection;
  1092     TCursorSelection selection;
  1141     GetCursorSelectionForFep(selection);
  1093     GetCursorSelectionForFep(selection);
  1142     return m_CcpuSupport && selection.Length();
  1094     return selection.Length();
  1143 }
  1095 }
  1144 
  1096 
  1145 // -----------------------------------------------------------------------------
  1097 // -----------------------------------------------------------------------------
  1146 // CcpuCopyL
  1098 // CcpuCopyL
  1147 //
  1099 //
  1158 //
  1110 //
  1159 // -----------------------------------------------------------------------------
  1111 // -----------------------------------------------------------------------------
  1160 TBool CWebFepTextEditor::CcpuCanPaste() const
  1112 TBool CWebFepTextEditor::CcpuCanPaste() const
  1161 {
  1113 {
  1162     TRAPD(err, DoCcpuCanPasteL());
  1114     TRAPD(err, DoCcpuCanPasteL());
  1163     return (err == KErrNone) && m_CcpuSupport;
  1115     return err == KErrNone;
  1164 }
  1116 }
  1165 
  1117 
  1166 // -----------------------------------------------------------------------------
  1118 // -----------------------------------------------------------------------------
  1167 // CcpuPasteL
  1119 // CcpuPasteL
  1168 //
  1120 //
  1177 // DoCcpuCanPasteL
  1129 // DoCcpuCanPasteL
  1178 //
  1130 //
  1179 //
  1131 //
  1180 // -----------------------------------------------------------------------------
  1132 // -----------------------------------------------------------------------------
  1181 void  CWebFepTextEditor::DoCcpuCanPasteL() const
  1133 void  CWebFepTextEditor::DoCcpuCanPasteL() const
  1182 {
  1134 { 
  1183     CClipboard* cb=CClipboard::NewForReadingL(CCoeEnv::Static()->FsSession());
  1135     CClipboard* cb=CClipboard::NewForReadingL(CCoeEnv::Static()->FsSession());
  1184     CleanupStack::PushL(cb);
  1136     CleanupStack::PushL(cb);
  1185     TStreamId streamId=cb->StreamDictionary().At(KClipboardUidTypePlainText);
  1137     TStreamId streamId=cb->StreamDictionary().At(KClipboardUidTypePlainText);
  1186     if (streamId==KNullStreamId)
  1138     if (streamId==KNullStreamId)
  1187         User::Leave(KErrNotFound);
  1139         User::Leave(KErrNotFound);
  1228     CleanupStack::PopAndDestroy();
  1180     CleanupStack::PopAndDestroy();
  1229 }
  1181 }
  1230 
  1182 
  1231 // -----------------------------------------------------------------------------
  1183 // -----------------------------------------------------------------------------
  1232 // HandleMaskedInsertText
  1184 // HandleMaskedInsertText
  1233 // 
  1185 //
  1234 // 
  1186 //
  1235 // -----------------------------------------------------------------------------
  1187 // -----------------------------------------------------------------------------
  1236 void CWebFepTextEditor::HandleMaskedInsertText(WebCore::Frame *frame, const String& text)
  1188 void CWebFepTextEditor::HandleMaskedInsertText(WebCore::Frame *frame, const String& text)
  1237 {
  1189 {
  1238     TInt pos = DocumentLengthForFep();
  1190     TInt pos = DocumentLengthForFep();
  1239     if (!pos) {
  1191     if (!pos) {
  1261 }
  1213 }
  1262 
  1214 
  1263 // -----------------------------------------------------------------------------
  1215 // -----------------------------------------------------------------------------
  1264 // HandleMaskedDeleteText
  1216 // HandleMaskedDeleteText
  1265 //
  1217 //
  1266 //  
  1218 //
  1267 // -----------------------------------------------------------------------------
  1219 // -----------------------------------------------------------------------------
  1268 void CWebFepTextEditor::HandleMaskedDeleteText(WebCore::Frame* frame)
  1220 void CWebFepTextEditor::HandleMaskedDeleteText(WebCore::Frame* frame)
  1269 {
  1221 {
  1270     TCursorSelection selection;
  1222     TCursorSelection selection;
  1271     GetCursorSelectionForFep(selection);
  1223     GetCursorSelectionForFep(selection);
  1283 }
  1235 }
  1284 
  1236 
  1285 // -----------------------------------------------------------------------------
  1237 // -----------------------------------------------------------------------------
  1286 // IsWapMaskedModeInput
  1238 // IsWapMaskedModeInput
  1287 //
  1239 //
  1288 //  
  1240 //
  1289 // -----------------------------------------------------------------------------
  1241 // -----------------------------------------------------------------------------
  1290 bool CWebFepTextEditor::IsWapMaskedModeInput(WebCore::Frame* frame)
  1242 bool CWebFepTextEditor::IsWapMaskedModeInput(WebCore::Frame* frame)
  1291 {
  1243 {
  1292     bool maskedInput(false);
  1244     bool maskedInput(false);
  1293     if (m_textFormatMask && frame->document() && frame->document()->focusedNode()) { 
  1245     if (m_textFormatMask && frame->document() && frame->document()->focusedNode()) {
  1294         RenderStyle* s = frame->document()->focusedNode()->renderStyle();
  1246         RenderStyle* s = frame->document()->focusedNode()->renderStyle();
  1295         if (s && (!s->wapInputFormat().isEmpty() || s->wapInputRequired())){            
  1247         if (s && (!s->wapInputFormat().isEmpty() || s->wapInputRequired())){
  1296             maskedInput = true;
  1248             maskedInput = true;
  1297         }
  1249         }
  1298     }
  1250     }
  1299     return maskedInput;
  1251     return maskedInput;
  1300 }
  1252 }
  1364 // -----------------------------------------------------------------------------
  1316 // -----------------------------------------------------------------------------
  1365 // EnableCcpu
  1317 // EnableCcpu
  1366 //
  1318 //
  1367 //
  1319 //
  1368 // -----------------------------------------------------------------------------
  1320 // -----------------------------------------------------------------------------
  1369 void CWebFepTextEditor::EnableCcpuL()
  1321 void CWebFepTextEditor::EnableCcpu(TBool aSupport)
  1370 {
  1322 {
  1371     CAknCcpuSupport* ccpu = NULL;
       
  1372     CAknEdwinState* edwinState = static_cast<CAknEdwinState*>(this->State(KNullUid));
  1323     CAknEdwinState* edwinState = static_cast<CAknEdwinState*>(this->State(KNullUid));
  1373     ccpu = new(ELeave) CAknCcpuSupport(this);
  1324     if(aSupport)
  1374     ccpu->SetMopParent(this);
       
  1375     CleanupStack::PushL(ccpu);
       
  1376     ccpu->ConstructL();
       
  1377     CleanupStack::Pop(ccpu);
       
  1378     delete m_CcpuSupport;
       
  1379     m_CcpuSupport = ccpu;
       
  1380     if (edwinState)
       
  1381         {
  1325         {
  1382         edwinState->SetCcpuState(this);    
  1326         edwinState->SetCcpuState(this);
  1383         edwinState->SetMenu();
  1327         }
  1384         if (edwinState->MenuBar())
  1328     else
  1385             edwinState->MenuBar()->SetEditMenuObserver( m_CcpuSupport );
  1329         {
  1386         }        
  1330         edwinState->SetCcpuState(NULL);
       
  1331         }
  1387 }
  1332 }
  1388 
  1333 
  1389 // -----------------------------------------------------------------------------
  1334 // -----------------------------------------------------------------------------
  1390 // findPrevSiblingTextLen
  1335 // findPrevSiblingTextLen
  1391 //
  1336 //
  1450 }
  1395 }
  1451 
  1396 
  1452 // -----------------------------------------------------------------------------
  1397 // -----------------------------------------------------------------------------
  1453 // SetSCTAvailability
  1398 // SetSCTAvailability
  1454 //
  1399 //
  1455 // Set availibility of the special character table. 
  1400 // Set availibility of the special character table.
  1456 // -----------------------------------------------------------------------------
  1401 // -----------------------------------------------------------------------------
  1457 void CWebFepTextEditor::setSCTAvailability(bool aAvailable)
  1402 void CWebFepTextEditor::setSCTAvailability(bool aAvailable)
  1458 {
  1403 {
  1459     if (m_ExtendedInputCapabilities) {
  1404     if (m_ExtendedInputCapabilities) {
  1460         TUint capabilities = m_ExtendedInputCapabilities->Capabilities();
  1405         TUint capabilities = m_ExtendedInputCapabilities->Capabilities();
  1466         }
  1411         }
  1467         m_ExtendedInputCapabilities->SetCapabilities(capabilities);
  1412         m_ExtendedInputCapabilities->SetCapabilities(capabilities);
  1468     }
  1413     }
  1469 }
  1414 }
  1470 
  1415 
  1471 // -----------------------------------------------------------------------------
       
  1472 // FocusChanging
       
  1473 //
       
  1474 // Called when the focus of the node changes, to commit the text 
       
  1475 // -----------------------------------------------------------------------------
       
  1476 void CWebFepTextEditor::FocusChanging()
       
  1477     { 
       
  1478     CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
       
  1479     if ( state ) {
       
  1480         TRAP_IGNORE( state->ReportAknEdStateEventL(MAknEdStateObserver::EAknSyncEdwinState ) );
       
  1481     }
       
  1482     CommitFepInlineEditL(*CEikonEnv::Static());
       
  1483     CancelEditingMode();    
       
  1484     } 
       
  1485 
       
  1486 // -----------------------------------------------------------------------------
       
  1487 // IsLongKeyPress
       
  1488 //
       
  1489 // Called to know the status of the key pressed 
       
  1490 // -----------------------------------------------------------------------------
       
  1491 TBool CWebFepTextEditor::IsLongKeyPress() const
       
  1492     {
       
  1493     return m_longKeyPress ;	
       
  1494     }
       
  1495