443 SelectionController* sc = frame->selectionController(); |
443 SelectionController* sc = frame->selectionController(); |
444 Node* editNode = sc->base().node(); |
444 Node* editNode = sc->base().node(); |
445 if ( frame && frame->document()->focusedNode() ) { |
445 if ( frame && frame->document()->focusedNode() ) { |
446 if ( IsTextAreaFocused() ) { |
446 if ( IsTextAreaFocused() ) { |
447 HTMLTextAreaElement* ie = static_cast<HTMLTextAreaElement*>(frame->document()->focusedNode()); |
447 HTMLTextAreaElement* ie = static_cast<HTMLTextAreaElement*>(frame->document()->focusedNode()); |
448 while(editNode && !editNode->isTextNode()) |
448 while(editNode && !editNode->isTextNode()) { |
449 editNode = editNode->previousSibling(); |
449 editNode = editNode->previousSibling(); |
|
450 } |
450 TInt len( 0 ); |
451 TInt len( 0 ); |
451 if ( editNode ) { |
452 if ( editNode ) { |
452 findPrevSiblingTextLen( editNode, len ); |
453 findPrevSiblingTextLen( editNode, len ); |
453 } |
454 } |
454 aCursorSelection.SetSelection( ((sc->baseOffset()+len > ie->value().length()) ? 0 : sc->baseOffset()+len), |
455 aCursorSelection.SetSelection( ((sc->baseOffset()+len > ie->value().length()) ? 0 : sc->baseOffset()+len), |
455 ((sc->extentOffset()+len > ie->value().length()) ? 0 : sc->baseOffset()+len)); |
456 ((sc->extentOffset()+len > ie->value().length()) ? 0 : sc->extentOffset()+len)); |
456 } |
457 } |
457 else { |
458 else { |
458 aCursorSelection.SetSelection(sc->baseOffset(), sc->extentOffset()); |
459 aCursorSelection.SetSelection(sc->baseOffset(), sc->extentOffset()); |
459 } |
460 } |
460 } |
461 } |
742 |
743 |
743 state->SetDefaultInputMode(inputMode); |
744 state->SetDefaultInputMode(inputMode); |
744 state->SetCurrentInputMode(inputMode); |
745 state->SetCurrentInputMode(inputMode); |
745 state->SetPermittedInputModes(permittedInputModes); |
746 state->SetPermittedInputModes(permittedInputModes); |
746 state->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(numericKeyMap)); |
747 state->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(numericKeyMap)); |
|
748 state->ReportAknEdStateEventL(MAknEdStateObserver::EAknSyncEdwinState); |
747 state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateInputModeUpdate); |
749 state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateInputModeUpdate); |
748 } |
750 } |
749 |
751 |
750 // ----------------------------------------------------------------------------- |
752 // ----------------------------------------------------------------------------- |
751 // UpdateCaseState |
753 // UpdateCaseState |
1177 { |
1179 { |
1178 if ( DocumentLengthForFep()== 0) |
1180 if ( DocumentLengthForFep()== 0) |
1179 return ; |
1181 return ; |
1180 TCursorSelection selection; |
1182 TCursorSelection selection; |
1181 GetCursorSelectionForFep(selection); |
1183 GetCursorSelectionForFep(selection); |
1182 |
1184 TInt len = DocumentLengthForFep(); |
1183 HBufC* buf = HBufC::NewLC(512); |
1185 |
|
1186 HBufC* buf = HBufC::NewLC(len); |
1184 TPtr ptr(buf->Des()); |
1187 TPtr ptr(buf->Des()); |
1185 |
1188 |
1186 GetEditorContentForFep(ptr,0,DocumentLengthForFep()); |
1189 GetEditorContentForFep(ptr,0,len); |
1187 CPlainText* text = CPlainText::NewL(CPlainText::EFlatStorage); |
1190 CPlainText* text = CPlainText::NewL(CPlainText::EFlatStorage); |
1188 |
1191 |
1189 text->InsertL(0,*buf); |
1192 text->InsertL(0,*buf); |
1190 text->CopyToStoreL(aStore, aDict, selection.LowerPos(), selection.Length()); |
1193 text->CopyToStoreL(aStore, aDict, selection.LowerPos(), selection.Length()); |
1191 |
1194 |
1293 TStreamId streamId=aDict.At(KClipboardUidTypePlainText); |
1296 TStreamId streamId=aDict.At(KClipboardUidTypePlainText); |
1294 TCursorSelection selection; |
1297 TCursorSelection selection; |
1295 GetCursorSelectionForFep(selection); |
1298 GetCursorSelectionForFep(selection); |
1296 const TInt cursorPos=selection.LowerPos(); |
1299 const TInt cursorPos=selection.LowerPos(); |
1297 |
1300 |
1298 HBufC* buf1 = HBufC::NewLC(512); |
1301 TInt len = DocumentLengthForFep(); |
|
1302 HBufC* buf1 = HBufC::NewLC(len); |
1299 TPtr ptr1(buf1->Des()); |
1303 TPtr ptr1(buf1->Des()); |
1300 |
1304 |
1301 CPlainText* text = CPlainText::NewL(CPlainText::EFlatStorage); |
1305 CPlainText* text = CPlainText::NewL(CPlainText::EFlatStorage); |
1302 |
1306 |
1303 GetEditorContentForFep(ptr1,0,DocumentLengthForFep()); |
1307 GetEditorContentForFep(ptr1,0,len); |
1304 |
1308 |
1305 text->InsertL(0,*buf1); |
1309 text->InsertL(0,*buf1); |
1306 |
1310 |
1307 TInt charPasted = text->PasteFromStoreL(aStore,aDict,cursorPos); |
1311 TInt charPasted = text->PasteFromStoreL(aStore,aDict,cursorPos); |
1308 |
1312 |
1309 HBufC* buf = HBufC::NewLC(512); |
1313 HBufC* buf = HBufC::NewLC(charPasted); |
1310 TPtr ptr(buf->Des()); |
1314 TPtr ptr(buf->Des()); |
1311 text->Extract(ptr,cursorPos,charPasted); |
1315 text->Extract(ptr,cursorPos,charPasted); |
1312 |
1316 |
1313 //remove Paragraph Delimiter |
1317 //remove Paragraph Delimiter |
1314 TInt position = ptr.Mid(0).LocateReverse(TChar(CEditableText::EParagraphDelimiter)); |
1318 TInt position = ptr.Mid(0).LocateReverse(TChar(CEditableText::EParagraphDelimiter)); |
1391 for ( ; aNode; aNode=aNode->nextSibling() ) { |
1395 for ( ; aNode; aNode=aNode->nextSibling() ) { |
1392 if ( aNode && aNode->isTextNode() ) { |
1396 if ( aNode && aNode->isTextNode() ) { |
1393 WebCore::Text* aText = (WebCore::Text*)aNode; |
1397 WebCore::Text* aText = (WebCore::Text*)aNode; |
1394 str = aText->data(); |
1398 str = aText->data(); |
1395 len += str.length(); |
1399 len += str.length(); |
1396 if ( len > aPos ) { |
1400 if ( len >= aPos ) { |
1397 // We found the text node at aPos, calculate the length of all |
1401 // We found the text node at aPos, calculate the length of all |
1398 // previous text nodes |
1402 // previous text nodes |
1399 retNode = aNode; |
1403 retNode = aNode; |
1400 aPos = len - str.length(); |
1404 aPos = len - str.length(); |
1401 break; |
1405 break; |