commonuis/CommonUi/inc/DocHandlerBase.h
changeset 0 2f259fa3e83a
child 18 fcdfafb36fe7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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 base class for content handlers.  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #if !defined(HANDLERBASE_H)
       
    20 #define HANDLERBASE_H
       
    21 
       
    22 // FORWARD DECLARATIONS
       
    23 class CAiwGenericParamList;
       
    24 
       
    25 /**
       
    26 * Virtual interface class for content handlers. All handlers have to be
       
    27 * derived from this class. There are no implemented functions or member data.
       
    28 * The implementor can also extend the CDocDefaultHandler class, which
       
    29 * is a implementation of the standard epoc-style.
       
    30 *
       
    31 * This interface allows different kinds of content storages to be used. The
       
    32 * implementor can use e.g. DirectFileStorage or any other method of saving
       
    33 * the content.
       
    34 *
       
    35 * If the concrete handler is capable of handling several data types, it
       
    36 * maybe necessary to deliver the data type also. The data type of a
       
    37 * content can be delivered to the concrete handler by the construction
       
    38 * time.
       
    39 */
       
    40 class CDocHandlerBase : public CBase
       
    41     {
       
    42     public:
       
    43 
       
    44         /**
       
    45         * Open an application standalone. 
       
    46         *        
       
    47         * @param aFileHandle Filehandle of file which should be opened.
       
    48         * @return           KErrNone if success. If fail, a fail reason 
       
    49         *                   constant declared in CDocumentHandler.h
       
    50         *
       
    51         * @since Series60 3.0
       
    52         */
       
    53         virtual TInt OpenFileL(RFile& aFileHandle) = 0;
       
    54         
       
    55         /**
       
    56         * Open an application embedded. 
       
    57         *
       
    58         * @param aFileHandle Filehandle of file which should be opened.
       
    59         * @return           KErrNone if success. If fail, a fail reason 
       
    60         *                   constant declared in CDocumentHandler.h
       
    61         *
       
    62         * @since Series60 3.0
       
    63         */
       
    64         virtual TInt OpenFileEmbeddedL(RFile& aFileHandle) = 0;
       
    65 
       
    66         /**
       
    67         * Save the content to process private path for temporarily. Use
       
    68         * the access attribute given if appropriate.
       
    69         *
       
    70         * @param aContent Content buffer
       
    71         * @param aAttr  Access attribute defined in  
       
    72         *               \epoc32\include\f32file.h.
       
    73         * @param aFileName Filename of saved file
       
    74         *
       
    75         * @return           KErrNone if success. If fail, a fail reason 
       
    76         *                   constant declared in CDocumentHandler.h
       
    77         * @since 3.0
       
    78         */
       
    79         virtual TInt SaveTempFileL( const TDesC8& aContent, const TUint aAttr,
       
    80             TDes& aFileName ) = 0;
       
    81 
       
    82         /**
       
    83         * Copy or move (based on DocOperation) content from a file set by the
       
    84         * SetSrcFileName(const TDesC &aName) -function to the application
       
    85         * spesific place. Use the access attribute given if appropriate. Possible
       
    86         * operations are EDocCopy, EDocMove and EDocSilentMove
       
    87         *
       
    88         * @param aAttr Access attribute defined in  
       
    89         *              \epoc32\include\f32file.
       
    90         *
       
    91         * @return           KErrNone if success. If fail, a fail reason 
       
    92         *                   constant declared in CDocumentHandler.h
       
    93         */
       
    94         virtual TInt CopyOrMoveL( const TUint aAttr ) = 0;
       
    95         
       
    96         /**
       
    97         * Copy a filehandle to the application spesific directory. Use the 
       
    98         * access attribute given if appropriate.
       
    99         *
       
   100         * @param        aAttr File attributes.
       
   101         * @param        aSourceFile File handle to copied
       
   102         *
       
   103         * @return       KErrNone if success. If fail, a fail reason
       
   104         *               constant declared in CDocumentHandler.h
       
   105         */
       
   106         virtual TInt CopyHandleL( const RFile& aSourceFile, const TUint aAttr ) = 0;
       
   107 
       
   108         /**
       
   109         * Set the destination of the content.
       
   110         *
       
   111         * If you want to save or copy the content with a different name
       
   112         * than the original, you have to set the destination name with
       
   113         * this function. The name can be a file name or any other
       
   114         * textual name depending on the storage type used.
       
   115         *
       
   116         * @param aName Name of the destination
       
   117         *
       
   118         * @return           KErrNone if success. If fail, a fail reason 
       
   119         *                   constant declared in CDocumentHandler.h
       
   120         */
       
   121         virtual TInt SetDestName( const TDesC& aName ) = 0;
       
   122 
       
   123         /**
       
   124         * Set the source file where the content must be fetched.
       
   125         *
       
   126         * @param aFileName File name
       
   127         *
       
   128         * @return           KErrNone if success. If fail, a fail reason 
       
   129         *                   constant declared in CDocumentHandler.h
       
   130         */
       
   131         virtual TInt SetSrcFileName( const TDesC& aFileName ) = 0;
       
   132 
       
   133         /**
       
   134         * Set the root path of the memory where the file should be moved.
       
   135         * This method is used only in case of SilentMoveL. 
       
   136         *
       
   137         * @param aRootPath Root path of memory
       
   138         *
       
   139         * @return           KErrNone if success. If fail, a fail reason 
       
   140         *                   constant declared in CDocumentHandler.h
       
   141         * @since 3.0
       
   142         */
       
   143         virtual TInt SetRootPath( const TDesC& aRootPath ) = 0;
       
   144 
       
   145         /**
       
   146         * Get the path where the content were saved. If the storage
       
   147         * is not a file based the path can be also any other
       
   148         * textual presentation of an object.
       
   149         *
       
   150         * This function is called e.g. when opening a buffer. The buffer
       
   151         * is saved first. After saving we have to know where we saved it
       
   152         * in order to be able to open it.
       
   153         *
       
   154         * @param aPath Path to the object
       
   155         *
       
   156         */
       
   157         virtual void GetPath( TDes& aPath ) const = 0;
       
   158 
       
   159         /**
       
   160         * Get the Uid of handler application. 
       
   161         *
       
   162         * @param aUid Uid of the handler application. In case of Media files
       
   163         * this is MediaGallery's Uid.
       
   164         *
       
   165         * @since 2.8
       
   166         */
       
   167         virtual void HandlerAppUid( TUid& aUid ) const = 0;
       
   168 
       
   169         /**
       
   170         * Access a status code of the handler.
       
   171         *
       
   172         * @return           KErrNone if success. If fail, a fail reason 
       
   173         *                   constant declared in CDocumentHandler.h
       
   174         */
       
   175         virtual TInt Status() const = 0;
       
   176 
       
   177         /**
       
   178         * Is the handler capable of opening the content
       
   179         * @param aDataType  Data type for content to be launched
       
   180         *
       
   181         * @return           ETrue if yes, else EFalse 
       
   182         */
       
   183         virtual TBool CanOpen() const = 0;
       
   184 
       
   185         /**
       
   186         * Is the handler capable of saving the content
       
   187         * @param aDataType  Data type for content to be saved
       
   188         *
       
   189         * @return           ETrue if yes, else EFalse 
       
   190         */
       
   191         virtual TBool CanSave() const = 0;
       
   192      
       
   193         /**
       
   194         * Utility method for deleting temporary file
       
   195         * CDocumentHandler will use this method for deleting temporary file
       
   196         *
       
   197         * @since Series60 3.0
       
   198         * @param aFileName a file to be deleted
       
   199         */
       
   200         virtual void DeleteFile(const TDesC& aFileName) = 0;
       
   201      
       
   202         /**
       
   203         * Append a correct file name extension for some content. 
       
   204         * This is needed, because we want quarantee that file extension
       
   205         * is correct with mime-type. Some content types cannot be recognized
       
   206         * based on the data it self. (No header information etc.)
       
   207         *
       
   208         * See related contents and extensions from documenthandlerui.rss:
       
   209         * r_extension_guaranteed_mime_types and r_extension_guaranteed_extensions
       
   210         *
       
   211         * @param aFileName  Append extension to this filename.
       
   212         * @param aDataType  The content type of the file.
       
   213         */
       
   214         virtual void CheckFileNameExtensionL(
       
   215             TDes& aFileName,
       
   216             const TDataType& aDatatype ) = 0;
       
   217      
       
   218         /**
       
   219         * Creates parameter store for given parameter list.
       
   220         * These parameters will be passed to embedded application.
       
   221         *
       
   222         * @since Series60 3.0
       
   223         * @param aParams a parameter list to be passed.
       
   224         */
       
   225         virtual void AddToParamListL(const CAiwGenericParamList& aParams) = 0;      
       
   226 
       
   227         /**
       
   228         * Return a list of possible output parameters set by embedded application.
       
   229         *
       
   230         * @since Series60 3.0
       
   231         * @param aParams a list of output parameters.
       
   232         */
       
   233         virtual const CAiwGenericParamList* OutputParamsL() = 0;
       
   234     };
       
   235 
       
   236 #endif // !defined(HANDLERBASE_H)
       
   237 
       
   238 // End of File