sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef __WPTEXTED_H__
|
sl@0
|
20 |
#define __WPTEXTED_H__
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <techview/eikrted.h>
|
sl@0
|
23 |
#include "form_and_etext_editor.h"
|
sl@0
|
24 |
#include "EditorUndo.h"
|
sl@0
|
25 |
#include "UndoSystem.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
class CWordUndoGatekeeper : public CBase, public UndoSystem::MNotUndoableGatekeeper
|
sl@0
|
28 |
/**
|
sl@0
|
29 |
@internalComponent
|
sl@0
|
30 |
*/
|
sl@0
|
31 |
{
|
sl@0
|
32 |
// from MNotUndoableGatekeeper
|
sl@0
|
33 |
TBool AllowNotUndoableL(TInt aReason);
|
sl@0
|
34 |
};
|
sl@0
|
35 |
|
sl@0
|
36 |
class CWordTextEditor : public CEikRichTextEditor, public MUnifiedEditor
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
@internalComponent
|
sl@0
|
39 |
*/
|
sl@0
|
40 |
{
|
sl@0
|
41 |
public:
|
sl@0
|
42 |
enum TAttributeValue { EAttributeUndefined = 0, EAttributeSet = 1,
|
sl@0
|
43 |
EAttributeClear = 2, EAttributeIndeterminate = 3 };
|
sl@0
|
44 |
CWordTextEditor(const TGulBorder& aBorder);
|
sl@0
|
45 |
~CWordTextEditor();
|
sl@0
|
46 |
MUnifiedEditor& UnifiedEditor();
|
sl@0
|
47 |
const MUnifiedEditor& UnifiedEditor() const;
|
sl@0
|
48 |
|
sl@0
|
49 |
void InitialiseUnifiedEditorL();
|
sl@0
|
50 |
void InsertCharacterL(TChar aCharacter);
|
sl@0
|
51 |
TBool DeleteSelectionL();
|
sl@0
|
52 |
void DeleteLeftL();
|
sl@0
|
53 |
void DeleteRightL();
|
sl@0
|
54 |
void HighlightL(TUint aEffects);
|
sl@0
|
55 |
void RemoveHighlightL(TUint aEffects);
|
sl@0
|
56 |
TAttributeValue IsHighlighted(TUint aEffects) const;
|
sl@0
|
57 |
void ToggleHighlightL(TUint aEffects);
|
sl@0
|
58 |
inline void RedoL();
|
sl@0
|
59 |
inline TBool CanRedo() const;
|
sl@0
|
60 |
|
sl@0
|
61 |
TInt ClipboardPasteL();
|
sl@0
|
62 |
void ClipboardCutL();
|
sl@0
|
63 |
void ClipboardCopyL() const;
|
sl@0
|
64 |
|
sl@0
|
65 |
void InsertFromHtmlFileL(const TDesC& aFileName);
|
sl@0
|
66 |
|
sl@0
|
67 |
public: // functions overloading non-virtual functions in base classes
|
sl@0
|
68 |
inline void UndoL();
|
sl@0
|
69 |
inline TBool CanUndo() const;
|
sl@0
|
70 |
void BoldItalicUnderlineEventL(TInt aFontFlag);
|
sl@0
|
71 |
|
sl@0
|
72 |
public: // from MUnifiedEditor
|
sl@0
|
73 |
TInt DocumentLength() const;
|
sl@0
|
74 |
void GetText(TInt aPos,TPtrC& aText) const;
|
sl@0
|
75 |
void GetBaseFormatL(TTmCharFormat& aCharFormat,RTmParFormat& aParFormat) const;
|
sl@0
|
76 |
void GetCharFormat(TInt aPos,TFormatLevel aLevel,TTmCharFormatLayer& aFormat,TInt& aRunLength) const;
|
sl@0
|
77 |
void GetParFormatL(TInt aPos,TFormatLevel aLevel,RTmParFormatLayer& aFormat,TInt& aRunLength) const;
|
sl@0
|
78 |
void InsertTextL(TInt aPos,const TDesC& aText,const TDesC* aStyle=NULL,
|
sl@0
|
79 |
const TTmCharFormatLayer* aCharFormat=NULL,const RTmParFormatLayer* aParFormat=NULL);
|
sl@0
|
80 |
void DeleteTextL(TInt aPos,TInt aLength);
|
sl@0
|
81 |
void SetBaseFormatL(const TTmCharFormat& aCharFormat,const RTmParFormat& aParFormat);
|
sl@0
|
82 |
void SetCharFormatL(TInt aPos,TInt aLength,const TTmCharFormatLayer& aFormat);
|
sl@0
|
83 |
void SetParFormatL(TInt aPos,TInt aLength,const RTmParFormatLayer& aFormat);
|
sl@0
|
84 |
void DeleteCharFormatL(TInt aPos,TInt aLength);
|
sl@0
|
85 |
void DeleteParFormatL(TInt aPos,TInt aLength);
|
sl@0
|
86 |
MTmOptionalInterface* Interface(TUint aId);
|
sl@0
|
87 |
void TestRunNotUndoableCommandL();
|
sl@0
|
88 |
void SetBookmark();
|
sl@0
|
89 |
TBool IsAtBookmark() const;
|
sl@0
|
90 |
void ResetUndo();
|
sl@0
|
91 |
private: // from CCoeControl
|
sl@0
|
92 |
void HandleResourceChange(TInt aType);
|
sl@0
|
93 |
void FocusChanged(TDrawNow aDrawNow);
|
sl@0
|
94 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
|
sl@0
|
95 |
|
sl@0
|
96 |
private:
|
sl@0
|
97 |
TFormAndEtextEditor iFormAndEtextEditor;
|
sl@0
|
98 |
CEditorWithUndo* iEditorWithUndo;
|
sl@0
|
99 |
UndoSystem::CCommandManager* iCommandManager;
|
sl@0
|
100 |
CWordUndoGatekeeper iGatekeeper;
|
sl@0
|
101 |
};
|
sl@0
|
102 |
|
sl@0
|
103 |
inline void CWordTextEditor::RedoL()
|
sl@0
|
104 |
{
|
sl@0
|
105 |
if (iEditorWithUndo)
|
sl@0
|
106 |
iEditorWithUndo->RedoL();
|
sl@0
|
107 |
}
|
sl@0
|
108 |
inline TBool CWordTextEditor::CanRedo() const
|
sl@0
|
109 |
{return iEditorWithUndo && iEditorWithUndo->CanRedo();}
|
sl@0
|
110 |
inline void CWordTextEditor::UndoL()
|
sl@0
|
111 |
{
|
sl@0
|
112 |
if (iEditorWithUndo)
|
sl@0
|
113 |
iEditorWithUndo->UndoL();
|
sl@0
|
114 |
}
|
sl@0
|
115 |
inline TBool CWordTextEditor::CanUndo() const
|
sl@0
|
116 |
{return iEditorWithUndo && iEditorWithUndo->CanUndo();}
|
sl@0
|
117 |
|
sl@0
|
118 |
#endif
|