|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: WebFepEditor.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <Browser_platform_variant.hrh> |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <fepbase.h> |
|
24 #include <coeinput.h> |
|
25 #include <fepipext.h> |
|
26 #include <frmtlay.h> |
|
27 #include <AknExtendedInputCapabilities.h> |
|
28 #include <eikccpu.h> |
|
29 #include <baclipb.h> |
|
30 |
|
31 #include "PlatformString.h" |
|
32 #include "Node.h" |
|
33 |
|
34 #ifndef WEBFEPTEXTEDITOR_H |
|
35 #define WEBFEPTEXTEDITOR_H |
|
36 |
|
37 using namespace WebCore; |
|
38 |
|
39 class WebView; |
|
40 class WebTextFormatMask; |
|
41 |
|
42 class CWebFepTextEditor : public CBase, |
|
43 public MObjectProvider, |
|
44 public MCoeFepAwareTextEditor, |
|
45 public MCoeFepAwareTextEditor_Extension1, |
|
46 public TCoeInputCapabilities::MCoeFepSpecificExtensions, |
|
47 public MEikCcpuEditor |
|
48 { |
|
49 public: |
|
50 CWebFepTextEditor(WebView* aView); |
|
51 ~CWebFepTextEditor(); |
|
52 |
|
53 void UpdateEditingMode(); |
|
54 void CancelEditingMode(); |
|
55 void ActivatePenInputRequest(); |
|
56 void DeactivatePenInputRequest(); |
|
57 TCoeInputCapabilities InputCapabilities(); |
|
58 |
|
59 public: |
|
60 // from MCoeFepAwareTextEditor |
|
61 virtual void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit); |
|
62 virtual void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText); |
|
63 virtual void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility); |
|
64 virtual void CancelFepInlineEdit(); |
|
65 virtual TInt DocumentLengthForFep() const; |
|
66 virtual TInt DocumentMaximumLengthForFep() const; |
|
67 virtual void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection); |
|
68 virtual void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const; |
|
69 virtual void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const; // must cope with aDocumentPosition being outside the range 0 to DocumentLengthForFep() |
|
70 virtual void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const; |
|
71 virtual void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, TInt aDocumentPosition) const; |
|
72 virtual void DoCommitFepInlineEditL(); |
|
73 virtual MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue); |
|
74 virtual void MCoeFepAwareTextEditor_Reserved_2(); |
|
75 |
|
76 // from MCoeFepAwareTextEditor_Extension1 |
|
77 void SetStateTransferingOwnershipL(CState* aState, TUid aTypeSafetyUid); |
|
78 CState* State(TUid aTypeSafetyUid); // this function does *not* transfer ownership |
|
79 virtual void StartFepInlineEditL(TBool& aSetToTrue, const TCursorSelection& aCursorSelection, const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit); |
|
80 virtual void SetCursorType(TBool& aSetToTrue, const TTextCursor& aTextCursor); |
|
81 virtual void MCoeFepAwareTextEditor_Extension1_Reserved_3(){}; |
|
82 virtual void MCoeFepAwareTextEditor_Extension1_Reserved_4(){}; |
|
83 |
|
84 // from TCoeInputCapabilities::MCoeFepSpecificExtensions |
|
85 virtual TBool IsValidCharacter(TInt aChar); |
|
86 virtual void MCoeFepSpecificExtensions_Reserved_1(){}; |
|
87 virtual void MCoeFepSpecificExtensions_Reserved_2(){}; |
|
88 |
|
89 // from MObjectProvider |
|
90 virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
91 |
|
92 // from MEikCcpuEditor |
|
93 virtual TBool CcpuIsFocused() const; |
|
94 virtual TBool CcpuCanCut() const; |
|
95 virtual void CcpuCutL(); |
|
96 virtual TBool CcpuCanCopy() const; |
|
97 virtual void CcpuCopyL(); |
|
98 virtual TBool CcpuCanPaste() const; |
|
99 virtual void CcpuPasteL(); |
|
100 virtual TBool CcpuCanUndo() const{return EFalse;} |
|
101 virtual void CcpuUndoL(){ } |
|
102 |
|
103 public: |
|
104 |
|
105 void UpdateFlagsState(TUint flags); |
|
106 void UpdateInputModeState(TUint inputMode, TUint permittedInputModes, TUint numericKeyMap); |
|
107 void UpdateCaseState(TUint currentCase, TUint permittedCase); |
|
108 bool GetStateFromFormatMask(TUint& currentCase, TUint& permittedCase, TUint& inputMode, TUint& permittedInputModes, TUint& flags, TUint& numericKeyMap); |
|
109 |
|
110 void HandleUpdateCursor(); |
|
111 void UpdateInlineText(const TDesC& aText); |
|
112 void ClearInlineText(); |
|
113 |
|
114 void CreateTextFormatMask(); |
|
115 bool validateTextFormat(); |
|
116 |
|
117 TBool IsDirectionRTL(); |
|
118 |
|
119 #if defined(BRDO_BROWSER_50_FF) |
|
120 void SetAlignment(CAknExtendedInputCapabilities::TInputCapabilities aAlignment); |
|
121 #endif // BRDO_BROWSER_50_FF |
|
122 |
|
123 bool IsTextAreaFocused() const; |
|
124 |
|
125 void EnableCcpu(TBool aSupport); |
|
126 void DoCcpuCanPasteL() const; |
|
127 void PlaceDataOnClipboardL(); |
|
128 void RetrieveDataFromClipboardL(); |
|
129 void PasteFromStoreL(CStreamStore& aStore,CStreamDictionary& aDict); |
|
130 void CopyToStoreL(CStreamStore& aStore,CStreamDictionary& aDict); |
|
131 |
|
132 private: |
|
133 void findPrevSiblingTextLen(Node*, TInt&) const; |
|
134 Node* findTextNodeForCurPos(Node* aNode, TInt& aPos) const; |
|
135 |
|
136 private: |
|
137 CState* m_state; |
|
138 WebView* m_webView; |
|
139 WebTextFormatMask* m_textFormatMask; |
|
140 HBufC* m_inlineEditText; |
|
141 String m_inputTextColor; |
|
142 CAknExtendedInputCapabilities* m_ExtendedInputCapabilities; |
|
143 }; |
|
144 |
|
145 #endif |