1 /* |
1 /* |
2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
61 class CAknPictographInterface; |
61 class CAknPictographInterface; |
62 class CAknExtendedInputCapabilities; |
62 class CAknExtendedInputCapabilities; |
63 class CAknPointerEventSuppressor; |
63 class CAknPointerEventSuppressor; |
64 class CSmileyManager; |
64 class CSmileyManager; |
65 class CSmileyCustomWrap; |
65 class CSmileyCustomWrap; |
|
66 class CAknEdwinPhysicsHandler; |
|
67 class CEdwinAsyncFormat; |
66 |
68 |
67 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin |
69 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin |
68 class CEikAvkonCustomDraw; |
70 class CEikAvkonCustomDraw; |
69 |
71 |
70 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin |
72 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin |
322 * Returns the value of ClearDirection |
324 * Returns the value of ClearDirection |
323 * |
325 * |
324 * @return value of current ClearDirection |
326 * @return value of current ClearDirection |
325 */ |
327 */ |
326 TInt ClearDirection() const; |
328 TInt ClearDirection() const; |
327 |
329 |
|
330 /** |
|
331 * Enables kinetic scrolling. |
|
332 */ |
|
333 void EnableKineticScrollingL(); |
|
334 |
|
335 /** |
|
336 * Enables physics. |
|
337 */ |
|
338 void EnablePhysicsL(); |
|
339 |
|
340 /** |
|
341 * Initializes physics. |
|
342 */ |
|
343 void InitPhysicsL(); |
|
344 |
328 public: // from MCenRepNotifyHandlerCallback |
345 public: // from MCenRepNotifyHandlerCallback |
329 void HandleNotifyInt(TUint32 aId, TInt aNewValue); |
346 void HandleNotifyInt(TUint32 aId, TInt aNewValue); |
330 |
347 |
331 private: |
348 private: |
332 |
349 |
392 ENotDraw = 0, |
410 ENotDraw = 0, |
393 EDrawn, |
411 EDrawn, |
394 EDrawing |
412 EDrawing |
395 }; |
413 }; |
396 TInt iDrawInvoked; |
414 TInt iDrawInvoked; |
397 TInt iThumbPos; |
415 TInt iThumbPos; |
398 #ifdef FF_AVKON_EMOTION_ICON_ENABLED |
|
399 // own |
416 // own |
400 CSmileyManager* iSmiley; |
417 CSmileyManager* iSmiley; |
401 CSmileyCustomWrap* iSmileyWrap; |
418 CSmileyCustomWrap* iSmileyWrap; |
402 TBool iInlineEditing; |
419 TBool iInlineEditing; |
403 TBool iDisableConvertInFormat; |
420 TBool iDisableConvertInFormat; |
404 #endif |
421 TCursorSelection iVisibleRange; |
405 }; |
422 CEdwinAsyncFormat* iAsyncFormat; |
|
423 |
|
424 /** |
|
425 * Pointer to CEikEdwin. |
|
426 * Not own. |
|
427 */ |
|
428 CEikEdwin* iEdwin; |
|
429 |
|
430 /** |
|
431 * Scrolled offset if using rate scroll way. |
|
432 */ |
|
433 TInt iScrolledDelta; |
|
434 |
|
435 /** |
|
436 * If ETrue, uses rate scroll. Otherwise uses original way. |
|
437 */ |
|
438 TBool iUseRateScroll; |
|
439 |
|
440 /** |
|
441 * Used with each step of dragging scrollbar to record |
|
442 * the thumb position before dragging action |
|
443 */ |
|
444 TInt iScrollbarPosition; |
|
445 |
|
446 /** |
|
447 * Physics handler. Used only when physics feature is enabled. |
|
448 * Own. |
|
449 */ |
|
450 CAknEdwinPhysicsHandler* iPhysicsHandler; |
|
451 |
|
452 /** |
|
453 * Content has moved down so that empty space |
|
454 * above the editor content is visible. |
|
455 */ |
|
456 TBool iStartBorderExceeded; |
|
457 |
|
458 /** |
|
459 * Content has moved up so that empty space |
|
460 * below the editor content is visible. |
|
461 */ |
|
462 TBool iEndBorderExceeded; |
|
463 |
|
464 /** |
|
465 * Amount of pixels out of border. In practice width |
|
466 * of empty space above or below editor content. |
|
467 */ |
|
468 TInt iPixelsOutOfBorder; |
|
469 |
|
470 /** |
|
471 * If ETrue, text cursor was visible before drag or flick started. |
|
472 * Used to store cursor state so that it is possible to enable cursor |
|
473 * again when dragging, flicking or bounce stops. |
|
474 */ |
|
475 TBool iCursorWasVisible; |
|
476 |
|
477 /** |
|
478 * If ETrue, ongoing scrolling is caused by moving scrollbar thumb. |
|
479 */ |
|
480 TBool iScrolledByScrollBar; |
|
481 }; |
406 |
482 |
407 public: |
483 public: |
408 |
484 |
409 /** |
485 /** |
410 * The following flags may be combined with a bitwise OR to form the |
486 * The following flags may be combined with a bitwise OR to form the |
1477 * |
1553 * |
1478 * @return @c ETrue if the document being edited is read-only. |
1554 * @return @c ETrue if the document being edited is read-only. |
1479 * @c EFalse otherwise. |
1555 * @c EFalse otherwise. |
1480 */ |
1556 */ |
1481 IMPORT_C TBool IsReadOnly() const; |
1557 IMPORT_C TBool IsReadOnly() const; |
|
1558 |
|
1559 /** |
|
1560 * Gets editor flags from the editor. |
|
1561 * @return editor flags if existed |
|
1562 * @or return KErrNotFound |
|
1563 */ |
|
1564 IMPORT_C TInt CEikEdwin::AknEditorFlags(); |
|
1565 |
|
1566 |
1482 |
1567 |
1483 /** |
1568 /** |
1484 * Determines whether the document being edited is read only. Displays |
1569 * Determines whether the document being edited is read only. Displays |
1485 * a message with @c CEikonEnv::InfoMsg() if the document is set as |
1570 * a message with @c CEikonEnv::InfoMsg() if the document is set as |
1486 * read-only. |
1571 * read-only. |
2229 * @param aSuppressed If ETrue, inhibit formatting from now on, if EFalse, |
2317 * @param aSuppressed If ETrue, inhibit formatting from now on, if EFalse, |
2230 * re-enable formatting from now on. |
2318 * re-enable formatting from now on. |
2231 */ |
2319 */ |
2232 IMPORT_C void SetSuppressFormatting( TBool aSuppressed ); |
2320 IMPORT_C void SetSuppressFormatting( TBool aSuppressed ); |
2233 |
2321 |
2234 #ifdef FF_AVKON_EMOTION_ICON_ENABLED |
2322 /** |
|
2323 * Enables kinetic scrolling in editor. |
|
2324 * |
|
2325 * Note that when kinetic scrolling is enabled, it is |
|
2326 * no longer possible to disable it with this function. |
|
2327 * |
|
2328 * @since S60 v5.2 |
|
2329 * @param aEnable ETrue if kinetic scrolling should be enabled. |
|
2330 */ |
|
2331 IMPORT_C void EnableKineticScrollingL( TBool aEnable ); |
|
2332 |
2235 public: |
2333 public: |
2236 void EnableSmileySupportL( TBool aEnableSmiley ); |
2334 void EnableSmileySupportL( TBool aEnableSmiley ); |
2237 TBool IsSmileyEnabled() const; |
2335 TBool IsSmileyEnabled() const; |
2238 void DrawSmileyInTextL( CBitmapContext& aGc, CFont& aFont, |
2336 void DrawSmileyInTextL( CBitmapContext& aGc, CFont& aFont, |
2239 const TDesC& aText, TPoint& aPt ); |
2337 const TDesC& aText, const TPoint& aPt ); |
2240 void ConvertVisibleTextForSmileyL( TBool aTextToCode ); |
2338 void ConvertVisibleTextForSmileyL( TBool aTextToCode ); |
2241 void HandleScrollForSmileyL(); |
2339 void HandleScrollForSmileyL(); |
2242 TBool AdjustCursorForSmileyL( TInt aOldCursor, TCursorSelection& aSelect ); |
2340 TBool AdjustCursorForSmileyL( TInt aOldCursor, TCursorSelection& aSelect ); |
|
2341 TRect AdjustDrawRectForSmiley( const TRect& aRect ) const; |
|
2342 void GetClipRegionForSmiley( RRegion& rgn, CFont& aFont, const TDesC& aText, |
|
2343 const TPoint& aPt, const TRect& aRect ) const; |
|
2344 HBufC* ExtractTextLC( TCursorSelection aSelect ); |
|
2345 void ConvertSmileyIconToTextL( TInt aStartPos, TDes& aText ); |
2243 |
2346 |
2244 private: |
2347 private: |
2245 void ConvertTextForSmileyL( TCursorSelection aSelect, |
2348 void ConvertTextForSmileyL( TCursorSelection aSelect, |
2246 TBool aTextToCode, TBool aRedraw = ETrue ); |
2349 TBool aTextToCode, TBool aRedraw = ETrue ); |
2247 void TrimText( TDes& aText ); |
2350 void TrimText( TDes& aText ); |
2248 TCursorSelection GetVisibleTextRangeL(); |
2351 TCursorSelection GetVisibleTextRangeL(); |
2249 HBufC* ExtractTextLC( TCursorSelection aSelect ); |
|
2250 void ExtendedRangeForSmiley( TCursorSelection& aSelect ); |
2352 void ExtendedRangeForSmiley( TCursorSelection& aSelect ); |
2251 void ConvertSmileyForDeleteL( TInt aDocPos, TBool aBackSpace ); |
2353 TBool ConvertSmileyForDeleteL( TInt aDocPos, TBool aBackSpace ); |
2252 void ConvertSmileyForDeleteL( const TCursorSelection &aSelect ); |
2354 void ConvertSmileyForDeleteL( const TCursorSelection &aSelect ); |
2253 #endif |
2355 TBool AdjustCursorPosByMovementL( TCursorPosition::TMovementType aMovement, |
|
2356 TBool aSelect ); |
|
2357 void HandleSelectionForSmiley( TCursorSelection aSelect ); |
2254 |
2358 |
2255 protected: |
2359 protected: |
2256 |
2360 |
2257 /** |
2361 /** |
2258 * Specifies the end points of the editable area. |
2362 * Specifies the end points of the editable area. |
2305 * Custom formatter is installed to find and format phone numbers |
2409 * Custom formatter is installed to find and format phone numbers |
2306 * (@c CEikRichTextEditor only). |
2410 * (@c CEikRichTextEditor only). |
2307 */ |
2411 */ |
2308 EPhoneNumberGrouping = 0x00000020, |
2412 EPhoneNumberGrouping = 0x00000020, |
2309 ESuppressNotifyDraw = 0x00000040, |
2413 ESuppressNotifyDraw = 0x00000040, |
2310 ESuppressFormatting = 0x00000080 // Suppresses calls to formatting |
2414 ESuppressFormatting = 0x00000080, // Suppresses calls to formatting |
|
2415 ESkipBackgroundDrawer = 0x00000100 |
2311 }; |
2416 }; |
2312 |
2417 |
2313 protected: // from MEditObserver |
2418 protected: // from MEditObserver |
2314 |
2419 |
2315 /** |
2420 /** |
2628 void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength ); |
2733 void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength ); |
2629 TRect AdjustedViewRect() const; |
2734 TRect AdjustedViewRect() const; |
2630 void SetVKBStatus(); |
2735 void SetVKBStatus(); |
2631 void ScrollViewToCursorLineL(); |
2736 void ScrollViewToCursorLineL(); |
2632 void PerformRecordedOperationL(); |
2737 void PerformRecordedOperationL(); |
2633 void ScrollIfAtTopOrBottom(); |
2738 void ScrollIfAtTopOrBottomL(); |
|
2739 void SetSelectionVisibilityL(TBool isVisable); |
|
2740 |
|
2741 /** |
|
2742 * Sets scrollbars with kinetic scrolling. |
|
2743 */ |
|
2744 void SetKineticScrollingScrollBarsL(); |
|
2745 |
|
2746 /** |
|
2747 * Sets vertical scrollbar model with kinetic scrolling. |
|
2748 * |
|
2749 * @param aVertModel Vertical scrollbar model |
|
2750 */ |
|
2751 void SetKineticScrollingScrollBarModel( |
|
2752 TEikScrollBarModel& aVertModel ) const; |
|
2753 |
|
2754 /** |
|
2755 * Enables rate scrolling in editor. |
|
2756 * |
|
2757 * @param aEnable ETrue if rate scrolling should be enabled. |
|
2758 */ |
|
2759 void EnableRateScrolling( TBool aEnable ); |
2634 |
2760 |
2635 private: |
2761 private: |
2636 |
2762 |
2637 void DrawFirstLineTextL() const; |
2763 void DrawFirstLineTextL() const; |
2638 CAknEdwinDrawingModifier* AknEdwinDrawingModifier(); |
2764 CAknEdwinDrawingModifier* AknEdwinDrawingModifier(); |
2814 * SetBackgroundColorL. It is unchanged if |
2946 * SetBackgroundColorL. It is unchanged if |
2815 * background color has not been set by SetBackgroundColorL |
2947 * background color has not been set by SetBackgroundColorL |
2816 * @return TRgb for the color to be used for background. |
2948 * @return TRgb for the color to be used for background. |
2817 */ |
2949 */ |
2818 TRgb EditorBackgroundColor(TRgb& aConditionalColor) const; |
2950 TRgb EditorBackgroundColor(TRgb& aConditionalColor) const; |
|
2951 |
|
2952 public: |
|
2953 /** |
|
2954 * Can be used by custom drawers to check if background drawing should be |
|
2955 * performed. This is meant to be used only if editor has |
|
2956 * MCoeControlBackground object attached. |
|
2957 * |
|
2958 * @return ETrue if custom drawer shouldn't draw background. |
|
2959 */ |
|
2960 TBool SkipBackgroundDrawer() const; |
|
2961 |
|
2962 /** |
|
2963 * Scrolls view by amount of pixels. |
|
2964 * Stops scrolling when beginning or end of content exceeded. |
|
2965 * This function should be used when scrolling starts from inside content |
|
2966 * (in other words in normal situation when begin- or end-border has not |
|
2967 * yet exceeded) |
|
2968 * |
|
2969 * @param aPixelsToScroll Amount of pixels to scroll |
|
2970 * @param aBorderExceeded returns ETrue if border was exceeded |
|
2971 * @param aRestOfPixels Amount of pixels not scrolled because border |
|
2972 * was exceeded |
|
2973 * |
|
2974 * @return Amount of scrolled pixels. |
|
2975 */ |
|
2976 TInt ScrollView( TInt aPixelsToScroll, TBool& aBorderExceeded, |
|
2977 TInt& aRestOfPixels ); |
|
2978 |
|
2979 /** |
|
2980 * Scrolls view by amount of pixels. |
|
2981 * |
|
2982 * This function should be used to scroll when we have already |
|
2983 * exceeded begin- or end-border (we are out of borders). |
|
2984 * This function supports scrolling so that there can be empty space |
|
2985 * above or below the editor content (used in bounce effect). |
|
2986 * Stops scrolling when we return back to inside borders. |
|
2987 * |
|
2988 * @param aPixelsToScroll Amount of pixels to scroll |
|
2989 * @param aEndOfBounce returns ETrue if content scrolled back |
|
2990 * to inside of borders |
|
2991 * @param aRestOfPixels Amount of pixels not scrolled |
|
2992 * |
|
2993 * @return Amount of scrolled pixels. |
|
2994 */ |
|
2995 TInt ScrollViewWithBounce( TInt aPixelsToScroll, TBool& aEndOfBounce, |
|
2996 TInt& aRestOfPixels ); |
|
2997 |
|
2998 /** |
|
2999 * Returns amount of pixels how much we are out of borders. |
|
3000 * |
|
3001 * @return Amount of pixels scrolled out of borders. |
|
3002 */ |
|
3003 TInt PixelsOutOfBorder() const; |
|
3004 |
|
3005 /** |
|
3006 * Handles scrollbar events with kinetic scrolling. |
|
3007 * |
|
3008 * @param aScrollBar The scrollbar. |
|
3009 */ |
|
3010 void HandleScrollEventWithPhysics( CEikScrollBar* aScrollBar ); |
|
3011 |
|
3012 /** |
|
3013 * If cursor is visible, disables it and stores cursor visibility info. |
|
3014 */ |
|
3015 void StoreCursorState(); |
|
3016 |
|
3017 /** |
|
3018 * Show cursor again if needed (based on stored cursor visibility info). |
|
3019 */ |
|
3020 void RestoreCursorState(); |
|
3021 |
|
3022 /** |
|
3023 * Returns ETrue if kinetic scrolling is enabled. |
|
3024 * |
|
3025 * @return ETrue if kinetic scrolling is enabled. |
|
3026 */ |
|
3027 TBool KineticScrollingEnabled() const; |
|
3028 |
2819 |
3029 |
2820 protected: |
3030 protected: |
2821 |
3031 |
2822 /** |
3032 /** |
2823 * Edwin user flags. |
3033 * Edwin user flags. |