calendarui/regionalplugins/KoreanLunar/inc/CalenKoreanLunarPlugin.h
branchRCL_3
changeset 31 97232defd20e
equal deleted inserted replaced
30:bd7edf625bdd 31:97232defd20e
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 : Class looking after alarm fields for forms.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CALENKOREANLUNARPLUGIN_H__
       
    19 #define __CALENKOREANLUNARPLUGIN_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <coneresloader.h>
       
    24 #include <calencommandhandler.h>
       
    25 #include <calennotificationhandler.h>
       
    26 #include <calenservices.h>
       
    27 #include <calencustomisation.h>
       
    28 #include <eiklabel.h>
       
    29 #include <KoreanCalConv.h>
       
    30 
       
    31 // FORWARD DECLARATION
       
    32 class CCalenLunarInfoProvider;
       
    33 class CCalenLunarLocalizer;
       
    34 class CCalenExtraRowFormatter;
       
    35 class CCalenLunarLocalizedInfo;
       
    36 class CFont;
       
    37 
       
    38 /**
       
    39 * Class declaration for Korean lunar plugin
       
    40 */ 
       
    41 class CCalenKoreanLunarPlugin : public CCalenCustomisation,
       
    42                                 public MCalenCommandHandler,
       
    43                                 public MCalenNotificationHandler   
       
    44     {
       
    45 public: // public API
       
    46     static CCalenKoreanLunarPlugin* CreateKoreanPluginL( MCalenServices* aServices );
       
    47 
       
    48     virtual ~CCalenKoreanLunarPlugin();
       
    49 
       
    50 public: // Plugins internal Public API
       
    51 
       
    52     TBool LoadEnabledStatusL();
       
    53     void StoreEnabledStatusL( TBool aEnabled );
       
    54 
       
    55 protected://From CCalenCustomisation
       
    56     
       
    57     	void GetCustomViewsL(  RPointerArray<CCalenView>& aCustomViewArray );
       
    58 		void GetCustomSettingsL( RPointerArray<CAknSettingItem>& aCustomSettingArray );
       
    59         CCoeControl* InfobarL( const TRect& aRect );
       
    60         const TDesC& InfobarL();
       
    61         CCoeControl* PreviewPaneL(  TRect& aRect );
       
    62         MCalenCommandHandler* CommandHandlerL( TInt aCommand );
       
    63         void RemoveViewsFromCycle( RArray<TInt>& aViews );
       
    64         TBool CustomiseMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    65         TBool CanBeEnabledDisabled();
       
    66         TAny* CalenCustomisationExtensionL( TUid aExtensionUid );
       
    67         
       
    68         /**
       
    69         * Gets the preview pane from the plugin to be shown at the 
       
    70         * calendar view. Offers the rectangle for the preview pane, 
       
    71         * which it can be used to draw the pane.
       
    72         * 
       
    73         * @param aRect The area available for the Preview Pane
       
    74         * @return Preview pane interface
       
    75         */
       
    76         virtual MCalenPreview* CustomPreviewPaneL( TRect& aRect );
       
    77                 
       
    78         // korean support to conversion as getting new api seems too difficult
       
    79      public:
       
    80      	virtual void DateTimeToKoreanL( const TDateTime& aDateTime, TKoreanDate& aKoreanDate );
       
    81 
       
    82         /* Method converting korean lunar date to gregorian date,
       
    83            supported range is 1.1.1900 - 31.12.2099
       
    84            Leaves with KErrArgument if date is uncovertible.
       
    85         */
       
    86      	virtual void KoreanToDateTimeL( TKoreanDate& aKoreanDate, TDateTime& aDateTime );
       
    87 
       
    88         /* Method getting supported gregorian date range
       
    89         */
       
    90      	virtual void DateRange( TDateTime& aLower, TDateTime& aUpper );
       
    91 
       
    92         /* Method getting supported korean lunar date range
       
    93         */
       
    94      	virtual void DateRange( TKoreanDate& aLower, TKoreanDate& aUpper );
       
    95         
       
    96 protected:// From MCalenCommandHandler
       
    97         TBool HandleCommandL( const TCalenCommand& aCommand );
       
    98         TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid );
       
    99     
       
   100 protected://From MCalenNotificationHandler 
       
   101         void HandleNotification( const TCalenNotification aNotification );
       
   102     
       
   103 private: // own methods
       
   104         CCalenKoreanLunarPlugin(TUint32 aCenRepLunarEnabledId, MCalenServices* aServices);
       
   105         
       
   106         void ConstructL();        
       
   107         void SetLunarLocalizerL();        
       
   108         void ShowDetailsL();
       
   109         TInt GetColor();      
       
   110         
       
   111         void FormatExtraRowStringL( CEikLabel& aLabel );
       
   112         TPtrC GetExtraRowTextL( CCalenLunarLocalizedInfo& aLocInfo, TInt aMaxWidth, const CFont& aFont );
       
   113         void UpdateInfoBarL();
       
   114 
       
   115 private: // data
       
   116     /**
       
   117      * Tells, if lunar functionality is currently enabled by user.
       
   118      * If not, only setting item is provided by plugin
       
   119      */
       
   120     TBool iLunarEnabled;
       
   121 
       
   122     /**
       
   123      * Language independent provider of lunar calendar information
       
   124      */
       
   125     CCalenLunarInfoProvider* iInfoProvider;
       
   126 
       
   127     /**
       
   128      * Language specific localizer of lunar calendar information
       
   129      */
       
   130     CCalenLunarLocalizer* iLocalizer;
       
   131 
       
   132     /**
       
   133      * Localized lunar info for currently focused day
       
   134      */
       
   135     CCalenLunarLocalizedInfo* iLocInfo;
       
   136 
       
   137     /**
       
   138      * Currently displayed text for extra row
       
   139      */
       
   140     TPtrC iExtraRowText;
       
   141 
       
   142     RConeResourceLoader iResourceLoader;
       
   143 
       
   144     // Central repository Id for enabled setting
       
   145     // We have different setting for Chinese and Vietnamese
       
   146     // in case that in future they would be in same image
       
   147     TUint32 iCenRepLunarEnabledId;    
       
   148     CEikLabel* iLabel;    
       
   149     MCalenServices* iServices;    
       
   150     TInt iStart;
       
   151     TInt iEnd;
       
   152         
       
   153     CKoreanCalConv* iConverter;
       
   154     
       
   155     // Infobar rect
       
   156     TRect iRect;
       
   157     
       
   158     // Skin color
       
   159     TRgb iSkinColor;
       
   160     };
       
   161 
       
   162 #endif // __CALENKOREANLUNARPLUGIN_H__