notepad/notepad1/inc/NpdViewerDialog.h
changeset 0 f979ecb2b13e
child 18 d68a4b5d5885
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declaration of Notepad Viewer Dialog class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NPDVIEWERDIALOG_H
       
    20 #define NPDVIEWERDIALOG_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <charconv.h>
       
    24 #include "NpdDialogBase.h"
       
    25 #include <centralrepository.h>
       
    26 #include <cenrepnotifyhandler.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CNotepadRichTextEditor;
       
    30 class CEikDialog;
       
    31 class CSendUi;
       
    32 class CItemFinder;
       
    33 class CFindItemMenu;
       
    34 class CPlainText;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 /**
       
    38 *  Dialog of viewer mode.
       
    39 *  CNotepadViewerDialog is a dialog for Notepad viewer.
       
    40 *  
       
    41 * @see CNotepadDialogBase
       
    42 */
       
    43 class CNotepadViewerDialog : public CNotepadDialogBase,
       
    44                              public MCenRepNotifyHandlerCallback
       
    45     {
       
    46     public: // Constructor and destructor
       
    47 
       
    48         /**
       
    49         * Constructor.
       
    50         *
       
    51         * @param resource id of type STRUCT NOTEPAD_VIEWER_DIALOG
       
    52         * @param aSelfPtr pointer to pointer of this
       
    53         * @return Newly constructed CNotepadViewerDialog object.
       
    54         * @internal
       
    55         */
       
    56         IMPORT_C static CNotepadViewerDialog* NewL(
       
    57             const TInt aResId, 
       
    58             CEikDialog** aSelfPtr );
       
    59 
       
    60         /**
       
    61         * Destructor.
       
    62         */
       
    63         IMPORT_C virtual ~CNotepadViewerDialog();
       
    64 
       
    65     public: // New functions
       
    66 
       
    67         /**
       
    68         * Execute a dialog.
       
    69         *
       
    70         * @return exit status value of CEikDialog's ExecuteLD.
       
    71         * @internal
       
    72         */
       
    73         //IMPORT_C TInt ExecuteLD();
       
    74 
       
    75         /**
       
    76         * Set information of the file to be shown.
       
    77         *
       
    78         * @param aFileName text file to view.
       
    79         * @param aTitle  TitlePane string (if NULL, Title will be FileName).
       
    80         * @param aGuessEncoding guess encoding if ETrue (ignore aEncoding).
       
    81         * @param aEncoding encoding of the File
       
    82         *   (default ISO-8859-1. This is ignored if aGuessEncoding is ETrue).
       
    83         * @internal
       
    84         */
       
    85         IMPORT_C void SetFileL(
       
    86             const TDesC& aFilename, 
       
    87             const TDesC* aTitle = NULL,
       
    88             TBool aGuessEncoding = EFalse,
       
    89             TUint aEncoding = KCharacterSetIdentifierIso88591);
       
    90 
       
    91         /**
       
    92         * Set information of the file to be shown.
       
    93         *
       
    94         * @param aFile file handle.
       
    95         * @param aTitle  TitlePane string (if NULL, Title will be FileName).
       
    96         * @param aGuessEncoding guess encoding if ETrue (ignore aEncoding).
       
    97         * @param aEncoding encoding of the File.
       
    98         * @internal
       
    99         */
       
   100         IMPORT_C void SetFileL(
       
   101             RFile& aFile, 
       
   102             const TDesC* aTitle = NULL,
       
   103             TBool aGuessEncoding = EFalse,
       
   104             TUint aEncoding = KCharacterSetIdentifierIso88591);
       
   105 
       
   106         /**
       
   107         * Load contents of the file into the viewer.
       
   108         *
       
   109         * @internal
       
   110         */
       
   111         IMPORT_C void LoadFileL();
       
   112 
       
   113         /**
       
   114         * Load contents of the file into the viewer.
       
   115         *
       
   116         * @param aFile file handle.
       
   117         * @internal
       
   118         */
       
   119         IMPORT_C void LoadFileL(RFile& aFile);
       
   120 
       
   121         /**
       
   122         * Set information of the file to be shown and load it.
       
   123         *
       
   124         * @param aFileName text file to view.
       
   125         * @param aTitle  TitlePane string (if NULL, Title will be FileName).
       
   126         * @param aGuessEncoding guess encoding if ETrue (ignore aEncoding).
       
   127         * @param aEncoding encoding of the File
       
   128         * @internal
       
   129         */
       
   130         IMPORT_C void OpenFileL(
       
   131             const TDesC& aFilename, 
       
   132             const TDesC* aTitle = NULL,
       
   133             TBool aGuessEncoding = EFalse,
       
   134             TUint aEncoding = KCharacterSetIdentifierIso88591);
       
   135  
       
   136         /**
       
   137         * Set information of the file to be shown and load it.
       
   138         *
       
   139         * @param aFile file handle.
       
   140         * @param aTitle  TitlePane string (if NULL, Title will be FileName).
       
   141         * @param aGuessEncoding guess encoding if ETrue (ignore aEncoding).
       
   142         * @param aEncoding encoding of the File
       
   143         * @internal
       
   144         */
       
   145         IMPORT_C void OpenFileL(
       
   146             RFile& aFile, 
       
   147             const TDesC* aTitle = NULL,
       
   148             TBool aGuessEncoding = EFalse,
       
   149             TUint aEncoding = KCharacterSetIdentifierIso88591);
       
   150             
       
   151         /**
       
   152         * Set information of the descriptor to be shown.
       
   153         *
       
   154         * @param aFileName text file to view.
       
   155         */
       
   156         void InitDescriptorViewerL(
       
   157             HBufC** aContentPointer, 
       
   158             TInt& aReturnStatus,
       
   159             TBool aReadOnly, 
       
   160             const TDesC& aText, 
       
   161             const TDesC& aTitle, 
       
   162             const TDesC& aDelConfirmation 
       
   163             );
       
   164 
       
   165         /**
       
   166         * Set the state of automatic highlighting
       
   167         * @param aSwitchON, ETrue if automatic highlighting is to used, otherwise EFalse
       
   168         */
       
   169         void SetAutomaticHighlightL( const TBool aSwitchON );
       
   170 
       
   171         /**
       
   172         * Reads the shared data value used to initialize automatic highlighting
       
   173         * @return TBool, ETrue if automatic highlighting is to be used
       
   174         */
       
   175         void ReadAutoHlCenRepValueAndSetNotifyL();
       
   176 
       
   177     protected:  // Functions from base classes
       
   178 
       
   179         /**
       
   180         * From CEikDialog.
       
   181         */
       
   182         TBool OkToExitL( TInt aButtonId ) ;
       
   183 
       
   184         /**
       
   185         * From MCenRepNotifyHandlerCallback
       
   186         * Handles the incoming notifications of key changes
       
   187         * @param aId, Key that has changed
       
   188         * @param aNewValue, New value of the key    
       
   189         */
       
   190         void HandleNotifyInt( TUint32 aId, TInt aNewValue );
       
   191 
       
   192         /**
       
   193         * From MCenRepNotifyHandlerCallback
       
   194         * Handles the notifier errors
       
   195         * @param aId, Key that has changed
       
   196         * @param aNewValue, New value of the key    
       
   197         */
       
   198         void HandleNotifyError( 
       
   199             TUint32 aId, 
       
   200             TInt aError, 
       
   201             CCenRepNotifyHandler* aHandler );
       
   202 
       
   203         /**
       
   204         * From CCoeControl
       
   205         *
       
   206         * @param aType event type.
       
   207         */
       
   208 		void HandleResourceChange(TInt aType);
       
   209 
       
   210         /**
       
   211         * From CCoeControl.
       
   212         * Called when SizeChanged.
       
   213         */
       
   214         void SizeChanged();
       
   215     public:
       
   216         void HandleDialogPointerEventL( const TPointerEvent& aPointerEvent );
       
   217 
       
   218     private: // New function
       
   219 
       
   220         /**
       
   221         * Show "Attachement saved" note.
       
   222         */
       
   223         void ShowConfirmationNoteL();
       
   224         /**
       
   225         * Handle Phone number calls
       
   226         */
       
   227         void HandleNumberCallL();
       
   228 
       
   229     private:  // Functions from base classes
       
   230     
       
   231         void ConstructL(TResourceReader& rr);
       
   232 
       
   233         /**
       
   234         * From CEikDialog.
       
   235         */
       
   236         void PostLayoutDynInitL();
       
   237 
       
   238         /**
       
   239         * From CCoeControl.
       
   240         */
       
   241         void ActivateL();
       
   242 
       
   243         /**
       
   244         * From CCoeControl
       
   245         *
       
   246         * @param aKeyEvent key event which includes ScanCode etc.
       
   247         * @param aType event type ( up, in, down...).
       
   248         */
       
   249         TKeyResponse OfferKeyEventL(
       
   250             const TKeyEvent& aKeyEvent, 
       
   251             TEventCode aType);
       
   252 
       
   253         /**
       
   254         * From CCoeControl.
       
   255         *
       
   256         * @param aContext TCoeHelpContext.
       
   257         */
       
   258         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   259 
       
   260         /**
       
   261         * From MEikCommandObserver
       
   262         * 
       
   263         * @param aCommandId command.
       
   264         */
       
   265         void ProcessCommandL(TInt aCommandId);
       
   266 
       
   267         /**
       
   268         * From MEikMenuObserver.
       
   269         * 
       
   270         * @param aResourceId resource id.
       
   271         * @param menu pane object.
       
   272         */
       
   273         void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
   274         
       
   275         /**
       
   276         * From MEikMenuObserver.
       
   277         * 
       
   278         * @param aResourceId resource id.
       
   279         * @param menu bar object.
       
   280         */
       
   281         void DynInitMenuBarL(TInt aResourceId,CEikMenuBar* aMenuBar);
       
   282 
       
   283     private: // Reserved
       
   284 
       
   285         /**
       
   286         * Reserved API entry.
       
   287         *
       
   288         * @internal
       
   289         */
       
   290         IMPORT_C void CNotepadViewerDialog_Reserved();   
       
   291 
       
   292     private:
       
   293         
       
   294         /**
       
   295         * Callback function for CPeriodic
       
   296         *
       
   297         * @param TAny* args.
       
   298         */
       
   299         static TInt TimerCallbackL(TAny* aPtr);    
       
   300         
       
   301         /**
       
   302         * Called in callback function to exit the dialog
       
   303         */
       
   304         void ExitDialogOnTimerExpireL();
       
   305 
       
   306     private: // Data
       
   307 
       
   308         enum TNotepadViewerFlags
       
   309             {
       
   310             ENotepadMenuByOkKey = 0x02
       
   311             };
       
   312         CNotepadRichTextEditor* iEditor; // not own (dialog own)
       
   313         HBufC* iFilename;  // own
       
   314         RFile  * iFile;
       
   315         HBufC** iContentPointer; // not owned
       
   316 		TBool iFileExist;
       
   317         TPtrC iContent; 
       
   318         TPtrC iTitle;
       
   319         TPtrC iDelConfirmation;
       
   320         TInt* iReturnValue;
       
   321         TUint iEncoding;
       
   322         TInt iStatus;
       
   323         TBool iGuessEncoding;
       
   324 
       
   325         // Used to flag whether viewer is handling file or descriptor passed
       
   326         // from calling application. This changes option menu items somewhat.
       
   327         TBool iDescriptorViewer; 
       
   328 
       
   329         // Used in conjunction with iDescriptorViewer flag to determine
       
   330         // whether "Edit" option menu item should be visible.
       
   331         TBool iEditable;
       
   332 
       
   333         CSendUi* iSendUi; // own
       
   334         TUint16 iFlags; 
       
   335 
       
   336         CItemFinder* iAutoFinder; // own
       
   337         CFindItemMenu* iFindMenu; // own
       
   338         TBool iTaskSwapperFlag;
       
   339 
       
   340         // flag for forward locked content
       
   341         TBool iForwardLocked;
       
   342         TBool iAutomaticHlValue;
       
   343         TBool iAutomaticHlInitialized;
       
   344         // Central Repository session
       
   345         CRepository* iCenRepSession;
       
   346         // Notifier to listen changes of offline state
       
   347         CCenRepNotifyHandler* iNotifier;
       
   348         CPeriodic*  iPeriodicTimer;
       
   349     };
       
   350 
       
   351 #endif // NPDVIEWERDIALOG_H
       
   352 
       
   353 // End of File