homescreensrv_plat/ai_content_model_api/inc/aicontentobserver.h
changeset 0 79c6a41cd166
child 3 ff572005ac23
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Active Idle content observer interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_AICONTENTOBSERVER_H
       
    20 #define M_AICONTENTOBSERVER_H
       
    21 
       
    22 #include <e32std.h>
       
    23 
       
    24 class MAiPropertyExtension;
       
    25 class RFile;
       
    26 class TDesC8;
       
    27 class TDesC16;
       
    28 struct TAiPublisherInfo;
       
    29 
       
    30 /**
       
    31  *  Used by AI Plug-in to give notification about modifications in
       
    32  *  content and/or internal state.
       
    33  *
       
    34  *  @since S60 3.2
       
    35  */
       
    36 class MAiContentObserver
       
    37     {
       
    38 public:  // New functions
       
    39 
       
    40     /**
       
    41      * Invoked by the plug-in to inform that it initiates content publishing
       
    42      * transaction.
       
    43      *
       
    44      * @param  aTxId - transaction Id
       
    45      * @return - Possible return values:
       
    46      *         - KErrNone - transaction is started.
       
    47      *         - KErrNotSupported - UI Controller does not support transactions,
       
    48      *         meaning that content will be rendered every time when Publish
       
    49      *         is called.
       
    50      */
       
    51     virtual TInt StartTransaction( TInt aTxId ) = 0;
       
    52 
       
    53     /**
       
    54      * Invoked by the plug-in to request framework that content publishing
       
    55      * transaction must be finalized and content should be rendered to the
       
    56      * screen.
       
    57      *
       
    58      * @param  aTxId - transaction Id
       
    59      * @return - Possible return values:
       
    60      *         - KErrNone - transaction is over.
       
    61      *         - KErrNotSupported - UI Controller does not support transactions,
       
    62      *         meaning that content will be rendered every time when Publish
       
    63      *         is called.
       
    64      *         - KErrNotFound - transaction with matching id has not been 
       
    65      *         started.
       
    66      *         - Any of the system-wide error codes in case of resource allocation failure.
       
    67      */
       
    68     virtual TInt Commit( TInt aTxId ) = 0;
       
    69 
       
    70     /**
       
    71      * Invoked by plug-in to indicate that content publishing transaction
       
    72      * must be cancelled.
       
    73      *
       
    74      * @param  aTxId - transaction Id
       
    75      * @return - Possible return values:
       
    76      *         - KErrNone - transaction is cancelled.
       
    77      *         - KErrNotSupported - UI Controller does not support transactions,
       
    78      *         meaning that content will be rendered every time when Publish
       
    79      *         is called.
       
    80      *         - KErrNotFound - transaction with matching id has not been 
       
    81      *         started.
       
    82      */
       
    83     virtual TInt CancelTransaction( TInt aTxId ) = 0;
       
    84 
       
    85     /**
       
    86      * Invoked by plug-in to test if the specified content can be published.
       
    87      *
       
    88      * @param  aPlugin - Plug-in property extension interface implementation.
       
    89      * @param  aContent - identification of content selector, MUST correspond
       
    90      *         single content selector supported by plug-in. The framework
       
    91      *         utilizes the selector id to match for cid and MIME type.
       
    92      * @param  aIndex - index of the content item.
       
    93      * @return ETrue - if content could be published; EFalse otherwise.
       
    94      */
       
    95     virtual TBool CanPublish( MAiPropertyExtension& aPlugin, TInt aContent, TInt aIndex ) = 0;
       
    96 
       
    97     /**
       
    98      * Invoked by the plug-in to inform that content identified by reference
       
    99      * aResource must be published to UI control\element identified by selector
       
   100      * aContent.
       
   101      *
       
   102      * @param  aPlugin - Plug-in property extension interface implementation.
       
   103      * @param  aContent - identification of content selector, MUST correspond
       
   104      *         single content selector supported by plug-in. The framework
       
   105      *         utilizes the selector id to match for cid and MIME type.
       
   106      * @param  aResource - identification of content reference, MUST correspond
       
   107      *         single content reference supported by plug-in. The framework
       
   108      *         utilizes the reference if to match for cid and MIME type of the
       
   109      *         content supplied with in UI definition.
       
   110      * @param  aIndex - index of the content item.
       
   111      * @return - Possible return values:
       
   112      *         - KErrNone - if content is published.
       
   113      *         - KErrNotSupported - if content selector is not supported by
       
   114      *         current UI definition.
       
   115      *         - KErrNotFound - if content reference is not found in current
       
   116      *         UI definition.
       
   117      */
       
   118     virtual TInt Publish( MAiPropertyExtension& aPlugin, TInt aContent, TInt aResource, TInt aIndex ) = 0;
       
   119 
       
   120     /**
       
   121      * Invoked by the plug-in to inform that textual content provided within 
       
   122      * parameter aText must be published to UI control\element identified by 
       
   123      * selector aContent.
       
   124      *
       
   125      * @param  aPlugin - Plug-in property extension interface implementation.
       
   126      * @param  aContent - identification of content selector, MUST correspond
       
   127      *         single content selector supported by plug-in. The framework
       
   128      *         utilizes the selector id to match for cid and MIME type.
       
   129      * @param  aText - Textual content in UNICODE.
       
   130      * @param  aIndex - index of the content item.
       
   131      * @return - Possible return values:
       
   132      *         - KErrNone - if content is published.
       
   133      *         - KErrNotSupported - if content selector is not supported by
       
   134      *         current UI definition.
       
   135      *         - KErrNotFound - if content reference is not found in current
       
   136      *         UI definition.
       
   137      *         - KErrArgument - if content cannot be published to UI element,
       
   138      *         e.g. MIME type mismatch.
       
   139      */
       
   140     virtual TInt Publish( MAiPropertyExtension& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex ) = 0;
       
   141 
       
   142     /**
       
   143      * Invoked by the plug-in to inform that content provided within buffer
       
   144      * aBuf must be published to UI control\element identified by selector
       
   145      * aContent.
       
   146      *
       
   147      * @param  aPlugin - Plug-in property extension interface implementation.
       
   148      * @param  aContent - identification of content selector, MUST correspond
       
   149      *         single content selector supported by plug-in. The framework
       
   150      *         utilizes the selector id to match for cid and MIME type.
       
   151      * @param  aBuf - instance of content.
       
   152      * @param  aIndex - index of the content item.
       
   153      * @return - Possible return values:
       
   154      *         - KErrNone - if content is published.
       
   155      *         - KErrNotSupported - if content selector is not supported by
       
   156      *         current UI definition.
       
   157      *         - KErrNotFound - if content reference is not found in current
       
   158      *         UI definition.
       
   159      *         - KErrArgument - if content cannot be published to UI element,
       
   160      *         e.g. MIME type mismatch.
       
   161      */ 
       
   162     virtual TInt Publish( MAiPropertyExtension& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex ) = 0;
       
   163     
       
   164     /**
       
   165      * Invoked by the plug-in to inform that an object provided by pointer aPtr
       
   166      * must be published to UI control\element identified by selector aContent.
       
   167      * The implementation packages the pointer to a buffer and delegates to 
       
   168      * buffer publishing method Publish(MAiPropertyExtension&, TInt, const TDesC8&, TInt).
       
   169      *
       
   170      * @param  aPlugin - Plug-in property extension interface implementation.
       
   171      * @param  aContent - identification of content selector, MUST correspond
       
   172      *         single content selector supported by plug-in. The framework
       
   173      *         utilizes the selector id to match for cid and MIME type.
       
   174      * @param  aPtr - pointer to the content object. The actual type of the 
       
   175      *         pointer is deduced based on the MIME type of the content item 
       
   176      *         identified by aContent.
       
   177      * @param  aIndex - index of the content item.
       
   178      * @return - Possible return values:
       
   179      *         - KErrNone - if content is published.
       
   180      *         - KErrNotSupported - if content selector is not supported by
       
   181      *         current UI definition.
       
   182      *         - KErrNotFound - if content reference is not found in current
       
   183      *         UI definition.
       
   184      *         - KErrArgument - if content cannot be published to UI element,
       
   185      *         e.g. MIME type mismatch.
       
   186      * @see KAiContentTypeBitmap
       
   187      */ 
       
   188     inline TInt PublishPtr( MAiPropertyExtension& aPlugin, TInt aContent, TAny* aPtr, TInt aIndex );
       
   189 
       
   190     /**
       
   191      * Helper function for unpacking a pointer that has been published with
       
   192      * MAiContentObserver::PublishPtr.
       
   193      *
       
   194      * @see MAiContentObserver::PublishPtr
       
   195      */
       
   196     template<class PtrT> inline static PtrT* UnpackPtr( const TDesC8& aBuf );
       
   197 
       
   198     /**
       
   199      * Invoked by the plug-in to inform that content from file handle aFile
       
   200      * must be published to UI control\element identified by selector aContent.
       
   201      *
       
   202      * @param  aPlugin - Plug-in property extension interface implementation.
       
   203      * @param  aContent - identification of content selector, MUST correspond
       
   204      *         single content selector supported by plug-in. The framework
       
   205      *         utilizes the selector id to match for cid and MIME type.
       
   206      * @param  aFile - file handle from where content can be obtained by UI
       
   207      *         framework.
       
   208      * @param  aIndex - index of the content item.
       
   209      * @return - Possible return values:
       
   210      *         - KErrNone - if content is published.
       
   211      *         - KErrNotSupported - if content selector is not supported by
       
   212      *         current UI definition.
       
   213      *         - KErrNotFound - if content reference is not found in current
       
   214      *         UI definition.
       
   215      *         - KErrArgument - if content cannot be published to UI element,
       
   216      *         e.g. MIME type mismatch.
       
   217      */
       
   218     virtual TInt Publish( MAiPropertyExtension& aPlugin, TInt aContent, RFile& aFile, TInt aIndex ) = 0;
       
   219 
       
   220     /**
       
   221      * Invoked by the plug-in to inform that content must be cleaned in UI
       
   222      * control\element identified by selector aContent.
       
   223      *
       
   224      * @param  aPlugin - Plug-in property extension interface implementation.
       
   225      * @param  aContent - identification of content selector, MUST correspond
       
   226      *         single content selector supported by plug-in. The framework
       
   227      *         utilizes the selector id to match for cid and MIME type.
       
   228      * @param  aIndex - index of the content item.
       
   229      * @return - Possible return values:
       
   230      *         - KErrNone - if content is published.
       
   231      *         - KErrNotSupported - if content selector is not supported by
       
   232      *         current UI definition.
       
   233      *         - KErrNotFound - if content reference is not found in current
       
   234      *         UI definition.
       
   235      */
       
   236     virtual TInt Clean( MAiPropertyExtension& aPlugin, TInt aContent, TInt aIndex ) = 0;
       
   237 
       
   238     /**
       
   239      * Returns interface extension. Not used in S60 3.2 release.
       
   240      *
       
   241      * @param  aUid - UID of the extension interface to access.
       
   242      * @return the extension interface. Actual type depends on the passed aUid 
       
   243      *         argument.
       
   244      */
       
   245     virtual TAny* Extension( TUid aUid ) = 0;
       
   246 
       
   247     /**
       
   248 	 * Invoked by the plugin factory
       
   249 	 *
       
   250 	 * @param aPublsiherInfo Publisher which requires subscription
       
   251 	 * @return ETrue if subsription is needed, EFalse otherwise
       
   252 	 */	
       
   253     virtual TBool RequiresSubscription( const TAiPublisherInfo& aPublisherInfo ) const = 0;	    
       
   254 
       
   255 protected:
       
   256     /**
       
   257      * Protected destructor prevents deletion through this interface.
       
   258      */
       
   259     ~MAiContentObserver() { }
       
   260     };
       
   261 
       
   262 
       
   263 #include <aicontentobserver.inl>
       
   264 
       
   265 #endif // M_AICONTENTOBSERVER_H