|
1 /* |
|
2 * Copyright (c) 1997-1999 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #if !defined(__EIKEDWIN_H__) |
|
20 #define __EIKEDWIN_H__ |
|
21 |
|
22 #include <s32std.h> |
|
23 #include <gdi.h> |
|
24 #include <txtetext.h> |
|
25 #include <medobsrv.h> |
|
26 #include <gulutil.h> |
|
27 #include <fepbase.h> |
|
28 #include <frmvis.h> |
|
29 #include <frmtview.h> |
|
30 #include <uikon.hrh> |
|
31 #include <eikon.hrh> |
|
32 #include <eikbctrl.h> |
|
33 #include <eikedwob.h> |
|
34 #include <eiksbfrm.h> |
|
35 #include <eikccpu.h> |
|
36 #include <eiklay.h> |
|
37 #include <lafmain.h> |
|
38 #include <AknPictographDrawerInterface.h> |
|
39 #include <babitflags.h> |
|
40 #include <centralrepository.h> // class CCenRepNotifyHandler; |
|
41 #include <cenrepnotifyhandler.h> // class CRepository; |
|
42 |
|
43 class CGlobalText; |
|
44 class CParaFormatLayer; |
|
45 class CCharFormatLayer; |
|
46 class MLayDoc; |
|
47 class CEikEdwinFepSupport; |
|
48 class CLafEdwinCustomDrawBase; |
|
49 class CClipboard; |
|
50 class CAknEdwinFormAccessor; |
|
51 class CAknEdwinState; |
|
52 class CAknInputPolicyManager; |
|
53 class CFormCursorModifier; |
|
54 class CTextView; |
|
55 class MAknsControlContext; |
|
56 class CAknEdwinDrawingModifier; |
|
57 class CAknEdwinFormExtendedInterfaceProvider; |
|
58 class CAknPhoneNumberInlineTextSource; |
|
59 class CAknNoMatchesIndicatorInlineTextSource; |
|
60 class CAknInlineTextSource; |
|
61 class CAknPictographInterface; |
|
62 class CAknExtendedInputCapabilities; |
|
63 class CAknPointerEventSuppressor; |
|
64 class CSmileyManager; |
|
65 class CSmileyCustomWrap; |
|
66 class CAknEdwinPhysicsHandler; |
|
67 class CEdwinAsyncFormat; |
|
68 class MAknsSkinInstance; |
|
69 |
|
70 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin |
|
71 class CEikAvkonCustomDraw; |
|
72 |
|
73 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin |
|
74 class CEikAvkonCustomDraw; |
|
75 |
|
76 // For construction of Rich Text - based custom formatters |
|
77 class CRichText; |
|
78 class CAknPhysics; |
|
79 |
|
80 enum TReplaceOption |
|
81 { |
|
82 ENoReplace, |
|
83 EReplaceOnce, |
|
84 EReplaceAll, |
|
85 EReplaceSkip |
|
86 }; |
|
87 |
|
88 /** |
|
89 * This describes the features of a |
|
90 * search-and-replace operation on a CEikEdwin. |
|
91 * |
|
92 * See CEikEdwin::ReplaceL(). |
|
93 */ |
|
94 struct SEdwinFindModel |
|
95 { |
|
96 /** Flags for the search (see CEikEdwin::TFindFlags) */ |
|
97 TInt iFlags; // TEdwinFindFlags |
|
98 /** Text to search for. */ |
|
99 TBuf<EEikEdwinFindStringMaxLen> iText; |
|
100 /** Text to replace it with. */ |
|
101 TBuf<EEikEdwinFindStringMaxLen> iReplaceText; |
|
102 /** Replace options. */ |
|
103 TReplaceOption iReplaceOption; |
|
104 }; |
|
105 |
|
106 /** |
|
107 * Styles for highlighting. See SetHighlightStyleL(). |
|
108 */ |
|
109 enum TAknsHighlightStyle |
|
110 { |
|
111 /** Normal highlighting. */ |
|
112 EEikEdwinHighlightNormal = 0, |
|
113 /** Link highlighting. */ |
|
114 EEikEdwinHighlightLink |
|
115 }; |
|
116 |
|
117 // inline utility to handle RGB values (set / unset) |
|
118 |
|
119 class SAknRgb |
|
120 { |
|
121 // data (private) |
|
122 TRgb iValue; |
|
123 TBool iIsSet; |
|
124 public: // utilities |
|
125 SAknRgb():iIsSet(EFalse){} |
|
126 TRgb Value(){return iValue;} |
|
127 SAknRgb& operator=(TRgb aRgb) |
|
128 { |
|
129 iValue = aRgb; |
|
130 iIsSet = ETrue; |
|
131 return *this; |
|
132 } |
|
133 TBool IsSet(){return iIsSet;} |
|
134 }; |
|
135 |
|
136 /** |
|
137 * Base class for controls that display and allow manipulation of text. |
|
138 * |
|
139 * The properties of a particular Edwin object can be set using bitwise flags, |
|
140 * which are defined in member enums (see @c TFlags for example). |
|
141 * |
|
142 * Edwins support Front End Processors, and so are a highly effective way of |
|
143 * getting textual data from the user. The text currently being composed by the |
|
144 * user is called the composition text. |
|
145 */ |
|
146 class CEikEdwin : public CEikBorderedControl, |
|
147 public MEikScrollBarObserver, |
|
148 public CTextView::MObserver, |
|
149 public MEditObserver, |
|
150 public MEikCcpuEditor |
|
151 { |
|
152 |
|
153 private: |
|
154 |
|
155 class CUndoBuffer; |
|
156 NONSHARABLE_CLASS(CEikEdwinExtension) : public CBase, MCenRepNotifyHandlerCallback |
|
157 { |
|
158 public: |
|
159 /** |
|
160 * Allocates and constructs a CEikEdwinExtension. |
|
161 * |
|
162 * @param aEdwin Pointer to the CEikEdwin creating the extension. |
|
163 * @return A newly constructed edwin extension. |
|
164 */ |
|
165 static CEikEdwinExtension* NewL(CEikEdwin* aEdwin); |
|
166 |
|
167 /** |
|
168 * Destructor. |
|
169 */ |
|
170 ~CEikEdwinExtension(); |
|
171 |
|
172 /** |
|
173 * Gets the form accessor. |
|
174 * |
|
175 * @return The form accessor. |
|
176 */ |
|
177 IMPORT_C CAknEdwinFormAccessor* FormAccessor() const; |
|
178 |
|
179 /** |
|
180 * Sets the form accessor. |
|
181 * |
|
182 * @param aFormAccessor The form accessor. |
|
183 */ |
|
184 IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor); |
|
185 |
|
186 /** |
|
187 * Sets the CIdle object to update scroll bar. |
|
188 * |
|
189 * @param The CIdle object to perform scroll bar updating. |
|
190 */ |
|
191 IMPORT_C void SetScrollBarSetter(CIdle* aScrollBarSetter); |
|
192 |
|
193 /** |
|
194 * Gets the CIdle object which updates scroll bar. |
|
195 * |
|
196 * @return The CIdle object used to perform scroll bar updating. |
|
197 */ |
|
198 IMPORT_C CIdle* ScrollBarSetter(); |
|
199 |
|
200 /** |
|
201 * Gets the custom wrapper. |
|
202 * |
|
203 * @return The custom wrapper. |
|
204 */ |
|
205 IMPORT_C const TAvkonEditorCustomWrap& TextWrapper(); |
|
206 |
|
207 // the following two methods are deprecated |
|
208 IMPORT_C CFormCursorModifier* FormCursorModifier() const; |
|
209 |
|
210 /** |
|
211 * Store a locally stored (but externally set) Skins background control context. |
|
212 * |
|
213 * @param aBackgroundControlContext Control context to store. Not owned. Can be NULL. |
|
214 */ |
|
215 void SetSkinBackgroundControlContext( MAknsControlContext* aBackgroundControlContext ); |
|
216 |
|
217 /** |
|
218 * Access to locally stored Skins background control context. |
|
219 * |
|
220 * @return Pointer to locally stored control context |
|
221 */ |
|
222 |
|
223 MAknsControlContext* SkinBackgroundControlContext() const; |
|
224 |
|
225 /** |
|
226 * This returns a flag that records whether the background context has ever been |
|
227 * set by API. |
|
228 * |
|
229 * @return EFalse iff control context has never been set. |
|
230 */ |
|
231 TBool SkinBackgroundControlContextHasBeenSet() const; |
|
232 |
|
233 /** |
|
234 * Stores the alignment value. |
|
235 * |
|
236 * @param aAlignment Editor alignment to be stored. |
|
237 */ |
|
238 void SetAlignment(TInt aAlignment); |
|
239 |
|
240 /** |
|
241 * Returns the stored alignment value. |
|
242 * |
|
243 * @return Value of the current editor alignment. |
|
244 */ |
|
245 TInt CurrentAlignment() const; |
|
246 |
|
247 /** |
|
248 * Sets pictograph animation callback. |
|
249 */ |
|
250 void SetPictoCallBack( TCallBack& aCallBack ); |
|
251 |
|
252 /** |
|
253 * Sets pictograph animation callback. |
|
254 */ |
|
255 const TCallBack& PictoCallBack() const; |
|
256 |
|
257 /** |
|
258 * Creates the CAknFormExtendedInterfaceProvider object if it does not exist. |
|
259 */ |
|
260 void CreateFormExtendedInterfaceProviderIfNeededL(); |
|
261 |
|
262 /** |
|
263 * Access to Form's extended interface provider. |
|
264 */ |
|
265 CAknEdwinFormExtendedInterfaceProvider* FormExtendedInferfaceProvider() const; |
|
266 |
|
267 /** |
|
268 * Create a custom formatter for pure phone number content. |
|
269 * |
|
270 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an |
|
271 * ExtendedInterfaceProvider object built. |
|
272 * |
|
273 * @param aTextLayout Reference to the CTextLayout object used for this editor. |
|
274 * aText CPlainText object reference for the text used in the editor. |
|
275 */ |
|
276 void CreatePurePhoneNumberFormatterL( CTextLayout& aTextLayout, const CPlainText& aText); |
|
277 |
|
278 /** |
|
279 * Create a custom formatter for pure phone number content. |
|
280 * |
|
281 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an |
|
282 * ExtendedInterfaceProvider object built. |
|
283 * |
|
284 * @param aTextLayout Reference to the CTextLayout object used for this editor |
|
285 */ |
|
286 void CreateNoMatchesIndicatorFormatterL( CTextLayout& aTextLayout ); |
|
287 |
|
288 /** |
|
289 * Create a custom formatter for rich text editor with general content. Phone numbers are |
|
290 * recognized using an internal parser and formatted with the number grouping engine |
|
291 * |
|
292 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an |
|
293 * ExtendedInterfaceProvider object built. |
|
294 * |
|
295 * @param aTextLayout Reference to the CTextLayout object used for this editor |
|
296 */ |
|
297 void CreateRichTextPhoneNumberFormatterL( CTextLayout& aTextLayout, const CRichText& aText ); |
|
298 |
|
299 /** |
|
300 * This allows the caller to access the single inline text interface that will be seen |
|
301 * by Tagma. All installed inline text source classes are held behind this single interface |
|
302 * |
|
303 * @return pointer to the inline text source object that will be provided to Tagma |
|
304 * Null is returned if none is installed. |
|
305 */ |
|
306 CAknInlineTextSource* InlineTextSource() const; |
|
307 |
|
308 /** |
|
309 * Returns pointer to pictograph interface. |
|
310 * |
|
311 * @return Pointer to pictograph interface. The value can be NULL if pictographs are not supported. |
|
312 */ |
|
313 CAknPictographInterface* PictographInterface() const; |
|
314 |
|
315 /** |
|
316 * Used for suppressing all editor's background drawing. |
|
317 */ |
|
318 void SetSuppressBackgroundDrawing( TBool aSuppress ); |
|
319 |
|
320 /** |
|
321 * Tests if the background drawing is suppressed. |
|
322 */ |
|
323 TBool IsBackgroundDrawingSuppressed() const; |
|
324 |
|
325 /** |
|
326 * Returns the value of ClearDirection |
|
327 * |
|
328 * @return value of current ClearDirection |
|
329 */ |
|
330 TInt ClearDirection() const; |
|
331 |
|
332 /** |
|
333 * Enables kinetic scrolling. |
|
334 */ |
|
335 void EnableKineticScrollingL( CAknPhysics* aPhysics = NULL ); |
|
336 |
|
337 /** |
|
338 * Enables physics. |
|
339 */ |
|
340 void EnablePhysicsL( CAknPhysics* aPhysics = NULL ); |
|
341 |
|
342 /** |
|
343 * Initializes physics. |
|
344 */ |
|
345 void InitPhysicsL(); |
|
346 |
|
347 public: // from MCenRepNotifyHandlerCallback |
|
348 void HandleNotifyInt(TUint32 aId, TInt aNewValue); |
|
349 |
|
350 private: |
|
351 |
|
352 CEikEdwinExtension(); |
|
353 void ConstructL(CEikEdwin* aEdwin); |
|
354 |
|
355 private: |
|
356 |
|
357 enum TFlagIndices |
|
358 { |
|
359 ESkinBackgroundControlContextHasBeenSetIndex = 0, |
|
360 ESuppressBackgroundDrawing, |
|
361 EKineticScrollingEnabled |
|
362 }; |
|
363 class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack |
|
364 { |
|
365 private: // From MAknPictographAnimatorCallBack |
|
366 void DrawPictographArea(); |
|
367 }; |
|
368 |
|
369 private: |
|
370 |
|
371 CIdle* iSetScrollBar; |
|
372 TAvkonEditorCustomWrap iTextWrapper; |
|
373 CAknEdwinFormAccessor* iFormAccessor; |
|
374 CFormCursorModifier* iFormCursorModifier; |
|
375 MAknsControlContext* iSkinBackgroundControlContext; |
|
376 TBitFlags iFlags; |
|
377 TInt iAlignment; |
|
378 TCallBack iPictoCallBack; |
|
379 CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; // Owned |
|
380 CAknInlineTextSource* iPhoneNumberFormatter; // Not owned |
|
381 CAknNoMatchesIndicatorInlineTextSource* iNoMatchesIndicatorFormatter; // Not owned |
|
382 TAknEdwinPictographDrawer iPictographDrawer; |
|
383 CAknPictographInterface* iPictographInterface; |
|
384 // For clear direction. |
|
385 CRepository* iCenRep; // Owned |
|
386 CCenRepNotifyHandler* iCenRepNotifyHandler; // Owned |
|
387 TInt iClearDirection; // Value of ClearDirection |
|
388 public: |
|
389 |
|
390 TInt iSkinIdForText; |
|
391 TAknsHighlightStyle iSkinHighlightStyle; |
|
392 SAknRgb iEditorBackgroundColor; |
|
393 TInt iUpperFullFormattingLength; |
|
394 CAknExtendedInputCapabilities* iExtendedInputCapabilities; |
|
395 TRect iTextLinesRect; |
|
396 TRect iScrollRect; |
|
397 TInt iTempCursorPos; |
|
398 TInt iTempAnchorPos; |
|
399 TInt iTempSelect; |
|
400 CAknPointerEventSuppressor* iPtSuppressor; |
|
401 TBool iDragging; |
|
402 TInt iRecordCursor; |
|
403 TBool iRecordScroll; |
|
404 /** |
|
405 * @c iDestroyedPtr is used for the object destruction check. |
|
406 * If it has non-null value, the destruction check is turned on, and |
|
407 * the value points to a local boolean variable that keeps the destroyed state. |
|
408 */ |
|
409 TBool* iDestroyedPtr; |
|
410 enum TDrawState |
|
411 { |
|
412 ENotDraw = 0, |
|
413 EDrawn, |
|
414 EDrawing |
|
415 }; |
|
416 TInt iDrawInvoked; |
|
417 TInt iThumbPos; |
|
418 // own |
|
419 CSmileyManager* iSmiley; |
|
420 CSmileyCustomWrap* iSmileyWrap; |
|
421 TBool iInlineEditing; |
|
422 TBool iDisableConvertInFormat; |
|
423 TCursorSelection iVisibleRange; |
|
424 CEdwinAsyncFormat* iAsyncFormat; |
|
425 |
|
426 /** |
|
427 * Pointer to CEikEdwin. |
|
428 * Not own. |
|
429 */ |
|
430 CEikEdwin* iEdwin; |
|
431 |
|
432 /** |
|
433 * Scrolled offset if using rate scroll way. |
|
434 */ |
|
435 TInt iScrolledDelta; |
|
436 |
|
437 /** |
|
438 * If ETrue, uses rate scroll. Otherwise uses original way. |
|
439 */ |
|
440 TBool iUseRateScroll; |
|
441 |
|
442 /** |
|
443 * Used with each step of dragging scrollbar to record |
|
444 * the thumb position before dragging action |
|
445 */ |
|
446 TInt iScrollbarPosition; |
|
447 |
|
448 /** |
|
449 * Physics handler. Used only when physics feature is enabled. |
|
450 * Own. |
|
451 */ |
|
452 CAknEdwinPhysicsHandler* iPhysicsHandler; |
|
453 |
|
454 /** |
|
455 * Content has moved down so that empty space |
|
456 * above the editor content is visible. |
|
457 */ |
|
458 TBool iStartBorderExceeded; |
|
459 |
|
460 /** |
|
461 * Content has moved up so that empty space |
|
462 * below the editor content is visible. |
|
463 */ |
|
464 TBool iEndBorderExceeded; |
|
465 |
|
466 /** |
|
467 * Amount of pixels out of border. In practice width |
|
468 * of empty space above or below editor content. |
|
469 */ |
|
470 TInt iPixelsOutOfBorder; |
|
471 |
|
472 /** |
|
473 * If ETrue, text cursor was visible before drag or flick started. |
|
474 * Used to store cursor state so that it is possible to enable cursor |
|
475 * again when dragging, flicking or bounce stops. |
|
476 */ |
|
477 TBool iCursorWasVisible; |
|
478 |
|
479 /** |
|
480 * If ETrue, ongoing scrolling is caused by moving scrollbar thumb. |
|
481 */ |
|
482 TBool iScrolledByScrollBar; |
|
483 /** |
|
484 * Record formatted height of layout |
|
485 */ |
|
486 TInt iRecordFormattedHeight; |
|
487 |
|
488 /** |
|
489 * Skins instance. |
|
490 * Not own. |
|
491 */ |
|
492 MAknsSkinInstance* iSkinInstance; |
|
493 |
|
494 /** |
|
495 * Record enableSmiley is supported. |
|
496 */ |
|
497 TBool iEnableSmileySupported; |
|
498 |
|
499 /** |
|
500 * Record if text view has been actually hidden. |
|
501 */ |
|
502 TBool iTextViewHidden; |
|
503 }; |
|
504 |
|
505 public: |
|
506 |
|
507 /** |
|
508 * The following flags may be combined with a bitwise OR to form the |
|
509 * @c aEdwinFlags argument to @c ConstructL(TInt, ...) or the flags field |
|
510 * of an EDWIN resource structure run through @c ConstructFromResourceL(). |
|
511 * |
|
512 * These flags are duplicated in @c uikon.hrh (see @c EEikEdwinKeepDocument |
|
513 * etc.) |
|
514 */ |
|
515 enum TFlags |
|
516 { // user flags |
|
517 /** */ |
|
518 EZeroEnumValue =0x00000000, |
|
519 |
|
520 /** |
|
521 * If set, @c CEikEdwin does not destroy its content on destruction. |
|
522 */ |
|
523 EKeepDocument =0x00000001, |
|
524 |
|
525 /** |
|
526 * If set, the content buffer uses segmented storage (see |
|
527 * @c CEditableText::ESegmentedStorage). |
|
528 */ |
|
529 ESegmentedStorage =0x00000002, |
|
530 |
|
531 /** |
|
532 * The size specified in the resource used to construct the object is |
|
533 * given in pixels, not character widths. |
|
534 */ |
|
535 EWidthInPixels =0x00000004, |
|
536 |
|
537 /** |
|
538 * No automatic selection takes place. Normally the entire text is |
|
539 * selected whenever the Edwin is created, resized or has its text |
|
540 * set as one operation. |
|
541 */ |
|
542 ENoAutoSelection =0x00000008, |
|
543 |
|
544 /** |
|
545 * If set, then whenever the control is activated the cursor is |
|
546 * moved to the end of the text. |
|
547 */ |
|
548 EJustAutoCurEnd =0x00000010, |
|
549 |
|
550 /** |
|
551 * Does not wrap the text being edited. |
|
552 */ |
|
553 ENoWrap =0x00000020, |
|
554 |
|
555 /** |
|
556 * Uses a line cursor instead of a block cursor. |
|
557 */ |
|
558 ELineCursor =0x00000040, |
|
559 |
|
560 /** |
|
561 * Does not perform horizontal scrolling. |
|
562 */ |
|
563 ENoHorizScrolling =0x00000080, |
|
564 |
|
565 /** |
|
566 * If set, scroll bars required to edit long documents appear inside |
|
567 * the Edwin. This reduces the area used to display the Edwin. |
|
568 * |
|
569 * If not set, scroll bars appear outside the Edwin. |
|
570 */ |
|
571 EInclusiveSizeFixed =0x00000100, |
|
572 |
|
573 /** |
|
574 * Sets the Edwin’s height according to the number of lines of text |
|
575 * supplied by the user. |
|
576 */ |
|
577 EUserSuppliedText =0x00000200, |
|
578 |
|
579 /** |
|
580 * The Edwin is a window-owning control. |
|
581 */ |
|
582 EOwnsWindow =0x00000400, |
|
583 |
|
584 /** |
|
585 * The Edwin does not respond to input at all. |
|
586 */ |
|
587 EDisplayOnly =0x00000800, |
|
588 |
|
589 /** |
|
590 * Does not hide the selection if the Edwin loses focus. |
|
591 */ |
|
592 EAlwaysShowSelection =0x00001000, |
|
593 |
|
594 /** |
|
595 * The Edwin is read-only so users cannot add text to any document it |
|
596 * displays. |
|
597 */ |
|
598 EReadOnly =0x00002000, |
|
599 |
|
600 /** |
|
601 * If set, no special attempt will be made to delete the embedded pictures cleanly. |
|
602 * |
|
603 * This flag does not apply to Edwins which do not edit rich text. |
|
604 */ |
|
605 EAllowPictures =0x00004000, |
|
606 |
|
607 /** |
|
608 * The Edwin supports undo operations. |
|
609 */ |
|
610 EAllowUndo =0x00008000, |
|
611 |
|
612 /** |
|
613 * Does not allow line or paragraph breaks in the text being edited. |
|
614 */ |
|
615 ENoLineOrParaBreaks =0x00010000, |
|
616 |
|
617 /** |
|
618 * Allows only ASCII characters. |
|
619 */ |
|
620 EOnlyASCIIChars =0x00020000, |
|
621 |
|
622 /** |
|
623 * The Edwin is resizable. |
|
624 */ |
|
625 EResizable =0x00040000, |
|
626 |
|
627 /** |
|
628 * The Edwin ignores the virtual cursor. |
|
629 */ |
|
630 EIgnoreVirtualCursor =0x00080000, |
|
631 |
|
632 /** |
|
633 * No custom draw is done. |
|
634 */ |
|
635 ENoCustomDraw =0x01000000, |
|
636 |
|
637 /** |
|
638 * Changes layout to Avkon style. |
|
639 */ |
|
640 EAvkonEditor =0x02000000, |
|
641 |
|
642 /** |
|
643 * Hides cursor. |
|
644 */ |
|
645 EAvkonDisableCursor =0x04000000, |
|
646 |
|
647 /** |
|
648 * Changes text editor to non-editable mode. |
|
649 */ |
|
650 EAvkonNotEditable =0x08000000, |
|
651 |
|
652 /** |
|
653 * Sets the @c Avkon wrapping rules ON. |
|
654 */ |
|
655 EEdwinAlternativeWrapping = 0x10000000, |
|
656 |
|
657 /** |
|
658 * Enables tab key handling |
|
659 */ |
|
660 EAvkonTabsEnabled = 0x20000000, |
|
661 |
|
662 /** |
|
663 * Disable VKB input |
|
664 */ |
|
665 EAvkonDisableVKB = 0x40000000, |
|
666 |
|
667 /** |
|
668 * Enable Smiley Support |
|
669 */ |
|
670 EAvkonEnableSmileySupport = 0x80000000 |
|
671 }; |
|
672 |
|
673 /** |
|
674 * Defines the possible commands for @c ClipboardL(). |
|
675 */ |
|
676 enum TClipboardFunc |
|
677 { |
|
678 /** Do nothing. */ |
|
679 ENoClipboard, |
|
680 |
|
681 /** Cut. */ |
|
682 ECut, |
|
683 |
|
684 /** Copy. */ |
|
685 ECopy, |
|
686 |
|
687 /** Paste. */ |
|
688 EPaste |
|
689 }; |
|
690 |
|
691 /** |
|
692 * The following flags may be ORed together for text searches (see |
|
693 * @c FindL() for example). |
|
694 */ |
|
695 enum TFindFlags |
|
696 { |
|
697 /** Search progresses up the screen. */ |
|
698 EFindDirectionUp =0x01, |
|
699 |
|
700 /** Only whole-word matches count. */ |
|
701 EFindWholeWord =0x02, |
|
702 |
|
703 /** Search is case-sensitive. */ |
|
704 EFindCaseSensitive =0x04, |
|
705 |
|
706 /** Finds again. */ |
|
707 EFindAgain =0x08, |
|
708 |
|
709 /** Does not display a busy message. */ |
|
710 ENoBusyMessage =0x10, |
|
711 |
|
712 /** */ |
|
713 EReadOnlyFile =0x20 // New for CKon |
|
714 }; |
|
715 |
|
716 /** |
|
717 * When content is supplied to an Edwin using @c SetDocumentContentL(), |
|
718 * this defines whether the new content is added to or has replaced the |
|
719 * existing content. |
|
720 */ |
|
721 enum TSetContent |
|
722 { |
|
723 /** Replaces the Edwin’s existing content. */ |
|
724 EUseText, |
|
725 |
|
726 /** Copies the supplied content into the existing content. */ |
|
727 ECopyText |
|
728 }; |
|
729 |
|
730 /** |
|
731 * Specifies whether the Edwin owns the document it is being used to edit. |
|
732 * |
|
733 * If the Edwin owns the document, the document object is destroyed on |
|
734 * destruction. |
|
735 */ |
|
736 enum TOwnershipType |
|
737 { |
|
738 /** Document is owned by the Edwin. */ |
|
739 EOwnsText, |
|
740 |
|
741 /** Document is owned by some other object. */ |
|
742 EDoesNotOwnText |
|
743 }; |
|
744 |
|
745 // order of hotkeys defined in resource file. Not all applicable to plain |
|
746 // text editors |
|
747 /** |
|
748 * Enumerates the hotkeys that are defined an @c r_eik_edwin_ctrl_hotkeys |
|
749 * or @c r_eik_edwin_shift_ctrl_hotkeys resource. |
|
750 * |
|
751 * Not all are applicable to plain text editors. |
|
752 */ |
|
753 enum TEdwinHotKeys |
|
754 { |
|
755 /** Cut. */ |
|
756 EHotKeyCut, |
|
757 |
|
758 /** Copy. */ |
|
759 EHotKeyCopy, |
|
760 |
|
761 /** Paste. */ |
|
762 EHotKeyPaste, |
|
763 |
|
764 /** Undo. */ |
|
765 EHotKeyUndo, |
|
766 |
|
767 /** Find. */ |
|
768 EHotKeyFind, |
|
769 |
|
770 /** Insert a character. */ |
|
771 EHotKeyInsertChar, |
|
772 |
|
773 /** Bold. */ |
|
774 EHotKeyBold, |
|
775 |
|
776 /** Italic. */ |
|
777 EHotKeyItalic, |
|
778 |
|
779 /** Underline. */ |
|
780 EHotKeyUnderline, |
|
781 |
|
782 /** Font. */ |
|
783 EHotKeyFont, |
|
784 |
|
785 /** Insert an object. */ |
|
786 EHotKeyInsertObject, |
|
787 |
|
788 /** Edit an object. */ |
|
789 EHotKeyEditObject, |
|
790 |
|
791 /** Format an object. */ |
|
792 EHotKeyFormatObject |
|
793 }; |
|
794 |
|
795 public: // construction and destruction |
|
796 |
|
797 /** |
|
798 * Destructor. |
|
799 * |
|
800 * Deletes objects and frees resources owned by this object. The Edwin’s |
|
801 * editable text is freed if the @c EKeepDocument flag is not set. |
|
802 */ |
|
803 IMPORT_C ~CEikEdwin(); |
|
804 |
|
805 /** |
|
806 * C++ default constructor. |
|
807 * |
|
808 * Creates a new @c Edwin, FEP support for the new editor will not be |
|
809 * present if there is insufficient memory. |
|
810 */ |
|
811 IMPORT_C CEikEdwin(); |
|
812 |
|
813 /** |
|
814 * Constructor. |
|
815 * |
|
816 * Creates a new @c Edwin, specifying the border to use. As with the default |
|
817 * constructor, FEP support for the new editor will not be present if there |
|
818 * is insufficient memory. S60 Edwin does not support / draw any borders. |
|
819 * |
|
820 * @param aBorder The Edwin border. |
|
821 */ |
|
822 IMPORT_C CEikEdwin(const TGulBorder& aBorder); |
|
823 |
|
824 /** |
|
825 * Handles Symbian 2nd phase construction. |
|
826 * Completes construction of a new @c Edwin, initialising its heap-stored |
|
827 * members from the supplied arguments. |
|
828 * |
|
829 * @param aEdwinFlags Bitwise ORed combination of flags from @c TFlags. |
|
830 Default value is 0. |
|
831 * @param aWidthInChars Specifies the width for the Edwin, in characters or |
|
832 pixels: see the @c EWidthInPixels flag. Default value is 0. |
|
833 * @param aTextLimit Maximum length for the text to present as editable. |
|
834 Default value is 0. |
|
835 * @param aNumberOfLines Height for the Edwin, in lines. Default value |
|
836 is 0. |
|
837 */ |
|
838 IMPORT_C void ConstructL(TInt aEdwinFlags=0, |
|
839 TInt aWidthInChars=0, |
|
840 TInt aTextLimit=0, |
|
841 TInt aNumberOfLines=0); |
|
842 |
|
843 /** |
|
844 * Sets the Edwin observer. The Edwin’s observer will be called back with |
|
845 * control events associated with the Edwin. |
|
846 * |
|
847 * @param aEdwinObserver New observer. |
|
848 */ |
|
849 IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver); |
|
850 |
|
851 /** |
|
852 * Adds an observer of standard Edwin events to the list of observers, |
|
853 * creating the list if necessary. May be called any number of times and is |
|
854 * independent of calls to @c SetEdwinObserver. |
|
855 * |
|
856 * @param aEdwinObserver The observer to add to the list of observers. |
|
857 */ |
|
858 IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver); |
|
859 |
|
860 /** |
|
861 * Removes the specified observer from the list of observers. Does nothing |
|
862 * if aEdwinObserver is not an observer. |
|
863 * |
|
864 * @param aEdwinObserver The observer to remove from the list of observers. |
|
865 */ |
|
866 IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver); |
|
867 |
|
868 /** |
|
869 * Creates the containing window for the Edwin if it does not already have one. |
|
870 */ |
|
871 IMPORT_C void SetContainerWindowL(); |
|
872 |
|
873 /** |
|
874 * Sets the Edwin’s editable content. Before calling this function you must |
|
875 * get the @c iText pointer as @c iText is replaced by @c aText. You must |
|
876 * also free the memory by deleting the previous @c iText contents. |
|
877 * |
|
878 * @param aText New value for the content. |
|
879 * @param aContent Specifies whether to use @c aText itself, or to copy its |
|
880 * content. Default value is @c CEikEdwin::ECopyText. |
|
881 */ |
|
882 IMPORT_C void SetDocumentContentL(CGlobalText& aText, |
|
883 TSetContent aContent=CEikEdwin::ECopyText); |
|
884 |
|
885 public: // from CCoeControl |
|
886 |
|
887 /** |
|
888 * From @c CCoeControl. |
|
889 * |
|
890 * Handles key events. |
|
891 * |
|
892 * @param aKeyEvent The key event. |
|
893 * @param aType The type of the event: @c EEventKeyDown, @c EEventKeyUp |
|
894 * or @c EEventKey. |
|
895 * @return A suitable response code. |
|
896 */ |
|
897 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
898 TEventCode aType); |
|
899 |
|
900 /** |
|
901 * From @c CCoeControl. |
|
902 * |
|
903 * Responds to focus-changed events. |
|
904 * |
|
905 * @param aDrawNow Not used. |
|
906 */ |
|
907 IMPORT_C void FocusChanged(TDrawNow aDrawNow); |
|
908 |
|
909 /** |
|
910 * From @c CCoeControl. |
|
911 * |
|
912 * Sets the Edwin as ready for drawing. |
|
913 * |
|
914 * @leave KErrNoMemory. |
|
915 */ |
|
916 IMPORT_C void ActivateL(); |
|
917 |
|
918 /** |
|
919 * From @c CCoeControl. |
|
920 * |
|
921 * Completes the construction of a new @c Edwin. This function initialises |
|
922 * the heap-stored members from an @c EDWIN resource. |
|
923 * |
|
924 * @param aReader A reader positioned for reading from an @c EDWIN resource. |
|
925 */ |
|
926 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); |
|
927 |
|
928 /** |
|
929 * From @c CCoeControl. |
|
930 * |
|
931 * Handles pointer events. |
|
932 * |
|
933 * @param aPointerEvent Pointer event to respond to. |
|
934 */ |
|
935 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
936 |
|
937 /** |
|
938 * From @c CCoeControl. |
|
939 * |
|
940 * Gets the minimum size of this Edwin for automatic-layout control |
|
941 * contexts such as dialogs. |
|
942 * |
|
943 * @return Minimum size for the control. |
|
944 */ |
|
945 IMPORT_C TSize MinimumSize(); |
|
946 |
|
947 /** |
|
948 * From @c CCoeControl. |
|
949 * |
|
950 * Draws the control on request. |
|
951 * |
|
952 * @param aRect If supplied, the rectangle in which to draw the Edwin. |
|
953 */ |
|
954 IMPORT_C void Draw(const TRect& aRect) const; |
|
955 |
|
956 /** |
|
957 * From @c CCoeControl. |
|
958 * |
|
959 * Dims or undims the Edwin. |
|
960 * |
|
961 * @param aDimmed @c ETrue to dim the Edwin. @c EFalse to undim the Edwin. |
|
962 */ |
|
963 IMPORT_C void SetDimmed(TBool aDimmed); |
|
964 |
|
965 /** |
|
966 * From @c CCoeControl. |
|
967 * |
|
968 * Sets the containing window for the Edwin by copying it from the specified |
|
969 * parent. Also copies a control context from @c aParent if one has not been |
|
970 * previously set. |
|
971 * |
|
972 *@param aParent The control to set as this Edwin’s parent. |
|
973 */ |
|
974 IMPORT_C void SetContainerWindowL(const CCoeControl& aParent); |
|
975 |
|
976 /** |
|
977 * From @c CCoeControl. |
|
978 * |
|
979 * Gets the list of logical colours employed in the drawing of the control, |
|
980 * paired with an explanation of how they are used. Appends the list to |
|
981 * @c aColorUseList. |
|
982 * |
|
983 * @param[out] aColorUseList The list of logical colours. |
|
984 */ |
|
985 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& |
|
986 aColorUseList) const; // not available before Release 005u |
|
987 |
|
988 // not available before Release 005u |
|
989 /** |
|
990 * From @c CCoeControl. |
|
991 * |
|
992 * Handles a change to Edwin’s resources which are shared across the |
|
993 * environment. Colours or fonts for example. |
|
994 * |
|
995 * @param aType The type of resource that was changed. |
|
996 */ |
|
997 IMPORT_C virtual void HandleResourceChange(TInt aType); |
|
998 |
|
999 /** |
|
1000 * From @c CCoeControl. |
|
1001 * |
|
1002 * Access to the input capabilities of the edwin. |
|
1003 * |
|
1004 * If this function is overrided in a subclass, the subclass should |
|
1005 * obtain this class' InputCapabilities' object provider through |
|
1006 * TCoeInputCapabilities::ObjectProvider() and set that as a part of |
|
1007 * the subclass' InputCapabilities object provider chain to ensure |
|
1008 * maximum functionality. |
|
1009 * |
|
1010 * @return The Edwin input capabilities. |
|
1011 */ |
|
1012 IMPORT_C TCoeInputCapabilities InputCapabilities() const; |
|
1013 |
|
1014 /** |
|
1015 * From @c CCoeControl. |
|
1016 * |
|
1017 * This method sets the input capabilities of the edwin. Ownership of the |
|
1018 * T-class is not transferred. |
|
1019 * |
|
1020 * @param aInputCapabilities Reference to an input capabilities object |
|
1021 * on the heap. |
|
1022 * @leave KErrNoMemory Edwin FEB support object is not created. |
|
1023 */ |
|
1024 IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities& |
|
1025 aInputCapabilities); |
|
1026 |
|
1027 /** |
|
1028 * From @c CCoeControl. |
|
1029 * |
|
1030 * In debug mode writes the internal state to the given stream. Does |
|
1031 * nothing in release mode. |
|
1032 * |
|
1033 * @param[out] aWriteStream A stream for writing the internal state. |
|
1034 */ |
|
1035 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; |
|
1036 |
|
1037 private: |
|
1038 |
|
1039 /** |
|
1040 * From CAknControl |
|
1041 */ |
|
1042 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1043 |
|
1044 public: // from MEikScrollBarObserver |
|
1045 |
|
1046 /** |
|
1047 * From @c MEikScrollBarObserver. |
|
1048 * |
|
1049 * Handles scrollbar key events. |
|
1050 * |
|
1051 * @param aScrollBar The scrollbar. |
|
1052 * @param aEventType The type of key event. |
|
1053 */ |
|
1054 IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar, |
|
1055 TEikScrollEvent aEventType); |
|
1056 |
|
1057 public: // from CTextView::MObserver |
|
1058 |
|
1059 /** |
|
1060 * From @c CTextView::MObserver. |
|
1061 * |
|
1062 * Called after reformatting but before redisplay so that edit windows |
|
1063 * etc. can be resized. |
|
1064 * |
|
1065 * @param aTextView Not used. |
|
1066 */ |
|
1067 IMPORT_C void OnReformatL(const CTextView* aTextView); |
|
1068 |
|
1069 public: |
|
1070 |
|
1071 /** |
|
1072 * Gets the number of characters in the document. |
|
1073 * |
|
1074 * @return The number of characters in the document. |
|
1075 */ |
|
1076 IMPORT_C TInt TextLength() const; |
|
1077 |
|
1078 /** |
|
1079 * Gets the cursor’s position within the document. |
|
1080 * |
|
1081 * @return The cursor’s position within the document. |
|
1082 */ |
|
1083 IMPORT_C TInt CursorPos() const; |
|
1084 |
|
1085 /** |
|
1086 * Gets the number of characters including non-printing characters within |
|
1087 * the selection. |
|
1088 * |
|
1089 * @return The number of characters within the selection. |
|
1090 */ |
|
1091 IMPORT_C TInt SelectionLength() const; |
|
1092 |
|
1093 /** |
|
1094 * Gets the cursor selection. If no text view is associated to the Edwin |
|
1095 * this returns @c TCursorSelection(0,0). |
|
1096 * |
|
1097 * @return The current selection. |
|
1098 */ |
|
1099 IMPORT_C TCursorSelection Selection() const; |
|
1100 |
|
1101 /** |
|
1102 * Removes the selection and any composition text. The cursor position is |
|
1103 * unaffected. If there is no selected region, this function has no effect. |
|
1104 */ |
|
1105 IMPORT_C void ClearSelectionL(); |
|
1106 |
|
1107 /** |
|
1108 * Sets the text selection. Highlights the selected area and makes the new |
|
1109 * cursor position visible. Any previous selection is cancelled. This |
|
1110 * function also updates the scroll bar thumbs if present. |
|
1111 * |
|
1112 * @param aCursorPos The cursor’s position. |
|
1113 * @param aAnchorPos The anchor’s position. |
|
1114 */ |
|
1115 IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos); |
|
1116 |
|
1117 /** |
|
1118 * Sets the cursor’s position within the document. If the new position is |
|
1119 * not visible the text is scrolled so that the line containing the |
|
1120 * cursor is visible. This function also updates the scroll bar thumbs |
|
1121 * if present. |
|
1122 * |
|
1123 * @param aCursorPos New cursor position. |
|
1124 * @param aSelect @c ETrue to extend the cursor’s selection to the new |
|
1125 * position. @c EFalse otherwise. |
|
1126 */ |
|
1127 IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect); |
|
1128 |
|
1129 /** |
|
1130 * Selects the entire document. |
|
1131 */ |
|
1132 IMPORT_C void SelectAllL(); |
|
1133 |
|
1134 /** |
|
1135 * Recalculates the screen width of an Edwin from the specified number |
|
1136 * of character widths. This is called during construction. If the |
|
1137 * Edwin only allows editing of numbers, the width of the zero |
|
1138 * character (0) is used; otherwise |
|
1139 * @c CFont::MaxNormalCharWidthInPixels() is used. |
|
1140 * |
|
1141 * If the @c EWidthInPixels flag has been set, the @c aWidthInChars |
|
1142 * argument is measured in pixels, not characters. |
|
1143 * |
|
1144 * @param aWidthInChars Width in either pixels or characters. |
|
1145 */ |
|
1146 IMPORT_C void CalculateWidth(TInt aWidthInChars); |
|
1147 |
|
1148 /** |
|
1149 * Copies the entire document’s content into a descriptor. It is the |
|
1150 * caller's responsibility to provide a large enough buffer. |
|
1151 * |
|
1152 * @param[out] aDes An initialised descriptor which on return contains a |
|
1153 * copy of the content of this Edwin. |
|
1154 */ |
|
1155 IMPORT_C void GetText(TDes& aDes) const; |
|
1156 |
|
1157 /** |
|
1158 * Gets a new buffer containing a copy of the whole text document. |
|
1159 * |
|
1160 * @return A new copy of the document text. |
|
1161 */ |
|
1162 IMPORT_C HBufC* GetTextInHBufL() const; |
|
1163 |
|
1164 /** |
|
1165 * Sets the document text of this Edwin from the contents of a descriptor. |
|
1166 * This function removes any pictures, any invalid characters and cancels |
|
1167 * any previous selection. |
|
1168 * |
|
1169 * @param aDes Descriptor from which to copy. |
|
1170 */ |
|
1171 IMPORT_C void SetTextL(const TDesC* aDes); |
|
1172 |
|
1173 /** |
|
1174 * Handles cut, copy and paste commands. This function also reports a |
|
1175 * change of state of the control to the observer when necessary. |
|
1176 * |
|
1177 * @param aClipboardFunc Clipboard operation. |
|
1178 */ |
|
1179 IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc); |
|
1180 |
|
1181 /** |
|
1182 * Inserts a field at the current cursor position. If a selection was made |
|
1183 * the field replaces that selection. |
|
1184 * |
|
1185 * @param aField Text field to insert. |
|
1186 * @param aFieldType Type of the field. |
|
1187 */ |
|
1188 IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType); |
|
1189 |
|
1190 /** |
|
1191 * Updates all the fields in the document. |
|
1192 */ |
|
1193 IMPORT_C void UpdateAllFieldsL(); |
|
1194 |
|
1195 /** |
|
1196 * Updates any text field at the current cursor position. Updating involves |
|
1197 * calculating the new value for the field, and replacing the field’s |
|
1198 * existing text content with the new text. |
|
1199 * |
|
1200 * This function does nothing if the cursor is not within a text field. |
|
1201 */ |
|
1202 IMPORT_C void UpdateCurrentFieldL(); |
|
1203 |
|
1204 /** |
|
1205 * Counts and returns the number of words in the document. |
|
1206 * |
|
1207 * @return The number of words in the document. |
|
1208 */ |
|
1209 IMPORT_C TInt CountWords(); |
|
1210 |
|
1211 /** |
|
1212 * Inserts the contents of a text file into the text being edited at the |
|
1213 * current cursor position. |
|
1214 * |
|
1215 * @param aFileName The file to open and read. |
|
1216 * @param aTextOrganisation How to handle line breaks. Default value is |
|
1217 * @c CPlainText::EOrganiseByLine. |
|
1218 */ |
|
1219 IMPORT_C void InsertFromTextFileL(const TFileName &aFileName, |
|
1220 const CPlainText::TTextOrganisation |
|
1221 aTextOrganisation=CPlainText::EOrganiseByLine); |
|
1222 |
|
1223 /** |
|
1224 * Uses @c SetScrollBarsL() to set the scrollbars. |
|
1225 * |
|
1226 * @param aPtr Pointer to @c CEikEdwin instance. |
|
1227 * @return Integer value of @c EFalse. |
|
1228 */ |
|
1229 IMPORT_C static TInt IdleL(TAny *aPtr); |
|
1230 |
|
1231 /** |
|
1232 * Gets a pointer to the Edwin’s document contents. |
|
1233 * |
|
1234 * @return A @c CPlainText pointer which contains the |
|
1235 * document. |
|
1236 */ |
|
1237 IMPORT_C CPlainText* Text() const; |
|
1238 |
|
1239 // this is particularly important for when the front-end processor is |
|
1240 // inline-editing a CEikEdwin |
|
1241 /** |
|
1242 * Cancels any current transaction with the Edwin’s front-end processor. |
|
1243 * Any front-end input windows are removed, and any highlighted text being |
|
1244 * edited in the Edwin is removed. The Edwin is rolled back to the state |
|
1245 * it was in before the FEP transaction started. This function is called |
|
1246 * by @c CEikEdwin itself when the document content, the cursor position |
|
1247 * or the current selection is changed. |
|
1248 * |
|
1249 * Cancelling outstanding FEP transactions before performing operations |
|
1250 * on the text programmatically is particularly important when the |
|
1251 * front-end processor is inline-editing an Edwin. |
|
1252 * |
|
1253 */ |
|
1254 IMPORT_C void CancelFepTransaction(); |
|
1255 |
|
1256 /** |
|
1257 * Handles all modifications made by reformatting the entire document. |
|
1258 * Calls @c CEikEdwin::FormatText() and redraws Edwin contents and |
|
1259 * scroll bars if they are ready to be redrawn. |
|
1260 */ |
|
1261 IMPORT_C void HandleTextChangedL(); |
|
1262 |
|
1263 /** |
|
1264 * Gets the width used for laying out the text inside the Edwin in pixels. |
|
1265 * This may be larger or smaller than the width of the Edwin itself. |
|
1266 * See @c SetWysiwygModeOn() for example. |
|
1267 * |
|
1268 * @return Width of the text layout area in pixels. |
|
1269 */ |
|
1270 IMPORT_C TInt LayoutWidth() const; |
|
1271 |
|
1272 /** |
|
1273 * Formats and draws a new document, updates scrollbars if necessary. |
|
1274 */ |
|
1275 IMPORT_C void NotifyNewDocumentL(); |
|
1276 |
|
1277 /** |
|
1278 * Reformats and redraws the document, updates scrollbars if necessary. |
|
1279 */ |
|
1280 IMPORT_C void NotifyNewFormatL(); |
|
1281 |
|
1282 /** |
|
1283 * Gets true if a substring is present in the text being edited before or |
|
1284 * after the cursor position. If @c aFindText is NULL, then the current |
|
1285 * word or selection will be searched for again. |
|
1286 * |
|
1287 * @param aFindText The substring to search for. |
|
1288 * @param aFindFlags See @c TFindFlags. Default value is 0. |
|
1289 * @return @c ETrue if aFindText is found. |
|
1290 */ |
|
1291 IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0); |
|
1292 |
|
1293 /** |
|
1294 * Gets the cursor position of the matching text in the document. The |
|
1295 * search starts from @c aPos. If @c aFindText is NULL, then the |
|
1296 * current word or selection will be searched for. If the substring |
|
1297 * cannot be found, this function returns @c KErrNotFound. |
|
1298 * |
|
1299 * @param aFindText The substring to search for. |
|
1300 * @param aPos Starting position for the find. |
|
1301 * @param aFindFlags See @c TFindFlags. |
|
1302 * @return KErrNotFound if the text was not found, otherwise the |
|
1303 * position of the matched substring. |
|
1304 */ |
|
1305 IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags); |
|
1306 |
|
1307 /** |
|
1308 * Replaces the highlighted text. See @c SEdwinFindModel struct. |
|
1309 * |
|
1310 * @param[in,out] aFindModel Pointer to the replacement text. |
|
1311 */ |
|
1312 IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel); |
|
1313 |
|
1314 /** |
|
1315 * Replaces all occurrences of a string with new text. Both old and new |
|
1316 * text are held in @c aFindModel. |
|
1317 * |
|
1318 * @param[in,out] aFindModel Pointer to the replacement text. |
|
1319 * @leave This function will leave if the replace operation fails |
|
1320 * unexpectedly. |
|
1321 */ |
|
1322 IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel); |
|
1323 |
|
1324 /** |
|
1325 * Gets the current word or selection and searches for it. This function |
|
1326 * is called by @c FindL() and @c FindTextL() when no text to search for |
|
1327 * is given. |
|
1328 * |
|
1329 * @param aFindText An empty descriptor. |
|
1330 */ |
|
1331 IMPORT_C void GetFindText(TDes* aFindText); |
|
1332 |
|
1333 /** |
|
1334 * Updates scrollbars. |
|
1335 */ |
|
1336 IMPORT_C void UpdateScrollBarsL(); |
|
1337 |
|
1338 /** |
|
1339 * Creates the Edwin scroll bar frame with no pre-allocation of memory |
|
1340 * for scroll bars. |
|
1341 * |
|
1342 * @return The scroll bar frame. |
|
1343 */ |
|
1344 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(); |
|
1345 |
|
1346 /** |
|
1347 * Creates a pre-allocated scroll bar frame. |
|
1348 * |
|
1349 * @return Pre-allocated scroll bar frame. |
|
1350 */ |
|
1351 inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL(); |
|
1352 |
|
1353 /** |
|
1354 * Gets the scroll bar frame surrounding this Edwin. |
|
1355 * |
|
1356 * @return Pointer to this Edwin’s scroll bar frame. |
|
1357 */ |
|
1358 inline CEikScrollBarFrame* ScrollBarFrame(); |
|
1359 |
|
1360 /** |
|
1361 * Sets word wrapping on or off. |
|
1362 * |
|
1363 * @param aWrapIsOn @c ETrue enables word wrapping, @c EFalse disables |
|
1364 * word wrapping. |
|
1365 */ |
|
1366 IMPORT_C void SetWordWrapL(TBool aWrapIsOn); |
|
1367 |
|
1368 /** |
|
1369 * Gets the width of a line cursor in pixels. |
|
1370 * |
|
1371 * @return Always 0. |
|
1372 */ |
|
1373 IMPORT_C virtual TInt LineCursorWidth() const; |
|
1374 |
|
1375 /** |
|
1376 * Sets the zoom factor of the document and reformats the document. |
|
1377 * |
|
1378 * @param aZoomFactor New value for the zooming factor. |
|
1379 */ |
|
1380 IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor); |
|
1381 |
|
1382 /** |
|
1383 * Sets the Edwin’s background colour. |
|
1384 * |
|
1385 * @param aBackground New value for the background colour. |
|
1386 */ |
|
1387 IMPORT_C void SetBackgroundColorL(TRgb aBackground); |
|
1388 |
|
1389 /** |
|
1390 * Sets the format mode to be WYSIWYG. |
|
1391 * |
|
1392 * @param aLayoutWidth Formatting width in twips. |
|
1393 * @param aDevice Mapping between twips and pixels on the target device. |
|
1394 */ |
|
1395 IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth, |
|
1396 MGraphicsDeviceMap* aDevice); |
|
1397 |
|
1398 /** |
|
1399 * Switches off the WYSIWYG mode. This function sets the new format mode |
|
1400 * to be @c EFScreenMode. |
|
1401 */ |
|
1402 IMPORT_C void SetWysiwygModeOff(); |
|
1403 |
|
1404 /** |
|
1405 * Updates the text wrap width. This function is for use in WYSIWYG mode |
|
1406 * only. |
|
1407 * |
|
1408 * @param aLayoutWidth New width to wrap text at in WYSIWYG mode in twips. |
|
1409 */ |
|
1410 IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth); |
|
1411 |
|
1412 /** |
|
1413 * Sends the Edwin’s document using an infra red beamer. |
|
1414 */ |
|
1415 IMPORT_C void SendDataOverIrL(); |
|
1416 |
|
1417 /** |
|
1418 * Receives an Edwin document using an infra red beamer. |
|
1419 * This function will leave if the data received is not a suitable type |
|
1420 * to be pasted into the Edwin. |
|
1421 */ |
|
1422 IMPORT_C void ReceiveDataOverIrL(); |
|
1423 |
|
1424 /** |
|
1425 * Controls the formatting mode of the editor. |
|
1426 * |
|
1427 * The length of the text is compared against current formatting mode thresholds. |
|
1428 * (See method SetUpperFullFormattingLength). If the length is greater than the |
|
1429 * upper limit of full formatting, then the editor is set to "band" formatting, |
|
1430 * where the editor attempts to format as little as is needed, e.g. the visible part |
|
1431 * of the editor. If the text length is less than the lower limit of band formatting, |
|
1432 * then the formatting mode is switched to full document formatting. |
|
1433 * |
|
1434 * This method performs an immediate re-formatting of all or part of the text with the new formatting mode. |
|
1435 * |
|
1436 * @param aIsNewDoc If EFalse, attempts to perform re-formatting based upon current formatting |
|
1437 * If not EFalse, whole document it formatted from scratch |
|
1438 * Note: This parameter is ignored if aReFormat is EFalse |
|
1439 */ |
|
1440 IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse); |
|
1441 |
|
1442 /** |
|
1443 * Controls the formatting mode of the editor. |
|
1444 * |
|
1445 * The length of the text is compared against the current formatting mode thresholds. |
|
1446 * (See method SetUpperFullFormattingLength). If the length is greater than the |
|
1447 * upper limit of full formatting, then the editor is set to "band" formatting, |
|
1448 * where the editor attempts to format as little as is needed, e.g. the visible part |
|
1449 * of the editor. If the text length is less than the lower limit of band formatting, |
|
1450 * then the formatting mode is switched to full document formatting. |
|
1451 * |
|
1452 * This method has a flag to allow any immediate re-formatting to be suppressed. |
|
1453 * Formatting text can be a time-consuming operation. If the client is able to |
|
1454 * ensure that no reformatting is needed, (for instance if a further re-formatting |
|
1455 * API is going to be called later) then the reformatting flag can be called |
|
1456 * with EFalse. Otherwise, a re-format will take place within this method. |
|
1457 * |
|
1458 * @since 3.1 |
|
1459 * @param aIsNewDoc If EFalse, attempts to perform re-formatting based upon current formatting |
|
1460 * If not EFalse, whole document it formatted from scratch |
|
1461 * Note: This parameter is ignored if aReFormat is EFalse |
|
1462 * @param aReFormat If EFalse, do not perform any re-formatting |
|
1463 */ |
|
1464 IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat ); |
|
1465 |
|
1466 /** |
|
1467 * Sets the @c EPasteFromIrStore flag. |
|
1468 * |
|
1469 * @param aPasteFromIrStore @c ETrue to set the @c EPasteFromIrStore flag. |
|
1470 * @c EFalse to remove the @c EPasteFromIrStore flag. |
|
1471 */ |
|
1472 IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore); |
|
1473 |
|
1474 /** |
|
1475 * Copies the contents of a stream store to the current cursor position, |
|
1476 * replacing any selected text. This function is used to paste data from |
|
1477 * the clipboard. |
|
1478 * |
|
1479 * @param[out] aStore Store from which to read. |
|
1480 * @param[in] aDict Stream dictionary. |
|
1481 */ |
|
1482 IMPORT_C void PasteFromStoreL(CStreamStore& aStore, |
|
1483 CStreamDictionary& aDict); |
|
1484 |
|
1485 /** |
|
1486 * Copies the highlighted text into a stream store. |
|
1487 * |
|
1488 * @param[out] aStore Store to write to. |
|
1489 * @param[in] aDict Stream dictionary. |
|
1490 */ |
|
1491 IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict); |
|
1492 |
|
1493 /** |
|
1494 * Sets the text view margins. |
|
1495 * |
|
1496 * @param aMargins New value for the view’s margins. |
|
1497 */ |
|
1498 IMPORT_C void SetBorderViewMargins(TMargins8 aMargins); |
|
1499 |
|
1500 /** |
|
1501 * Forces the scrollbars to update now; this is a synchronous function. |
|
1502 */ |
|
1503 IMPORT_C void ForceScrollBarUpdateL(); |
|
1504 |
|
1505 /** |
|
1506 * Sets whether the Edwin owns a document. Edwins can either be used as a |
|
1507 * standalone text editor control, or as an editor for text owned by |
|
1508 * another object. The document ownership setting determines whether the |
|
1509 * Edwin or another object owns the document. |
|
1510 * |
|
1511 * @param aOwner Whether Edwin or another object owns the document. |
|
1512 * See @c TOwnershipType. |
|
1513 */ |
|
1514 IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner); |
|
1515 |
|
1516 /** |
|
1517 * Sets the maximum number of characters that can be inserted. |
|
1518 * |
|
1519 * @param aLimit New maximum for the number of characters that can be |
|
1520 * inserted. |
|
1521 */ |
|
1522 IMPORT_C void SetTextLimit(TInt aLimit); |
|
1523 |
|
1524 /** |
|
1525 * Displays a dialog allowing the user to choose a character from the |
|
1526 * character map. The selected character is inserted into the Edwin |
|
1527 * at the current cursor position. |
|
1528 */ |
|
1529 IMPORT_C void RunCharMapDialogL(); |
|
1530 |
|
1531 /** |
|
1532 * Gets the text view margins. |
|
1533 * |
|
1534 * @return The text view margins. |
|
1535 */ |
|
1536 IMPORT_C TMargins8 Margins() const; |
|
1537 |
|
1538 /** |
|
1539 * Gets the upper limit for formatting. This returns the value of |
|
1540 * @c KFullFormattingUpperThreshold which determines the maximum number of |
|
1541 * characters that can be formatted, if it is exceeded then only visible |
|
1542 * text is formatted. This is used with @c KPartialFormattingLowerThreshold |
|
1543 * to control the extent of text formatting. |
|
1544 * |
|
1545 * @return The value of @c KFullFormattingUpperThreshold. |
|
1546 */ |
|
1547 IMPORT_C TInt UpperFullFormattingLength() const; |
|
1548 |
|
1549 /** |
|
1550 * Gets the lower limit for formatting. This returns the value of |
|
1551 * @c KPartialFormattingLowerThreshold which determines when a switch is |
|
1552 * made from formatting only visible text to formatting all text. When the |
|
1553 * text length exceeds the @c KFullFormattingUpperThreshold only visible |
|
1554 * text is formatted. If some characters are deleted so that the text |
|
1555 * length is less than @c KFullFormattingUpperThreshold the entire text |
|
1556 * is still not formatted. Instead, reformatting occurs only when the |
|
1557 * number of characters is less than the value of |
|
1558 * @c KPartialFormattingLowerThreshold. |
|
1559 * |
|
1560 * @return The value of @c KPartialFormattingLowerThreshold. |
|
1561 */ |
|
1562 IMPORT_C TInt LowerPartialFormattingLength() const; |
|
1563 |
|
1564 /** |
|
1565 * Sets the Edwin’s read-only flag so that documents displayed by Edwin |
|
1566 * cannot be edited by users. |
|
1567 * |
|
1568 * @param aReadOnly @c ETrue to set Edwin to display documents as |
|
1569 * read-only. @c EFalse otherwise. |
|
1570 */ |
|
1571 IMPORT_C void SetReadOnly(TBool aReadOnly); |
|
1572 |
|
1573 /** |
|
1574 * Determines whether the document being edited with Edwin is read-only. |
|
1575 * |
|
1576 * @return @c ETrue if the document being edited is read-only. |
|
1577 * @c EFalse otherwise. |
|
1578 */ |
|
1579 IMPORT_C TBool IsReadOnly() const; |
|
1580 |
|
1581 /** |
|
1582 * Gets editor flags from the editor. |
|
1583 * @return editor flags if existed |
|
1584 * @or return KErrNotFound |
|
1585 */ |
|
1586 IMPORT_C TInt CEikEdwin::AknEditorFlags(); |
|
1587 |
|
1588 |
|
1589 |
|
1590 /** |
|
1591 * Determines whether the document being edited is read only. Displays |
|
1592 * a message with @c CEikonEnv::InfoMsg() if the document is set as |
|
1593 * read-only. |
|
1594 */ |
|
1595 IMPORT_C void CheckNotReadOnlyL(); |
|
1596 |
|
1597 /** |
|
1598 * Sets whether the document accepts pictures. |
|
1599 * |
|
1600 * @param aAllow @c ETrue sets the document to accept pictures, @c EFalse |
|
1601 * sets the document to not accept pictures. |
|
1602 */ |
|
1603 IMPORT_C void SetAllowPictures(TBool aAllow); |
|
1604 |
|
1605 /** |
|
1606 * Removes unwanted pictures. If @c EAllowPictures has been set, returns |
|
1607 * immediately. Otherwise, this function checks the document text between |
|
1608 * two bounds and removes all pictures in that range. |
|
1609 * |
|
1610 * @param aStartPos Where to start looking for unwanted pictures. |
|
1611 * @param aLength Where to stop. |
|
1612 */ |
|
1613 IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength); |
|
1614 |
|
1615 /** |
|
1616 * Sets the minimum gap between text and the right hand edge of the Edwin |
|
1617 * when text is wrapped. This value is used to calculate the layout area |
|
1618 * for text. |
|
1619 * |
|
1620 * @param aGap Size of the gutter in pixels. |
|
1621 */ |
|
1622 IMPORT_C void SetRightWrapGutter(TInt aGap); |
|
1623 |
|
1624 /** |
|
1625 * Undoes the most recent text operation when the Edwin supports this |
|
1626 * feature and when the undo store is not empty. |
|
1627 */ |
|
1628 IMPORT_C void UndoL(); |
|
1629 |
|
1630 /** |
|
1631 * Deletes the undo store. |
|
1632 */ |
|
1633 IMPORT_C void ClearUndo(); |
|
1634 |
|
1635 /** |
|
1636 * Sets whether the undo operation is permitted. |
|
1637 * |
|
1638 * @param aAllow ETrue to permit undo operations. EFalse to not permit undo |
|
1639 * operations. |
|
1640 */ |
|
1641 IMPORT_C void SetAllowUndo(TBool aAllow); |
|
1642 |
|
1643 /** |
|
1644 * Gets whether Edwin is set to support the undo command. |
|
1645 * |
|
1646 * @return @c ETrue if edits can be undone. @c EFalse if edits cannot |
|
1647 * be undone. |
|
1648 */ |
|
1649 IMPORT_C TBool SupportsUndo() const; |
|
1650 |
|
1651 /** |
|
1652 * Tests whether an undo is possible. Returns @c ETrue only if the undo |
|
1653 * store is available to Edwin. |
|
1654 * |
|
1655 * @return @c ETrue if the undo store is available. @c EFalse if the |
|
1656 * undo store is not available. |
|
1657 */ |
|
1658 IMPORT_C TBool CanUndo() const; |
|
1659 |
|
1660 /** |
|
1661 * Sets whether picture characters and/or punctuation should be treated as |
|
1662 * word delimiters in addition to whitespace. |
|
1663 * |
|
1664 * @param aPicture @c ETrue if picture characters should be treated as |
|
1665 * delimiters for words. |
|
1666 * @param aPunctuation @c ETrue if punctuation should be treated as |
|
1667 * delimiters for words. |
|
1668 */ |
|
1669 IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation); |
|
1670 |
|
1671 /** |
|
1672 * Gets the start position and the length of the word in which the |
|
1673 * specified document position is located. |
|
1674 * |
|
1675 * @param[in] aCurrentPos A position within a word in the text. |
|
1676 * @param[out] aStartPos Returns the start position of the word. |
|
1677 * @param[out] aLength Returns the word’s length. |
|
1678 */ |
|
1679 IMPORT_C void GetWordInfo(TInt aCurrentPos, |
|
1680 TInt& aStartPos, |
|
1681 TInt& aLength) const; |
|
1682 |
|
1683 /** |
|
1684 * Sets the new cursor position. If the cursor is no longer visible the |
|
1685 * document is scrolled to display the line containing the new cursor |
|
1686 * position. Scrollbars are also updated if present. |
|
1687 * |
|
1688 * @param aMovement The cursor movement. |
|
1689 * @param aSelect If @c ETrue, the selection is extended. This corresponds |
|
1690 * to holding down the Shift key on a machine keyboard. |
|
1691 */ |
|
1692 IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement, |
|
1693 TBool aSelect); |
|
1694 |
|
1695 /** |
|
1696 * Scrolls the text either horizontally or vertically without affecting |
|
1697 * the cursor’s position. |
|
1698 * |
|
1699 * @param aMovement The cursor's movement. |
|
1700 */ |
|
1701 IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement); |
|
1702 |
|
1703 /** |
|
1704 * Removes all non-ASCII characters from the specified text. This can be |
|
1705 * used to remove Unicode characters where they are not valid characters |
|
1706 * for example. |
|
1707 * |
|
1708 * @param aStartPos The start position in the text. |
|
1709 * @param aLength The number of characters, beginning with aStartPos to |
|
1710 * check. |
|
1711 */ |
|
1712 IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength); |
|
1713 |
|
1714 /** |
|
1715 * Sets the @c EOnlyASCIIChars flag. |
|
1716 * |
|
1717 * @param aASCIIOnly If @c ETrue the EOnlyASCIIChars flag will be set. If |
|
1718 * @c EFalse the EOnlyASCIIChars flag will be removed. |
|
1719 */ |
|
1720 IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly); |
|
1721 |
|
1722 /** |
|
1723 * Tests whether the @c EOnlyASCIIChars flag is set. |
|
1724 * |
|
1725 * @return @c ETrue if the @c EOnlyASCIIChars flag is set. |
|
1726 */ |
|
1727 IMPORT_C TBool OnlyASCIIChars() const; |
|
1728 |
|
1729 /** |
|
1730 * Gets the average number of lines shown in Edwin’s view. |
|
1731 * |
|
1732 * @return The average number of lines. |
|
1733 */ |
|
1734 inline TInt AvgLinesInViewRect() const; |
|
1735 |
|
1736 /** |
|
1737 * Gets the average number of characters on a line. |
|
1738 * |
|
1739 * @return The average number of characters on a line. |
|
1740 */ |
|
1741 inline TInt AvgCharsPerLine() const; |
|
1742 |
|
1743 /** |
|
1744 * Sets the average number of lines displayed in Edwin’s view. |
|
1745 * |
|
1746 * @param aAvgLines The average number of lines to display. |
|
1747 */ |
|
1748 inline void SetAvgLinesInViewRect(TInt aAvgLines); |
|
1749 |
|
1750 /** |
|
1751 * Sets the average number of characters per line. |
|
1752 * |
|
1753 * @param aAvgChars The average number of characters per line. |
|
1754 */ |
|
1755 inline void SetAvgCharsPerLine(TInt aAvgChars); |
|
1756 |
|
1757 /** |
|
1758 * Sets the Edwin size observer. Does not imply transfer of ownership. |
|
1759 * |
|
1760 * @param aEdwinSizeObserver The Edwin size observer. |
|
1761 */ |
|
1762 IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver* |
|
1763 aEdwinSizeObserver); |
|
1764 |
|
1765 /** |
|
1766 * Gets the minimum Edwin height. |
|
1767 * |
|
1768 * @return The minimum Edwin height. |
|
1769 */ |
|
1770 IMPORT_C TInt MinimumHeight() const; |
|
1771 |
|
1772 /** |
|
1773 * Gets the maximum Edwin height. |
|
1774 * |
|
1775 * Please do not use the following method for deciding heights if you are |
|
1776 * using edwins with Maximum Heights in forms. Use @c MaximumHeightInLines |
|
1777 * instead. |
|
1778 * |
|
1779 * @return The maximum Edwin height. |
|
1780 */ |
|
1781 IMPORT_C TInt MaximumHeight() const; |
|
1782 |
|
1783 /** |
|
1784 * Sets the minimum Edwin height. This function also increases the maximum |
|
1785 * Edwin height if its value is less than @c aHeight. |
|
1786 */ |
|
1787 IMPORT_C void SetMinimumHeight(TInt aHeight); |
|
1788 |
|
1789 /** |
|
1790 * Sets the maximum Edwin height. This function also decreases the minimum |
|
1791 * Edwin height if its value is greater than @c aHeight. |
|
1792 * |
|
1793 * Please do not use the following method for setting maximum heights if |
|
1794 * you are using edwins with maximum heights in forms. Use |
|
1795 * @c MaximumHeightInLines instead. |
|
1796 * |
|
1797 * @param aHeight The maximum Edwin height. |
|
1798 */ |
|
1799 IMPORT_C void SetMaximumHeight(TInt aHeight); |
|
1800 |
|
1801 void OnEditorStateFlagChange( TInt aOldFlag, TInt aNewFlag ); |
|
1802 void ReportChinesePopupEventL( TBool aChinesePopupOpen ); |
|
1803 |
|
1804 public: // new utility methods |
|
1805 |
|
1806 /** |
|
1807 * Replaces the cursor selection with the identified text. |
|
1808 * |
|
1809 * @param aInsertPos The position at which text will be inserted. |
|
1810 * @param aText The text to insert. |
|
1811 * @param aDelete The cursor-selected text that will be replaced by @c |
|
1812 * aText. |
|
1813 */ |
|
1814 IMPORT_C void InsertDeleteCharsL(TInt aInsertPos, |
|
1815 const TDesC& aText, |
|
1816 const TCursorSelection& aDelete); |
|
1817 |
|
1818 /** |
|
1819 * Sets non-printing characters?visibility. |
|
1820 * |
|
1821 * @param aVisibility Non-printing characters?visibility. |
|
1822 */ |
|
1823 IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility |
|
1824 aVisibility); |
|
1825 |
|
1826 /** |
|
1827 * Sets non-printing characters?visibility. |
|
1828 * |
|
1829 * @return Non-printing characters?visibility. |
|
1830 */ |
|
1831 IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const; |
|
1832 |
|
1833 public: // new Avkon wrap interface |
|
1834 |
|
1835 /** |
|
1836 * Sets the @c EAvkonEditor flag. |
|
1837 * |
|
1838 * @param aAvkonWrapIsOn If @c ETrue @c EAvkonEditor flag is set. |
|
1839 */ |
|
1840 IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn); |
|
1841 |
|
1842 public: // Avkon editor extensions |
|
1843 |
|
1844 /** |
|
1845 * Sets default case for the editor. The case is used when the editor |
|
1846 * is focused first time. Available case flags from @c uikon.hrh |
|
1847 * are @c EAknEditorUpperCase, @c EAknEditorLowerCase and |
|
1848 * @c EAknEditorTextCase. @c EAknEditorTextCase is used if the initial |
|
1849 * case is not set from EDWIN resource default_case or with this API. |
|
1850 * |
|
1851 * @param aCase Initial case to be used in the editor. |
|
1852 */ |
|
1853 IMPORT_C void SetAknEditorCase(TInt aCase); |
|
1854 |
|
1855 /** |
|
1856 * Sets permitted cases for the editor. |
|
1857 * Possible flags from @c uikon.hrh are @c EAknEditorAllCaseModes, |
|
1858 * @c EAknEditorUpperCase, @c EAknEditorLowerCase and |
|
1859 * @c EAknEditorTextCase. @c EAknEditorAllCaseModes is used if the value |
|
1860 * is not set from EDWIN resource allowed_case_modes or with this API. |
|
1861 * |
|
1862 * @param aPermittedCaseModes Case modes that are available in the editor. |
|
1863 */ |
|
1864 IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes); |
|
1865 |
|
1866 /** |
|
1867 * Sets number mode key mapping for '*' and '#' keys. The key mapping is |
|
1868 * used in editors when numeric input mode is used. Key mapping characters |
|
1869 * for '*' key are shown on special character table if also text input |
|
1870 * modes are allowed in the editor but the current input mode is numeric |
|
1871 * mode. @c EAknEditorStandardNumberModeKeymap is used in editors that |
|
1872 * allow only numeric input if the mapping is not set from EDWIN resource |
|
1873 * @c numeric_keymap or with this API. |
|
1874 * @c EAknEditorAlphanumericNumberModeKeymap is used as default if the |
|
1875 * editor allows also text input mode. |
|
1876 * |
|
1877 * @param aNumericKeymap Key mapping used in an editor with number input |
|
1878 * mode. |
|
1879 */ |
|
1880 IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap |
|
1881 aNumericKeymap); |
|
1882 |
|
1883 /** |
|
1884 * Sets default input mode for the editor. The input mode is used when |
|
1885 * the editor is focused first time. |
|
1886 * @c EAknEditorTextInputMode is used if the initial input mode is not set |
|
1887 * from EDWIN resource default_input_mode or with this API. |
|
1888 * |
|
1889 * @param aInputMode Initial input mode to be used in the editor. |
|
1890 */ |
|
1891 IMPORT_C void SetAknEditorInputMode(TInt aInputMode); |
|
1892 |
|
1893 /** |
|
1894 * Sets allowed input modes for the editor. |
|
1895 * All input modes are allowed (@c EAknEditorAllInputModes) if the value |
|
1896 * is not set from EDWIN resource @c allowed_input_modes or with this API. |
|
1897 * |
|
1898 * @param aInputModes Input modes that are allowed in the editor. |
|
1899 */ |
|
1900 IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes); |
|
1901 |
|
1902 /** |
|
1903 * Sets editor specific special character table. |
|
1904 * |
|
1905 * @param aSCTResId Special character table dialog resource. |
|
1906 */ |
|
1907 IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId); |
|
1908 |
|
1909 /** |
|
1910 * Sets initial editor flags for the editor. |
|
1911 * This method can be used also to update editor flags after the editor is |
|
1912 * focused. FEP is automatically notified of the updated editor flags. |
|
1913 * |
|
1914 * @param aFlags Avkon editor flags for the editor. |
|
1915 */ |
|
1916 IMPORT_C void SetAknEditorFlags(TInt aFlags); |
|
1917 |
|
1918 /** |
|
1919 * Enables or disables CCPU interface provided functionalities |
|
1920 * (cut, copy, paste and undo). |
|
1921 * |
|
1922 * @param aSupport CCPU support enabled if @c ETrue. |
|
1923 */ |
|
1924 IMPORT_C void EnableCcpuSupportL(TBool aSupport); |
|
1925 |
|
1926 /** |
|
1927 * Updates editor input mode. FEP is automatically notified of the |
|
1928 * new input mode in editor state and FEP takes new input mode to use |
|
1929 * immediatelly. Current inline editing is reset. |
|
1930 * This method should not be used for setting initial input mode for the |
|
1931 * editor. Use @c SetAknEditorInputMode() method instead for setting |
|
1932 * initial input mode. |
|
1933 * |
|
1934 * @param aInputMode New input mode for the editor. |
|
1935 */ |
|
1936 IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode); |
|
1937 |
|
1938 /** |
|
1939 * Returns the input mode that has been saved to editor state. |
|
1940 * |
|
1941 * @since S60 2.6 |
|
1942 * @return Input Mode that is saved to editor state. |
|
1943 */ |
|
1944 IMPORT_C TInt AknEditorCurrentInputMode(); |
|
1945 |
|
1946 /** |
|
1947 * Updates editor case. FEP is automatically notified of the |
|
1948 * case change in editor state and FEP takes new case to use immediately. |
|
1949 * Available case flags from @c uikon.hrh are @c EAknEditorUpperCase, |
|
1950 * @c EAknEditorLowerCase and @c EAknEditorTextCase. |
|
1951 * This method should not be used to set initial case for the editor. |
|
1952 * Use @c SetAknEditorCase() method instead for setting initial case. |
|
1953 * |
|
1954 * @param aCase New case for the editor. |
|
1955 */ |
|
1956 IMPORT_C void SetAknEditorCurrentCase(TInt aCase); |
|
1957 |
|
1958 /** |
|
1959 * Sets new local input language for the editor. Global input language |
|
1960 * changes have not effect for the input language but the user can still |
|
1961 * change the input language from the edit menu. |
|
1962 * |
|
1963 * @param aLanguage Editor local input language. |
|
1964 */ |
|
1965 IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage); |
|
1966 |
|
1967 /** |
|
1968 * This call causes FEP to reset current editing state and |
|
1969 * new editing state is fetched from @c CAknEdwinState object. |
|
1970 */ |
|
1971 IMPORT_C void NotifyEditorStateObserverOfStateChangeL(); |
|
1972 |
|
1973 /** |
|
1974 * Used for suppressing all editor's background drawing. This is |
|
1975 * intended for internal use. |
|
1976 * |
|
1977 * Note that when this is set, the background is not drawn with skin |
|
1978 * nor cleared, so the background MUST be drawn by the parent control |
|
1979 * every time the editor changes. |
|
1980 * |
|
1981 * @param aSuppress If ETrue, suppress background drawing |
|
1982 */ |
|
1983 IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress ); |
|
1984 |
|
1985 /** |
|
1986 * Tests if the background drawing is suppressed. |
|
1987 * |
|
1988 * @return ETrue if the background drawing is suppressed |
|
1989 */ |
|
1990 IMPORT_C TBool IsBackgroundDrawingSuppressed() const; |
|
1991 |
|
1992 /** |
|
1993 * Used to prevent partial text lines from being drawn. |
|
1994 * The client is responsible for giving a sane value. An empty |
|
1995 * rect disables this feature. This is intended for internal use. |
|
1996 * |
|
1997 * @param aRect The rect which contains text lines to be drawn |
|
1998 */ |
|
1999 IMPORT_C void SetTextLinesRect( const TRect& aRect ); |
|
2000 |
|
2001 /** |
|
2002 * Used to determine which area is used for scrolling |
|
2003 */ |
|
2004 IMPORT_C void SetScrollRect( const TRect & aRect ); |
|
2005 |
|
2006 /** |
|
2007 * Gets the rectangle set for drawing only full lines. In case |
|
2008 * the feature is disabled, this returns an empty rect. |
|
2009 * This is intended for internal use. |
|
2010 * |
|
2011 * @return The rect which contains text lines to be drawn |
|
2012 */ |
|
2013 IMPORT_C TRect GetTextLinesRect() const; |
|
2014 |
|
2015 /** |
|
2016 * Used to control cursor visibility |
|
2017 */ |
|
2018 IMPORT_C void SetCursorVisible(TBool aVisible); |
|
2019 public: |
|
2020 |
|
2021 // These methods have been added for use with Avkon to set maximum |
|
2022 // editor heights. |
|
2023 /** |
|
2024 * Sets editor's maximum height in lines. |
|
2025 * |
|
2026 * @param aLines Maximum height in lines. |
|
2027 */ |
|
2028 IMPORT_C void SetMaximumHeightInLines(TInt aLines); |
|
2029 |
|
2030 /** |
|
2031 * Gets editor maximum height in lines. |
|
2032 * |
|
2033 * @return Maximum height in lines. |
|
2034 */ |
|
2035 IMPORT_C TInt MaximumHeightInLines() const; |
|
2036 |
|
2037 public: // From MEikCcpuEditor |
|
2038 |
|
2039 /** |
|
2040 * Tests whether the editor is focused. |
|
2041 * |
|
2042 * @return If editor is focused, @c ETrue is returned. |
|
2043 */ |
|
2044 IMPORT_C TBool CcpuIsFocused() const; |
|
2045 |
|
2046 /** |
|
2047 * Tests whether the selected text can be cut. |
|
2048 * |
|
2049 * @return @c ETrue if it is possible to cut the selected text. |
|
2050 */ |
|
2051 IMPORT_C TBool CcpuCanCut() const; |
|
2052 |
|
2053 /** |
|
2054 * Cuts selected text. |
|
2055 */ |
|
2056 IMPORT_C void CcpuCutL(); |
|
2057 |
|
2058 /** |
|
2059 * Tests whether the selected text can be copied. |
|
2060 * |
|
2061 * @return @c ETrue if it is possible to copy the selected text. |
|
2062 */ |
|
2063 IMPORT_C TBool CcpuCanCopy() const; |
|
2064 |
|
2065 /** |
|
2066 * Copies selected text. |
|
2067 */ |
|
2068 IMPORT_C void CcpuCopyL(); |
|
2069 |
|
2070 /** |
|
2071 * Tests whether text can be pasted from the clipboard. |
|
2072 * |
|
2073 * @return @c ETrue if it is possible to paste the clipboard text. |
|
2074 */ |
|
2075 IMPORT_C TBool CcpuCanPaste() const; |
|
2076 |
|
2077 /** |
|
2078 * Pastes text from the clipboard to the editor. |
|
2079 */ |
|
2080 IMPORT_C void CcpuPasteL(); |
|
2081 |
|
2082 /** |
|
2083 * Tests is it possible to undo previous operation. |
|
2084 * |
|
2085 * @return @c ETrue if it is possible to undo previous operation. |
|
2086 */ |
|
2087 IMPORT_C TBool CcpuCanUndo() const; |
|
2088 |
|
2089 /** |
|
2090 * Undoes the most recent text operation when the Edwin supports this |
|
2091 * feature and when the undo store is not empty |
|
2092 */ |
|
2093 IMPORT_C void CcpuUndoL(); |
|
2094 |
|
2095 /** |
|
2096 * Gets edwin's flags from @c CAknEdwinState. |
|
2097 * |
|
2098 * @return The control's flags. |
|
2099 */ |
|
2100 IMPORT_C TInt AknEdwinFlags() const; |
|
2101 |
|
2102 |
|
2103 public: // Internal to Symbian |
|
2104 |
|
2105 // the following methods are deprecated and will be removed in a future |
|
2106 // release |
|
2107 /** |
|
2108 * Allocates memory for the Edwin text view. |
|
2109 */ |
|
2110 IMPORT_C void CreateTextViewL(); |
|
2111 |
|
2112 /** |
|
2113 * Gets Edwin text view. |
|
2114 * |
|
2115 * @return Pointer to the Edwin text view. |
|
2116 */ |
|
2117 IMPORT_C CTextView* TextView() const; |
|
2118 |
|
2119 /** |
|
2120 * Gets Edwins text layout. |
|
2121 * |
|
2122 * @return Pointer to the text layout. |
|
2123 */ |
|
2124 IMPORT_C CTextLayout* TextLayout() const; |
|
2125 |
|
2126 /** |
|
2127 * Sets undo buffer for the Edwin. |
|
2128 * |
|
2129 * @param aSelection The current selection. |
|
2130 * @return @c ETrue if buffer was set. |
|
2131 */ |
|
2132 IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection); |
|
2133 |
|
2134 /** |
|
2135 * Sets new undoable text to the undo buffer. |
|
2136 * |
|
2137 * @param aSelection The current selection. |
|
2138 */ |
|
2139 IMPORT_C void SetUndoableText(const TCursorSelection& aSelection); |
|
2140 |
|
2141 /** |
|
2142 * Gets the editor state. |
|
2143 * |
|
2144 * @return Pointer to editor state object. |
|
2145 */ |
|
2146 CAknEdwinState* EditorState() const; |
|
2147 |
|
2148 /** |
|
2149 * Sets maximum length for the editor. |
|
2150 * |
|
2151 * @param aLength Maximum length for the editor. |
|
2152 */ |
|
2153 inline void SetMaxLength(TInt aLength); |
|
2154 |
|
2155 /** |
|
2156 * Gets the editor maximum length. |
|
2157 * |
|
2158 * @return The editor maximum length |
|
2159 */ |
|
2160 inline TInt MaxLength() const; |
|
2161 |
|
2162 public: |
|
2163 |
|
2164 // added to get access to user flags without a get/set for every different |
|
2165 // flag. |
|
2166 /** |
|
2167 * Adds user flags. |
|
2168 * See @c TFlags. |
|
2169 * |
|
2170 * @param aFlag Flags to add. |
|
2171 */ |
|
2172 IMPORT_C void AddFlagToUserFlags(TUint32 aFlag); |
|
2173 |
|
2174 /** |
|
2175 * Removes user flags. |
|
2176 * See @c TFlags. |
|
2177 * |
|
2178 * @param aFlag Flags to remove. |
|
2179 */ |
|
2180 IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag); |
|
2181 |
|
2182 /** |
|
2183 * Gets user flags. |
|
2184 * See @c TFlags. |
|
2185 * |
|
2186 * @return The user flags. |
|
2187 */ |
|
2188 IMPORT_C TUint32 UserFlags() const ; |
|
2189 |
|
2190 public: |
|
2191 |
|
2192 /** |
|
2193 * Sets the character format layer for the editor. Ownership of the |
|
2194 * CCharFormatLayer is transferred. |
|
2195 * |
|
2196 * @param aCharFormatLayer Pointer to the character format layer object. |
|
2197 */ |
|
2198 IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer); |
|
2199 |
|
2200 /** |
|
2201 * Sets the paragraph format layer for the editor. Ownership of the |
|
2202 * CParaFormatLayer is transferred. |
|
2203 * |
|
2204 * @param aParaFormatLayer Pointer to the paragraph format layer object. |
|
2205 */ |
|
2206 IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer); |
|
2207 |
|
2208 |
|
2209 public: // Skins support |
|
2210 |
|
2211 /** |
|
2212 * Sets within in the editor an externally owned Skins background control |
|
2213 * context. This background control context will then be used by the editor |
|
2214 * to draw background. |
|
2215 * |
|
2216 * If this API is not called, then the editor IS skin enabled, (that is |
|
2217 * @c CEikEdwins are skin enabled by default) but it will try to find a |
|
2218 * control context with which to perform background drawing from the |
|
2219 * Control Environment, via the Object Provider. |
|
2220 * |
|
2221 * Setting this control context to NULL will have the effect of turning off |
|
2222 * background skinning. |
|
2223 * |
|
2224 * @param aContext Control context to store. Not owned. Can be NULL. |
|
2225 */ |
|
2226 IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* |
|
2227 aContext ); |
|
2228 |
|
2229 /** |
|
2230 * Access to Skins background control context that is potentially being |
|
2231 * used by the Editor. |
|
2232 * |
|
2233 * This API will first check to see if an control context has been set by |
|
2234 * API, and if so, return that. If the background control context has been |
|
2235 * set to NULL by API, then it will return NULL. If the background control |
|
2236 * context has never been set by API, then this returns the control context |
|
2237 * (if one exists) that the object obtains from Object Provider. |
|
2238 * |
|
2239 * @return Pointer to control context potentially in |
|
2240 * use, or NULL. |
|
2241 */ |
|
2242 MAknsControlContext* SkinBackgroundControlContext() const; |
|
2243 |
|
2244 /** |
|
2245 * Access to disposition of the editor to perform Skinning. This does not |
|
2246 * take into account whether the application is skin enabled or whether the |
|
2247 * environment is providing a background control context. It is only a |
|
2248 * function of whether editor's (default) disposition to skin has been |
|
2249 * countered by calls on the editor API. |
|
2250 * |
|
2251 * @return @c EFalse if SetSkinBackgroundControlContextL has been |
|
2252 * called with NULL in its most recent call. |
|
2253 */ |
|
2254 TBool SkinEnabled() const; |
|
2255 |
|
2256 /** |
|
2257 * Stores the alignment value for an editor. |
|
2258 * |
|
2259 * @param aAlignment Editor alignment to be stored - must be supplied as |
|
2260 * one of the values in Avkon editor alignment enum i.e.: |
|
2261 * EAknEditorAlignCenter, |
|
2262 * EAknEditorAlignLeft, |
|
2263 * EAknEditorAlignRight, |
|
2264 * EAknEditorAlignBidi |
|
2265 */ |
|
2266 IMPORT_C void SetAlignment(TInt aAlignment); |
|
2267 |
|
2268 public: // Pictograph support |
|
2269 |
|
2270 /** |
|
2271 * Redraws text view. Used for pictograph animations. |
|
2272 */ |
|
2273 void DrawTextView() const; |
|
2274 |
|
2275 /** |
|
2276 * Sets the callback, which the editor calls after having redrawn itself |
|
2277 * for animated pictographs. @c CEikCaptionedControl uses it to draw the |
|
2278 * highlight frame on top of the editor. |
|
2279 * |
|
2280 * @since S60 2.6 |
|
2281 * @param aCallBack The callback. |
|
2282 */ |
|
2283 IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack ); |
|
2284 |
|
2285 /** |
|
2286 * Returns pictograph animation callback. If it is not set, the function |
|
2287 * pointer is NULL. |
|
2288 * |
|
2289 * @return Pictograph animation callback |
|
2290 */ |
|
2291 const TCallBack& PictographAnimationCallBack() const; |
|
2292 |
|
2293 /** |
|
2294 * This method sets the upper limit of full document formatting. |
|
2295 * |
|
2296 * At construction, the mode is full document formatting, where the text |
|
2297 * formatter processes the whole document to determine its layout. |
|
2298 * |
|
2299 * When the text content is set, or when user input causes the length of |
|
2300 * text to exceed this value, the formatting mode switches to "Band" |
|
2301 * formatting, where the text formatter attempts to format as little as |
|
2302 * possible - optimally just the visible screen. |
|
2303 * |
|
2304 * A lower limit is calculated from the passed-in value, by the subtraction |
|
2305 * of a constant. When the text becomes smaller than this lower limit, the |
|
2306 * formatting switches to full document formatting. |
|
2307 * |
|
2308 * Internally-imposed limits prevent the client setting too small a value |
|
2309 * for proper operation of the text formatting. |
|
2310 * |
|
2311 * If this method is not called, the upper and lower limts are set to a |
|
2312 * large default values. |
|
2313 * |
|
2314 * Access to the actual limits is available via the methods |
|
2315 * @c UpperFullFormattingLength() and @c LowerPartialFormattingLength(). |
|
2316 * |
|
2317 * @since 3.0 |
|
2318 * @param aUpperFullFormattingLimit The upper limit of full document |
|
2319 * formatting. |
|
2320 */ |
|
2321 IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit ); |
|
2322 |
|
2323 /** |
|
2324 * Can be called to inhibit redrawing of the editor when NotifyNewFormatL() |
|
2325 * is called. |
|
2326 * |
|
2327 * @param aEnabled If ETrue, inhibit redrawing when notified of |
|
2328 * new format from now on. |
|
2329 */ |
|
2330 IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled ); |
|
2331 |
|
2332 /** |
|
2333 * Can be called to inhibit formatting of the editor. Care is required to ensure that |
|
2334 * the necessary reformatting is carried out later on if this API is used. |
|
2335 * |
|
2336 * Note: When called with EFalse, it does not automatically trigger reformatting. |
|
2337 * |
|
2338 * @since 3.1 |
|
2339 * @param aSuppressed If ETrue, inhibit formatting from now on, if EFalse, |
|
2340 * re-enable formatting from now on. |
|
2341 */ |
|
2342 IMPORT_C void SetSuppressFormatting( TBool aSuppressed ); |
|
2343 |
|
2344 /** |
|
2345 * Enables kinetic scrolling in editor. |
|
2346 * |
|
2347 * Note that when kinetic scrolling is enabled, it is |
|
2348 * no longer possible to disable it with this function. |
|
2349 * |
|
2350 * @since S60 v5.2 |
|
2351 * @param aEnable ETrue if kinetic scrolling should be enabled. |
|
2352 */ |
|
2353 IMPORT_C void EnableKineticScrollingL( TBool aEnable ); |
|
2354 |
|
2355 /** |
|
2356 * Enables kinetic scrolling in editor with external CAknPhysics instance. |
|
2357 * |
|
2358 * Note that when kinetic scrolling is enabled, it is |
|
2359 * no longer possible to disable it with this function. |
|
2360 * |
|
2361 * @since S60 v5.2 |
|
2362 * @param aPhysics Pointer to external CAknPhysics instance. |
|
2363 */ |
|
2364 IMPORT_C void EnableKineticScrollingL( CAknPhysics* aPhysics ); |
|
2365 |
|
2366 public: |
|
2367 void EnableSmileySupportL( TBool aEnableSmiley ); |
|
2368 TBool IsSmileyEnabled() const; |
|
2369 void DrawSmileyInTextL( RRegion& rgn, const TRect& aDrawRect, |
|
2370 CBitmapContext& aGc, CFont& aFont, const TDesC& aText, const TPoint& aPt ); |
|
2371 void ConvertVisibleTextForSmileyL( TBool aTextToCode ); |
|
2372 TBool AdjustCursorForSmileyL( TInt aOldCursor, TCursorSelection& aSelect ); |
|
2373 TRect AdjustDrawRectForSmiley( const TRect& aRect ) const; |
|
2374 HBufC* ExtractTextLC( TCursorSelection aSelect ); |
|
2375 void ConvertSmileyIconToTextL( TInt aStartPos, TDes& aText ); |
|
2376 |
|
2377 private: |
|
2378 void ConvertTextForSmileyL( TCursorSelection aSelect, |
|
2379 TBool aTextToCode, TBool aRedraw = ETrue ); |
|
2380 void TrimText( TDes& aText ); |
|
2381 TCursorSelection GetVisibleTextRangeL(); |
|
2382 void ExtendedRangeForSmiley( TCursorSelection& aSelect ); |
|
2383 TBool ConvertSmileyForDeleteL( TInt aDocPos, TBool aBackSpace ); |
|
2384 void ConvertSmileyForDeleteL( const TCursorSelection &aSelect ); |
|
2385 TBool AdjustCursorPosByMovementL( TCursorPosition::TMovementType aMovement, |
|
2386 TBool aSelect ); |
|
2387 void HandleSelectionForSmiley( TCursorSelection aSelect ); |
|
2388 |
|
2389 protected: |
|
2390 |
|
2391 /** |
|
2392 * Specifies the end points of the editable area. |
|
2393 */ |
|
2394 enum TEnd |
|
2395 { |
|
2396 /** The start of the editable area. */ |
|
2397 EStart, |
|
2398 |
|
2399 /** The end of the editable area. */ |
|
2400 EEnd |
|
2401 }; |
|
2402 |
|
2403 /** |
|
2404 * Specifies the chunk size as either a word, or a paragraph. |
|
2405 */ |
|
2406 enum TChunkSize |
|
2407 { |
|
2408 /** A word. */ |
|
2409 EChunkWord, |
|
2410 |
|
2411 /** A paragraph. */ |
|
2412 EChunkPara |
|
2413 }; |
|
2414 |
|
2415 /** |
|
2416 * Specifies the chunk size as either a word, or a paragraph. |
|
2417 */ |
|
2418 enum TEikEdwinFlags // Internal flags |
|
2419 { |
|
2420 /** Rich text editor used. */ |
|
2421 ERichText =0x00000001, |
|
2422 |
|
2423 /** For double item dragging. */ |
|
2424 EDragDouble =0x00000002, |
|
2425 |
|
2426 /** |
|
2427 * If set, indicates the pointer being pressed inside the |
|
2428 * editor rectangle. |
|
2429 */ |
|
2430 ELeftDownInViewRect =0x00000004, |
|
2431 |
|
2432 /** Used to calculate initial width. */ |
|
2433 ENumericCharacters =0x00000008, |
|
2434 |
|
2435 /** Edwin has one line and is not resizable. */ |
|
2436 EHasOneLineOnly =0x00000010, |
|
2437 |
|
2438 /** |
|
2439 * Custom formatter is installed to find and format phone numbers |
|
2440 * (@c CEikRichTextEditor only). |
|
2441 */ |
|
2442 EPhoneNumberGrouping = 0x00000020, |
|
2443 ESuppressNotifyDraw = 0x00000040, |
|
2444 ESuppressFormatting = 0x00000080, // Suppresses calls to formatting |
|
2445 ESkipBackgroundDrawer = 0x00000100 |
|
2446 /* NOTE : If you want to add new flags here please be carefull. There are other |
|
2447 flags are defined as |
|
2448 enum |
|
2449 { // internal flags |
|
2450 EWysiwygOn = 0x00000200, |
|
2451 EUnderOneScreenFormattedText = 0x00000400, |
|
2452 EPictureDelimits = 0x00000800, |
|
2453 EPunctuationDelimits = 0x00001000, |
|
2454 EPasteFromIrStore = 0x00002000, |
|
2455 ELockScrollBarState = 0x00004000, |
|
2456 EOnReformatting = 0x00008000 |
|
2457 }; |
|
2458 */ |
|
2459 }; |
|
2460 |
|
2461 protected: // from MEditObserver |
|
2462 |
|
2463 /** |
|
2464 * From @c MEditObserver. |
|
2465 * |
|
2466 * Observer function called by the @c CRichText object when the object is |
|
2467 * edited to give notification of changes to its text buffer. In this way, |
|
2468 * the control knows how the text object has changed and can reformat and |
|
2469 * redraw the text object appropriately. |
|
2470 * |
|
2471 * @param aStartEdit The start position of the edit. |
|
2472 * @param aEditLength The number of characters added or, if negative, |
|
2473 * deleted after this position. |
|
2474 */ |
|
2475 IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength); |
|
2476 |
|
2477 protected: |
|
2478 |
|
2479 /** |
|
2480 * Draws the visible text and the cursor for DrawL(), but does not draw |
|
2481 * the border. The @c DrawL() function is trapped to handle problems due |
|
2482 * to insufficient resources being available. |
|
2483 * |
|
2484 * @param aRect Rectangle in which to draw. |
|
2485 */ |
|
2486 IMPORT_C void TrappedDraw(const TRect& aRect) const; |
|
2487 |
|
2488 /** |
|
2489 * Draws the visible text and the cursor. |
|
2490 */ |
|
2491 IMPORT_C void DrawContents(); |
|
2492 |
|
2493 /** |
|
2494 * Completes the second-phase construction of a @c CEikEdwin object. This |
|
2495 * protected function is called by @c ConstructL() and |
|
2496 * @c ConstructFromResourceL() after the Edwin’s size, flags and text |
|
2497 * limit have been set. Derived classes should call either this function |
|
2498 * or @c CEikEdwin’s @c ConstructL() or @c ConstructFromResourceL() |
|
2499 * functions during their construction before initialising their own |
|
2500 * members. |
|
2501 */ |
|
2502 IMPORT_C void BaseConstructL(); |
|
2503 |
|
2504 /** |
|
2505 * Formats all the text in the text view. Called by several functions, for |
|
2506 * example by @c CEikEdwin::HandleTextChangedL() and |
|
2507 * @c CEikEdwin::SetTextL(). |
|
2508 */ |
|
2509 IMPORT_C void FormatTextL(); |
|
2510 |
|
2511 /** |
|
2512 * Deletes the text under the cursor selection, also cancelling the |
|
2513 * selection. This function asks the user to confirm this action if |
|
2514 * aPromptConfirmation is ETrue. |
|
2515 * |
|
2516 * @param[out] aChanged On return, @c ETrue if the text was changed. |
|
2517 * @param[in] aIsBackSpace ETrue if this is in response to backspace being |
|
2518 * pressed. Determines whether character formatting is preserved |
|
2519 * or not. Default value is @c EFalse. |
|
2520 * @param[in] aPromptConfirmation Optional. @c ETrue to ask the user to |
|
2521 * confirm this action. Default value is @c ETrue. |
|
2522 * @return The cursor position in the text after deletion. |
|
2523 */ |
|
2524 IMPORT_C TInt DeleteHighlightL(TBool& aChanged, |
|
2525 TBool aIsBackSpace=EFalse, |
|
2526 TBool aPromptConfirmation=ETrue); |
|
2527 |
|
2528 /** |
|
2529 * Confirms whether the deletion of the user’s selection is required. |
|
2530 * |
|
2531 * If the user’s selection is less than @c KBlockDeleteWarningSize and does |
|
2532 * not contain a picture, this function returns @c ETrue. |
|
2533 * |
|
2534 * If the user’s selection is greater than @c KBlockDeleteWarningSize or |
|
2535 * contains a picture, this function asks the user to confirm deletion of |
|
2536 * their selection and then returns the user’s response. |
|
2537 * |
|
2538 * @return @c ETrue. |
|
2539 */ |
|
2540 IMPORT_C TBool OkToDeleteSelectionL(); |
|
2541 |
|
2542 /** |
|
2543 * Deletes the cursor’s selection. If no selection is made, this function |
|
2544 * deletes only one character. The argument @c aIsBackSpace determines |
|
2545 * whether to preserve the character formatting or not. |
|
2546 * |
|
2547 * @param[out] aChanged On return, @c ETrue if the text was changed. |
|
2548 * @param[in] aSelection The cursor selection describing the position to be |
|
2549 * deleted. |
|
2550 * @param[in] aIsBackSpace @c ETrue if this in response to backspace being |
|
2551 * pressed. Determines whether character formatting is preserved |
|
2552 * or not. |
|
2553 * @param[in] aAllowUndo @c ETrue if the user is permitted to undo this |
|
2554 * change. |
|
2555 */ |
|
2556 IMPORT_C void DeleteL(TBool& aChanged, |
|
2557 const TCursorSelection& aSelection, |
|
2558 TBool aIsBackSpace=EFalse, |
|
2559 TBool aAllowUndo=ETrue); |
|
2560 |
|
2561 /** |
|
2562 * Handles errors that occur when handling a change in Edwin’s size. Calls |
|
2563 * @c CEikonEnv::NotifyIdleErrorWhileRedrawing(). |
|
2564 */ |
|
2565 IMPORT_C void TrappedSizeChanged(); |
|
2566 |
|
2567 /** |
|
2568 * Handles a change in Edwin’s size. This function accounts for text wrap |
|
2569 * settings and whether the Edwin is ready to be redrawn and also calls |
|
2570 * functions to reformat text and to update the Edwin’s scroll bars. |
|
2571 */ |
|
2572 IMPORT_C void HandleSizeChangedL(); |
|
2573 |
|
2574 /** |
|
2575 * Cancels the selection and any FEP composition text. This function then |
|
2576 * repositions the cursor at the specified end of the currently selected |
|
2577 * text. |
|
2578 * |
|
2579 * @param aEndOfSelectionToLeaveCursor The end of the current selection at |
|
2580 * which the cursor is repositioned. |
|
2581 */ |
|
2582 IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor); |
|
2583 |
|
2584 /** |
|
2585 * Moves the cursor to the beginning of the next word or paragraph. This |
|
2586 * function cancels any front end processing transaction currently in |
|
2587 * progress for the Edwin. |
|
2588 * |
|
2589 * @param aSelect If @c ETrue the chunk is selected, otherwise @c EFalse. |
|
2590 * @param aChunkSize The chunk size, this can be either a word or a |
|
2591 * paragraph. See @c TChunkSize enum. |
|
2592 * @param aEndScanningTowards Which direction to scan towards, the start |
|
2593 * or the end of the document. |
|
2594 */ |
|
2595 IMPORT_C void MoveCursorToChunkStartL(TBool aSelect, |
|
2596 TChunkSize aChunkSize, |
|
2597 TEnd aEndScanningTowards); |
|
2598 |
|
2599 /** |
|
2600 * Cancels the insertion of a character format. This can be used for rich |
|
2601 * text only. |
|
2602 */ |
|
2603 IMPORT_C void CancelInsertCharFormat(); |
|
2604 |
|
2605 /** |
|
2606 * Copies the contents of the cursor selection onto the clipboard. |
|
2607 */ |
|
2608 IMPORT_C void PlaceDataOnClipboardL(); |
|
2609 |
|
2610 /** |
|
2611 * Reports an Edwin event of the specified type. The Edwin event is passed |
|
2612 * first to the Edwin observer and then to the list of observers, even if |
|
2613 * the first Edwin observer is not set. If the Edwin has a custom drawer, |
|
2614 * and the event is of type @c EEventFormatChanged, the event is passed to |
|
2615 * the custom drawer. If the Edwin has an observer the event is passed to |
|
2616 * that observer. If no observer is set for the Edwin, this function passes |
|
2617 * the event to each observer in the observer list. |
|
2618 * |
|
2619 * @param aEventType The type of event to report. |
|
2620 */ |
|
2621 IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType); |
|
2622 |
|
2623 /** |
|
2624 * Sets margin widths and line cursor width. |
|
2625 */ |
|
2626 IMPORT_C void SetLineCursorDetailsL(); |
|
2627 |
|
2628 /** |
|
2629 * Replaces the current Edwin text. |
|
2630 * |
|
2631 * @param aInText Text with which the current text is replaced. |
|
2632 * @param aOutText On return, the replaced text. |
|
2633 */ |
|
2634 IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText, |
|
2635 CGlobalText& aOutText); |
|
2636 |
|
2637 /** |
|
2638 * Displays an information message to indicate that the specified text |
|
2639 * could not be found. The information message is constructed from |
|
2640 * @c R_EIK_TBUF_CANNOT_FIND_TEXT. |
|
2641 * |
|
2642 * @param aFindText The text that could not be found. |
|
2643 */ |
|
2644 IMPORT_C void DisplayFindTextNotFound(TDes& aFindText); |
|
2645 |
|
2646 /** |
|
2647 * Not implemented. |
|
2648 * |
|
2649 * @param aStartPos Not used. |
|
2650 * @param aLength Not used. |
|
2651 */ |
|
2652 IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength); |
|
2653 |
|
2654 /** |
|
2655 * Creates a new @c CLafEdwinCustomDrawBase instance. |
|
2656 * |
|
2657 * @return Pointer to new custom @c CLafEdwinCustomDrawBase object. |
|
2658 */ |
|
2659 IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL(); |
|
2660 |
|
2661 // Avkon editor extensions |
|
2662 /** |
|
2663 * Used in @c ConstructFromResourceL(). Sets Avkon editor properties. |
|
2664 * |
|
2665 * @param aReader A reader positioned for reading from an EDWIN resource. |
|
2666 */ |
|
2667 IMPORT_C void ReadAknResourceL(TResourceReader& aReader); |
|
2668 |
|
2669 protected: // Internal to Symbian |
|
2670 |
|
2671 /** |
|
2672 * Creates new text layout. |
|
2673 * |
|
2674 * @param aLayDoc Pointer to the @c MLayDoc implementation that is the |
|
2675 * source of the text and formatting information. |
|
2676 */ |
|
2677 IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc); |
|
2678 |
|
2679 /** |
|
2680 * Creates new instance of @c CGlobalText and text layout based on it. |
|
2681 * |
|
2682 * @param aParaFormatLayer Paragraph format layer pointer for |
|
2683 * @c CGlobalText constructor. |
|
2684 * @param aCharFormatLayer Character format layer pointer for |
|
2685 * @c CGlobalText constructor. |
|
2686 */ |
|
2687 IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer, |
|
2688 CCharFormatLayer* aCharFormatLayer); |
|
2689 |
|
2690 /** |
|
2691 * Checks that is Edwin's extension created. If not, it will be created. |
|
2692 * |
|
2693 * @leave KErrNoMemory If the Edwin FEP support pointer is NULL. |
|
2694 */ |
|
2695 IMPORT_C void CheckEdwinExtensionL(); |
|
2696 |
|
2697 /** |
|
2698 * Gets Edwin's extension. |
|
2699 * |
|
2700 * @return Pointer to Edwin's extension. |
|
2701 */ |
|
2702 IMPORT_C CEikEdwinExtension* EdwinExtension(); |
|
2703 private: |
|
2704 // NOTE : the follow enume and the enum TEikEdwinFlags are both used for iEdwinInternalFlags |
|
2705 // it is very easy to conflict !!! So if you want add new flag please check if it has been |
|
2706 // declared in enum TEikEdwinFlags |
|
2707 enum |
|
2708 { // internal flags |
|
2709 EWysiwygOn = 0x00000200, |
|
2710 EUnderOneScreenFormattedText = 0x00000400, |
|
2711 EPictureDelimits = 0x00000800, |
|
2712 EPunctuationDelimits = 0x00001000, |
|
2713 EPasteFromIrStore = 0x00002000, |
|
2714 ELockScrollBarState = 0x00004000, |
|
2715 EOnReformatting = 0x00008000 |
|
2716 }; |
|
2717 |
|
2718 private: // from CCoeControl |
|
2719 |
|
2720 IMPORT_C void SizeChanged(); |
|
2721 IMPORT_C TInt CountComponentControls() const; |
|
2722 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; |
|
2723 IMPORT_C void Reserved_2(); |
|
2724 |
|
2725 private: |
|
2726 |
|
2727 IMPORT_C virtual void Reserved_3(); |
|
2728 IMPORT_C virtual void NotifyInvalidOperationOnReadOnlyL(); |
|
2729 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc); |
|
2730 void SetVirtualCursorStateL(TBool aIsFocused) const; |
|
2731 void SetHeightForNumOfLinesL(); |
|
2732 void ApplyAutoSelectionL(); |
|
2733 void SetScrollBarsL(); |
|
2734 void SetVertScrollBarModelByCharactersL(TEikScrollBarModel& aVertModel) const; |
|
2735 void RetrieveDataFromClipboardL(); |
|
2736 void SetCursorVisibilityL(TBool aEmphasis); |
|
2737 TBool OwnsScrollBars() const; |
|
2738 void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const; |
|
2739 void UpdateHorizScrollBarThumb(); |
|
2740 void UpdateVertScrollBarThumbL(); |
|
2741 void DoSetUndoBufferL(const TCursorSelection& aSelection); |
|
2742 void DoPasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDict); |
|
2743 void DoReplaceAllL(SEdwinFindModel* aModel,TBool& aTextFound,TBool& aReplaced); |
|
2744 void DeleteExtraParasL(TInt aStartPos,TInt aLength); |
|
2745 TInt LocateChar(TChar aChar,TInt aStartPos,TInt aLength); |
|
2746 TBool IsValidChar(TInt aChar) const; |
|
2747 TInt CalcMinimumHeightFromNumOfLinesL() const; |
|
2748 void CheckEdwinHeight(); |
|
2749 TBool IsNewHeightWithinMinimumAndMaximum(TInt aNewHeight) const; |
|
2750 void SetEdwinHeight(TInt aHeight); |
|
2751 void DoCreateCustomDrawL(); |
|
2752 void SetCursorSizeAndType(); |
|
2753 TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
2754 void DoCcpuCanPasteL() const; |
|
2755 void DoReportEventL(MCoeControlObserver::TCoeEvent aEvent); |
|
2756 void CheckIfEdwinIsResizable(); |
|
2757 void SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 aKeyRepeatRate) const; |
|
2758 HBufC* GetAllowedCharsLC() const; |
|
2759 TInt CheckAllowedCharsL(const TDesC& aChars, CClipboard& aClipboard, TBool aRichText) const; |
|
2760 |
|
2761 TInt CursorWidth() const; |
|
2762 TFontSpec CursorFontSpec() const; |
|
2763 |
|
2764 void BuildEdwinFepSupport(); |
|
2765 void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer); |
|
2766 void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer); |
|
2767 void UpdateCache(TInt aId); |
|
2768 void DrawBackgroundAroundTextView( |
|
2769 CWindowGc& gc, |
|
2770 const TRect& aOuterRect, |
|
2771 const TRect& aInnerRect, |
|
2772 const TRgb& aBackgroundColor ) const; |
|
2773 TInt CurrentAlignment() const; |
|
2774 void DoAlignment(); |
|
2775 void NewParagraphL(); |
|
2776 TKeyResponse ScrollReadOnlyNoCursorDisplayL(TUint aKeyCode); |
|
2777 void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength ); |
|
2778 TRect AdjustedViewRect() const; |
|
2779 void SetVKBStatus(); |
|
2780 void ScrollViewToCursorLineL(); |
|
2781 void PerformRecordedOperationL(); |
|
2782 void ScrollIfAtTopOrBottomL(); |
|
2783 void SetSelectionVisibilityL( TBool aIsVisable ); |
|
2784 |
|
2785 /** |
|
2786 * Sets scrollbars with kinetic scrolling. |
|
2787 */ |
|
2788 void SetKineticScrollingScrollBarsL(); |
|
2789 |
|
2790 /** |
|
2791 * Sets vertical scrollbar model with kinetic scrolling. |
|
2792 * |
|
2793 * @param aVertModel Vertical scrollbar model |
|
2794 */ |
|
2795 void SetKineticScrollingScrollBarModel( |
|
2796 TEikScrollBarModel& aVertModel ) const; |
|
2797 |
|
2798 /** |
|
2799 * Enables rate scrolling in editor. |
|
2800 * |
|
2801 * @param aEnable ETrue if rate scrolling should be enabled. |
|
2802 */ |
|
2803 void EnableRateScrolling( TBool aEnable ); |
|
2804 |
|
2805 private: |
|
2806 |
|
2807 void DrawFirstLineTextL() const; |
|
2808 CAknEdwinDrawingModifier* AknEdwinDrawingModifier(); |
|
2809 TBool EditorSupportsNeutralProtection() const; |
|
2810 |
|
2811 /** |
|
2812 * Main routine for neutral protection. This routine returns a boolean stating if there is a |
|
2813 * requirement for protection, but also returns the text that should replace the to-be-deleted text. |
|
2814 * |
|
2815 * @param aPosOfLosEndOfDelete index of the first character deleted |
|
2816 * @param aLengthToDelete length the text to be deleted |
|
2817 * @param aNewText neutral protection characters to replace the delete |
|
2818 * @param aForwardProtectionNeeded EFalse if only reverse protection needed; data valid only if |
|
2819 * method does not return EFalse. |
|
2820 * @return EFalse iff no deletion is to be performed |
|
2821 */ |
|
2822 TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded ); |
|
2823 |
|
2824 /** |
|
2825 * Returns whether the character is strongly directional |
|
2826 * |
|
2827 * @param aChar character to be examined |
|
2828 * @param aRightToLeft This is valid upon return only if EFalse is not returned. |
|
2829 * Value is EFalse if the strong directionality is Left-to-right |
|
2830 * @return EFalse if the character is not strongly directional. |
|
2831 */ |
|
2832 TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const; |
|
2833 |
|
2834 /** |
|
2835 * Returns ETrue if the character at aPos is neutral |
|
2836 * |
|
2837 * @param aPos index in editor; must be a valid index |
|
2838 * @return EFalse iff the character is not neutral |
|
2839 */ |
|
2840 TBool CharIsNeutral( TInt aPos ) const; |
|
2841 |
|
2842 /** |
|
2843 * Looks through the passed descriptor, looking for a strongly directional character. |
|
2844 * Direction of search can be set. Search starts at the begining if searching forward; |
|
2845 * starts at the end if searching backwards. |
|
2846 * |
|
2847 * Search is carried out until a strong character is found or the end (or beginning) |
|
2848 * of the descriptor has been reached. |
|
2849 * |
|
2850 * @param aText Descriptor to search. |
|
2851 * @param aForward If EFalse, then search is backward (decreasing index) in logical buffer |
|
2852 * @param aIsRightToLeft Set to ETrue on return if first strong character found is RTL |
|
2853 * |
|
2854 * @return EFalse if no strong character was found. |
|
2855 */ |
|
2856 TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const; |
|
2857 |
|
2858 /** |
|
2859 * Looks through the editor's text starting at character aPos, looking for a |
|
2860 * strongly directional character. Direction of search can be set. |
|
2861 * Search is carried out until a strong character is found or the end (or beginning) |
|
2862 * of the editor text has been reached. |
|
2863 * |
|
2864 * @param aPos First character to look at |
|
2865 * @param aForward If EFalse, then search is backward (decreasing index) in logical buffer |
|
2866 * @param aIsRightToLeft Set to ETrue on return if first strong character found is RTL |
|
2867 * |
|
2868 * @return EFalse if no strong character was found. |
|
2869 */ |
|
2870 TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const; |
|
2871 |
|
2872 /** |
|
2873 * Routine to perform the operation of replacing a selection with new text. |
|
2874 * This is intended for internal use. |
|
2875 * |
|
2876 * The current selection, if non-zero length is deleted, and replace with aNewText if non-zero length |
|
2877 * iTextView must be set. |
|
2878 * |
|
2879 * @param aNewText Replacement text. May be zero length. |
|
2880 * @param aCursorPosInNewText This is the position, relative to the beginning of the newtext, |
|
2881 * that you want the cursor to be at when the operation is complete |
|
2882 * @param aFormatHasChanged Set this to ETrue if you want the reformatting to start at |
|
2883 * the beginning of the paragraph. EFalse if just to reformat the line. |
|
2884 * This variable may also be set by the call to DeleteHighlight that this |
|
2885 * code executes, so it may be set to ETrue upon return, even if EFalse was |
|
2886 * passed. |
|
2887 */ |
|
2888 void ReplaceSelectionWithTextL( const TDesC& aNewText, |
|
2889 TInt aCursorPosInNewText, |
|
2890 TBool& aFormatHasChanged ); |
|
2891 |
|
2892 /** |
|
2893 * Returns EFalse iff ( phone number had only numeric input modes AND the keymap is a phone number |
|
2894 * type keymap ). |
|
2895 * Phone number type keymaps are: |
|
2896 * EAknEditorStandardNumberModeKeymap |
|
2897 * EAknEditorFixedDiallingNumberModeKeymap |
|
2898 * |
|
2899 * @return EFalse if the phone number will only contain a pure phone number |
|
2900 */ |
|
2901 TBool IsPurePhoneNumberEditor() const; |
|
2902 |
|
2903 /** |
|
2904 * Standard check on upper and lower formatting thresholds versus current textview formatting mode. |
|
2905 * |
|
2906 * @return EFalse iff the formatting mode does not need changing |
|
2907 */ |
|
2908 TBool NeedToChangeFormattingModeL() const; |
|
2909 |
|
2910 /** |
|
2911 * When Band formatting is started, this should be called to update the cached |
|
2912 * metrics used for the scroll bar calculations. |
|
2913 */ |
|
2914 void CalculateLineMetricsForBandFormattingL(); |
|
2915 |
|
2916 /** |
|
2917 * check the selection content is visible character or not |
|
2918 */ |
|
2919 TBool IsSelectionVisible(); |
|
2920 |
|
2921 |
|
2922 protected: // from MObjectProvider |
|
2923 |
|
2924 /** |
|
2925 * From @c MObjectProvider. |
|
2926 * |
|
2927 * Retrieves an object of the same type as that encapsulated in @c aId. |
|
2928 * |
|
2929 * This function is used to allow controls to ask their owners for access |
|
2930 * to other objects that they own. |
|
2931 * |
|
2932 * Other than in the case where NULL is returned, the object returned must |
|
2933 * be of the same object type - that is, the @c ETypeId member of the |
|
2934 * object pointed to by the pointer returned by this function must be equal |
|
2935 * to the @c iUid member of @c aId. |
|
2936 * |
|
2937 * @param aId An encapsulated object type ID. |
|
2938 * @return Encapsulates the pointer to the object provided. Note that the |
|
2939 * encapsulated pointer may be NULL. |
|
2940 */ |
|
2941 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
2942 |
|
2943 public: // new since 3.0 |
|
2944 |
|
2945 /** |
|
2946 * Sets skin id for text. |
|
2947 * |
|
2948 * @param aAknSkinIdForTextColor The skin id. |
|
2949 */ |
|
2950 IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor); |
|
2951 |
|
2952 /** |
|
2953 * Sets highlight style. |
|
2954 * |
|
2955 * @param aStyle The highlight style. |
|
2956 */ |
|
2957 IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle); |
|
2958 |
|
2959 // for custom drawer, not exported |
|
2960 /** |
|
2961 * Gets skin id. |
|
2962 * |
|
2963 * @return The skin id. |
|
2964 */ |
|
2965 TInt SkinColorId() const; |
|
2966 |
|
2967 /** |
|
2968 * Gets highlight style. |
|
2969 * |
|
2970 * @return The highlight style. |
|
2971 */ |
|
2972 TAknsHighlightStyle HighlightStyle() const; |
|
2973 |
|
2974 /** |
|
2975 * Called to determine the background color to draw. It is not to be used if skinning is |
|
2976 * being used to draw the background. |
|
2977 * |
|
2978 * This API can be used two ways: |
|
2979 * |
|
2980 * i) If the caller has a default color to offer (to be used as |
|
2981 * a fallback if SetBackgroundColorL has not been called), then he should use the |
|
2982 * Input/Output parameter aConditionalColor, and ignore the return value. The output |
|
2983 * parameter will only be over-written by the set background color if SetBackgroundColorL |
|
2984 * has been called. |
|
2985 * |
|
2986 * ii) If the caller does not have a default color to offer, then he should pass in a dummy |
|
2987 * input parameter and use the return value. |
|
2988 * |
|
2989 * @param aConditionalColor Output parameter. Returns a color set by |
|
2990 * SetBackgroundColorL. It is unchanged if |
|
2991 * background color has not been set by SetBackgroundColorL |
|
2992 * @return TRgb for the color to be used for background. |
|
2993 */ |
|
2994 TRgb EditorBackgroundColor(TRgb& aConditionalColor) const; |
|
2995 |
|
2996 public: |
|
2997 /** |
|
2998 * Can be used by custom drawers to check if background drawing should be |
|
2999 * performed. This is meant to be used only if editor has |
|
3000 * MCoeControlBackground object attached. |
|
3001 * |
|
3002 * @return ETrue if custom drawer shouldn't draw background. |
|
3003 */ |
|
3004 TBool SkipBackgroundDrawer() const; |
|
3005 |
|
3006 /** |
|
3007 * Scrolls view by amount of pixels. |
|
3008 * Stops scrolling when beginning or end of content exceeded. |
|
3009 * This function should be used when scrolling starts from inside content |
|
3010 * (in other words in normal situation when begin- or end-border has not |
|
3011 * yet exceeded) |
|
3012 * |
|
3013 * @param aPixelsToScroll Amount of pixels to scroll |
|
3014 * @param aBorderExceeded returns ETrue if border was exceeded |
|
3015 * @param aRestOfPixels Amount of pixels not scrolled because border |
|
3016 * was exceeded |
|
3017 * |
|
3018 * @return Amount of scrolled pixels. |
|
3019 */ |
|
3020 TInt ScrollView( TInt aPixelsToScroll, TBool& aBorderExceeded, |
|
3021 TInt& aRestOfPixels ); |
|
3022 |
|
3023 /** |
|
3024 * Scrolls view by amount of pixels. |
|
3025 * |
|
3026 * This function should be used to scroll when we have already |
|
3027 * exceeded begin- or end-border (we are out of borders). |
|
3028 * This function supports scrolling so that there can be empty space |
|
3029 * above or below the editor content (used in bounce effect). |
|
3030 * Stops scrolling when we return back to inside borders. |
|
3031 * |
|
3032 * @param aPixelsToScroll Amount of pixels to scroll |
|
3033 * @param aEndOfBounce returns ETrue if content scrolled back |
|
3034 * to inside of borders |
|
3035 * @param aRestOfPixels Amount of pixels not scrolled |
|
3036 * |
|
3037 * @return Amount of scrolled pixels. |
|
3038 */ |
|
3039 TInt ScrollViewWithBounce( TInt aPixelsToScroll, TBool& aEndOfBounce, |
|
3040 TInt& aRestOfPixels ); |
|
3041 |
|
3042 /** |
|
3043 * Returns amount of pixels how much we are out of borders. |
|
3044 * |
|
3045 * @return Amount of pixels scrolled out of borders. |
|
3046 */ |
|
3047 TInt PixelsOutOfBorder() const; |
|
3048 |
|
3049 /** |
|
3050 * Handles scrollbar events with kinetic scrolling. |
|
3051 * |
|
3052 * @param aScrollBar The scrollbar. |
|
3053 */ |
|
3054 void HandleScrollEventWithPhysics( CEikScrollBar* aScrollBar ); |
|
3055 |
|
3056 /** |
|
3057 * If cursor is visible, disables it and stores cursor visibility info. |
|
3058 */ |
|
3059 void StoreCursorState(); |
|
3060 |
|
3061 /** |
|
3062 * Show cursor again if needed (based on stored cursor visibility info). |
|
3063 */ |
|
3064 void RestoreCursorState(); |
|
3065 |
|
3066 /** |
|
3067 * Returns ETrue if kinetic scrolling is enabled. |
|
3068 * |
|
3069 * @return ETrue if kinetic scrolling is enabled. |
|
3070 */ |
|
3071 TBool KineticScrollingEnabled() const; |
|
3072 |
|
3073 /** |
|
3074 * Draws background to the whole view area. Call with parameter value ETrue |
|
3075 * must be followed by a call with EFalse or otherwise window's redraw |
|
3076 * isn't ended properly and graphics context is not deactivated. |
|
3077 * |
|
3078 * @param aStart If true then window area occupied by editor's view is |
|
3079 * invalidated and redraw is began. Also graphics context is |
|
3080 * activated. EFalse ends the redraw and deactivates graphics |
|
3081 * context. |
|
3082 */ |
|
3083 void DrawViewBackground( TBool aStart ) const; |
|
3084 |
|
3085 /** |
|
3086 * Returns ETrue if editor content fits to view rect. |
|
3087 * |
|
3088 * @return ETrue if editor content fits to view rect. |
|
3089 */ |
|
3090 TBool ContentFitsToViewRect() const; |
|
3091 |
|
3092 protected: |
|
3093 |
|
3094 /** |
|
3095 * Edwin user flags. |
|
3096 */ |
|
3097 TUint32 iEdwinUserFlags; |
|
3098 |
|
3099 /** |
|
3100 * Internal Edwin flags. |
|
3101 */ |
|
3102 TUint32 iEdwinInternalFlags; |
|
3103 |
|
3104 /** |
|
3105 * Edwin's text content. |
|
3106 */ |
|
3107 CPlainText* iText; |
|
3108 |
|
3109 protected: // Internal to Symbian |
|
3110 |
|
3111 /** |
|
3112 * Edwin's text view. |
|
3113 */ |
|
3114 CTextView* iTextView; |
|
3115 |
|
3116 /** |
|
3117 * Edwin's text layout. |
|
3118 */ |
|
3119 CTextLayout* iLayout; |
|
3120 |
|
3121 protected: |
|
3122 |
|
3123 /** |
|
3124 * Maximum length ot the edwin. |
|
3125 */ |
|
3126 TInt iTextLimit; |
|
3127 |
|
3128 /** |
|
3129 * Number of lines in Edwin. |
|
3130 */ |
|
3131 TInt iNumberOfLines; |
|
3132 |
|
3133 /** |
|
3134 * Current zoom factor. |
|
3135 */ |
|
3136 MGraphicsDeviceMap* iZoomFactor; |
|
3137 |
|
3138 /** |
|
3139 * Cursor position. |
|
3140 */ |
|
3141 TInt iLastPointerDocPos; |
|
3142 |
|
3143 /** |
|
3144 * Edwin's margins. |
|
3145 */ |
|
3146 TMargins8 iMargins; |
|
3147 |
|
3148 private: |
|
3149 |
|
3150 friend class CEikEdwinFepSupport; |
|
3151 friend class CEikEdwinExtension; |
|
3152 // added this class to allow additional data members without breaking BC |
|
3153 CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar |
|
3154 CEikScrollBarFrame* iSBFrame; |
|
3155 MEikEdwinObserver* iEdwinObserver; |
|
3156 CArrayPtr<MEikEdwinObserver>* iObserverArray; |
|
3157 CEikEdwinFepSupport* iEdwinFepSupport; |
|
3158 CUndoBuffer* iUndoStore; |
|
3159 TInt iAvgLinesInViewRect; |
|
3160 TInt iAvgCharsPerLine; |
|
3161 TInt iRightWrapGutter; |
|
3162 TInt iLayoutWidth; |
|
3163 MEikEdwinSizeObserver* iEdwinSizeObserver; |
|
3164 TInt iMinimumHeight; |
|
3165 TInt iMaximumHeight; |
|
3166 /* |
|
3167 iMaximumHeightInLines |
|
3168 --------------------- |
|
3169 This is simply a holder for the number, used to simplify some Avkon LAF requirements. |
|
3170 The viewable region of an edwin is actually measured in pixels, However, if certain LAF |
|
3171 requirements are enforced (that the view region has to be smaller than the number of |
|
3172 lines viewable * the baseline separation (in pixels)) some undesired scrolling effects |
|
3173 occur. |
|
3174 |
|
3175 |
|
3176 That is to say, by simply setting iMaximumHeightInLines, this will not affect |
|
3177 the actual maximum height of the edwin. To do this, you must set the iMaximumHeight |
|
3178 |
|
3179 One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin. |
|
3180 That method uses iMaximumHeightInLines along with the baseline separation, to set |
|
3181 the iMaximumHeight. |
|
3182 |
|
3183 The general formula is very simple, to remove unneeded scrolling. |
|
3184 iMaximumHeight=baselineSeparation*iMaximumNumberOfLines |
|
3185 |
|
3186 If you cannot allocate sufficient space to the edwin, to permit so much viewable region |
|
3187 then the method AlterViewRect can be called on the TextView() component. This will introduce |
|
3188 a clipping rectangle, which allows blank space required by the edwin layout component |
|
3189 to not be shown. |
|
3190 */ |
|
3191 TInt iMaximumHeightInLines; |
|
3192 CLafEdwinCustomDrawBase* iCustomDrawer; |
|
3193 TInt iLastPointerAnchorPos; |
|
3194 CAknCcpuSupport* iCcpuSupport; |
|
3195 CCharFormatLayer* iCharFormatLayer; |
|
3196 CParaFormatLayer* iParaFormatLayer; |
|
3197 TInt iSpare_1; |
|
3198 TInt iSpare_2; |
|
3199 }; |
|
3200 |
|
3201 |
|
3202 inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL() |
|
3203 { return CreateScrollBarFrameL(ETrue);} |
|
3204 inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame() |
|
3205 { return ((CEikScrollBarFrame* const)iSBFrame); } |
|
3206 inline TInt CEikEdwin::AvgLinesInViewRect() const |
|
3207 { return iAvgLinesInViewRect; } |
|
3208 inline TInt CEikEdwin::AvgCharsPerLine() const |
|
3209 { return iAvgCharsPerLine;} |
|
3210 inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines) |
|
3211 { iAvgLinesInViewRect=aAvgLines; } |
|
3212 inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars) |
|
3213 { iAvgCharsPerLine=aAvgChars; } |
|
3214 |
|
3215 inline void CEikEdwin::SetMaxLength(TInt aLength ) |
|
3216 { SetTextLimit(aLength); } |
|
3217 inline TInt CEikEdwin::MaxLength() const |
|
3218 { return iTextLimit; } |
|
3219 |
|
3220 #endif |