emailuis/emailui/inc/ncseditor.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 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: This file defines class CNcsEditor.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CNCSEDITOR_H
       
    21 #define CNCSEDITOR_H
       
    22 
       
    23 
       
    24 #include <eikrted.h>
       
    25 #include <AknUtils.h>
       
    26 #include "ncscontrol.h"
       
    27 #include "ncsutility.h"
       
    28 #include "ncsconstants.h"
       
    29 
       
    30 class CAknsBasicBackgroundControlContext;
       
    31 class CNcsCustomDraw;
       
    32 class CNcsEditorCustomDraw;
       
    33 
       
    34 /**
       
    35 *  CNcsEditor
       
    36 */
       
    37 class CNcsEditor : public CEikRichTextEditor, public MNcsControl, public MCoeCaptionRetrieverForFep
       
    38     {
       
    39 public: // construction and destruction
       
    40     
       
    41     CNcsEditor(
       
    42         MNcsFieldSizeObserver* aSizeObserver = NULL,
       
    43         TBool aHeaderField = ETrue,
       
    44         TNcsEditorUsage aEditorUsage = ENcsEditorDefault,
       
    45         const TDesC& aCaptionText = TPtrC() );
       
    46     
       
    47     void ConstructL( const CCoeControl* aParent,
       
    48                      TInt aNumberOfLines,
       
    49                      TInt aTextLimit );    
       
    50 
       
    51     virtual ~CNcsEditor();
       
    52 
       
    53 public: // new functions
       
    54     
       
    55     void OpenVirtualKeyBoardL();
       
    56     
       
    57     void GetLineRectL( TRect& aLineRect ) const;
       
    58         
       
    59     virtual TInt ScrollableLines() const;
       
    60     
       
    61     virtual TInt CursorLineNumber() const;
       
    62     
       
    63     virtual TInt LineCount() const;
       
    64         
       
    65     virtual TInt CursorPosition() const;
       
    66         
       
    67     virtual const TDesC& GetLabelText() const;
       
    68 		
       
    69     // <cmail> Platform layout change       
       
    70     TInt LayoutLineCount() const;
       
    71     // </cmail> Platform layout change    
       
    72     
       
    73     virtual void Reposition(TPoint& /*aPt*/, TInt /*aWidth*/) {}
       
    74 
       
    75     void SetMaximumLabelLength( TSize aSize );
       
    76 		
       
    77     void SetupEditorL();
       
    78 		
       
    79     void PositionChanged();
       
    80         
       
    81     TInt TextHeight() const;
       
    82         
       
    83     TInt GetLineHeightL() const;
       
    84         
       
    85     TInt GetNumChars() const;
       
    86         
       
    87     TInt DocumentLength() const;
       
    88 
       
    89     TInt PixelsAboveBand() const;
       
    90     
       
    91     TInt ChangeBandTopL(TInt aPixels);
       
    92     
       
    93 	void UpdateFontSize();
       
    94 	
       
    95 	TBool HasSemicolonAtTheEndL() const;
       
    96 	
       
    97 	//<cmail>
       
    98 	void SetRealRect( TRect aRect );
       
    99 	
       
   100 	void FormatAllTextNowL();
       
   101 	//<cmail>
       
   102 
       
   103 	void UpdateCustomDrawer();
       
   104 	
       
   105 	void SetPhysicsEmulationOngoing( TBool aPhysOngoing );
       
   106 	
       
   107 	TBool IsPhysicsEmulationOngoing() const;
       
   108 	
       
   109 #ifdef _DEBUG
       
   110     void DebugDump();
       
   111 #endif
       
   112         
       
   113     void SetTextColorL( TLogicalRgb aColor );
       
   114 
       
   115     TInt TrimmedTextLength();
       
   116 
       
   117 // <cmail> Platform layout changes   
       
   118     void SetNcsFontType( NcsUtility::TNcsLayoutFont aFontType );
       
   119 // </cmail> Platform layout changes
       
   120 
       
   121 public: // from CoeControl
       
   122 
       
   123     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   124     void ActivateL();
       
   125 
       
   126 public: // from CEikEdwin
       
   127 
       
   128     virtual void SetTextL( const TDesC* aDes );
       
   129 
       
   130     virtual void HandleResourceChange( TInt aType );
       
   131 
       
   132 protected: // from CEikEdwin    
       
   133     
       
   134     //<cmail> Platform layout change
       
   135     // virtual CLafEdwinCustomDrawBase* CreateCustomDrawL();
       
   136     // </cmail>
       
   137 
       
   138 protected: // from MEditObserver
       
   139 
       
   140     virtual void EditObserver( TInt aStart, TInt aExtent );
       
   141     
       
   142 public: // CEikEdwin
       
   143     TCoeInputCapabilities InputCapabilities() const;  
       
   144 public: // MCoeCaptionRetrieverForFep
       
   145     void GetCaptionForFep(TDes& aCaption) const;
       
   146 
       
   147 private: // methods used internally    
       
   148 	// <cmail> Platform layout change 
       
   149     void UpdateFontL();
       
   150     // </cmail> Platform layout change 
       
   151 	
       
   152     void UpdateColors();
       
   153 
       
   154     TAknTextComponentLayout GetLayout();
       
   155 
       
   156     void Draw( const TRect& aRect ) const;
       
   157 
       
   158 private: // data
       
   159     
       
   160     TInt iPreviousFontHeight;
       
   161     TInt32 iPreviousLineSpacingInTwips;
       
   162 
       
   163     TRgb iTextColor;
       
   164     CCharFormatLayer* iGlobalCharFormat;
       
   165     
       
   166     // Flag indicating whether this control is header field.
       
   167     // Header fields have different backgrounds than message field.
       
   168     TBool iHeaderField;
       
   169 
       
   170     // Custom drawer. Not owned.
       
   171     CNcsCustomDraw* iCustomDrawer;
       
   172 
       
   173     // Platform layout change
       
   174     NcsUtility::TNcsLayoutFont iNcsFontType;
       
   175 
       
   176     // Custom drawer for row lines. Own  
       
   177     CNcsEditorCustomDraw* iEditorCustomDrawer;
       
   178     
       
   179     // what purpose editor is used to
       
   180     TNcsEditorUsage iEditorUsage;
       
   181     
       
   182     // Real screen rectangle
       
   183     TRect iRealRect;
       
   184 
       
   185 	// Caption text for virtual ITU-T
       
   186     HBufC*   iCaptionText; 
       
   187     
       
   188     // flag to indicate is there physics based dragging or flicking ongoing
       
   189     TBool iPhysOngoing;
       
   190     };
       
   191 
       
   192 
       
   193 #endif