|
1 /* |
|
2 * Copyright (c) 2002 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 "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: Implementation of Notepad/Template Editor. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "NpdRichTextEditor.h" |
|
20 #include "NpdEdwinBase.h" |
|
21 #include "NpdDialogBase.h" |
|
22 #include "NpdLibPanic.h" |
|
23 #include "NpdViewerDialog.h" |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CNotepadRichTextEditor::DoEditorLayoutL |
|
28 // Sets the layout of the Edwin and the scrollbar. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 void CNotepadRichTextEditor::DoEditorLayoutL() |
|
32 { |
|
33 iEdwinBase->DoEditorLayoutL(); |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CNotepadRichTextEditor::InitNotepadEditorL |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 void CNotepadRichTextEditor::InitNotepadEditorL( |
|
41 CEikDialog* aParent,CNotepadEdwinLines* aEdwinLines) |
|
42 { |
|
43 iEdwinBase->InitNotepadEditorL(aParent,ETrue,aEdwinLines); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CNotepadRichTextEditor::InitNotepadEditorL |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 void CNotepadRichTextEditor::ConstructBaseL(CNotepadDialogBase* aBaseDialog) |
|
51 { |
|
52 iEdwinBase = new (ELeave) CNotepadEdwinBase(); |
|
53 iEdwinBase->Share(this,this); |
|
54 iBaseDialog = aBaseDialog; |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CNotepadRichTextEditor::SetBackgroundColorL |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 void CNotepadRichTextEditor::SetBackgroundColorL() |
|
62 { |
|
63 iEdwinBase->SetBackgroundColorL(); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CNotepadRichTextEditor::HandleResourceChange |
|
68 // from CCoeControl |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 void CNotepadRichTextEditor::HandleResourceChange(TInt aType) |
|
72 { |
|
73 iEdwinBase->HandleResourceChange(aType); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CNotepadRichTextEditor::Draw |
|
78 // from CCoeControl |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CNotepadRichTextEditor::Draw(const TRect& aRect) const |
|
82 { |
|
83 iEdwinBase->Draw(aRect); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // CNotepadRichTextEditor::MopSupplyObject(TTypeUid aId) |
|
88 // Gets an object whose type is encapsulated by |
|
89 // the specified TTypeUid object. |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 TTypeUid::Ptr CNotepadRichTextEditor::MopSupplyObject(TTypeUid aId) |
|
93 { |
|
94 TTypeUid::Ptr ptr = TTypeUid::Null(); |
|
95 if(iEdwinBase->SupplyMopObject(aId,ptr)) |
|
96 return ptr; |
|
97 return CCoeControl::MopSupplyObject(aId); |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------- |
|
101 // CNotepadRichTextEditor::~CNotepadRichTextEditor() |
|
102 // Destructor |
|
103 // --------------------------------------------------------- |
|
104 // |
|
105 CNotepadRichTextEditor::~CNotepadRichTextEditor() |
|
106 { |
|
107 delete iEdwinBase; |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------- |
|
111 // CNotepadEdwin::GetLayout() |
|
112 // returns reference to iLayout |
|
113 // --------------------------------------------------------- |
|
114 // |
|
115 |
|
116 CTextLayout& CNotepadRichTextEditor::GetLayout() |
|
117 { |
|
118 return *iLayout; |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------- |
|
122 // CNotepadEdwin::GetLayout() |
|
123 // returns reference to iTextView |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 CTextView& CNotepadRichTextEditor::GetTextView() |
|
127 { |
|
128 return *iTextView; |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------- |
|
132 // CNotepadEdwin::GetLayout() |
|
133 // Calls SetCanDrawOusideRect() |
|
134 // --------------------------------------------------------- |
|
135 // |
|
136 void CNotepadRichTextEditor::CallSetCanDrawOutsideRect() |
|
137 { |
|
138 SetCanDrawOutsideRect(); |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------- |
|
142 // CNotepadEdwin::GetLayout() |
|
143 // returns reference to iCoeEnv |
|
144 // --------------------------------------------------------- |
|
145 // |
|
146 |
|
147 CCoeEnv& CNotepadRichTextEditor::GetCoeEnv() |
|
148 { |
|
149 return *iCoeEnv; |
|
150 } |
|
151 |
|
152 void CNotepadRichTextEditor::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
153 { |
|
154 __ASSERT_DEBUG( iBaseDialog, Panic(ENotepadLibraryPanicNoEdwin) ); |
|
155 static_cast<CNotepadViewerDialog*> (iBaseDialog)->HandleDialogPointerEventL(aPointerEvent); |
|
156 |
|
157 CEikRichTextEditor::HandlePointerEventL(aPointerEvent); |
|
158 } |
|
159 |
|
160 // End of File |