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