equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "emailtrace.h" |
18 #include "emailtrace.h" |
19 #include "cesmrncseditor.h" |
19 #include "cesmrncseditor.h" |
|
20 #include "nmrcolormanager.h" |
20 |
21 |
21 #include <avkon.hrh> |
22 #include <avkon.hrh> |
22 #include <aknenv.h> // CAknEnv |
23 #include <aknenv.h> // CAknEnv |
23 #include <txtrich.h> |
24 #include <txtrich.h> |
24 #include <AknUtils.h> // AknLayoutUtils |
25 #include <aknutils.h> // AknLayoutUtils |
25 #include <txtglobl.h> |
26 #include <txtglobl.h> |
26 |
27 |
27 #include <AknsConstants.h> |
28 #include <aknsconstants.h> |
28 #include <AknsUtils.h> |
29 #include <aknsutils.h> |
29 #include <AknsSkinInstance.h> |
30 #include <aknsskininstance.h> |
30 #include <AknsBasicBackgroundControlContext.h> |
31 #include <aknsbasicbackgroundcontrolcontext.h> |
31 |
32 |
32 #include "cesmrlayoutmgr.h" |
|
33 |
33 |
34 // ======== MEMBER FUNCTIONS ======== |
34 // ======== MEMBER FUNCTIONS ======== |
35 |
35 |
36 // --------------------------------------------------------------------------- |
36 // --------------------------------------------------------------------------- |
37 // constructor |
37 // constructor |
51 // ----------------------------------------------------------------------------- |
51 // ----------------------------------------------------------------------------- |
52 // |
52 // |
53 CESMRNcsEditor::~CESMRNcsEditor() |
53 CESMRNcsEditor::~CESMRNcsEditor() |
54 { |
54 { |
55 FUNC_LOG; |
55 FUNC_LOG; |
56 delete iBgContext; |
|
57 } |
56 } |
58 |
57 |
59 // ----------------------------------------------------------------------------- |
58 // ----------------------------------------------------------------------------- |
60 // CESMRNcsEditor::GetLineRectL() const |
59 // CESMRNcsEditor::GetLineRectL() const |
61 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
131 UpdateColors(); |
130 UpdateColors(); |
132 } |
131 } |
133 } |
132 } |
134 |
133 |
135 // ----------------------------------------------------------------------------- |
134 // ----------------------------------------------------------------------------- |
136 // CESMRNcsEditor::SetRect |
135 // CESMRNcsEditor::FocusChanged |
137 // ----------------------------------------------------------------------------- |
136 // ----------------------------------------------------------------------------- |
138 // |
137 // |
139 void CESMRNcsEditor::SetRect( const TRect& aRect ) |
138 void CESMRNcsEditor::FocusChanged( TDrawNow aDrawNow ) |
140 { |
139 { |
141 FUNC_LOG; |
140 CEikRichTextEditor::FocusChanged( aDrawNow ); |
142 CCoeControl::SetRect( aRect ); |
141 } |
143 |
142 |
144 if ( iBgContext ) |
143 // ----------------------------------------------------------------------------- |
145 { |
144 // CESMRNcsEditor::HandlePointerEventL |
146 iBgContext->SetRect( aRect ); |
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void CESMRNcsEditor::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
148 { |
|
149 if ( Rect().Contains( aPointerEvent.iPosition ) ) |
|
150 { |
|
151 switch ( aPointerEvent.iType ) |
|
152 { |
|
153 case TPointerEvent::EButton1Down: |
|
154 case TPointerEvent::EButton1Up: |
|
155 { |
|
156 CEikRichTextEditor::HandlePointerEventL( aPointerEvent ); |
|
157 break; |
|
158 } |
|
159 default: |
|
160 { |
|
161 break; |
|
162 } |
|
163 } |
147 } |
164 } |
148 } |
165 } |
149 |
166 |
150 // ----------------------------------------------------------------------------- |
167 // ----------------------------------------------------------------------------- |
151 // CESMRNcsEditor::HandleResourceChange |
168 // CESMRNcsEditor::HandleResourceChange |
202 TInt lineCount = iLayout->GetLineNumber( TextLength() ); |
219 TInt lineCount = iLayout->GetLineNumber( TextLength() ); |
203 lineCount++; |
220 lineCount++; |
204 return lineCount; |
221 return lineCount; |
205 } |
222 } |
206 |
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CESMRNcsEditor::ScrollableLines() const |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
207 TInt CESMRNcsEditor::ScrollableLines() const |
228 TInt CESMRNcsEditor::ScrollableLines() const |
208 { |
229 { |
209 FUNC_LOG; |
230 FUNC_LOG; |
210 TRect lineRect; |
231 TRect lineRect; |
211 // First get the rect for one line |
232 // First get the rect for one line |
214 TInt lines = rect.Height()/lineRect.Height(); |
235 TInt lines = rect.Height()/lineRect.Height(); |
215 return lines; |
236 return lines; |
216 } |
237 } |
217 |
238 |
218 // ----------------------------------------------------------------------------- |
239 // ----------------------------------------------------------------------------- |
219 // CESMRNcsEditor::PositionChanged() const |
240 // CESMRNcsEditor::PositionChanged() |
220 // ----------------------------------------------------------------------------- |
241 // ----------------------------------------------------------------------------- |
221 // |
242 // |
222 void CESMRNcsEditor::PositionChanged() |
243 void CESMRNcsEditor::PositionChanged() |
223 { |
244 { |
224 FUNC_LOG; |
245 FUNC_LOG; |
304 |
325 |
305 HBufC* text = NULL; |
326 HBufC* text = NULL; |
306 TRAPD( error, text = GetTextInHBufL()); |
327 TRAPD( error, text = GetTextInHBufL()); |
307 if (error!= KErrNone) |
328 if (error!= KErrNone) |
308 { |
329 { |
309 CEikonEnv::Static()-> // codescanner::eikonenvstatic |
330 iCoeEnv->HandleError(error); |
310 HandleError(error); |
|
311 } |
331 } |
312 |
332 |
313 // if we are adding or removing multiple characters check |
333 // if we are adding or removing multiple characters check |
314 // if we have default text |
334 // if we have default text |
315 if ( iDefaultText && ( aExtent > 1 || aExtent < -1 ) ) |
335 if ( iDefaultText && ( aExtent > 1 || aExtent < -1 ) ) |
425 |
445 |
426 // ----------------------------------------------------------------------------- |
446 // ----------------------------------------------------------------------------- |
427 // CESMRNcsEditor::SetFontL |
447 // CESMRNcsEditor::SetFontL |
428 // ----------------------------------------------------------------------------- |
448 // ----------------------------------------------------------------------------- |
429 // |
449 // |
430 void CESMRNcsEditor::SetFontL( const CFont* aFont, CESMRLayoutManager* aLayout ) |
450 void CESMRNcsEditor::SetFontL( const CFont* aFont ) |
431 { |
451 { |
432 FUNC_LOG; |
452 FUNC_LOG; |
433 const CFont* font = aFont; |
453 const CFont* font = aFont; |
434 TFontSpec fontSpec = font->FontSpecInTwips(); |
454 TFontSpec fontSpec = font->FontSpecInTwips(); |
435 |
455 |
447 |
467 |
448 formatMask.SetAttrib( EAttFontTypeface ); |
468 formatMask.SetAttrib( EAttFontTypeface ); |
449 formatMask.SetAttrib( EAttFontHeight ); |
469 formatMask.SetAttrib( EAttFontHeight ); |
450 formatMask.SetAttrib( EAttFontPosture ); |
470 formatMask.SetAttrib( EAttFontPosture ); |
451 formatMask.SetAttrib( EAttFontStrokeWeight ); |
471 formatMask.SetAttrib( EAttFontStrokeWeight ); |
452 |
472 formatMask.SetAttrib(EAttFontHighlightColor); |
453 charFormat.iFontPresentation.iTextColor = aLayout->NormalTextColor(); |
|
454 formatMask.SetAttrib( EAttColor ); |
473 formatMask.SetAttrib( EAttColor ); |
|
474 |
|
475 charFormat.iFontPresentation.iTextColor = |
|
476 NMRColorManager::Color( NMRColorManager::EMRMainAreaTextColor ); |
|
477 |
|
478 charFormat.iFontPresentation.iHighlightColor = |
|
479 NMRColorManager::Color( NMRColorManager::EMRCutCopyPasteHighlightColor ); |
455 |
480 |
456 CParaFormatLayer* paraFormatLayer = |
481 CParaFormatLayer* paraFormatLayer = |
457 CParaFormatLayer::NewL( paraFormat, paraFormatMask ); |
482 CParaFormatLayer::NewL( paraFormat, paraFormatMask ); |
458 CleanupStack::PushL( paraFormatLayer ); |
483 CleanupStack::PushL( paraFormatLayer ); |
459 CCharFormatLayer* charFormatLayer = |
484 CCharFormatLayer* charFormatLayer = |