Index: sd/source/ui/inc/ViewShell.hxx =================================================================== --- sd/source/ui/inc/ViewShell.hxx (revision 264822) +++ sd/source/ui/inc/ViewShell.hxx (working copy) @@ -216,6 +216,8 @@ virtual BOOL RequestHelp( const HelpEvent& rEvt, ::sd::Window* pWin ); virtual long Notify( NotifyEvent& rNEvt, ::sd::Window* pWin ); + BOOL HandleCommand(const CommandEvent& rCEvt, ::sd::Window* pWin); + BOOL HandlePlayCommand(const CommandEvent& rCEvt, ::sd::Window* pWin); BOOL HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin); virtual void Draw(OutputDevice &rDev, const Region &rReg); Index: sd/source/ui/view/viewshel.cxx =================================================================== --- sd/source/ui/view/viewshel.cxx (revision 265132) +++ sd/source/ui/view/viewshel.cxx (working copy) @@ -654,7 +654,7 @@ void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) { - BOOL bDone = HandleScrollCommand (rCEvt, pWin); + BOOL bDone = HandleCommand (rCEvt, pWin); if( !bDone ) { @@ -671,6 +671,7 @@ } } + long ViewShell::Notify(NotifyEvent& rNEvt, ::sd::Window* pWin) { // handle scroll commands when they arrived at child windows @@ -679,15 +680,53 @@ { // note: dynamic_cast is not possible as GetData() returns a void* CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData()); - nRet = HandleScrollCommand(*pCmdEvent, pWin); + nRet = HandleCommand(*pCmdEvent, pWin); } return nRet; } +BOOL ViewShell::HandleCommand(const CommandEvent& rCEvt, ::sd::Window* pWin) +{ + // handle scroll commands when they arrived at child windows + bool toReturn = FALSE; + CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rCEvt.GetData()); + //const CommandEvent& rEvent = *(const CommandEvent*)static_cast(pEvent)->GetData(); + + if (pCmdEvent) + { + fprintf( stdout, "pCmdEvent->GetCommand() = %hd \n",pCmdEvent->GetCommand()); + if( pCmdEvent->GetCommand() == COMMAND_MEDIA ) + { + // note: dynamic_cast is not possible as GetData() returns a void* + toReturn = HandlePlayCommand(*pCmdEvent, pWin); + } + else // EVENT_COMMAND + toReturn = HandleScrollCommand(*pCmdEvent, pWin); + } + return toReturn; +} + +BOOL ViewShell::HandlePlayCommand(const CommandEvent& rCEvt, ::sd::Window* pWin) +{ + BOOL bIsDone = FALSE; + fprintf( stdout, "rCEvt.GetMediaCommand() = %hd \n",rCEvt.GetMediaCommand()); + + if( ( rCEvt.GetMediaCommand() == MEDIA_COMMAND_PLAY ) ) + { + Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) ); + if( xSlideShowController.is() ) + { + GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION ); + bIsDone = TRUE; + } + } + return bIsDone; +} + BOOL ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin) { - BOOL bDone = FALSE; + BOOL bIsDone = FALSE; switch( rCEvt.GetCommand() ) { @@ -737,7 +776,7 @@ Invalidate( SID_ATTR_ZOOM ); Invalidate( SID_ATTR_ZOOMSLIDER ); - bDone = TRUE; + bIsDone = TRUE; } } else @@ -751,7 +790,7 @@ nScrollLines,pData->GetMode(),pData->GetModifier(),pData->IsHorz() ); CommandEvent aReWrite( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(), rCEvt.IsMouseEvent(),(const void *) &aWheelData ); - bDone = pWin->HandleScrollCommand( aReWrite, + bIsDone = pWin->HandleScrollCommand( aReWrite, mpHorizontalScrollBar.get(), mpVerticalScrollBar.get()); } @@ -764,7 +803,7 @@ break; } - return bDone; + return bIsDone; }