mobilemessaging/smilui/playersrc/SmilPlayerPresentationController.cpp
changeset 0 72b543305e3a
child 2 0bf1d54f37d9
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002-2006 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: SmilPlayerPresentationController implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "SmilPlayerPresentationController.h"
       
    21 
       
    22 #include <eikenv.h>
       
    23 #include <avkon.hrh>
       
    24 #include <AknWaitDialog.h>          //Wait note
       
    25 #include <AknQueryDialog.h>         // Confirmation dialog
       
    26 #include <AknStatuspaneUtils.h>     // AknStatuspaneUtils
       
    27 
       
    28 #include <applayout.cdl.h> // LAF
       
    29 #include <aknlayoutscalable_apps.cdl.h>
       
    30 #include <aknlayoutscalable_avkon.cdl.h>
       
    31 #include <layoutmetadata.cdl.h>
       
    32 #include <StringLoader.h>
       
    33 
       
    34 #include <gmxmldocument.h>
       
    35 #include <gmxmlnode.h>
       
    36 #include <gmxmlelement.h>
       
    37 
       
    38 #include <smilmedia.h>
       
    39 #include <smilparser.h>             //SmilParser
       
    40 #include <smilpresentation.h>       //SmilEngine
       
    41 #include <smiltransitionfactory.h>
       
    42 #include <smilobject.h>
       
    43 
       
    44 #include <aiwdialdata.h>
       
    45 #include <AiwCommon.h>
       
    46 #include <AiwServiceHandler.h>
       
    47 
       
    48 #include <commonphoneparser.h>      // Phonenumber parser
       
    49 #include <sendui.h>                 // for CSendUi
       
    50 #include <CMessageData.h>           // CMessageData
       
    51 #include <SenduiMtmUids.h>          // Mtm uids
       
    52 #include <apgcli.h>                 // RApaLsSession for WMLBrowser launch
       
    53 
       
    54 #include <aknnavi.h>
       
    55 #include <aknnavide.h>
       
    56 
       
    57 #include <BrowserLauncher.h>
       
    58 
       
    59 #include <txtetext.h>           // for CPlainText
       
    60 #include "SmilTextRenderer.h"
       
    61 #include "SmilPlayerPanic.h"
       
    62 #include "SmilPlayerPresentationControl.h"
       
    63 #include "SmilPlayerDialog.h"
       
    64 #include "SmilPlayerLinkParser.h"
       
    65 #include "SmilPlayerIndicatorController.h"
       
    66 #include "SmilPlayerSynchXmlParser.h"
       
    67 #include <SmilPlayer.rsg>
       
    68 
       
    69 #ifdef PRESCONTROLLER_DEBUG
       
    70 #include "SMilPlayerLogging.h"
       
    71 #endif
       
    72 
       
    73 // CONSTANTS
       
    74 const TReal KLayoutScaleDown = 0.20;
       
    75 const TReal KLayoutScaleUp = 2.00;
       
    76 
       
    77 const TInt KScrollModifierCode = 32769;
       
    78 const TInt KScrollScanCode = 3;
       
    79 
       
    80 _LIT( KInternalLinkMark, "#" );
       
    81 _LIT( KSpace, " " ); // Space for WML Browser's parameter
       
    82 
       
    83 _LIT( KActivate, "activateEvent" );
       
    84 _LIT( KWmlBrowserParameter, "4" ); // magic number for Wml browser to open the URL
       
    85 
       
    86 
       
    87 
       
    88 // ============================ MEMBER FUNCTIONS ===============================
       
    89 
       
    90 // ----------------------------------------------------------------------------
       
    91 // CSmilPlayerPresentationController::CSmilPlayerPresentationController
       
    92 // C++ constructor. Initializes class member variables.
       
    93 // ----------------------------------------------------------------------------
       
    94 //
       
    95 CSmilPlayerPresentationController::CSmilPlayerPresentationController( CMDXMLDocument* aDOM,
       
    96                                                                       MMediaFactoryFileInfo* aFileInfo,
       
    97                                                                       CSmilPlayerDialog* aParent,
       
    98                                                                       RFile& aFileHandle ) :
       
    99     iDOM( aDOM ),
       
   100     iFileInfo( aFileInfo ),
       
   101     iParent( aParent ),
       
   102     iFileHandle( aFileHandle )
       
   103     {
       
   104     }
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // CSmilPlayerPresentationController::ConstructL
       
   108 // Symbian 2nd phase constructor. Creates indicator controller and tranfers it's ownership
       
   109 // to indicator container. Also creates buffer bitmap and context for it that
       
   110 // are used as a double buffer for drawing the presentation (i.e. presentation
       
   111 // is first drawn to buffer and then buffer is drawn to screen). After this media
       
   112 // factory (component that creates media renderers) and transition effect factory
       
   113 // (component that creates transition effect filters) are created. Also presentation
       
   114 // control that performs presentation drawing is created and initialized. Presentation
       
   115 // parsing is done next and if everything went ok all the controls are layed out correctly.
       
   116 // ----------------------------------------------------------------------------
       
   117 //
       
   118 void CSmilPlayerPresentationController::ConstructL( const TRect& aRect, 
       
   119                                                     const TDesC& aBaseUrl, 
       
   120                                                     TBool aVolumeEnabled )
       
   121     {
       
   122 #ifdef PRESCONTROLLER_DEBUG
       
   123     SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] PresController: ConstructL" );
       
   124     SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: aRect=(%d, %d) (%d, %d)"), 
       
   125         aRect.iTl.iX, aRect.iTl.iY, aRect.iBr.iX, aRect.iBr.iY );
       
   126 #endif
       
   127  
       
   128     CreateWindowL();
       
   129     SetRect( aRect );
       
   130     
       
   131     // Overlap flag set to EFalse at construction time
       
   132     SetPresentationOverlapped( EFalse );
       
   133             
       
   134     CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
       
   135     CAknNavigationControlContainer* naviContainer = 
       
   136         static_cast<CAknNavigationControlContainer*>( sp->ControlL( 
       
   137                                                             TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
   138     
       
   139     // Not owned by presentation controller.
       
   140     iIndicatorController = CSmilPlayerIndicatorController::NewL( naviContainer, 
       
   141                                                                  this,
       
   142                                                                  aVolumeEnabled );
       
   143     
       
   144     // iIndicatorController ownership transferred to iIndicatorContainer.
       
   145     iIndicatorContainer = CAknNavigationDecorator::NewL( naviContainer, iIndicatorController );
       
   146     iIndicatorContainer->SetContainerWindowL( *naviContainer );
       
   147     iIndicatorContainer->MakeScrollButtonVisible( EFalse );
       
   148     iIndicatorContainer->SetComponentsToInheritVisibility( ETrue );
       
   149     
       
   150     InitializeDoubleBufferL();
       
   151     
       
   152     iMediaFactory = CSmilPlayerMediaFactory::NewL( *iCoeEnv,
       
   153                                                    iBufferContext,
       
   154                                                    iFileInfo );
       
   155 
       
   156     iTransitionFactory = new(ELeave) CSmilTransitionFactory( iBufferBitmap );
       
   157 
       
   158     iPresentationControl = CSmilPlayerPresentationControl::NewL( this );
       
   159     iPresentationControl->SetRect( Rect() );
       
   160 
       
   161     iBaseUrl = aBaseUrl.AllocL();
       
   162     
       
   163     TRAPD( error, DoParsingL() );
       
   164     if ( error == KErrNone )
       
   165         {
       
   166         LayoutPresentationControl();
       
   167         
       
   168         SetComponentsToInheritVisibility( ETrue );
       
   169         MakeVisible( EFalse );
       
   170         }
       
   171     else 
       
   172         {
       
   173 #ifdef PRESCONTROLLER_DEBUG
       
   174         SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: Presentation creation failed=%d"), error );
       
   175 #endif
       
   176         delete iWaitDialog;
       
   177         iWaitDialog = NULL;
       
   178         
       
   179         // All other error cases are handled on CSmilDialog::ActivateL function
       
   180         if ( error == KErrNoMemory )
       
   181             {
       
   182             User::Leave( error );
       
   183             }
       
   184         }
       
   185 
       
   186 #ifdef PRESCONTROLLER_DEBUG
       
   187     SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] PresController: ConstructL" );
       
   188 #endif
       
   189     }
       
   190 
       
   191 // ----------------------------------------------------------------------------
       
   192 // CSmilPlayerPresentationController::NewL
       
   193 // Symbian two phased constructor
       
   194 // ----------------------------------------------------------------------------
       
   195 //
       
   196 CSmilPlayerPresentationController* CSmilPlayerPresentationController::NewL( const TRect& aRect,
       
   197                                                                             const TDesC& aBaseUrl,
       
   198                                                                             MMediaFactoryFileInfo* aFileInfo,
       
   199                                                                             CSmilPlayerDialog* aParent,
       
   200                                                                             CMDXMLDocument* aDOM,
       
   201                                                                             TBool aVolumeEnabled )
       
   202     {
       
   203     RFile tempHandle;
       
   204     CSmilPlayerPresentationController* self = new(ELeave) CSmilPlayerPresentationController( aDOM,
       
   205                                                                                              aFileInfo,
       
   206                                                                                              aParent,
       
   207                                                                                              tempHandle );
       
   208     
       
   209     CleanupStack::PushL( self );
       
   210     self->ConstructL( aRect, aBaseUrl, aVolumeEnabled );
       
   211     CleanupStack::Pop( self );
       
   212 
       
   213     return self;
       
   214     }
       
   215 
       
   216 // ----------------------------------------------------------------------------
       
   217 // CSmilPlayerPresentationController::NewL
       
   218 // Symbian two phased constructor
       
   219 // ----------------------------------------------------------------------------
       
   220 //
       
   221 CSmilPlayerPresentationController* CSmilPlayerPresentationController::NewL( const TRect& aRect,
       
   222                                                                             const TDesC& aBaseUrl,
       
   223                                                                             MMediaFactoryFileInfo* aFileInfo,
       
   224                                                                             CSmilPlayerDialog* aParent,
       
   225                                                                             RFile& aFileHandle,
       
   226                                                                             TBool aVolumeEnabled )
       
   227     {
       
   228     CSmilPlayerPresentationController* self = new(ELeave) CSmilPlayerPresentationController( NULL,
       
   229                                                                                              aFileInfo,
       
   230                                                                                              aParent,
       
   231                                                                                              aFileHandle );
       
   232     
       
   233     CleanupStack::PushL( self );
       
   234     self->ConstructL( aRect, aBaseUrl, aVolumeEnabled );
       
   235     CleanupStack::Pop( self );
       
   236 
       
   237     return self;
       
   238     }
       
   239 
       
   240 // ----------------------------------------------------------------------------
       
   241 // CSmilPlayerPresentationController::~CSmilPlayerPresentationController
       
   242 // Destructor
       
   243 // ----------------------------------------------------------------------------
       
   244 //
       
   245 CSmilPlayerPresentationController::~CSmilPlayerPresentationController()
       
   246     {
       
   247     delete iPresentation;
       
   248     delete iMediaFactory;   
       
   249     delete iTransitionFactory;   
       
   250     delete iBufferContext;
       
   251     delete iBufferDevice;
       
   252     delete iBufferBitmap;
       
   253     delete iPresentationControl;
       
   254     delete iSendUi;
       
   255     delete iIndicatorContainer;
       
   256     delete iWaitDialog;
       
   257 
       
   258     delete iServiceHandler;
       
   259 
       
   260     delete iBaseUrl;
       
   261     if ( iDOMInternallyOwned )
       
   262         {
       
   263         delete iDOM;
       
   264         }
       
   265     
       
   266     iFileInfo = NULL; // For Lint
       
   267     iParent = NULL;   // For Lint
       
   268     iIndicatorController = NULL; // For Lint. Ownership transferred to decorator.
       
   269     }
       
   270 
       
   271 // ----------------------------------------------------------------------------
       
   272 // CSmilPlayerPresentationController::ChangeStateL
       
   273 // Changes controller state to specified one. Indicator state is change here or
       
   274 // on PresentationEvent function depending which one is more approriate for this state.
       
   275 // ----------------------------------------------------------------------------
       
   276 //
       
   277 void CSmilPlayerPresentationController::ChangeStateL( TSmilPresControllerStates aState )
       
   278     {
       
   279 #ifdef PRESCONTROLLER_DEBUG
       
   280     SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] PresController: ChangeStateL" );
       
   281     SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: aState=%d"), aState );
       
   282 #endif
       
   283     
       
   284     if ( !iPresentation )
       
   285         {
       
   286         __ASSERT_DEBUG( EFalse, Panic( ESmilPlayerPresentationNotReady ) );
       
   287         return;
       
   288         }
       
   289         
       
   290     switch ( aState )
       
   291         {
       
   292         case EStatePlay:
       
   293             {
       
   294             iIndicatorController->Start();
       
   295             
       
   296             if ( iPresentation->State() != CSmilPresentation::EPlaying )
       
   297                 {
       
   298                 iPresentation->PlayL();
       
   299                 }
       
   300             break;
       
   301             }
       
   302         case EStateStop:
       
   303             {
       
   304             if ( iPresentation->State() != CSmilPresentation::EStopped )
       
   305                 {
       
   306                 iPresentation->StopL();
       
   307                 }
       
   308             break;
       
   309             }
       
   310         case EStatePause:
       
   311             {
       
   312             if ( iPresentation->State() == CSmilPresentation::EPlaying )
       
   313                 {
       
   314                 iPresentation->Pause();                   
       
   315                 }
       
   316             break;
       
   317             }
       
   318         case EStateResume:
       
   319             {
       
   320             if ( iPresentation->State() != CSmilPresentation::EPlaying )
       
   321                 {
       
   322                 iPresentation->Resume();
       
   323                 }
       
   324             break;
       
   325             }
       
   326         default:
       
   327             {
       
   328             __ASSERT_DEBUG( EFalse, Panic( ESmilPlayerUnknownState ) );
       
   329             break;
       
   330             }
       
   331         }
       
   332         
       
   333 #ifdef PRESCONTROLLER_DEBUG
       
   334     SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] PresController: ChangeStateL" );
       
   335 #endif
       
   336     }
       
   337 
       
   338 // ----------------------------------------------------------------------------
       
   339 // CSmilPlayerPresentationController::StopTimer
       
   340 // Stops timer indicator.
       
   341 // ----------------------------------------------------------------------------
       
   342 //
       
   343 void CSmilPlayerPresentationController::StopTimer()
       
   344     {
       
   345     iIndicatorController->Stop();
       
   346     }
       
   347 
       
   348 // ----------------------------------------------------------------------------
       
   349 // CSmilPlayerPresentationController::RedrawArea
       
   350 // Called by SMIL Engine. Calls presentation control to redraw given area.
       
   351 // ----------------------------------------------------------------------------
       
   352 //
       
   353 void CSmilPlayerPresentationController::RedrawArea( const TRect& aArea ) const
       
   354     {
       
   355     iPresentationControl->RedrawArea( aArea );
       
   356     }
       
   357 
       
   358 // ----------------------------------------------------------------------------
       
   359 // CSmilPlayerPresentationController::SetStatusPaneVisibilityL
       
   360 // Controls statuspane layout. aValue is ETrue "normal" statuspane is used and
       
   361 // if aValue is EFalse SMIL Player own statuspane is used.
       
   362 // ----------------------------------------------------------------------------
       
   363 //
       
   364 void CSmilPlayerPresentationController::SetStatusPaneVisibilityL( TBool aValue )
       
   365     {
       
   366     TRect newRect;
       
   367     
       
   368     TRect applicationWindow;
       
   369     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, applicationWindow );
       
   370 
       
   371     TAknLayoutRect mainPane;
       
   372     
       
   373     if ( CSmilPlayerPresentationController::UseWidescreenStatusPane() )
       
   374         {
       
   375         // select appropriate main_pane variety based on presentation overlap flag
       
   376         if ( IsPresentationOverlapped() )
       
   377             mainPane.LayoutRect( applicationWindow, AknLayoutScalable_Avkon::main_pane( 4 ) );
       
   378         else
       
   379             mainPane.LayoutRect( applicationWindow, AknLayoutScalable_Avkon::main_pane( 22 ) );
       
   380         }
       
   381     else if ( AknStatuspaneUtils::StaconPaneActive() )
       
   382         {
       
   383         mainPane.LayoutRect( applicationWindow, AknLayoutScalable_Avkon::main_pane( 4 ) );   
       
   384         }
       
   385     else
       
   386         {
       
   387         if ( aValue )
       
   388             {
       
   389             mainPane.LayoutRect( applicationWindow, AknLayoutScalable_Avkon::main_pane( 5 ) );
       
   390             }
       
   391         else
       
   392             {
       
   393             mainPane.LayoutRect( applicationWindow, AknLayoutScalable_Avkon::main_pane( 0 ) );
       
   394             }
       
   395         }
       
   396 
       
   397     TAknLayoutRect mainSmilPane;
       
   398     mainSmilPane.LayoutRect( mainPane.Rect(), AknLayoutScalable_Apps::main_smil_pane() );
       
   399         
       
   400     newRect = mainSmilPane.Rect();
       
   401         
       
   402     TInt notUsed( 0 );
       
   403     
       
   404     if ( aValue )
       
   405         {
       
   406         SwitchStatusPaneL( R_AVKON_STATUS_PANE_LAYOUT_USUAL, EFalse, notUsed );
       
   407         SetRect( newRect );
       
   408         }
       
   409     else
       
   410         {
       
   411         SetRect( newRect );
       
   412         
       
   413         TInt newStatusPaneResId = R_AVKON_STATUS_PANE_LAYOUT_SMALL;
       
   414         if ( CSmilPlayerPresentationController::UseWidescreenStatusPane() )
       
   415             {
       
   416             newStatusPaneResId = R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT;
       
   417             }
       
   418 
       
   419         SwitchStatusPaneL( newStatusPaneResId, ETrue, notUsed );
       
   420         }
       
   421     
       
   422     iOwnStatusPaneVisible = !aValue;
       
   423     
       
   424     DrawNow();
       
   425     }
       
   426 
       
   427 // ----------------------------------------------------------------------------
       
   428 // CSmilPlayerPresentationController::AnchorExist
       
   429 // Returns if anchor exists on presentation. Anchors are links pointing to 
       
   430 // internal place inside presentation or external place outside presentation 
       
   431 // (such as HTTP, mailto and callto links).
       
   432 // ----------------------------------------------------------------------------
       
   433 //
       
   434 TBool CSmilPlayerPresentationController::AnchorExist() const
       
   435     {
       
   436     TBool result( EFalse );
       
   437     CSmilObject* focused = iPresentation->FocusedObject();
       
   438     
       
   439     if ( focused )
       
   440         {
       
   441         CSmilAnchor* anchor = static_cast<CSmilMedia*>( focused )->Anchor();
       
   442         if ( anchor && anchor->Href().Length() > 0 )
       
   443             {
       
   444             result = ETrue;
       
   445             }
       
   446         }
       
   447     return result;
       
   448     }
       
   449 
       
   450 // ----------------------------------------------------------------------------
       
   451 // CSmilPlayerPresentationController::AnchorIsInternalLink
       
   452 // Retuns whether anchor (i.e. link) is internal (i.e. points inside
       
   453 // presentation).
       
   454 // ----------------------------------------------------------------------------
       
   455 //
       
   456 TBool CSmilPlayerPresentationController::AnchorIsInternalLink() const
       
   457     {
       
   458     TBool result( EFalse );
       
   459     CSmilObject* focused = iPresentation->FocusedObject();
       
   460     
       
   461     if ( focused )
       
   462         {
       
   463         CSmilAnchor* anchor = static_cast<CSmilMedia*>( focused )->Anchor();
       
   464         if ( anchor ) 
       
   465             {
       
   466             TPtrC href = anchor->Href();
       
   467 
       
   468             if( href.Length() >= KInternalLinkMark().Length() ) 
       
   469                 {
       
   470                 if( href.Left( KInternalLinkMark().Length() ).MatchF( 
       
   471                                 KInternalLinkMark ) != KErrNotFound )
       
   472                     {
       
   473                     result = ETrue;
       
   474                     }
       
   475                 }
       
   476             }
       
   477         }
       
   478     return result;
       
   479     }
       
   480 // ----------------------------------------------------------------------------
       
   481 // CSmilPlayerPresentationController::ScrollingActivationEnabled
       
   482 // Returns if scrolling can be activated for given focused object. Checks
       
   483 // if object is focused and it is scrollable and not already activated. 
       
   484 // ----------------------------------------------------------------------------
       
   485 //
       
   486 TBool CSmilPlayerPresentationController::ScrollingActivationEnabled() const
       
   487     {
       
   488     TBool result( EFalse );
       
   489     #ifdef RD_SCALABLE_UI_V2
       
   490     if ( AknLayoutUtils::PenEnabled() )
       
   491     return result;
       
   492     #endif
       
   493     CSmilObject* focused = iPresentation->FocusedObject();
       
   494     
       
   495     if ( focused )
       
   496         {
       
   497         result = ( static_cast<CSmilMedia*>( focused )->IsScrollable() &&
       
   498                    !iPresentation->MediaSelected() );
       
   499         }
       
   500     return result;
       
   501     }
       
   502 
       
   503 // ----------------------------------------------------------------------------
       
   504 // CSmilPlayerPresentationController::FocusedObjectScrollable
       
   505 // Returns if focused object is scrollable. Checks if object is focused and it is
       
   506 // scrollable.
       
   507 // ----------------------------------------------------------------------------
       
   508 //
       
   509 TBool CSmilPlayerPresentationController::FocusedObjectScrollable() const
       
   510     {
       
   511     TBool result( EFalse );
       
   512     CSmilObject* focused = iPresentation->FocusedObject();
       
   513     
       
   514     if ( focused )
       
   515         {
       
   516         result = static_cast<CSmilMedia*>( focused )->IsScrollable();
       
   517         }
       
   518     return result;
       
   519     }
       
   520 
       
   521 // ----------------------------------------------------------------------------
       
   522 // CSmilPlayerPresentationController::PrepareExitL
       
   523 // Switches statuspane to the one that was used using resource ID that was
       
   524 // stored on InitializeL. Sets controller also invisible and refreshes the screen
       
   525 // for better drawing result.
       
   526 // ----------------------------------------------------------------------------
       
   527 //
       
   528 void CSmilPlayerPresentationController::PrepareExitL()
       
   529     {
       
   530     //set layout back 
       
   531     TInt notUsed;
       
   532     SwitchStatusPaneL( iLayoutResId, EFalse, notUsed );
       
   533     iOwnStatusPaneVisible = EFalse;
       
   534     
       
   535     MakeVisible( EFalse );
       
   536     DrawNow();
       
   537     }
       
   538 
       
   539 // ----------------------------------------------------------------------------
       
   540 // CSmilPlayerDialog::Initialize
       
   541 // Initializes and activates the dialog. Switches statuspane to small statuspane.
       
   542 // Also stores old statuspane resource ID. Also activates controller and sets
       
   543 // it visible and refreshes the screen. This is done for better drawing result.
       
   544 // Returns EFalse if presentation parsing was not successful.
       
   545 // ----------------------------------------------------------------------------
       
   546 //
       
   547 TBool CSmilPlayerPresentationController::InitializeL()
       
   548     {
       
   549     TBool result( EFalse );
       
   550     
       
   551     if ( iPresentation )
       
   552         {
       
   553         MakeVisible( ETrue );
       
   554         ActivateL();  
       
   555         
       
   556         TInt newStatusPaneResId = R_AVKON_STATUS_PANE_LAYOUT_SMALL;
       
   557         if ( CSmilPlayerPresentationController::UseWidescreenStatusPane() )
       
   558             {
       
   559             newStatusPaneResId = R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS;
       
   560             }
       
   561         
       
   562         SwitchStatusPaneL( newStatusPaneResId, 
       
   563                            ETrue,
       
   564                            iLayoutResId );
       
   565         iOwnStatusPaneVisible = ETrue;
       
   566         
       
   567         DrawNow();
       
   568         
       
   569         result = ETrue;
       
   570         }
       
   571         
       
   572     return result;
       
   573     }
       
   574 
       
   575 // ----------------------------------------------------------------------------
       
   576 // CSmilPlayerPresentationController::ActivateScrolling
       
   577 // Activates scolling. This is done by giving EKeyEnter event to the presentation.
       
   578 // Also if non-internal anchor (link) exists flag is raised so that open document
       
   579 // cannot be called (can panic).
       
   580 // ----------------------------------------------------------------------------
       
   581 //
       
   582 void CSmilPlayerPresentationController::ActivateScrollingL()
       
   583     {
       
   584     TKeyEvent keyEvent;
       
   585     keyEvent.iCode = EKeyEnter;
       
   586     keyEvent.iScanCode = KScrollScanCode;
       
   587     keyEvent.iModifiers = KScrollModifierCode;
       
   588     keyEvent.iRepeats = 0;
       
   589     TEventCode type = EEventKey;
       
   590 
       
   591     if( AnchorExist() &&
       
   592         !AnchorIsInternalLink() )
       
   593         {
       
   594         iScrollingTogglePerformedWhileLinkExist = ETrue;
       
   595         }
       
   596 
       
   597     iPresentation->HandleKeyEventL( keyEvent, type);
       
   598     }
       
   599 
       
   600 // ----------------------------------------------------------------------------
       
   601 // CSmilPlayerPresentationController::DeactivateScrollingL
       
   602 // Deactivates scolling (same implementation as activate scrolling)
       
   603 // ----------------------------------------------------------------------------
       
   604 //
       
   605 void CSmilPlayerPresentationController::DeactivateScrollingL()
       
   606     {
       
   607     // The implemention is exactly as activateScrolling()
       
   608     ActivateScrollingL();
       
   609     }
       
   610 
       
   611 // ----------------------------------------------------------------------------
       
   612 // CSmilPlayerPresentationController::HandleVolumeKeyEventL
       
   613 // Calls DoHandleVolumeKeyL to handle volume key event.
       
   614 // ----------------------------------------------------------------------------
       
   615 //
       
   616 TKeyResponse CSmilPlayerPresentationController::HandleVolumeKeyEventL( const TKeyEvent& aKeyEvent, 
       
   617                                                                        TEventCode aType )
       
   618     {
       
   619     return DoHandleVolumeKeyL( aKeyEvent, aType );
       
   620     }
       
   621 
       
   622 // ----------------------------------------------------------------------------
       
   623 // CSmilPlayerPresentationController::HandleScrollKeyEventL
       
   624 // Calls presentation to handle scroll key event if scrolling deactivation is not ongoing.
       
   625 // ----------------------------------------------------------------------------
       
   626 //
       
   627 TKeyResponse CSmilPlayerPresentationController::HandleScrollKeyEventL( const TKeyEvent& aKeyEvent, 
       
   628                                                                        TEventCode aType )
       
   629     {
       
   630     TKeyResponse result( EKeyWasNotConsumed );
       
   631     if ( iScrollingTogglePerformedWhileLinkExist )
       
   632         {
       
   633 #ifdef PRESCONTROLLER_DEBUG
       
   634         SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: Changing scrolling mode") );
       
   635 #endif
       
   636         // scrolling deactivation ongoing...
       
   637         // should not do any key handling, otherwise can panic
       
   638         result = EKeyWasConsumed;
       
   639         }
       
   640     else
       
   641         {
       
   642         result = iPresentation->HandleKeyEventL( aKeyEvent, aType );
       
   643         }
       
   644     return result;
       
   645     }
       
   646 
       
   647 
       
   648 // ----------------------------------------------------------------------------
       
   649 // CSmilPlayerPresentationController::HandleRCSOperation
       
   650 // Call internal function to handle specified operation. Silently ignores errors.
       
   651 // ----------------------------------------------------------------------------
       
   652 //
       
   653 void CSmilPlayerPresentationController::HandleRCSOperation( TRemConCoreApiOperationId aOperation )
       
   654     {
       
   655     TRAP_IGNORE( DoHandleRCSOperationL( aOperation ) );
       
   656     }
       
   657 
       
   658 // ----------------------------------------------------------------------------
       
   659 // CSmilPlayerPresentationController::DoHandleRCSOperationL
       
   660 // Performs Remote Control Server operation handling. VolumeUp and VolumeDown
       
   661 // events are interpreted as right/left key events. 
       
   662 // ----------------------------------------------------------------------------
       
   663 //
       
   664 void CSmilPlayerPresentationController::DoHandleRCSOperationL( TRemConCoreApiOperationId aOperation )
       
   665     {
       
   666     switch ( aOperation )
       
   667         {
       
   668         case ERemConCoreApiVolumeUp:
       
   669             {
       
   670             TKeyEvent keyEvent;
       
   671             keyEvent.iCode = EKeyRightArrow;
       
   672             TEventCode type = EEventKey;
       
   673             
       
   674             DoHandleVolumeKeyL( keyEvent, type );
       
   675             break;
       
   676             }
       
   677         case ERemConCoreApiVolumeDown:
       
   678             {
       
   679             TKeyEvent keyEvent;
       
   680             keyEvent.iCode = EKeyLeftArrow;
       
   681             TEventCode type = EEventKey;
       
   682             
       
   683             DoHandleVolumeKeyL( keyEvent, type );
       
   684             
       
   685             break;
       
   686             }
       
   687         default:
       
   688             {
       
   689             break;
       
   690             }
       
   691         }
       
   692     }
       
   693 
       
   694 // ----------------------------------------------------------------------------
       
   695 // CSmilPlayerPresentationController::DoHandleVolumeKeyL
       
   696 // Performs volume key handling. Forwards volume key event to indicator controller
       
   697 // and if key event is consumed there changes presentation volume accordingly.
       
   698 // ----------------------------------------------------------------------------
       
   699 //
       
   700 TKeyResponse CSmilPlayerPresentationController::DoHandleVolumeKeyL( const TKeyEvent& aKeyEvent, 
       
   701                                                                     TEventCode aType )
       
   702     {
       
   703     TKeyResponse result( EKeyWasNotConsumed);
       
   704     
       
   705     if ( iPresentation )
       
   706         {
       
   707         result = iIndicatorController->OfferKeyEventL( aKeyEvent, aType );
       
   708         if ( result ==  EKeyWasConsumed )
       
   709             {
       
   710             iPresentation->SetVolume( iIndicatorController->VolumeValue() * 10 );
       
   711             }    
       
   712         }
       
   713     
       
   714     return result;
       
   715     }
       
   716 
       
   717 // ----------------------------------------------------------------------------
       
   718 // CSmilPlayerPresentationController::OpenDocumentL
       
   719 // ----------------------------------------------------------------------------
       
   720 //
       
   721 void CSmilPlayerPresentationController::OpenDocumentL( const TDesC& aUrl,
       
   722                                                        const CSmilAnchor* /*aAnchor*/,
       
   723                                                        const CSmilPresentation* /*aPres*/ )
       
   724     {
       
   725     if ( iScrollingTogglePerformedWhileLinkExist )
       
   726         {
       
   727         // used when activating/deactivating scrolling while link exists also
       
   728         iScrollingTogglePerformedWhileLinkExist = EFalse;
       
   729         return;
       
   730         }
       
   731 
       
   732     SmilPlayerLinkParser::TSmilPlayerLinkType linkResult = 
       
   733                     SmilPlayerLinkParser::LinkType( aUrl );
       
   734 
       
   735     switch( linkResult )
       
   736         {
       
   737         case SmilPlayerLinkParser::ESmilPlayerNotSupported:
       
   738             {
       
   739             // nothing to do in this case
       
   740             break;
       
   741             }
       
   742         case SmilPlayerLinkParser::ESmilPlayerPhoneNumber:
       
   743             {
       
   744             // use phone client to make a call
       
   745             if ( LoadTextAndConfirmL( R_SMILPLAYER_CONFIRM_CALLTO,
       
   746                                  aUrl.Right( aUrl.Length() - KPhoneToString().Length() ) ) )
       
   747                 {
       
   748                 CallL( aUrl.Right( aUrl.Length() - KPhoneToString().Length() ) );
       
   749                 }
       
   750             break;
       
   751             }
       
   752         case SmilPlayerLinkParser::ESmilPlayerMailAddress:
       
   753             {
       
   754             // open mail editor
       
   755             if ( LoadTextAndConfirmL( R_SMILPLAYER_CONFIRM_MAILTO,
       
   756                                  aUrl.Right( aUrl.Length() - KMailToString().Length() ) ) )
       
   757                 {
       
   758                 SetStatusPaneVisibilityL( ETrue );
       
   759 
       
   760                 // TRAPD used to catch the case where access point not defined
       
   761                 // and user doesn't want to define it, and when getting back
       
   762                 // the StatusPane should be set invisible again
       
   763                 TRAP_IGNORE( SendMessageL( KSenduiMtmSmtpUid,
       
   764                                            aUrl.Right( aUrl.Length() - KMailToString().Length() ) ) );
       
   765                 SetStatusPaneVisibilityL( EFalse );
       
   766                 }
       
   767             break;
       
   768             }
       
   769         case SmilPlayerLinkParser::ESmilPlayerUrlAddress:
       
   770             {
       
   771             // open browser
       
   772             if ( LoadTextAndConfirmL( R_SMILPLAYER_CONFIRM_OPEN, aUrl ) )
       
   773                 {
       
   774                 GoToUrlL( aUrl );
       
   775                 }
       
   776             break;
       
   777             }
       
   778         default:
       
   779             {
       
   780             break;
       
   781             }
       
   782         }
       
   783     }
       
   784 
       
   785 // ----------------------------------------------------------------------------
       
   786 // CSmilPlayerPresentationController::PresentationEvent
       
   787 // Handles presentation event notifications from SMIL Engine. Indicator
       
   788 // state is changes here or on ChangeStateL function depending which one
       
   789 // is more approriate for that state. On end reached state event notifies
       
   790 // SMIL Player dialog about the presetation end.
       
   791 // ----------------------------------------------------------------------------
       
   792 //
       
   793 void CSmilPlayerPresentationController::PresentationEvent( TInt aEvent,
       
   794                                                            const CSmilPresentation* /*aPres*/,
       
   795                                                            const TDesC& /*aUrl*/ )
       
   796     {   
       
   797 #ifdef PRESCONTROLLER_DEBUG
       
   798     SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] PresController: PresentationEvent" );
       
   799     SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: aEvent=%d"), aEvent );
       
   800 #endif
       
   801   
       
   802     switch( aEvent )
       
   803         {
       
   804         case MSmilPlayer::EStarted:            
       
   805         case MSmilPlayer::EStopped:
       
   806             {
       
   807             // Do not stop indicator controller here because presentation
       
   808             // end might follow that requires special handling.
       
   809             break;
       
   810             }
       
   811         case MSmilPlayer::EPaused:
       
   812             {
       
   813             iIndicatorController->Pause();
       
   814             break;
       
   815             }
       
   816         case MSmilPlayer::EResumed:
       
   817             {
       
   818             iIndicatorController->Resume();
       
   819             break;
       
   820             }
       
   821         case MSmilPlayer::ESeeked:
       
   822         case MSmilPlayer::EStalled:
       
   823         case MSmilPlayer::EMediaNotFound:
       
   824             {
       
   825             break;
       
   826             }
       
   827         case MSmilPlayer::EEndReached:
       
   828             {
       
   829             iIndicatorController->EndReached();
       
   830             TRAP_IGNORE( iParent->PresentationStoppedL() );
       
   831             break;
       
   832             }
       
   833         default:
       
   834             {
       
   835             break;
       
   836             }
       
   837         }
       
   838 
       
   839 #ifdef PRESCONTROLLER_DEBUG
       
   840     SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] PresController: PresentationEvent" );
       
   841 #endif
       
   842     }
       
   843 
       
   844 
       
   845 // ----------------------------------------------------------------------------
       
   846 // CSmilPlayerPresentationController::LayoutPresentationControl
       
   847 // Sets correct layout for presentation control. Retrieves presentation root-region
       
   848 // size (this is always starting from 0,0). After this calculates the top left corner
       
   849 // so that presentation is centralized.
       
   850 // ----------------------------------------------------------------------------
       
   851 //
       
   852  void CSmilPlayerPresentationController::LayoutPresentationControl()
       
   853     {
       
   854     TSize presentationSize = iPresentation->RootRegionRect().Size();
       
   855 
       
   856     TPoint newtopleft;
       
   857     newtopleft.iX = ( Rect().Width() - presentationSize.iWidth ) / 2;
       
   858     newtopleft.iY = ( Rect().Height() - presentationSize.iHeight ) / 2;
       
   859     
       
   860     iPresentationControl->SetRect( TRect( newtopleft, presentationSize ) );
       
   861     iPresentationRect = iPresentationControl->Rect();
       
   862     }
       
   863 
       
   864 // ----------------------------------------------------------------------------
       
   865 // CSmilPlayerPresentationController::DoParsingL
       
   866 // Performs SMIL Presentation parsing. If client has not give valid DOM it is 
       
   867 // parsed from given file handle using XML parser. After valid DOM is present
       
   868 // SMIL presentation is parsed from it. During SMIL presentation parsing
       
   869 // wait note is shown if approriate. When presentation is parsed it is initialized
       
   870 // with correct parameters.
       
   871 // ----------------------------------------------------------------------------
       
   872 //
       
   873 void CSmilPlayerPresentationController::DoParsingL()
       
   874     {
       
   875 #ifdef PRESCONTROLLER_DEBUG
       
   876     SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] PresController: DoParsingL" );
       
   877 #endif
       
   878 
       
   879     iWaitDialog = new(ELeave) CAknWaitDialog( ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ) ); 
       
   880     iWaitDialog->SetTone( CAknNoteDialog::ENoTone );
       
   881     iWaitDialog->ExecuteLD( R_WAIT_NOTE ); 
       
   882 
       
   883 #ifdef PRESCONTROLLER_DEBUG
       
   884     SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: Wait dialog created") );
       
   885 #endif
       
   886 
       
   887     //dom parsing needed?
       
   888     if ( !iDOM )
       
   889         {
       
   890         CSmilPlayerSynchXmlParser* util = new(ELeave) CSmilPlayerSynchXmlParser;
       
   891         CleanupStack::PushL( util );
       
   892         
       
   893         iDOM = util->ParseL( iFileHandle );
       
   894         iDOMInternallyOwned = ETrue;
       
   895         
       
   896         CleanupStack::PopAndDestroy( util );
       
   897         }
       
   898 
       
   899     CSmilParser* parser = CSmilParser::NewL( this );
       
   900     CleanupStack::PushL( parser );
       
   901 
       
   902 #ifdef PRESCONTROLLER_DEBUG
       
   903     SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: Parser created") );
       
   904 #endif
       
   905     
       
   906     //Set layout scaling mode
       
   907     parser->SetMaxDownUpScaling( static_cast<TReal32>( KLayoutScaleDown ),
       
   908                                  static_cast<TReal32>( KLayoutScaleUp ) );
       
   909     
       
   910     iPresentation = parser->ParseL( iDOM, *iBaseUrl );
       
   911     
       
   912 #ifdef PRESCONTROLLER_DEBUG
       
   913     SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] PresController: Presentation parsed") );
       
   914 #endif
       
   915 
       
   916     delete iWaitDialog;
       
   917     iWaitDialog = NULL;
       
   918     
       
   919     iPresentation->SetEndAction( CSmilPresentation::EStopAtEnd );
       
   920     iPresentation->SetStartAction( CSmilPresentation::EShowFirstFrame );
       
   921     iPresentation->SetVolume( iIndicatorController->VolumeValue() * 10 );
       
   922 
       
   923     CleanupStack::PopAndDestroy( parser );
       
   924     
       
   925 #ifdef PRESCONTROLLER_DEBUG
       
   926     SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] PresController: DoParsingL" );
       
   927 #endif
       
   928     }
       
   929 
       
   930 // ----------------------------------------------------------------------------
       
   931 // CSmilPlayerPresentationController::CallL
       
   932 // Creates a call to speficied number. First phone client is created if none exists.
       
   933 // Then phone number is parsed from the given string and phone call is created
       
   934 // using phone client.
       
   935 // ----------------------------------------------------------------------------
       
   936 //
       
   937 void CSmilPlayerPresentationController::CallL( const TDesC& aString )
       
   938     {
       
   939 
       
   940     if ( !iServiceHandler )
       
   941         {
       
   942         iServiceHandler = CAiwServiceHandler::NewL();
       
   943         }
       
   944         
       
   945     // Attach to AIW interest
       
   946     iServiceHandler->AttachL ( R_SMILPLAYER_CALL_INTEREST );
       
   947                 
       
   948     CAiwDialData* dialData = CAiwDialData::NewLC();
       
   949     
       
   950     // Set test parameters  
       
   951     dialData->SetPhoneNumberL( aString );
       
   952     dialData->SetCallType( CAiwDialData::EAIWVoice );
       
   953     dialData->SetWindowGroup( iCoeEnv->RootWin().WindowGroupId() );
       
   954 
       
   955     CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
       
   956     dialData->FillInParamListL( paramList );
       
   957  
       
   958     // Execute AIW command with notification callback
       
   959     iServiceHandler->ExecuteServiceCmdL( KAiwCmdCall, 
       
   960                                          paramList,
       
   961                                          iServiceHandler->OutParamListL(),
       
   962                                          0, 
       
   963                                          NULL );
       
   964             
       
   965     iServiceHandler->DetachL( R_SMILPLAYER_CALL_INTEREST );
       
   966         
       
   967     CleanupStack::PopAndDestroy( dialData );
       
   968     }
       
   969 
       
   970 // ----------------------------------------------------------------------------
       
   971 // CSmilPlayerPresentationController::SendMessageL
       
   972 // Sends message (SMS, MMS or E-mail) referenced e-mail address
       
   973 // ----------------------------------------------------------------------------
       
   974 //
       
   975 void CSmilPlayerPresentationController::SendMessageL( const TUid& aMtmUid,
       
   976                                                       const TDesC& aString )
       
   977     {
       
   978     if ( !iSendUi )
       
   979         {
       
   980         iSendUi = CSendUi::NewL();
       
   981         }
       
   982 
       
   983     CMessageData* messageData = CMessageData::NewL();
       
   984     CleanupStack::PushL( messageData );
       
   985     
       
   986     messageData->AppendToAddressL( aString );
       
   987     
       
   988     iSendUi->CreateAndSendMessageL( aMtmUid, 
       
   989                                     messageData );
       
   990                                        
       
   991     CleanupStack::PopAndDestroy( messageData );
       
   992     }
       
   993 
       
   994 // ----------------------------------------------------------------------------
       
   995 // CSmilPlayerPresentationController::GoToUrlL
       
   996 // Opens browser with given address,
       
   997 // ----------------------------------------------------------------------------
       
   998 //
       
   999 void CSmilPlayerPresentationController::GoToUrlL( const TDesC& aString )
       
  1000     {
       
  1001     HBufC* parameters = HBufC::NewLC( aString.Length() + 2 ); 
       
  1002                         // 2 = length of the first parameter + space
       
  1003 
       
  1004     TPtr paramPtr = parameters->Des();
       
  1005     paramPtr.Copy( KWmlBrowserParameter );
       
  1006     paramPtr.Append( KSpace );
       
  1007     paramPtr.Append( aString );
       
  1008 
       
  1009     CBrowserLauncher* launcher = CBrowserLauncher::NewLC();
       
  1010     
       
  1011     User::LeaveIfError( launcher->LaunchBrowserSyncEmbeddedL( *parameters ,NULL, NULL ) );
       
  1012     
       
  1013     CleanupStack::PopAndDestroy( launcher );
       
  1014     
       
  1015     CleanupStack::PopAndDestroy( parameters );
       
  1016 
       
  1017     }
       
  1018 
       
  1019 // ----------------------------------------------------------------------------
       
  1020 // CSmilPlayerPresentationController::LoadTextAndConfirmL
       
  1021 // Loads correct text from given resource and shown confirmation query dialog
       
  1022 // by using ShowConfirmQueryL. Also forwards user answer to confirmation query
       
  1023 // dialog to caller.
       
  1024 // ----------------------------------------------------------------------------
       
  1025 //
       
  1026 TBool CSmilPlayerPresentationController::LoadTextAndConfirmL( TInt aResourceId, 
       
  1027                                                              const TDesC& aString ) const
       
  1028     {
       
  1029     HBufC* dlgText = StringLoader::LoadLC( aResourceId, aString, iEikonEnv );
       
  1030     
       
  1031     TBool result( ShowConfirmQueryL( R_SMILPLAYER_CONFIRM_QUERY, *dlgText ) );
       
  1032     
       
  1033     CleanupStack::PopAndDestroy( dlgText );
       
  1034     return result;
       
  1035     }
       
  1036 
       
  1037 // ----------------------------------------------------------------------------
       
  1038 // CSmilPlayerPresentationController::ShowConfirmQueryL
       
  1039 // Shows confirmation query dialog to user by using CAknQueryDialog. Returns 
       
  1040 // ETrue if user selected "Yes" and EFalse if "No".
       
  1041 // ----------------------------------------------------------------------------
       
  1042 //
       
  1043 TBool CSmilPlayerPresentationController::ShowConfirmQueryL( TInt aResource,
       
  1044                                                             const TDesC& aText ) const
       
  1045     {
       
  1046     TBool result( EFalse );
       
  1047     
       
  1048     CAknQueryDialog* dialog = CAknQueryDialog::NewL();
       
  1049     TInt ret = dialog->ExecuteLD( aResource, aText );
       
  1050     User::LeaveIfError( ret );
       
  1051     
       
  1052     if ( ret == EAknSoftkeyYes )
       
  1053         {
       
  1054         result = ETrue;
       
  1055         }    
       
  1056     return result;
       
  1057     }
       
  1058 
       
  1059 // ----------------------------------------------------------------------------
       
  1060 // CSmilPlayerPresentationController::CountComponentControls
       
  1061 // Returns number of presentation controller child controls.
       
  1062 // ----------------------------------------------------------------------------
       
  1063 //
       
  1064 TInt CSmilPlayerPresentationController::CountComponentControls() const
       
  1065     {
       
  1066     // return nbr of controls inside this container
       
  1067     return 1; 
       
  1068     }
       
  1069 
       
  1070 // ----------------------------------------------------------------------------
       
  1071 // CSmilPlayerPresentationController::ComponentControl
       
  1072 // Returns presentation control child control.
       
  1073 // ----------------------------------------------------------------------------
       
  1074 //
       
  1075 CCoeControl* CSmilPlayerPresentationController::ComponentControl( TInt aIndex ) const
       
  1076     {
       
  1077     CCoeControl* result = NULL;
       
  1078     
       
  1079     switch ( aIndex )
       
  1080         {
       
  1081         case 0: 
       
  1082             {
       
  1083             result = iPresentationControl;
       
  1084             break;
       
  1085             }
       
  1086         default:
       
  1087             {
       
  1088             break;
       
  1089             }
       
  1090         }
       
  1091     return result;
       
  1092     }
       
  1093 
       
  1094 // ----------------------------------------------------------------------------
       
  1095 // CSmilPlayerPresentationController::Draw
       
  1096 // Draws the "borders" of the presentation. By "borders" here is meant
       
  1097 // areas the under statuspane that are not used by presentation. These areas
       
  1098 // are produced when original presentation is so small that even with maximum
       
  1099 // up-scaling presentation does not fill the whole available area or when
       
  1100 // original presentation uses different aspect ratio than playing device.
       
  1101 // To prevent flickering only border areas are drawn instead of whole presentation
       
  1102 // control rectangle.
       
  1103 // ----------------------------------------------------------------------------
       
  1104 //
       
  1105 void CSmilPlayerPresentationController::Draw( const TRect& /*aRect*/ ) const
       
  1106     {    
       
  1107     TRect controllerRect( Rect() );
       
  1108     TRect presentationRect( iPresentationControl->Rect() );
       
  1109     
       
  1110     CWindowGc& gc = SystemGc();
       
  1111     gc.SetPenStyle( CGraphicsContext::ENullPen );
       
  1112     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  1113     gc.SetBrushColor( KRgbWhite );
       
  1114     
       
  1115     TRect borderRect;
       
  1116     
       
  1117     // Draw the top border if neccessary
       
  1118     if ( controllerRect.iTl.iY < presentationRect.iTl.iY )
       
  1119         {
       
  1120         borderRect.SetRect( controllerRect.iTl, 
       
  1121                             TPoint( controllerRect.iBr.iX, presentationRect.iTl.iY ) );
       
  1122         
       
  1123         gc.DrawRect( borderRect );
       
  1124         }
       
  1125     
       
  1126     // Draw the left border if neccessary
       
  1127     if ( controllerRect.iTl.iX < presentationRect.iTl.iX )
       
  1128         {
       
  1129         borderRect.SetRect( controllerRect.iTl, 
       
  1130                             TPoint( presentationRect.iTl.iX, controllerRect.iBr.iY ) );
       
  1131         
       
  1132         gc.DrawRect( borderRect );
       
  1133         }
       
  1134     
       
  1135     // Draw the right border if neccessary
       
  1136     if ( controllerRect.iBr.iX > presentationRect.iBr.iX )
       
  1137         {
       
  1138         borderRect.SetRect( TPoint( presentationRect.iBr.iX, controllerRect.iTl.iY ),
       
  1139                             controllerRect.iBr );
       
  1140         
       
  1141         gc.DrawRect( borderRect );
       
  1142         }
       
  1143         
       
  1144     // Draw the bottom border if neccessary
       
  1145     if ( controllerRect.iBr.iY > presentationRect.iBr.iY )
       
  1146         {
       
  1147         borderRect.SetRect( TPoint( controllerRect.iTl.iX, presentationRect.iBr.iY ),
       
  1148                             controllerRect.iBr );
       
  1149         
       
  1150         gc.DrawRect( borderRect );
       
  1151         }
       
  1152     
       
  1153     }
       
  1154 
       
  1155 // ----------------------------------------------------------------------------
       
  1156 // CSmilPlayerPresentationController::LayoutPresentationL
       
  1157 // Sets correct layout for presentation control according to current LAF values.
       
  1158 // First flag for layout change is set and presentation existence is checked. If
       
  1159 // presentation does not exist then we are in the middle of presentation creation
       
  1160 // and layout switching is restarted when current presentation creation finishes.
       
  1161 // When performing the real layout change code first indicators are stopped 
       
  1162 // if presentation is playing or paused. After this presentation controller state is 
       
  1163 // reseted and new buffer bitmap & buffer context is created. 
       
  1164 // This new buffer bitmap context is also updated for media factory 
       
  1165 // so that newly created text renderers use correct buffer. Then presentation
       
  1166 // is parsed again so that all media regions and renderers use new corrected
       
  1167 // (this is currently the only way to fit SMIL engine for new layout).
       
  1168 // After this is done presentation control and indicator are adjusted to new
       
  1169 // layout and screen is updated.
       
  1170 // ----------------------------------------------------------------------------
       
  1171 //
       
  1172 void CSmilPlayerPresentationController::LayoutPresentationL()
       
  1173     {
       
  1174     iChangeLayout = ETrue;
       
  1175     
       
  1176     if ( iPresentation )
       
  1177         {
       
  1178         while ( iChangeLayout )
       
  1179             {
       
  1180             CSmilPresentation::TPresentationState presentationState( iPresentation->State() );
       
  1181     
       
  1182             iIndicatorController->MakeVisible( EFalse );
       
  1183             
       
  1184             if ( presentationState == CSmilPresentation::EPlaying ||
       
  1185                  presentationState == CSmilPresentation::EPaused )
       
  1186         	    {
       
  1187         	    iIndicatorController->Stop();
       
  1188         	    }
       
  1189     	
       
  1190             Reset();
       
  1191             
       
  1192             InitializeDoubleBufferL();
       
  1193             
       
  1194             iMediaFactory = CSmilPlayerMediaFactory::NewL( *iCoeEnv,
       
  1195                                                            iBufferContext,
       
  1196                                                            iFileInfo );
       
  1197 
       
  1198             iTransitionFactory = new( ELeave ) CSmilTransitionFactory( iBufferBitmap );
       
  1199             
       
  1200             iPresentationControl->SetRect( Rect() );
       
  1201             
       
  1202             iChangeLayout = EFalse;
       
  1203         	DoParsingL();
       
  1204         	
       
  1205         	if ( iChangeLayout )
       
  1206         	    {
       
  1207         	    continue;
       
  1208         	    }
       
  1209         	    
       
  1210         	LayoutPresentationControl();
       
  1211         	
       
  1212         	iIndicatorController->SetRect( iIndicatorContainer->Rect() );
       
  1213         	iIndicatorController->LayoutIndicators();
       
  1214         	
       
  1215         	iIndicatorController->MakeVisible( ETrue );
       
  1216         	
       
  1217         	iPresentation->PlayL();
       
  1218         	iPresentation->StopL(); 
       
  1219         	
       
  1220         	DrawDeferred();
       
  1221             }
       
  1222         }
       
  1223     }
       
  1224 
       
  1225 // ----------------------------------------------------------------------------
       
  1226 // CSmilPlayerPresentationController::IsPresentationOverlapped
       
  1227 // Returns presentation overlap flag status
       
  1228 // ----------------------------------------------------------------------------
       
  1229 //
       
  1230 TBool CSmilPlayerPresentationController::IsPresentationOverlapped()
       
  1231     {
       
  1232     return iPresentationOverlapped;
       
  1233     }
       
  1234 
       
  1235 // ----------------------------------------------------------------------------
       
  1236 // CSmilPlayerPresentationController::SetPresentationOverlapped
       
  1237 // Sets flag to indicate that the presentation is overlapped.
       
  1238 // ----------------------------------------------------------------------------
       
  1239 //
       
  1240 void CSmilPlayerPresentationController::SetPresentationOverlapped( TBool aOverlapped )
       
  1241     {
       
  1242     iPresentationOverlapped = aOverlapped;
       
  1243     return;
       
  1244     }
       
  1245 
       
  1246 // ----------------------------------------------------------------------------
       
  1247 // CSmilPlayerPresentationController::LayoutOverlappedPresentation
       
  1248 // Sets the correct presentation layout, when a dialog (e.g. FindUi)
       
  1249 // is overlapping the presentation.
       
  1250 // ----------------------------------------------------------------------------
       
  1251 //
       
  1252 void CSmilPlayerPresentationController::LayoutOverlappedPresentation()
       
  1253     {
       
  1254     iPresentationControl->SetRect( Rect() );
       
  1255     LayoutPresentationControl();
       
  1256     DrawDeferred();
       
  1257     }
       
  1258 
       
  1259 
       
  1260 // ----------------------------------------------------------------------------
       
  1261 // CSmilPlayerPresentationController::Reset
       
  1262 // Resets the presentation controller internal state.
       
  1263 // ----------------------------------------------------------------------------
       
  1264 //
       
  1265 void CSmilPlayerPresentationController::Reset()
       
  1266     {
       
  1267     delete iPresentation;
       
  1268     iPresentation = NULL;
       
  1269     
       
  1270     delete iMediaFactory;
       
  1271     iMediaFactory = NULL;
       
  1272     
       
  1273     delete iTransitionFactory;
       
  1274     iTransitionFactory = NULL;
       
  1275     
       
  1276     delete iBufferBitmap;
       
  1277     iBufferBitmap = NULL;
       
  1278     
       
  1279     delete iBufferDevice;
       
  1280     iBufferDevice = NULL;
       
  1281     
       
  1282     delete iBufferContext;
       
  1283     iBufferContext = NULL;
       
  1284     }
       
  1285 
       
  1286 // ----------------------------------------------------------------------------
       
  1287 // CSmilPlayerPresentationController::SwitchStatusPaneL
       
  1288 // Changes statuspane to new one and possibly sets SMIL player own indicator
       
  1289 // for the statuspane. First checks that navigation pane is present on current
       
  1290 // statuspane layout and that it is application owned. These are global settings
       
  1291 // to all statuspane layouts and without these we cannot make any changes
       
  1292 // to navigation pane. If navigation pane is present and it is application owned
       
  1293 // it is first checked that it does not already have our own indicators as top most
       
  1294 // indicators. If this is true remove our own indicators. Then if our own indicators
       
  1295 // are wanted to be set to navigation pane this is done and after this statuspane layout
       
  1296 // is switched. Then last thing is to check that does this layout really contain
       
  1297 // navigation pane. If it does not and we have set our own indicators they are removed.
       
  1298 // NOTE! This is extremely sensitive function and changes to this might have really
       
  1299 // bad effects to visual appearance of statuspane switch. 
       
  1300 // ----------------------------------------------------------------------------
       
  1301 //
       
  1302 void CSmilPlayerPresentationController::SwitchStatusPaneL( TInt aNewPaneResourceId, 
       
  1303                                                            TBool aSetOwnIndicators,
       
  1304                                                            TInt& aOldPaneResourceId )
       
  1305     {    
       
  1306     CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
       
  1307     
       
  1308     aOldPaneResourceId = statusPane->CurrentLayoutResId();
       
  1309     
       
  1310     CEikStatusPaneBase::TPaneCapabilities naviCapabilities = 
       
  1311         statusPane->PaneCapabilities( TUid::Uid( EEikStatusPaneUidNavi ) );
       
  1312     
       
  1313     if ( naviCapabilities.IsPresent() && 
       
  1314          naviCapabilities.IsAppOwned() )
       
  1315         {
       
  1316         CAknNavigationControlContainer* naviContainer = 
       
  1317           static_cast<CAknNavigationControlContainer*>( statusPane->ControlL( 
       
  1318                                                             TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
  1319                                                                   
       
  1320         if ( naviContainer->Top() == iIndicatorContainer )
       
  1321             {
       
  1322             naviContainer->Pop( iIndicatorContainer );
       
  1323             iIndicatorController->MakeVisible( EFalse );
       
  1324             }
       
  1325             
       
  1326         if ( aSetOwnIndicators )
       
  1327             {
       
  1328             naviContainer->PushL( *iIndicatorContainer );
       
  1329             naviContainer->MakeVisible( EFalse );
       
  1330             iIndicatorController->MakeVisible( ETrue );
       
  1331             }
       
  1332         
       
  1333         statusPane->SwitchLayoutL( aNewPaneResourceId );
       
  1334         
       
  1335         naviCapabilities = statusPane->PaneCapabilities( TUid::Uid( EEikStatusPaneUidNavi ) );
       
  1336         
       
  1337         if ( !naviCapabilities.IsInCurrentLayout() &&
       
  1338              aSetOwnIndicators )
       
  1339             {
       
  1340             naviContainer->Pop( iIndicatorContainer );
       
  1341             iIndicatorController->MakeVisible( EFalse );
       
  1342             }
       
  1343         else if ( aSetOwnIndicators )
       
  1344             {
       
  1345             naviContainer->MakeVisible( ETrue );
       
  1346             iIndicatorController->SetRect( iIndicatorContainer->Rect() );
       
  1347             iIndicatorController->LayoutIndicators();
       
  1348             }
       
  1349             
       
  1350         statusPane->ApplyCurrentSettingsL();
       
  1351         statusPane->DrawNow();
       
  1352         iCoeEnv->WsSession().Flush();
       
  1353         }
       
  1354     }
       
  1355 
       
  1356 // ----------------------------------------------------------------------------
       
  1357 // CSmilPlayerPresentationController::ActivateFocusedMediaL
       
  1358 // Sends an activation event to focused media object.
       
  1359 // ----------------------------------------------------------------------------
       
  1360 //
       
  1361 void CSmilPlayerPresentationController::ActivateFocusedMediaL()
       
  1362     {
       
  1363     iPresentation->SubmitEventL( KActivate, iPresentation->FocusedObject() );
       
  1364     }
       
  1365 
       
  1366 // ----------------------------------------------------------------------------
       
  1367 // CSmilPlayerPresentationController::PresentationTextL
       
  1368 // All texts inside presentation are concatenated into
       
  1369 // one text so that they are sepatated with two paragraph characters from each
       
  1370 // others. 
       
  1371 // ----------------------------------------------------------------------------
       
  1372 //
       
  1373 HBufC* CSmilPlayerPresentationController::PresentationTextL()
       
  1374     {
       
  1375     CRendererArray* renderers = iMediaFactory->GetRenderers();
       
  1376 
       
  1377     if ( !renderers )
       
  1378         {
       
  1379         return NULL;
       
  1380         }
       
  1381 
       
  1382     TChar PS( CEditableText::EParagraphDelimiter );  // Unicode paragraph separator
       
  1383 
       
  1384     TInt totalSize = 0;
       
  1385     CPlainText* textTemp;
       
  1386     TInt count = renderers->Count();
       
  1387     
       
  1388     // Count the total length of all text renderers
       
  1389     for ( TInt current = 0; current < count ; current++ ) 
       
  1390         {     
       
  1391         if ( renderers->At( current )->MediaType() == EMsgMediaText ||
       
  1392              renderers->At( current )->MediaType() == EMsgMediaXhtml )
       
  1393             {
       
  1394             textTemp = static_cast<CSmilTextRenderer*>( renderers->At( current ) )->GetText();
       
  1395             TInt textSize = textTemp->DocumentLength();
       
  1396             // + 2 is for two Unicode paragraph separator
       
  1397             totalSize = totalSize + textSize + 2;
       
  1398             }
       
  1399         }
       
  1400 
       
  1401     HBufC* resultHeap = NULL;
       
  1402     if ( totalSize > 0 )
       
  1403         {
       
  1404         // Create buffer for total size of all texts
       
  1405         resultHeap = HBufC::NewLC( totalSize + 1 );
       
  1406         HBufC* tempHeap = HBufC::NewLC( totalSize );
       
  1407         TPtr ptrResultHeap = resultHeap->Des();
       
  1408         TPtr ptrTempHeap = tempHeap->Des();
       
  1409         
       
  1410         for ( TInt current = 0; current < count; current++ )
       
  1411             {     
       
  1412             if ( renderers->At( current )->MediaType() == EMsgMediaText ||
       
  1413                  renderers->At( current )->MediaType() == EMsgMediaXhtml )
       
  1414                 {
       
  1415                 textTemp = static_cast<CSmilTextRenderer*>( renderers->At( current ) )->GetText();
       
  1416                 
       
  1417                 TInt position = textTemp->DocumentLength();
       
  1418 
       
  1419                 // Adding 2 paragragh separators and current text renderer's text.
       
  1420                 textTemp->InsertL( position, PS );
       
  1421                 textTemp->InsertL( position, PS );
       
  1422 
       
  1423                 textTemp->Extract( ptrTempHeap );
       
  1424                 ptrResultHeap.Append( ptrTempHeap );
       
  1425                 }
       
  1426             }
       
  1427         
       
  1428         CleanupStack::PopAndDestroy( tempHeap );
       
  1429         CleanupStack::Pop( resultHeap );
       
  1430         }
       
  1431         
       
  1432     return resultHeap;
       
  1433     }
       
  1434 
       
  1435 // ----------------------------------------------------------------------------
       
  1436 // CSmilPlayerPresentationController::PresentationContains
       
  1437 // Performs a check whether presentation contains specified type of renderer.
       
  1438 // ----------------------------------------------------------------------------
       
  1439 //
       
  1440 TBool CSmilPlayerPresentationController::PresentationContains( const TMsgMediaType& aType ) const
       
  1441     {
       
  1442     CRendererArray* renderers = iMediaFactory->GetRenderers();
       
  1443     
       
  1444     if ( !renderers )
       
  1445         {
       
  1446         return EFalse;
       
  1447         }
       
  1448 
       
  1449     for ( TInt current = 0; current < renderers->Count(); current++ )
       
  1450         {     
       
  1451         if ( renderers->At( current )->MediaType() == aType )
       
  1452             {
       
  1453             return ETrue;
       
  1454             }
       
  1455         }
       
  1456     return EFalse;
       
  1457     }
       
  1458 
       
  1459 
       
  1460 // ----------------------------------------------------------------------------
       
  1461 // CSmilPlayerPresentationController::PlayPauseTappedL
       
  1462 // ----------------------------------------------------------------------------
       
  1463 //
       
  1464 void CSmilPlayerPresentationController::PlayPauseTappedL()
       
  1465     {
       
  1466 #ifdef RD_SCALABLE_UI_V2  
       
  1467     TInt state = iPresentation->State();  
       
  1468     if  (  state == CSmilPresentation::EPlaying )
       
  1469         {
       
  1470         iParent->PauseTappedL();     
       
  1471         }
       
  1472     else if ( state == CSmilPresentation::EPaused )
       
  1473         {
       
  1474         iParent->PlayTappedL();
       
  1475         }        
       
  1476 #endif        
       
  1477     }
       
  1478   
       
  1479     
       
  1480 #ifdef RD_SCALABLE_UI_V2
       
  1481 // ---------------------------------------------------------
       
  1482 // CSmilPlayerPresentationController::HandlePointerEventL
       
  1483 // ---------------------------------------------------------
       
  1484 //
       
  1485 void CSmilPlayerPresentationController::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
  1486     {
       
  1487     if ( AknLayoutUtils::PenEnabled() )
       
  1488         {
       
  1489         switch ( aPointerEvent.iType )
       
  1490             {
       
  1491             case TPointerEvent::EButton1Up:
       
  1492             case TPointerEvent::EButton1Down:
       
  1493                 {
       
  1494                 // The check needs to be here as CSmilObject is null on this state
       
  1495                 if ( iPresentation->FocusedObject() )
       
  1496                     {
       
  1497                     TRect focusedRect;
       
  1498                     if ( iPresentation->FocusedObject()->GetRegion() )
       
  1499                         {
       
  1500                         focusedRect = iPresentation->FocusedObject()->GetRegion()->GetRectangle();
       
  1501                         // Returned rect is relative to presentation rect, we need window relative rect
       
  1502                         focusedRect.Move( iPresentationRect.iTl );
       
  1503                         }
       
  1504                     
       
  1505                     if ( !focusedRect.IsEmpty() &&
       
  1506                          !focusedRect.Contains( aPointerEvent.iPosition ) )
       
  1507                         {
       
  1508                         // First tap on the region
       
  1509                         // pointerevent is window related, we have to give smilengine presentation related
       
  1510                         TPointerEvent pointerEvent( aPointerEvent );
       
  1511                         pointerEvent.iPosition -= iPresentationRect.iTl;
       
  1512                         iPresentation->HandlePointerEventL( pointerEvent );
       
  1513                         iParent->DeactivateScrollingL();
       
  1514                         iTappedObject = NULL;
       
  1515                         }
       
  1516                     else if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
  1517                         {
       
  1518                         iTappedObject = iPresentation->FocusedObject(); 
       
  1519                         }
       
  1520                     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && iTappedObject == iPresentation->FocusedObject() )
       
  1521                         {
       
  1522                         iParent->HandleSelectionKeyL();
       
  1523                         }
       
  1524                     }
       
  1525                 break;
       
  1526                 }
       
  1527             default:
       
  1528                 break;
       
  1529             }
       
  1530         }
       
  1531     }  
       
  1532 
       
  1533 
       
  1534 #else
       
  1535 void CSmilPlayerPresentationController::HandlePointerEventL( const TPointerEvent& /*aPointerEvent*/ )
       
  1536     {
       
  1537     }
       
  1538 #endif // RD_SCALABLE_UI_V2
       
  1539 
       
  1540 // ---------------------------------------------------------
       
  1541 // CSmilPlayerPresentationController::InitializeDoubleBufferL
       
  1542 //
       
  1543 // Initializes double buffer bitmap, device and context.
       
  1544 // ---------------------------------------------------------
       
  1545 //
       
  1546 void CSmilPlayerPresentationController::InitializeDoubleBufferL()
       
  1547     {
       
  1548     iBufferBitmap = new( ELeave ) CWsBitmap();
       
  1549     
       
  1550     if ( iEikonEnv->DefaultDisplayMode() < EColor16MU )
       
  1551         {
       
  1552         User::LeaveIfError( iBufferBitmap->Create( Size(),  EColor16M ) );
       
  1553         }
       
  1554     else
       
  1555         {
       
  1556         User::LeaveIfError( iBufferBitmap->Create( Size(), SystemGc().Device()->DisplayMode() ) );
       
  1557         }
       
  1558     
       
  1559     // Sets the twip-size of the bitmap by converting the bitmaps pixel-size from pixels to twips, 
       
  1560     // using the conversion functions in the specified graphics device map. This is needed to retrieve
       
  1561     // correct font from FBS server.
       
  1562     iBufferBitmap->SetSizeInTwips( SystemGc().Device() );
       
  1563         
       
  1564     iBufferDevice = CFbsBitmapDevice::NewL( iBufferBitmap );
       
  1565     User::LeaveIfError( iBufferDevice->CreateContext( iBufferContext ) );
       
  1566     }
       
  1567 
       
  1568 // ----------------------------------------------------------------------------
       
  1569 // CSmilPlayerPresentationController::IsFocused
       
  1570 // ----------------------------------------------------------------------------
       
  1571 //
       
  1572 TBool CSmilPlayerPresentationController::IsFocused( const TMsgMediaType& aMediaType ) const
       
  1573     {
       
  1574     TBool result( EFalse );
       
  1575     CSmilObject* focused = iPresentation->FocusedObject();
       
  1576     
       
  1577     if ( focused && focused->IsMedia() )
       
  1578         {
       
  1579         CSmilMedia* media = static_cast<CSmilMedia*>( focused );
       
  1580         if ( media )
       
  1581         	{
       
  1582             CSmilMediaRendererBase* renderer = static_cast<CSmilMediaRendererBase*>( media->GetRenderer() );
       
  1583             
       
  1584             if ( renderer && 
       
  1585             	 renderer->MediaType() == aMediaType )
       
  1586                 {
       
  1587                 // Media object type is the same as parameter.
       
  1588                 result = ETrue;
       
  1589                 }        	
       
  1590         	}
       
  1591         }
       
  1592     return result;
       
  1593     }
       
  1594 
       
  1595 // ----------------------------------------------------------------------------
       
  1596 // CSmilPlayerPresentationController::ActivateFocusedL
       
  1597 // ----------------------------------------------------------------------------
       
  1598 //
       
  1599 void CSmilPlayerPresentationController::ActivateFocusedL()
       
  1600     {
       
  1601     CSmilObject* focused = iPresentation->FocusedObject();
       
  1602     
       
  1603     if ( focused )
       
  1604         {
       
  1605         CSmilMedia* media = static_cast<CSmilMedia*>( focused );
       
  1606         CSmilMediaRendererBase* renderer = static_cast<CSmilMediaRendererBase*>( media->GetRenderer() );
       
  1607         
       
  1608         SetStatusPaneVisibilityL( ETrue );
       
  1609         
       
  1610         TRAPD( error, renderer->ActivateRendererL() );
       
  1611         
       
  1612         SetStatusPaneVisibilityL( EFalse );
       
  1613         
       
  1614         User::LeaveIfError( error );
       
  1615         }
       
  1616     }
       
  1617 
       
  1618 // ----------------------------------------------------------------------------
       
  1619 // CSmilPlayerPresentationController::OwnStatusPaneVisible
       
  1620 // ----------------------------------------------------------------------------
       
  1621 //
       
  1622 TBool CSmilPlayerPresentationController::OwnStatusPaneVisible()
       
  1623     {
       
  1624     return iOwnStatusPaneVisible;
       
  1625     }
       
  1626 
       
  1627 // ----------------------------------------------------------------------------
       
  1628 // CSmilPlayerPresentationController::UseWidescreenStatusPane
       
  1629 // ----------------------------------------------------------------------------
       
  1630 TBool CSmilPlayerPresentationController::UseWidescreenStatusPane()
       
  1631     {
       
  1632     return Layout_Meta_Data::IsLandscapeOrientation() && AknLayoutUtils::PenEnabled();
       
  1633     }
       
  1634 
       
  1635 // End of File  
       
  1636