skins/AknSkins/lskininc/aknlocalskinlib.h
changeset 0 05e9090e2422
child 54 08459e712984
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Header file for CAknLocalSkinInstance
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CAKNLOCALSKININSTANCE_H
       
    20 #define C_CAKNLOCALSKININSTANCE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 #include <AknsItemID.h>
       
    25 #include <AknsSrvClient.h>
       
    26 #include <AknsItemDef.h>
       
    27 #include <AknsPkgID.h>
       
    28 #include <AknsItemID.h>
       
    29 
       
    30 
       
    31 class CDRMHelper;
       
    32 
       
    33 /**
       
    34  *  This class provides support for local skinning.
       
    35  *
       
    36  *  For example an application can change its skin locally without affecting
       
    37  *  the look of the rest of the system.
       
    38  *
       
    39  *
       
    40  *  @since S60 v5.0
       
    41  */
       
    42 NONSHARABLE_CLASS(CAknLocalSkinInstance) : public CBase
       
    43 {
       
    44 public:
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      */
       
    48     IMPORT_C static CAknLocalSkinInstance* NewL(const RFs& aFilesystem, const RAknsSrvSession& aSkinSrv);
       
    49 
       
    50     /**
       
    51      * Applies the given skin to a list of skin items.
       
    52      *
       
    53      * @param aFilename the name of the skin file.
       
    54      * @param aItemsToOverride list of skin items for which the skin to be applied.
       
    55      * @leave EAknsSrvProtected if the skin (aFilename) is DRM-protected and can't be applied
       
    56      *        locally.
       
    57      */
       
    58     IMPORT_C void ApplyL(const TDesC& aFilename, RArray<TAknsItemID>& aItemsToOverride);
       
    59 
       
    60     /**
       
    61      * Destructor.
       
    62      */
       
    63     IMPORT_C virtual ~CAknLocalSkinInstance();
       
    64 protected:
       
    65     CAknLocalSkinInstance(const RFs& aFileSystem, const RAknsSrvSession& aSkinSrv);
       
    66 private:
       
    67     TInt ProcessChunksL( TUint32 aOffset, TUint32 aChunkCount );
       
    68     TInt HandleFilenameChunkL(TUint32 offset);
       
    69     TInt HandleClassChunkL(TUint32 aOffset);
       
    70     TInt HandleGenericRelRestrictionChunkL(TUint32 aFileOffset);
       
    71     TInt Handle26RelRestrictionChunkL(TUint32 aFileOffset );
       
    72 
       
    73     void DoOverrideImageTableDefinitionL( TUint32 fileoffset);
       
    74     void DoOverrideBitmapDefinitionL(TUint32 aOffset);
       
    75     void DoOverrideColorTableDefinitionL( TUint32 aOffset );
       
    76     void DoOverrideEffectQueueL(TUint32 aOffset);
       
    77     TUint32 DoOverrideEffectCommandsL(const TUint aOffset, TUint32& aBase,
       
    78             CAknsEffectQueueItemDef* aEffectQueue, const TUint16 aEffectCount );
       
    79 
       
    80     TUint32 DoOverrideParamsL(const TUint aOffset, TUint32& aEqBase,
       
    81         CAknsEffectItemDef* aEffect, const TUint16 aParamCount );
       
    82 
       
    83     void ReadAttributeChunkL( const TUint aOffset, TInt& aAttributes, TInt& aAlignment,
       
    84         TInt& aCoordX, TInt& aCoordY, TInt& aSizeW, TInt& aSizeH );
       
    85 
       
    86     TBool OverrideElement(const TAknsItemID& aId);
       
    87     TBool IsScalableItem(const TAknsItemID& aId);
       
    88     TBool IsDrmProtectedL(RFile &aFile);
       
    89     TInt GetRightsDetailsL(RFile &aFile);
       
    90     void DoApplyL(const TDesC& aFilename);
       
    91     void ReadFromProtectedFileL(TDes8 &aDes, RFile &aFile);
       
    92     
       
    93    /**
       
    94     * Read arabic/hebrew mirroring state.
       
    95     */
       
    96     void RetrieveAHMirroringState();
       
    97     
       
    98     /**
       
    99     * Check skin item override state.
       
   100     * @param aItemDef skin item ID.
       
   101     * @return ETrue, if skin item already override.
       
   102     */
       
   103     TBool AlreadyOverrideElement(const TAknsItemID& aId);
       
   104     
       
   105     /**
       
   106     * Load skin item from skin file.
       
   107     * @param aFilename skin package file name.
       
   108     * @param aIsDefaultSkin skin package is default skin.
       
   109     */
       
   110     void ProcessSkinFileL( const TDesC& aFilename, TBool aIsDefaultSkin );
       
   111     
       
   112     /**
       
   113     * Override local skin item.
       
   114     * @param aItemDef skin item to be overridden.
       
   115     */
       
   116     void UpdateOverriddenItem(const CAknsItemDef* aItemDef);
       
   117     
       
   118     
       
   119     /**
       
   120     * Handles language restriction chunk..
       
   121     * @return chunk size.
       
   122     */
       
   123     TInt HandleLangRestrictionChunkL(TUint32 aFileOffset);
       
   124 private:
       
   125     // File server session.
       
   126     RFs iFs;
       
   127 
       
   128     // Skin server session.
       
   129     RAknsSrvSession iSkinSrv;
       
   130 
       
   131     // File buffer for active theme.
       
   132     // Own.
       
   133     HBufC8* iSknBuffer;
       
   134 
       
   135     // File buffer for default theme.
       
   136     // This is kept open always when this class is available. Previewed theme defaults to default theme.
       
   137     // Own.
       
   138     HBufC8* iDefaultSknBuffer;
       
   139 
       
   140     // Data pointer to skin content.
       
   141     // Own.
       
   142     TUint8* iDataPtr;
       
   143 
       
   144     // Filename in previewed theme.
       
   145     // Own.
       
   146     HBufC* iBitmapFilename;
       
   147     // Path to previewed theme.
       
   148     // Own.
       
   149     HBufC* iBitmapPath;
       
   150 
       
   151     // Array of skin items overridden already.
       
   152     RPointerArray<CAknsItemDef> iOverriddenItems;
       
   153 
       
   154     // Array of skin items to override from previewed theme.
       
   155     // not owned
       
   156     RArray<TAknsItemID> iItemsToOVerride;
       
   157 
       
   158     TAknsPkgID iPkg;
       
   159 
       
   160     // ETrue, if previewed theme contains color definitions.
       
   161     TBool iNoColors;
       
   162 
       
   163     CDRMHelper* iDrmHelper;
       
   164 
       
   165     // Number of skin items to override initially.
       
   166     TInt iInitialCount;
       
   167 
       
   168     // Are there color definitions in previewed theme.
       
   169     TBool iColorsFound;
       
   170     
       
   171     /*
       
   172     * Arabic/Hebrew Mirroring State.
       
   173     */
       
   174     TBool iAHMirroringActive;
       
   175 
       
   176     /*
       
   177     * Platform Major Number
       
   178     */
       
   179     TUint iPlatformMajor;
       
   180     
       
   181     /*
       
   182     * Platform Minor Number
       
   183     */
       
   184     TUint iPlatformMinor;
       
   185 };
       
   186 
       
   187 #endif // C_CAKNLOCALSKININSTANCE_H