commonuis/CommonUi/inc/DocNotepadHandler.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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:  Header file for text data handler.  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDOCNOTEPADHANDLER_H
       
    20 #define CDOCNOTEPADHANDLER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "DocDefaultHandler.h"
       
    24 
       
    25 // CLASS DECLARATION
       
    26 class CCommonUiNpdApiLoader;
       
    27 
       
    28 /**
       
    29 * Handler for text files. 
       
    30 * Uses the Notepad's api for saving. Uses TextViewer for opening text content.
       
    31 */
       
    32 NONSHARABLE_CLASS(CDocNotepadHandler) : public CDocDefaultHandler
       
    33     {
       
    34     public:        // Constructors and destructor
       
    35 
       
    36         /**
       
    37         * Two-phased constructor. 
       
    38         * @param aDataType      Data type
       
    39         * @param aUid           UID of the handler app
       
    40         * @param aDocDispatcher Pointer to DocumentHandler instance
       
    41         * @return               Constructed CNotepadHandler
       
    42         */
       
    43         static CDocNotepadHandler* NewL( const TDataType& aDataType,
       
    44                                          const TUid& aUid,
       
    45                                          CDocumentHandler* aDocDispatcher );
       
    46 
       
    47         /**
       
    48         * Two-phased constructor. Leaves the contructed instance in to the 
       
    49         * clean up stack.
       
    50         * @param aDataType      Data type
       
    51         * @param aUid           UID of the handler app
       
    52         * @param aDocDispatcher Pointer to DocumentHandler instance
       
    53         * @return               Constructed CNotepadHandler
       
    54         */
       
    55         static CDocNotepadHandler* NewLC( const TDataType&
       
    56                                           aDataType, 
       
    57                                           const TUid& aUid,
       
    58                                           CDocumentHandler* aDocDispatcher );
       
    59         /**
       
    60         * Destructor
       
    61         */
       
    62         ~CDocNotepadHandler();
       
    63 
       
    64         private:
       
    65         
       
    66         /**
       
    67         * Epoc constructor
       
    68         */
       
    69         void ConstructL();
       
    70 
       
    71         /**
       
    72         * Constructor
       
    73         * @param aDataType      Data type
       
    74         * @param aUid           UID of the handler app
       
    75         * @param aDocDispatcher Pointer to DocumentHandler instance
       
    76         * @param aServiceMode   EDocOpenAndSave (Can handle both operations.)
       
    77         */
       
    78         CDocNotepadHandler( const TDataType&
       
    79                             aDataType, 
       
    80                             const TUid& aUid,
       
    81                             CDocumentHandler* aDocDispatcher,
       
    82                             TDocServiceMode aServiceMode = EDocOpenAndSave );
       
    83         /**
       
    84         * Load Notepad Api.
       
    85         */
       
    86 		void LoadNpdApiL();
       
    87 		
       
    88 
       
    89     public:       // Functions from base classes
       
    90         /**
       
    91         * Copy/move a file to the correct directory.
       
    92         * @param        aAttr File attributes.
       
    93         * @return       KErrNone if success, a status code if failed.
       
    94         */
       
    95         TInt CopyOrMoveL( const TUint );
       
    96         
       
    97         /**
       
    98         * Copy a file to the correct directory.
       
    99         * @param        a filehandle of source file
       
   100         * @param        aAttr File attributes.
       
   101         * @return       KErrNone if success, a status code if failed.
       
   102         */
       
   103         TInt CopyHandleL( const RFile& aSourceFile, const TUint aAttr );
       
   104         
       
   105     private:
       
   106     
       
   107     	/*
       
   108         * Has the Npd Api DLL already been loaded.
       
   109         */
       
   110         TBool iNpdDllLoaded;
       
   111 
       
   112         /*
       
   113         * A handle to a dynamically loadable DLL.
       
   114         */
       
   115         RLibrary iNpdDll;
       
   116 
       
   117         /*
       
   118         * Loads Npd Api DLL dynamically to memory.
       
   119         * Allows use of the DLL through this pointer, but only for
       
   120         * methods implemented within.
       
   121         * Own.
       
   122         */
       
   123         CCommonUiNpdApiLoader* iNpdApi;
       
   124 
       
   125     };
       
   126 
       
   127 #endif      // CDOCNOTEPADHANDLER_H
       
   128 
       
   129 // End of File