menucontentsrv/enginc/menuengobjectfactoryproxy.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MENUENGOBJECTFACTORYPROXY_H__
       
    19 #define __MENUENGOBJECTFACTORYPROXY_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <gecodefaultobjectfactory.h>
       
    23 
       
    24 // FORWARD DECLARATION
       
    25 
       
    26 class CMenuEng;
       
    27 class CMenuEngObjectFactory;
       
    28 class CMenuEngLegacyObjectFactory;
       
    29 
       
    30 /**
       
    31 * Menu Engine Object factory proxy. 
       
    32 * Redirects factory methods to the appropriate concrete factory when 
       
    33 * initializing objects. Objects are initialized to the new format.
       
    34 * Note! Saving of the objects is always done in the new format.
       
    35 */
       
    36 NONSHARABLE_CLASS( CMenuEngObjectFactoryProxy ): public CGECODefaultObjectFactory
       
    37     {
       
    38 
       
    39 public:     // construction
       
    40 
       
    41     /**
       
    42     * Destructor.
       
    43     */
       
    44     virtual ~CMenuEngObjectFactoryProxy();
       
    45 
       
    46     /**
       
    47     * Two-phased constructor.
       
    48     * @param aEng Engine.
       
    49     * @return The created object.
       
    50     */
       
    51     static CMenuEngObjectFactoryProxy* NewL( CMenuEng& aEng );
       
    52 
       
    53 public:     // New methods
       
    54 
       
    55     /**
       
    56     * Set support for legacy format.
       
    57     * @param aSupport New setting for legacy format support.
       
    58     */
       
    59     void SupportLegacyFormat( TBool aSupport );
       
    60     
       
    61     /**
       
    62     * Get legacy format status.
       
    63     * @retrun legacy format
       
    64     */
       
    65     TBool IsLegacyFormat();
       
    66 
       
    67     /**
       
    68     * Reset the proxy's state.
       
    69     */
       
    70     void Reset();
       
    71 
       
    72 protected:  // construction
       
    73 
       
    74     /**
       
    75     * Constructor.
       
    76     * @param aEng Engine.
       
    77     */
       
    78     CMenuEngObjectFactoryProxy( CMenuEng& aEng );
       
    79 
       
    80     /**
       
    81     * Second phase constructor.
       
    82     */
       
    83     void ConstructL();
       
    84 
       
    85 public:    // from CGECOObjectFactoryBase
       
    86 
       
    87     /**
       
    88     * Create object and set it current.
       
    89     * @param aTypeIdentifier Object type identifier.
       
    90     * @return CGECOObjectBase derived object. Caller takes ownership.
       
    91     */
       
    92     CGECOObjectBase* GetContentObjectAndSetContextL(
       
    93         const TDesC& aTypeIdentifier );
       
    94 
       
    95     /**
       
    96     * Initializes the current object with attribute provider data.
       
    97     * @param aAttributeProvider Attribute provider for data initialization.
       
    98     */
       
    99     void InitializeObjectL(
       
   100         MGECOAttributeProvider& aAttributeProvider );
       
   101 
       
   102     /**
       
   103     * Set context object for initialize and preparesave operations.
       
   104     * @param aContext Object to use in InitializeL operations.
       
   105     * @return Error code.
       
   106     */
       
   107     TInt SetContext( CGECOObjectBase* aContext );
       
   108 
       
   109 public:    // from MGECOAttributeProvider
       
   110 
       
   111     /**
       
   112     * Get number of attributes (of current object).
       
   113     * @return Number of attributes.
       
   114     */
       
   115     TInt NumAttributes();
       
   116 
       
   117     /**
       
   118     * Get attribute by index (of current object).
       
   119     * @param aIndex Attribute index.
       
   120     * @param aAttrName Attribute name is returned here.
       
   121     * @param aAttrValue Attribute value is returned here.
       
   122     * @param aIsLocalized Localized status is returned here.
       
   123     */
       
   124     void AttributeDetailsL(
       
   125         const TInt aIndex,
       
   126         TPtrC& aAttrName, 
       
   127         TPtrC& aAttrValue,
       
   128         TBool& aIsLocalized );
       
   129 
       
   130     /**
       
   131     * Get attribute by index (of current object).
       
   132     * @param aIndex Attribute index.
       
   133     * @param aAttrName Attribute name is returned here.
       
   134     * @param aAttrValue Attribute value is returned here.
       
   135     */
       
   136     void AttributeDetailsL(
       
   137         const TInt aIndex,
       
   138         TPtrC& aAttrName, 
       
   139         TPtrC& aAttrValue );
       
   140 
       
   141     /**
       
   142     * Check if current object has text data.
       
   143     * @return ETrue if current object has text data.
       
   144     */
       
   145     TBool HasTextData();
       
   146 
       
   147     /**
       
   148     * Get text data of current object.
       
   149     * @param aText Text data is returned here.
       
   150     * @param aIsLocalized Localized status is returned here.
       
   151     */
       
   152     void TextDetailsL( TPtrC& aText, TBool& aIsLocalized );
       
   153 
       
   154 private:    // data
       
   155 
       
   156     CMenuEng& iEng; ///< Engine. Not owned.
       
   157     CMenuEngObjectFactory* iObjFactory; ///< Owned.
       
   158     TBool iSupportLegacyFormat; ///< Legacy format supported?
       
   159     CMenuEngLegacyObjectFactory* iLegacyFactory; ///< Owned. Factory for legacy xml format.
       
   160     TBool iParsingInLegacyFormat; ///< Is the context legacy type?
       
   161 
       
   162     };
       
   163 
       
   164 #endif // __MENUENGOBJECTFACTORYPROXY_H__