menucontentsrv/enginc/menuenglegacyobjectfactory.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 __MENUENGLEGACYOBJECTFACTORY_H__
       
    19 #define __MENUENGLEGACYOBJECTFACTORY_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <gecodefaultobjectfactory.h>
       
    23 
       
    24 // FORWARD DECLARATION
       
    25 
       
    26 class CMenuEng;
       
    27 
       
    28 /**
       
    29 * Menu Engine Object factory for reading previous, legacy version of XML.
       
    30 * Note. This class is meant only for reading! Objects are internalized 
       
    31 * and saved to the new format (@see CMenuEngObjectFactory).
       
    32 */
       
    33 NONSHARABLE_CLASS( CMenuEngLegacyObjectFactory ): public CGECODefaultObjectFactory
       
    34     {
       
    35 
       
    36 public:     // construction
       
    37 
       
    38     /**
       
    39     * Destructor.
       
    40     */
       
    41     virtual ~CMenuEngLegacyObjectFactory();
       
    42 
       
    43     /**
       
    44     * Two-phased constructor.
       
    45     * @param aEng Engine.
       
    46     * @return The created object.
       
    47     */
       
    48     static CMenuEngLegacyObjectFactory* NewL( CMenuEng& aEng );
       
    49 
       
    50 protected:  // construction
       
    51 
       
    52     /**
       
    53     * Constructor.
       
    54     * @param aEng Engine.
       
    55     */
       
    56     CMenuEngLegacyObjectFactory( CMenuEng& aEng );
       
    57 
       
    58 private:    // New
       
    59 
       
    60     /**
       
    61     * Check support for legacy node type.
       
    62     * @param aLegacyTypeIdentifier Node type.
       
    63     * @return ETrue if aLegacyTypeIdentifier is supported by this factory.
       
    64     */
       
    65     TBool IsSupportedType( const TDesC& aLegacyTypeIdentifier ) const;
       
    66 
       
    67     /**
       
    68     * Get the converted (current) type for legacy node type.
       
    69     * @param aLegacyTypeIdentifier Node type.
       
    70     * @return Converted type.
       
    71     */
       
    72     TPtrC ConvertedType( const TDesC& aLegacyTypeIdentifier ) const;
       
    73 
       
    74 public:    // from CGECOObjectFactoryBase
       
    75 
       
    76     /**
       
    77     * Create object and set it current.
       
    78     * @param aTypeIdentifier Object type identifier.
       
    79     * @return CGECOObjectBase derived object. Caller takes ownership.
       
    80     */
       
    81     CGECOObjectBase* GetContentObjectAndSetContextL(
       
    82         const TDesC& aTypeIdentifier );
       
    83 
       
    84     /**
       
    85     * Initializes the current object with attribute provider data.
       
    86     * @param aAttributeProvider Attribute provider for data initialization.
       
    87     */
       
    88     void InitializeObjectL(
       
    89         MGECOAttributeProvider& aAttributeProvider );
       
    90 
       
    91     /**
       
    92     * Set context object for initialize and preparesave operations.
       
    93     * @param aContext Object to use in InitializeL operations.
       
    94     * @return Error code.
       
    95     */
       
    96     TInt SetContext( CGECOObjectBase* aContext );
       
    97 
       
    98 public:    // from MGECOAttributeProvider
       
    99 
       
   100     /**
       
   101     * Get number of attributes (of current object).
       
   102     * @return Number of attributes.
       
   103     */
       
   104     TInt NumAttributes();
       
   105 
       
   106     /**
       
   107     * Get attribute by index (of current object).
       
   108     * @param aIndex Attribute index.
       
   109     * @param aAttrName Attribute name is returned here.
       
   110     * @param aAttrValue Attribute value is returned here.
       
   111     * @param aIsLocalized Localized status is returned here.
       
   112     */
       
   113     void AttributeDetailsL(
       
   114         const TInt aIndex,
       
   115         TPtrC& aAttrName, 
       
   116         TPtrC& aAttrValue,
       
   117         TBool& aIsLocalized );
       
   118 
       
   119     /**
       
   120     * Get attribute by index (of current object).
       
   121     * @param aIndex Attribute index.
       
   122     * @param aAttrName Attribute name is returned here.
       
   123     * @param aAttrValue Attribute value is returned here.
       
   124     */
       
   125     void AttributeDetailsL(
       
   126         const TInt aIndex,
       
   127         TPtrC& aAttrName, 
       
   128         TPtrC& aAttrValue );
       
   129 
       
   130     /**
       
   131     * Check if current object has text data.
       
   132     * @return ETrue if current object has text data.
       
   133     */
       
   134     TBool HasTextData();
       
   135 
       
   136     /**
       
   137     * Get text data of current object.
       
   138     * @param aText Text data is returned here.
       
   139     * @param aIsLocalized Localized status is returned here.
       
   140     */
       
   141     void TextDetailsL( TPtrC& aText, TBool& aIsLocalized );
       
   142 
       
   143 
       
   144 private:    // data
       
   145 
       
   146     CMenuEng& iEng; ///< Engine. Not owned.
       
   147 
       
   148     };
       
   149 
       
   150 #endif // __MENUENGLEGACYOBJECTFACTORY_H__