phoneapp/phoneuiview/inc/cphonebubblewrapper.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005 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:  PhoneUI Bubble Wrapper
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPHONEBUBBLEWRAPPER_H
       
    19 #define CPHONEBUBBLEWRAPPER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <e32std.h>
       
    24 #include <coecntrl.h>
       
    25 #include <eikimage.h>
       
    26 #include <pevirtualengine.h>
       
    27 #include <bmbubblemanager.h>
       
    28 #include "mphonevideoplayer.h"
       
    29 #include "bmvideoplaybackobserver.h"
       
    30 #include "mphoneviewcommandhandle.h"
       
    31 #include "cphonecallthememonitor.h"
       
    32 #include "mphonenumberentrychangedhandler.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CBubbleManager;
       
    36 class CPhoneBubbleMapping;
       
    37 class CPhoneNumberEntry;
       
    38 class TPhoneCommandParam;
       
    39 class TPhoneCmdParamCallHeaderData;
       
    40 class CPhoneCallHeaderTextAnimation;
       
    41 
       
    42 class MNumberEntryObserver;
       
    43 class MNumberEntry;
       
    44 
       
    45 class CPhoneBubbleExtensionManager;
       
    46 class MPhoneCustomization;
       
    47 
       
    48 class CPhoneBubbleWrapper :
       
    49     public CBase,
       
    50     public MPhoneVideoPlayer,
       
    51     private MBubbleVideoPlaybackObserver,
       
    52     public MPhoneCallThemeSettingsObserver,
       
    53     public MPhoneNumberEntryChangedHandler,
       
    54     public MCoeControlObserver
       
    55     {
       
    56     public: // Constructors and destructor
       
    57 
       
    58         /**
       
    59         * Two-phased constructor.
       
    60         */
       
    61         static CPhoneBubbleWrapper* NewL(
       
    62             CCoeControl* aControl,
       
    63             const TRect& aRect );
       
    64 
       
    65         /**
       
    66         * Destructor.
       
    67         */
       
    68         virtual ~CPhoneBubbleWrapper();
       
    69 
       
    70     public: // Call Header functions
       
    71 
       
    72         void RemoveCallHeaderL( TInt aCallId );
       
    73 
       
    74         CBubbleManager::TBubbleId CreateCallHeaderL(
       
    75             TInt aCallId,
       
    76             TPhoneCommandParam* aCommandParam );
       
    77 
       
    78         CBubbleManager::TBubbleId CreateEmergencyCallHeaderL(
       
    79             TInt aCallId,
       
    80             TPhoneCommandParam* aCommandParam );
       
    81 
       
    82         void UpdateCallHeaderDisplay(
       
    83             TInt aCallId,
       
    84             TPhoneCommandParam* aCommandParam );
       
    85 
       
    86         void UpdateCallHeaderAndLabel(
       
    87             TInt aCallId,
       
    88             TPhoneCommandParam* aCommandParam );
       
    89 
       
    90     public: // Thumbnail functions
       
    91 
       
    92     public: // Number Entry functions
       
    93 
       
    94         void CreateNumberEntry();
       
    95 
       
    96         void SetNumberEntryObserver( MNumberEntryObserver& aObserver  );
       
    97 
       
    98         void SetNumberEntryPromptText( const TDesC& aPromptText );
       
    99 
       
   100         void RemoveNumberEntry();
       
   101 
       
   102         void SetNumberEntryContent( const TDesC& aContent );
       
   103 
       
   104         void GetNumberEntryContent( TPhoneCommandParam* aCommandParam );
       
   105 
       
   106         void GetLocalizedNumberEntryContent( TPhoneCommandParam* aCommandParam );
       
   107 
       
   108         void SetNumberEntryVisible( TPhoneCommandParam* aCommandParam );
       
   109 
       
   110         void GetNumberEntryCount( TPhoneCommandParam* aCommandParam );
       
   111 
       
   112         TBool IsNumberEntryUsed();
       
   113 
       
   114         TBool IsNumberEntryVisible();
       
   115 
       
   116         /**
       
   117         * Count amount of characters in number entry.
       
   118         * @return amount of chracters.
       
   119         */
       
   120         TInt CountNumberEntryCharacters();
       
   121 
       
   122         // from base class MPhoneNumberEntryChangedHandler
       
   123         
       
   124         /**
       
   125          * From MPhoneNumberEntryChangedHandler
       
   126          * 
       
   127          * Contains implementation about what is done when Phone Number Entry
       
   128          *  has informed that it's state has changed  
       
   129          *  
       
   130          * @since S60 5.0
       
   131          */
       
   132         void HandleNumberEntryChanged( );
       
   133         
       
   134         /**
       
   135          * From MPhoneNumberEntryChangedHandler
       
   136          * 
       
   137          * Sets callback function to observer that want to know about the 
       
   138          * number entry changes. 
       
   139          *
       
   140          * @since S60 5.0 
       
   141          */
       
   142         void SetNumberEntryChangedCallBack( TPhoneCommandParam* aCommandParam );
       
   143         
       
   144         /**
       
   145          * From MCoeControlObserver
       
   146          * 
       
   147          * Bubble wrapper receives events from bubble number editor
       
   148          */
       
   149         void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
       
   150         
       
   151         
       
   152     public: // New functions
       
   153 
       
   154         /**
       
   155         * Handles key event.
       
   156         *
       
   157         * @param aCommandParam a command parameter
       
   158         * @return Indicates if event was handled.
       
   159         */
       
   160         TKeyResponse HandleKeyEventL( TPhoneCommandParam* aCommandParam );
       
   161 
       
   162         /**
       
   163         * Set the phone muted icon.
       
   164         * @param aCommandParam a command parameter
       
   165         */
       
   166         void SetPhoneMuted( TPhoneCommandParam* aCommandParam );
       
   167 
       
   168         /**
       
   169         * Prepare the call state
       
   170         * @param aCallId call id
       
   171         * @param aState call state
       
   172         * @param aStateLabelText label associated with the call state
       
   173         * @param aStateShortLabelText short label associated with the call state
       
   174         */
       
   175         void PrepareCallStateL(
       
   176             TInt aCallId,
       
   177             TPEState aState,
       
   178             const TDesC& aStateLabelText,
       
   179             const TDesC& aStateShortLabelText );
       
   180 
       
   181         /**
       
   182         * Update the call duration
       
   183         * @param aCallId call id
       
   184         */
       
   185         void UpdateCallDuration( TInt aCallId, const TDesC& aDurationText );
       
   186 
       
   187         /**
       
   188         * Give selected conf member callId
       
   189         * @param  aCommandParam
       
   190         */
       
   191         TBool SelectedConfMemberCallIdL( TPhoneCommandParam* aCommandParam );
       
   192 
       
   193         /**
       
   194         * Give selected conf member callId
       
   195         * @param  aCommandParam
       
   196         */
       
   197         void OpenConferenceList( TPhoneCommandParam* aCommandParam );
       
   198 
       
   199         /**
       
   200         * Move Highlight in conference up/down
       
   201         * @param  aCommandParam
       
   202         */
       
   203         void MoveHighlightInConference( TPhoneCommandParam* aCommandParam );
       
   204 
       
   205         /**
       
   206         * Give callState by callId
       
   207         * @param  aCommandParam
       
   208         */
       
   209         TInt GetCallState( TPhoneCommandParam* aCommandParam );
       
   210 
       
   211         /**
       
   212         * Give callId by callState
       
   213         * @param  aCommandParam
       
   214         */
       
   215         TInt GetCallIdByState( TPhoneCommandParam* aCommandParam );
       
   216 
       
   217         /**
       
   218         * Give number of active calls
       
   219         * @param  aCommandParam
       
   220         */
       
   221         void GetActiveCallsCount( TPhoneCommandParam* aCommandParam );
       
   222 
       
   223         /**
       
   224         * Give is conference active or not
       
   225         * @param  aCommandParam
       
   226         */
       
   227         void GetIsConference( TPhoneCommandParam* aCommandParam );
       
   228 
       
   229         /**
       
   230         * Give is this callId member of conference or not
       
   231         * @param    aCallId, callId
       
   232         *           aCommandParam
       
   233         */
       
   234         void CallExistsInConference(
       
   235             TInt aCallId,
       
   236             TPhoneCommandParam* aCommandParam );
       
   237         /**
       
   238         * Removes all callHeaders
       
   239         */
       
   240         void RemoveAllCallHeadersL();
       
   241 
       
   242         /**
       
   243         * Updates ciphering indicator in the bubble if necessary.
       
   244         * @param aCallId Call id.
       
   245         * @param aCommandParam Command parameter.
       
   246         */
       
   247         void UpdateCipheringIndicator(
       
   248             TInt aCallId,
       
   249             TPhoneCommandParam* aCommandParam );
       
   250 
       
   251         /**
       
   252         * Give is max members in conference
       
   253         */
       
   254         TBool IsMaxMembersInConf() const;
       
   255 
       
   256         /**
       
   257         * Toggle number entry mode
       
   258         * @param aCommandparam ETrue if new mode is alpha
       
   259         */
       
   260         void ToggleNumberEntryAlphaNumericMode( TPhoneCommandParam* aCommandParam );
       
   261 
       
   262         /**
       
   263         * Opens VKB
       
   264         * 
       
   265         */
       
   266         void OpenVkbL();
       
   267         
       
   268         /**
       
   269         * Get number entry cursor position
       
   270         * @param aCommandparam cursor position
       
   271         */
       
   272         void GetNumberEntryCursorPosition( TPhoneCommandParam* aCommandParam );
       
   273 
       
   274         /**
       
   275         * Set number entry cursor position
       
   276         * @param aCommandparam cursor position
       
   277         */
       
   278         void SetNumberEntryCursorPositionL( TPhoneCommandParam* aCommandParam );
       
   279            
       
   280         /**
       
   281         * Get number entry mode
       
   282         */
       
   283         TBool IsNENumericMode() const;
       
   284 
       
   285         /**
       
   286         * Before making any changes to bubble headers, call this function.
       
   287         */
       
   288         void StartChanges();
       
   289 
       
   290         /**
       
   291         * After the changes to bubble headers call this function.
       
   292         */
       
   293         void EndChanges();
       
   294 
       
   295         /**
       
   296         * Gives access to button pane.
       
   297         */
       
   298         MBubbleTouchPaneInterface& TouchPane() const;
       
   299 
       
   300         /**
       
   301         * Sets touchpane visible.
       
   302         * @param aVisible ETrue if touch is to be shown
       
   303         *        otherwise EFalse.
       
   304         */
       
   305         void SetTouchPaneVisible( TBool aVisible );
       
   306 
       
   307         /**
       
   308         * Gives access to bubblemanager's interface.
       
   309         */
       
   310         CBubbleManager& BubbleManager();
       
   311 
       
   312         /**
       
   313         * Returns BubbleManager's CCoeControl interface.
       
   314         */
       
   315         CCoeControl* Control();
       
   316 
       
   317         /**
       
   318         * Checks whether conference is in expanded mode
       
   319         */
       
   320         TBool IsConferenceInExpandedMode() const;
       
   321 
       
   322         /**
       
   323          * Loads the extension plugins.
       
   324          */
       
   325         void LoadPlugins();
       
   326 
       
   327         /**
       
   328          * Sets phone customization interface
       
   329          */
       
   330         void SetPhoneCustomization( MPhoneCustomization* aCustomization );
       
   331     public: // Dialer specific methods
       
   332 
       
   333         /**
       
   334         * Sets number entry
       
   335         */
       
   336         void SetNumberEntry( MNumberEntry* aNumberEntry );
       
   337 
       
   338         /**
       
   339         * Forward commands to Dialer
       
   340         * @param aCommand Dialer command
       
   341         */
       
   342         void HandleCommandL( TInt aCommand);
       
   343 
       
   344         /**
       
   345         * Keypad audio enabled
       
   346         *
       
   347         */
       
   348         void KeypadAudioEnabled();
       
   349 
       
   350         /**
       
   351         * Keypad audio disabled
       
   352         *
       
   353         */
       
   354         void KeypadAudioDisabled();
       
   355 
       
   356     public: // DO NOT CALL THE FOLLOWING BEFORE STARTCHANGES HAS BEEN CALLED.
       
   357 
       
   358         /**
       
   359         * Creates new bubble for call. If bubble for the
       
   360         * call already exists, then it is returned.
       
   361         *
       
   362         * @param aCallId callId.
       
   363         * @return bubble id.
       
   364         */
       
   365         CBubbleManager::TBubbleId CreateBubbleL(
       
   366             TInt aCallId );
       
   367 
       
   368         /**
       
   369         * Changes CLI of the bubble.
       
   370         *
       
   371         * @param aId bubble id.
       
   372         * @param aText text, new CLI.
       
   373         * @param aDirection clipping direction.
       
   374         */
       
   375         void SetCLI(
       
   376             CBubbleManager::TBubbleId aId,
       
   377             const TDesC& aText,
       
   378             CBubbleManager::TPhoneClippingDirection aDirection );
       
   379 
       
   380         /**
       
   381         * Changes Cnap of the bubble, clipping done from the beginning
       
   382         * Related to __SERIES60_PHONE_CNAP flag
       
   383         *
       
   384         * @param aId bubble id.
       
   385         * @param aCnapText text, new Cnap
       
   386         * @param aDirection clipping direction.
       
   387         */
       
   388         void SetCNAP( 
       
   389             CBubbleManager::TBubbleId aId,
       
   390             const TDesC& aCnapText,
       
   391             CBubbleManager::TPhoneClippingDirection aDirection );
       
   392 
       
   393         /**
       
   394         * Set the icon that represents the call number type in the current
       
   395         * call bubble.
       
   396         * @param aBubbleId bubble id.
       
   397         * @param aNumberType number type.
       
   398         */
       
   399         void SetNumberTypeIndicator(
       
   400             CBubbleManager::TBubbleId aId,
       
   401             TPEPhoneNumberIdType aNumberType  );
       
   402 
       
   403         /**
       
   404         * Creates a new conference call.
       
   405         * @param TInt aCallId .
       
   406         */
       
   407         void CreateConferenceL(
       
   408             TInt aCallId,
       
   409             TPhoneCommandParam *aCommandParam );
       
   410 
       
   411         /**
       
   412         * Removes conference call
       
   413         */
       
   414         void RemoveConferenceL();
       
   415 
       
   416         /**
       
   417         * Removes conference call bubble
       
   418         */
       
   419         void RemoveConferenceBubbleL();
       
   420 
       
   421         /**
       
   422         * Removes party from conference call.
       
   423         * @param TInt aCallId .
       
   424         */
       
   425         void RemoveFromConferenceL(TInt aCallId);
       
   426 
       
   427         /**
       
   428         * Finds a participant position in conference call participant list.
       
   429         *
       
   430         * @param aCallId call id to search for
       
   431         * @return position in participant list or KErrNotFound
       
   432         */
       
   433         TInt FindParticipantPosition( TInt aCallId );
       
   434 
       
   435         /**
       
   436         * Set conference call header expanded
       
   437         */
       
   438         void SetConferenceExpand( TBool aStatus );
       
   439 
       
   440         /**
       
   441         * Set conference call header highlighted
       
   442         */
       
   443         void SetConferenceHighlight( TBool aStatus );
       
   444 
       
   445         /**
       
   446         * Handles flag changes.
       
   447         */
       
   448         void HandleFlagsUpdated( TInt aNewFlags );
       
   449 
       
   450         /**
       
   451         * Drop party from conference call
       
   452         * to private call.
       
   453         * @param TInt aCallId .
       
   454         */
       
   455         void ConferenceMemberToPrivateL( TInt aCalld );
       
   456 
       
   457         /**
       
   458         * Adds party to conference call.
       
   459         */
       
   460         void AddToConferenceL();
       
   461 
       
   462 
       
   463     protected:  // Constructors
       
   464 
       
   465         /**
       
   466         * C++ default constructor.
       
   467         */
       
   468         CPhoneBubbleWrapper(  );
       
   469 
       
   470     protected:
       
   471 
       
   472         /**
       
   473         * By default EPOC constructor is private.
       
   474         */
       
   475         void ConstructL( CCoeControl* aControl, const TRect& aRect );
       
   476 
       
   477         /**
       
   478         * convert TPEState to TPhoneCallState
       
   479         */
       
   480         CBubbleManager::TPhoneCallState GetBubbleState( TPEState aState );
       
   481 
       
   482         /**
       
   483         * convert TPhoneCallState to TPEState
       
   484         */
       
   485         TPEState ConvertCallState(
       
   486             CBubbleManager::TPhoneCallState aBubbleState );
       
   487 
       
   488         /**
       
   489         * Count active call bubbles (Active + Hold + Disconnecting )
       
   490         */
       
   491         TInt CountNumberOfActiveCalls() const;
       
   492 
       
   493         /**
       
   494         * Adds party to conference call.
       
   495         */
       
   496         void AddToConferenceL( TInt aCallId );
       
   497 
       
   498 
       
   499     private:
       
   500 
       
   501         void StartMOVideoCallAnimationHeaderL(
       
   502             CBubbleManager::TBubbleId aBubbleId,
       
   503             const TDesC& aStateLabelText,
       
   504             const TDesC& aStateShortLabelText );
       
   505 
       
   506         /**
       
   507         * From MPhoneVideoPlayer
       
   508         */
       
   509         void PlayVideoRingTone( const TDesC& aFileName,
       
   510                                 TPlayMode aPlayType,
       
   511                                 TInt aVolumeLevel,
       
   512                                 TBool aArbitraryScaling,
       
   513                                 MPhoneVideoPlayerObserver* aObserver );
       
   514 
       
   515         /**
       
   516         * From MPhoneVideoPlayer
       
   517         */
       
   518         void StopVideoRingTone();
       
   519 
       
   520         /**
       
   521         * From MPhoneVideoPlayer
       
   522         */
       
   523         void MuteVideoRingTone();
       
   524 
       
   525         /**
       
   526         * From MPhoneVideoPlayer
       
   527         */
       
   528         void CancelVideoRingTone();
       
   529 
       
   530         /**
       
   531         * From MBubbleVideoPlaybackObserver
       
   532         */
       
   533         void HandleBubbleVideoPlaybackEvent(
       
   534             TBubbleVideoPlaybackEvent aEvent );
       
   535 
       
   536         /**
       
   537         * From MBubbleVideoPlaybackObserver
       
   538         */
       
   539         void HandleBubbleVideoPlaybackError(
       
   540             TBubbleVideoPlaybackError aErrorType, TInt aErrorCode );
       
   541 
       
   542         /**
       
   543         * Get number entry mode from bubblemanager
       
   544         */
       
   545         TBool IsNumberEntryNumericMode() const;
       
   546 
       
   547         /**
       
   548         * From MPhoneCallThemeSettingsObserver
       
   549         */
       
   550         void CallThemeSettingsChanged();
       
   551 
       
   552         /**
       
   553         * Sets call header parameters.
       
   554         */
       
   555         void SetCallHeaderParameters(
       
   556             TInt aBubble,
       
   557             TPhoneCmdParamCallHeaderData* aCallHeaderParam );
       
   558         
       
   559         /**
       
   560          * Returns ETrue if simplified conference call bubble must be used
       
   561          * in a conference created using the given service.
       
   562          * 
       
   563          * @param   aServiceId  Service identifier.
       
   564          * @return  ETrue if simplified conference call bubble setting is 
       
   565          *          enabled, EFalse otherwise.
       
   566          */
       
   567         TBool IsSimplifiedConferenceCallHeaderEnabledL( TUint32 aServiceId ) const;
       
   568         
       
   569         /**
       
   570          * Sets simplified conference call header status flag on/off.
       
   571          * 
       
   572          * @param   aOnOff      ETrue switches setting on, EFalse off.
       
   573          */
       
   574         void SetSimplifiedConferenceCallHeaderStatus( TBool aOnOff );
       
   575         
       
   576     private:
       
   577 
       
   578         // Real bubble manager
       
   579         CBubbleManager* iBubbleManager;
       
   580 
       
   581         // Bubble mapping of call and bubble
       
   582         CPhoneBubbleMapping* iMapping;
       
   583 
       
   584         // is number entry visible
       
   585         TBool iNumberEntryVisible;
       
   586 
       
   587         // is conference call on or not
       
   588         TBool iConference;
       
   589 
       
   590         // Stores call id's of conference participants.
       
   591         typedef CArrayFixFlat<const TInt> CParticipantArray;
       
   592         CParticipantArray* iParticipants;
       
   593 
       
   594 
       
   595 
       
   596         // ETrue if ciphering indicator is allowed
       
   597         TBool iCipheringIndicatorAllowed;
       
   598 
       
   599         enum TFlags
       
   600             {
       
   601             // Conference is expanded.
       
   602             EFlagConferenceExpanded = 1,
       
   603             // Conference is required to expanded, with highlight
       
   604             EFlagConferenceReqExpanded = 2,
       
   605             // Number entry exists
       
   606             EFlagNumberEntryExists = 4,
       
   607             // Number entry visible
       
   608             EFlagNumberEntryVisible = 8,
       
   609             // Overrides EFlagConferenceExpanded setting
       
   610             EFlagSimplifiedConferenceCallHeader = 16
       
   611             };
       
   612         // Sum of subset of TFlags
       
   613         TInt iFlags;
       
   614 
       
   615         // Pointer to video call's text animation bubble header
       
   616         CPhoneCallHeaderTextAnimation* iVideoCallAnimationHeader;
       
   617 
       
   618         // Is Image/text call feature supported
       
   619         TBool iCallImageTextSupported;
       
   620 
       
   621         /** 
       
   622          * Pointer to call theme monitor
       
   623          * Own.
       
   624          */
       
   625         CPhoneCallThemeMonitor* iCallTheme;
       
   626 
       
   627         // Observer for video playback events
       
   628         MPhoneVideoPlayerObserver* iVideoPlayerObserver;
       
   629 
       
   630         /**
       
   631          * Container for Phone number entry related handling.
       
   632          * Own.
       
   633          */
       
   634         CPhoneNumberEntry* iPhoneNumberEntry;
       
   635 
       
   636         /**
       
   637          * Interface to Dialer's number entry functionality
       
   638          * Not own.
       
   639         */
       
   640         MNumberEntry* iDialerNumberEntry;
       
   641 
       
   642         // Is dialler supported.
       
   643         TBool iUseDialer;
       
   644 
       
   645         // Is number entry mode numeric/alpha
       
   646         TBool iIsNumberEntryModeNumeric;
       
   647 
       
   648         /**
       
   649          * Bubble extension plugin manager.
       
   650          * Own.
       
   651          */
       
   652         CPhoneBubbleExtensionManager* iBubbleExtensionManager;
       
   653        
       
   654         /**
       
   655          * Interface to phone customization
       
   656          * Not own.
       
   657          */
       
   658         MPhoneCustomization* iPhoneCustomization;
       
   659     };
       
   660 
       
   661 #endif // CPHONEBUBBLEWRAPPER_H
       
   662 
       
   663 // End of File