idlehomescreen/xmluicontroller/inc/contentrenderer.h
branchRCL_3
changeset 9 f966699dea19
parent 4 4d54b72983ae
child 54 1b758917cafc
equal deleted inserted replaced
5:c743ef5928ba 9:f966699dea19
    17 
    17 
    18 
    18 
    19 #ifndef C_CONTENTRENDERER_H
    19 #ifndef C_CONTENTRENDERER_H
    20 #define C_CONTENTRENDERER_H
    20 #define C_CONTENTRENDERER_H
    21 
    21 
       
    22 // System includes
    22 #include <e32base.h>
    23 #include <e32base.h>
    23 #include <e32hashtab.h>
    24 #include <e32hashtab.h>
       
    25 
       
    26 // User includes
    24 #include "xnnewsticker.h"
    27 #include "xnnewsticker.h"
       
    28 #include "aicontentobserver.h"
    25 #include "xnproperty.h"
    29 #include "xnproperty.h"
    26 #include "aicontentobserver.h"
    30 
    27 
    31 // Forward declarations
    28 class TXnUiEngineAppIf;
    32 class TXnUiEngineAppIf;
    29 class CXnNodeAppIf;
    33 class CXnNodeAppIf;
    30 class CGulIcon;
    34 class CGulIcon;
    31 class MAiFwEventHandler;
    35 class MAiFwEventHandler;
    32 struct TAiPublisherInfo;
    36 class CHsContentPublisher;
       
    37 class THsPublisherInfo;
    33 
    38 
    34 namespace AiUtility
    39 namespace AiUtility
    35     {
    40     {
    36     class CContentPriorityMap;
    41     class CContentPriorityMap;
    37     }
    42     }
    48     class CCssPropertyMap;
    53     class CCssPropertyMap;
    49     class CPolicyEvaluator;
    54     class CPolicyEvaluator;
    50     class TAiPolicyElement;
    55     class TAiPolicyElement;
    51     }
    56     }
    52 
    57 
    53 
       
    54 namespace AiXmlUiController
    58 namespace AiXmlUiController
    55 {
    59 {
    56 
    60 
    57 /**
    61 /**
    58 *  @ingroup group_xmluicontroller
    62 *  @ingroup group_xmluicontroller
    60 *  CContentRenderer renders the content of the content publisher plug-ins
    64 *  CContentRenderer renders the content of the content publisher plug-ins
    61 *
    65 *
    62 *  @lib AiXmlUiMain
    66 *  @lib AiXmlUiMain
    63 */
    67 */
    64 class CContentRenderer : public CBase,
    68 class CContentRenderer : public CBase,
    65                          public MAiContentObserver,
    69     public MAiContentObserver,
    66                          public XnNewstickerInterface::MXnNewstickerCallbackInterface
    70     public XnNewstickerInterface::MXnNewstickerCallbackInterface
    67     {
    71     {
    68 public:  // Constructors and destructor
    72 public:  
       
    73     // Constructors and destructor
    69     
    74     
    70     static CContentRenderer* NewL( CAppUi& aAppUi );
    75     static CContentRenderer* NewL( CAppUi& aAppUi );
    71     
    76     
    72     virtual ~CContentRenderer();
    77     ~CContentRenderer();
    73 
    78 
       
    79 public:   
       
    80     // New functions
       
    81     
    74     /**
    82     /**
    75      * Sets event handler.
    83      * Sets event handler.
    76      * 
    84      * 
    77      * @param aFwEventHandler the event handler to use.
    85      * @param aFwEventHandler the event handler to use.
    78      */
    86      */
    79     void SetEventHandler( MAiFwEventHandler& aFwEventHandler );
    87     void SetEventHandler( MAiFwEventHandler& aFwEventHandler );
    80 
    88 
    81     /**
    89     /**
    82      * Resets content renderer for new theme.
       
    83      */
       
    84     void Reset();
       
    85 
       
    86     /**
       
    87      * Cleans all content items published by aPlugin.
    90      * Cleans all content items published by aPlugin.
    88      */
    91      */
    89     void CleanPluginFromUi( MAiPropertyExtension& aPlugin );
    92     void CleanPluginFromUi( CHsContentPublisher& aPlugin );
    90 
    93 
    91 // Functions from MAiContentObserver
    94 public:    
    92 
    95     // from MAiContentObserver
       
    96 
       
    97     /**
       
    98      * @see MAiContentObserver 
       
    99      */
    93     TInt StartTransaction( TInt aTxId );
   100     TInt StartTransaction( TInt aTxId );
    94 
   101 
       
   102     /**
       
   103      * @see MAiContentObserver 
       
   104      */    
    95     TInt Commit( TInt aTxId );
   105     TInt Commit( TInt aTxId );
    96 
   106 
       
   107     /**
       
   108      * @see MAiContentObserver 
       
   109      */    
    97     TInt CancelTransaction( TInt aTxId );
   110     TInt CancelTransaction( TInt aTxId );
    98 
   111 
    99     TBool CanPublish( MAiPropertyExtension& aPlugin,
   112     /**
   100                       TInt aContent,
   113      * @see MAiContentObserver 
   101                       TInt aIndex );
   114      */    
   102 
   115     TBool CanPublish( CHsContentPublisher& aPlugin,
   103     TInt Publish( MAiPropertyExtension& aPlugin,
   116           TInt aContent, TInt aIndex );
   104                   TInt aContent,
   117                       
   105                   TInt aResource,
   118     /**
   106                   TInt aIndex );
   119      * @see MAiContentObserver 
   107 
   120      */    
   108     TInt Publish( MAiPropertyExtension& aPlugin,
   121     TInt Publish( CHsContentPublisher& aPlugin,
   109                   TInt aContent,
   122         TInt aContent, TInt aResource, TInt aIndex );
   110                   const TDesC16& aText,
   123                                    
   111                   TInt aIndex );
   124     /**
   112 
   125      * @see MAiContentObserver 
   113     TInt Publish( MAiPropertyExtension& aPlugin,
   126      */    
   114                   TInt aContent,
   127     TInt Publish( CHsContentPublisher& aPlugin,
   115                   const TDesC8& aBuf,
   128         TInt aContent, const TDesC16& aText, TInt aIndex );
   116                   TInt aIndex );
   129 
   117 
   130     /**
   118     TInt Publish( MAiPropertyExtension& aPlugin,
   131      * @see MAiContentObserver 
   119                   TInt aContent,
   132      */        
   120                   RFile& aFile,
   133     TInt Publish( CHsContentPublisher& aPlugin,
   121                   TInt aIndex );
   134         TInt aContent, const TDesC8& aBuf, TInt aIndex );
   122 
   135 
   123     TInt Clean( MAiPropertyExtension& aPlugin, TInt aContent, TInt aIndex );
   136     /**
   124 
   137      * @see MAiContentObserver 
       
   138      */        
       
   139     TInt Publish( CHsContentPublisher& aPlugin,
       
   140         TInt aContent, RFile& aFile, TInt aIndex );
       
   141 
       
   142     /**
       
   143      * @see MAiContentObserver 
       
   144      */        
       
   145     TInt Clean( CHsContentPublisher& aPlugin, 
       
   146         TInt aContent, TInt aIndex );
       
   147 
       
   148     /**
       
   149      * @see MAiContentObserver 
       
   150      */        
   125     TAny* Extension( TUid aUid );
   151     TAny* Extension( TUid aUid );
   126     
   152     
   127     TBool RequiresSubscription( const TAiPublisherInfo& aPublisherInfo ) const;
   153     /**
   128     
   154      * @see MAiContentObserver 
   129     TInt SetProperty(MAiPropertyExtension& aPlugin,
   155      */        
   130             const TDesC8& aElementId,
   156     TBool RequiresSubscription( 
   131             const TDesC8& aPropertyName,
   157         const THsPublisherInfo& aPublisherInfo ) const;
   132             const TDesC8& aPropertyValue );
   158 
       
   159     /**
       
   160      * @see MAiContentObserver 
       
   161      */            
       
   162     TInt SetProperty( CHsContentPublisher& aPlugin,
       
   163         const TDesC8& aElementId, const TDesC8& aPropertyName,           
       
   164         const TDesC8& aPropertyValue );
   133        
   165        
   134     TInt SetProperty(MAiPropertyExtension& aPlugin,
   166     /**
   135             const TDesC8& aElementId,
   167      * @see MAiContentObserver 
   136             const TDesC8& aPropertyName,
   168      */            
   137             const TDesC8& aPropertyValue,  
   169     TInt SetProperty( CHsContentPublisher& aPlugin,
   138             MAiContentObserver::TValueType aValueType);  
   170         const TDesC8& aElementId, const TDesC8& aPropertyName,        
   139     
   171         const TDesC8& aPropertyValue, 
   140     CXnDomPropertyValue::TPrimitiveValueType 
   172         MAiContentObserver::TValueType aValueType );  
   141         DomPropertyValueType(MAiContentObserver::TValueType aValueType);
   173                   
   142 
       
   143 private:
   174 private:
   144 
   175     // Constructors
       
   176     
       
   177     /**
       
   178      * C++ default constructor
       
   179      */
   145     CContentRenderer( CAppUi& aAppUi );
   180     CContentRenderer( CAppUi& aAppUi );
   146     
   181     
       
   182     /**
       
   183      * 2nd phase constructor
       
   184      */
   147     void ConstructL();
   185     void ConstructL();
   148     
   186     
       
   187 private:
       
   188     // New functions
       
   189 
   149     void DoStartTransactionL( TInt aTxId );
   190     void DoStartTransactionL( TInt aTxId );
   150 
   191 
   151     TInt CanPublishL( MAiPropertyExtension& aPlugin,
   192     TInt CanPublishL( CHsContentPublisher& aPlugin,
   152                       TInt aContent,
   193         TInt aContent, TInt aIndex );
   153                       TInt aIndex );
   194                       
   154 
   195     TInt DoPublishL( CHsContentPublisher& aPlugin,
   155     TInt DoPublishL( MAiPropertyExtension& aPlugin,
   196         TInt aContent, TInt aResource, TInt aIndex );
   156                      TInt aContent,
   197     
   157                      TInt aResource,
   198     TInt DoPublishL( CHsContentPublisher& aPlugin,
   158                      TInt aIndex);
   199         TInt aContent, const TDesC16& aText, TInt aIndex );
   159     
   200     
   160     TInt DoPublishL( MAiPropertyExtension& aPlugin,
   201     TInt DoPublishL( CHsContentPublisher& aPlugin,
   161                      TInt aContent,
   202         TInt aContent, const TDesC8& aBuf, TInt aIndex );
   162                      const TDesC16& aText,
   203 
   163                      TInt aIndex );
   204     TInt DoPublishL( CHsContentPublisher& aPlugin,
   164     
   205         TInt aContent, RFile& aFile, TInt aIndex );
   165     TInt DoPublishL( MAiPropertyExtension& aPlugin,
   206 
   166                      TInt aContent,
   207     TInt DoCleanL( CHsContentPublisher& aPlugin,
   167                      const TDesC8& aBuf,
   208         TInt aContent, TInt aIndex );
   168                      TInt aIndex );
   209                        
   169     
       
   170     TInt DoPublishL( MAiPropertyExtension& aPlugin,
       
   171                      TInt aContent,
       
   172                      RFile& aFile,
       
   173                      TInt aIndex );
       
   174     
       
   175     TInt DoCleanL( MAiPropertyExtension& aPlugin,
       
   176                    TInt aContent,
       
   177                    TInt aIndex );
       
   178     
       
   179     void SetImmediateMode( TBool aImmediateMode );
   210     void SetImmediateMode( TBool aImmediateMode );
   180     
   211     
   181     TBool IsImmediateMode() const;
   212     TBool IsImmediateMode() const;
   182     
   213     
   183     void ProcessTransactionElementL( MTransactionElement* aElement );
   214     void ProcessTransactionElementL( 
   184 
   215         MTransactionElement* aElement );
   185     CXnNodeAppIf* FindNodeByClassL( const TDesC& aCid,
   216 
   186                                     TInt aIndex,
   217     CXnNodeAppIf* FindNodeByClassL( 
   187                                     const TDesC8& aNs );
   218         const TDesC& aCid, TInt aIndex, const TDesC8& aNs );
   188 
   219 
   189     CXnNodeAppIf* FindNodeByIdL( const TDesC& aCid, const TDesC& aNs = KNullDesC );
   220     CXnNodeAppIf* FindNodeByIdL( 
   190 
   221         const TDesC& aCid, const TDesC& aNs = KNullDesC );
   191     CXnNodeAppIf* FindNodeByIdL( const TDesC8& aCid, const TDesC8& aNs = KNullDesC8 );
   222 
   192     
   223     CXnNodeAppIf* FindNodeByIdL( 
   193     TInt PublishIconL( MAiPropertyExtension& aPlugin,
   224         const TDesC8& aCid, const TDesC8& aNs = KNullDesC8 );
   194                        const TDesC& aCid,
   225     
   195                        CGulIcon* aIcon,
   226     TInt PublishIconL( CHsContentPublisher& aPlugin,
   196                        TInt aIndex,
   227         const TDesC& aCid, CGulIcon* aIcon, TInt aIndex, 
   197                        CXnNodeAppIf* aResource = NULL );
   228         CXnNodeAppIf* aResource = NULL );
   198                        
   229                        
   199     TInt PublishDataL( MAiPropertyExtension& aPlugin,
   230     TInt PublishDataL( CHsContentPublisher& aPlugin,
   200                        const TDesC& aCid,
   231         const TDesC& aCid, const TDesC8& aData,
   201                        const TDesC8& aData,
   232         const TDesC8& aContentType, TInt aIndex,
   202                        const TDesC8& aContentType,
   233         CXnNodeAppIf* aResource = NULL );
   203                        TInt aIndex,
   234     
   204                        CXnNodeAppIf* aResource = NULL );
   235     TBool AllowPublishByPriority( 
   205     
   236         CXnNodeAppIf& aUiElement, TInt aNewPriority ) const;
   206     TBool AllowPublishByPriority( CXnNodeAppIf& aUiElement,
   237                                       
   207                                   TInt aNewPriority ) const;
       
   208     
       
   209     void StartContentRefresh();
   238     void StartContentRefresh();
   210     
   239     
   211     TInt RefreshContentL( HBufC* aUiElementId,
   240     TInt RefreshContentL( HBufC* aUiElementId, TInt aOldPriority ); 
   212                           TInt aOldPriority );
   241                                       
   213     
       
   214     static TInt RefreshContentCallback( TAny* aContentRenderer );
   242     static TInt RefreshContentCallback( TAny* aContentRenderer );
   215     
   243     
   216     void SendRefreshContentEventL();
   244     void SendRefreshContentEventL();
   217     
   245     
   218     TBool IsParentNewsticker( CXnNodeAppIf& aTarget );
   246     TBool IsParentNewsticker( CXnNodeAppIf& aTarget );
   219     
   247     
   220     void RegisterNewstickerCallbackInterfaceL( CXnNodeAppIf& aTarget );
   248     void RegisterNewstickerCallbackInterfaceL( CXnNodeAppIf& aTarget );
   221     
   249 
   222     TInt SetPropertyL(MAiPropertyExtension& aPlugin,
   250     void ProcessContentChangesL( MTransaction& aTr );
   223                const TDesC8& aElementId,
   251     void ProcessContentChangeL( TAiPolicyElement& aElement );         
   224                const TDesC8& aPropertyName,
   252     
   225                const TDesC8& aPropertyValue,  
   253     TInt SetPropertyL( CHsContentPublisher& aPlugin,
   226                MAiContentObserver::TValueType aValueType);
   254        const TDesC8& aElementId, const TDesC8& aPropertyName,               
   227 
   255        const TDesC8& aPropertyValue, MAiContentObserver::TValueType aValueType );  
   228 // From XnNewstickerInterface::MXnNewstickerCallbackInterface    
   256                    
       
   257     CXnDomPropertyValue::TPrimitiveValueType DomPropertyValueType( 
       
   258         MAiContentObserver::TValueType aValueType ); 
       
   259             
       
   260 private:    
       
   261     // From XnNewstickerInterface::MXnNewstickerCallbackInterface    
   229 
   262 
   230     void TitleScrolled(TInt aTitleIndex);
   263     void TitleScrolled(TInt aTitleIndex);
   231     
   264     
   232     void TitleToScroll(TInt aTitleIndex);
   265     void TitleToScroll(TInt aTitleIndex);
   233     
   266     
   234     void CleanPluginFromUiL( MAiPropertyExtension& aPlugin );
   267 private:    
   235     
   268     // data
   236     void ProcessContentChangesL( MTransaction& aTr );
   269     
   237     void ProcessContentChangeL( TAiPolicyElement& aElement );     
   270     /** Transaction stack, Owned. */
   238 
   271     CActiveTransactionStack* iStack;    
   239 private:    // Data
   272     /** Factory for transacations, Owned. */
   240     
   273     CTransactionFactoryImpl* iFactory;    
   241     /**
   274     /** Immediate mode flag, Owned. */
   242      * Transaction stack. Own.
   275     TBool iImmediateMode;    
   243      */
   276     /** AppUI, Not owned. */
   244     CActiveTransactionStack* iStack;
   277     CAppUi& iAppUi;    
   245     
   278     /** Node lookup id generator, Owned. */
   246     /**
   279     CXmlNodeIdGenerator* iNodeIdGenerator;    
   247      * Factory for transacations. Own.
   280     /** Content priority map, Owned. */
   248      */
   281     AiUtility::CContentPriorityMap* iContentPriorityMap;    
   249     CTransactionFactoryImpl* iFactory;
   282     /** Map of refreshable ui elements. */
   250     
   283     RPtrHashMap< TDesC, TInt > iRefreshableUiElements;    
   251     /**
   284     /** Timer for asynchronous content refreshing, Owned. */
   252      * Immediate mode flag. Own.
   285     CPeriodic* iTimer;    
   253      */
   286     /** Fw event handler, Not owned. */
   254     TBool iImmediateMode;
       
   255     
       
   256     /**
       
   257      * App UI
       
   258      */
       
   259     CAppUi& iAppUi;
       
   260     
       
   261     /**
       
   262      * Node lookup id generator. Own.
       
   263      */
       
   264     CXmlNodeIdGenerator* iNodeIdGenerator;
       
   265     
       
   266     /**
       
   267      * Content priority map. Own.
       
   268      */
       
   269     AiUtility::CContentPriorityMap* iContentPriorityMap;
       
   270     
       
   271     /**
       
   272      * Map of refreshable ui elements.
       
   273      */
       
   274     RPtrHashMap< TDesC, TInt > iRefreshableUiElements;
       
   275     
       
   276     /**
       
   277      * Timer for asynchronous content refreshing
       
   278      */
       
   279     CPeriodic* iTimer;
       
   280     
       
   281     /**
       
   282      * Fw event handler needed for content refresh event notifications.
       
   283      * Not own.
       
   284      */
       
   285     MAiFwEventHandler* iFwEventHandler;
   287     MAiFwEventHandler* iFwEventHandler;
   286     
   288     /** Newsticker callback handler, Owned */
   287     /**
   289     CNewstickerCallbackHandler* iCallbackHandler;    
   288      * Newsticker callback handler
   290     /** Pointer descriptor to newsticker plugin name */
   289      */
   291     TPtrC iNTPublisher;    
   290     CNewstickerCallbackHandler* iCallbackHandler;
   292     /** Newsticker element property class, Owned */
   291     
   293     HBufC* iNTClass;    
   292     /**
   294     /** CSS property map, Owned. */
   293      * Pointer descriptor to newsticker plugin name
   295     CCssPropertyMap* iPropertyMap;    
   294      */
   296     /** Publishing policy evaluator, Owned. */
   295     TPtrC iNTPublisher;
       
   296     
       
   297     /**
       
   298      * Newsticker element property class.
       
   299      */
       
   300     HBufC* iNTClass;
       
   301     
       
   302     /**
       
   303      * CSS property map. Own
       
   304      */
       
   305     CCssPropertyMap* iPropertyMap;
       
   306     
       
   307     /**
       
   308      * Publishing policy evaluator. Own.
       
   309      */
       
   310     CPolicyEvaluator* iPolicyEvaluator;
   297     CPolicyEvaluator* iPolicyEvaluator;
   311     
       
   312     };
   298     };
   313 
   299 
   314 } // namespace AiXmlUiController
   300 } // namespace AiXmlUiController
   315 
   301 
   316 #endif      // C_CONTENTRENDERER_H  
   302 #endif      // C_CONTENTRENDERER_H