Kaydet (Commit) b104e6e9 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:flatten in sd/source/ui/slideshow

Change-Id: Id820f0f7ac51928ba1a783615c3e9d6c268affdd
Reviewed-on: https://gerrit.libreoffice.org/67831
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst fcdfb94a
...@@ -45,7 +45,10 @@ PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow) ...@@ -45,7 +45,10 @@ PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow)
{ {
// Hide the left and right pane windows when a slideshow exists and is // Hide the left and right pane windows when a slideshow exists and is
// not full screen. // not full screen.
if (pSlideShow!=nullptr && !pSlideShow->isFullScreen()) try if (pSlideShow==nullptr || pSlideShow->isFullScreen())
return;
try
{ {
Reference<XControllerManager> xControllerManager ( Reference<XControllerManager> xControllerManager (
mrViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW); mrViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW);
......
...@@ -81,46 +81,46 @@ void SlideShowRestarter::Restart (bool bForce) ...@@ -81,46 +81,46 @@ void SlideShowRestarter::Restart (bool bForce)
IMPL_LINK_NOARG(SlideShowRestarter, EndPresentation, void*, void) IMPL_LINK_NOARG(SlideShowRestarter, EndPresentation, void*, void)
{ {
mnEventId = nullptr; mnEventId = nullptr;
if (mpSlideShow.is()) if (!mpSlideShow.is())
return;
if (mnDisplayCount == static_cast<sal_Int32>(Application::GetScreenCount()))
return;
bool bIsExitAfterPresenting = mpSlideShow->IsExitAfterPresenting();
mpSlideShow->SetExitAfterPresenting(false);
mpSlideShow->end();
mpSlideShow->SetExitAfterPresenting(bIsExitAfterPresenting);
// The following piece of code should not be here because the
// slide show should be aware of the existence of the presenter
// console (which is displayed in the FullScreenPane). But the
// timing has to be right and I did not find a better place for
// it.
// Wait for the full screen pane, which displays the presenter
// console, to disappear. Only when it is gone, call
// InitiatePresenterStart(), in order to begin the asynchronous
// restart of the slide show.
if (mpViewShellBase == nullptr)
return;
::std::shared_ptr<FrameworkHelper> pHelper(
FrameworkHelper::Instance(*mpViewShellBase));
if (pHelper->GetConfigurationController()->getResource(
FrameworkHelper::CreateResourceId(FrameworkHelper::msFullScreenPaneURL)).is())
{ {
if (mnDisplayCount != static_cast<sal_Int32>(Application::GetScreenCount())) ::sd::framework::ConfigurationController::Lock aLock (
{ pHelper->GetConfigurationController());
bool bIsExitAfterPresenting = mpSlideShow->IsExitAfterPresenting();
mpSlideShow->SetExitAfterPresenting(false); pHelper->RunOnConfigurationEvent(
mpSlideShow->end(); FrameworkHelper::msConfigurationUpdateEndEvent,
mpSlideShow->SetExitAfterPresenting(bIsExitAfterPresenting); ::std::bind(&SlideShowRestarter::StartPresentation, shared_from_this()));
pHelper->UpdateConfiguration();
// The following piece of code should not be here because the }
// slide show should be aware of the existence of the presenter else
// console (which is displayed in the FullScreenPane). But the {
// timing has to be right and I did not find a better place for StartPresentation();
// it.
// Wait for the full screen pane, which displays the presenter
// console, to disappear. Only when it is gone, call
// InitiatePresenterStart(), in order to begin the asynchronous
// restart of the slide show.
if (mpViewShellBase != nullptr)
{
::std::shared_ptr<FrameworkHelper> pHelper(
FrameworkHelper::Instance(*mpViewShellBase));
if (pHelper->GetConfigurationController()->getResource(
FrameworkHelper::CreateResourceId(FrameworkHelper::msFullScreenPaneURL)).is())
{
::sd::framework::ConfigurationController::Lock aLock (
pHelper->GetConfigurationController());
pHelper->RunOnConfigurationEvent(
FrameworkHelper::msConfigurationUpdateEndEvent,
::std::bind(&SlideShowRestarter::StartPresentation, shared_from_this()));
pHelper->UpdateConfiguration();
}
else
{
StartPresentation();
}
}
}
} }
} }
......
...@@ -294,21 +294,21 @@ void ShowWindow::LoseFocus() ...@@ -294,21 +294,21 @@ void ShowWindow::LoseFocus()
void ShowWindow::SetEndMode() void ShowWindow::SetEndMode()
{ {
if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() ) if( !(( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView()) )
{ return;
DeleteWindowFromPaintView();
meShowWindowMode = SHOWWINDOWMODE_END;
maShowBackground = Wallpaper( COL_BLACK );
// hide navigator if it is visible DeleteWindowFromPaintView();
if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) ) meShowWindowMode = SHOWWINDOWMODE_END;
{ maShowBackground = Wallpaper( COL_BLACK );
mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, false );
mbShowNavigatorAfterSpecialMode = true;
}
Invalidate(); // hide navigator if it is visible
if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
{
mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, false );
mbShowNavigatorAfterSpecialMode = true;
} }
Invalidate();
} }
bool ShowWindow::SetPauseMode( sal_Int32 nTimeout, Graphic const * pLogo ) bool ShowWindow::SetPauseMode( sal_Int32 nTimeout, Graphic const * pLogo )
......
...@@ -650,135 +650,135 @@ void SAL_CALL SlideShow::end() ...@@ -650,135 +650,135 @@ void SAL_CALL SlideShow::end()
mbIsInStartup = false; mbIsInStartup = false;
rtl::Reference< SlideshowImpl > xController( mxController ); rtl::Reference< SlideshowImpl > xController( mxController );
if( xController.is() ) if( !xController.is() )
return;
mxController.clear();
if( mpFullScreenFrameView )
{ {
mxController.clear(); delete mpFullScreenFrameView;
mpFullScreenFrameView = nullptr;
}
if( mpFullScreenFrameView ) ViewShellBase* pFullScreenViewShellBase = mpFullScreenViewShellBase;
{ mpFullScreenViewShellBase = nullptr;
delete mpFullScreenFrameView;
mpFullScreenFrameView = nullptr;
}
ViewShellBase* pFullScreenViewShellBase = mpFullScreenViewShellBase; // dispose before fullscreen window changes screens
mpFullScreenViewShellBase = nullptr; // (potentially). If this needs to be moved behind
// pWorkWindow->StartPresentationMode() again, read issue
// pWorkWindow->i94007 & implement the solution outlined
// there.
xController->dispose();
// dispose before fullscreen window changes screens if( pFullScreenViewShellBase )
// (potentially). If this needs to be moved behind {
// pWorkWindow->StartPresentationMode() again, read issue PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>(pFullScreenViewShellBase->GetMainViewShell().get());
// pWorkWindow->i94007 & implement the solution outlined
// there.
xController->dispose();
if( pFullScreenViewShellBase ) if( pShell && pShell->GetViewFrame() )
{ {
PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>(pFullScreenViewShellBase->GetMainViewShell().get()); WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pShell->GetViewFrame()->GetFrame().GetWindow().GetParent());
if( pWorkWindow )
if( pShell && pShell->GetViewFrame() )
{ {
WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pShell->GetViewFrame()->GetFrame().GetWindow().GetParent()); pWorkWindow->StartPresentationMode( (mxController.is() && mxController->maPresSettings.mbAlwaysOnTop)
if( pWorkWindow ) ? PresentationFlags::HideAllApps : PresentationFlags::NONE );
{
pWorkWindow->StartPresentationMode( (mxController.is() && mxController->maPresSettings.mbAlwaysOnTop)
? PresentationFlags::HideAllApps : PresentationFlags::NONE );
}
} }
} }
}
if( pFullScreenViewShellBase ) if( pFullScreenViewShellBase )
{
PresentationViewShell* pShell = nullptr;
{ {
PresentationViewShell* pShell = nullptr; // Get the shell pointer in its own scope to be sure that
{ // the shared_ptr to the shell is released before DoClose()
// Get the shell pointer in its own scope to be sure that // is called.
// the shared_ptr to the shell is released before DoClose() ::std::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->GetMainViewShell());
// is called. pShell = dynamic_cast<PresentationViewShell*>(pSharedView.get());
::std::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->GetMainViewShell());
pShell = dynamic_cast<PresentationViewShell*>(pSharedView.get());
}
if( pShell && pShell->GetViewFrame() )
pShell->GetViewFrame()->DoClose();
} }
else if( mpCurrentViewShellBase ) if( pShell && pShell->GetViewFrame() )
pShell->GetViewFrame()->DoClose();
}
else if( mpCurrentViewShellBase )
{
ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get();
if( pViewShell )
{ {
ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get(); FrameView* pFrameView = pViewShell->GetFrameView();
if( pViewShell ) if( pFrameView && (pFrameView->GetPresentationViewShellId() != SID_VIEWSHELL0) )
{ {
FrameView* pFrameView = pViewShell->GetFrameView(); ViewShell::ShellType ePreviousType (pFrameView->GetPreviousViewShellType());
pFrameView->SetPreviousViewShellType(ViewShell::ST_NONE);
if( pFrameView && (pFrameView->GetPresentationViewShellId() != SID_VIEWSHELL0) )
{
ViewShell::ShellType ePreviousType (pFrameView->GetPreviousViewShellType());
pFrameView->SetPreviousViewShellType(ViewShell::ST_NONE);
pFrameView->SetPresentationViewShellId(SID_VIEWSHELL0); pFrameView->SetPresentationViewShellId(SID_VIEWSHELL0);
pFrameView->SetPreviousViewShellType(pViewShell->GetShellType()); pFrameView->SetPreviousViewShellType(pViewShell->GetShellType());
framework::FrameworkHelper::Instance(*mpCurrentViewShellBase)->RequestView( framework::FrameworkHelper::Instance(*mpCurrentViewShellBase)->RequestView(
framework::FrameworkHelper::GetViewURL(ePreviousType), framework::FrameworkHelper::GetViewURL(ePreviousType),
framework::FrameworkHelper::msCenterPaneURL); framework::FrameworkHelper::msCenterPaneURL);
pViewShell->GetViewFrame()->GetBindings().InvalidateAll( true ); pViewShell->GetViewFrame()->GetBindings().InvalidateAll( true );
}
} }
} }
}
if( mpCurrentViewShellBase ) if( mpCurrentViewShellBase )
{
ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get();
if( pViewShell )
{ {
ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get(); // invalidate the view shell so the presentation slot will be re-enabled
if( pViewShell ) // and the rehearsing will be updated
{ pViewShell->Invalidate();
// invalidate the view shell so the presentation slot will be re-enabled
// and the rehearsing will be updated
pViewShell->Invalidate();
if( xController->meAnimationMode ==ANIMATIONMODE_SHOW ) if( xController->meAnimationMode ==ANIMATIONMODE_SHOW )
{
// switch to the previously visible Slide
DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>( pViewShell );
if( pDrawViewShell )
pDrawViewShell->SwitchPage( static_cast<sal_uInt16>(xController->getRestoreSlide()) );
else
{ {
// switch to the previously visible Slide Reference<XDrawView> xDrawView (
DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>( pViewShell ); Reference<XWeak>(&mpCurrentViewShellBase->GetDrawController()), UNO_QUERY);
if( pDrawViewShell ) if (xDrawView.is())
pDrawViewShell->SwitchPage( static_cast<sal_uInt16>(xController->getRestoreSlide()) ); xDrawView->setCurrentPage(
else Reference<XDrawPage>(
{ mpDoc->GetSdPage(xController->getRestoreSlide(), PageKind::Standard)->getUnoPage(),
Reference<XDrawView> xDrawView ( UNO_QUERY));
Reference<XWeak>(&mpCurrentViewShellBase->GetDrawController()), UNO_QUERY);
if (xDrawView.is())
xDrawView->setCurrentPage(
Reference<XDrawPage>(
mpDoc->GetSdPage(xController->getRestoreSlide(), PageKind::Standard)->getUnoPage(),
UNO_QUERY));
}
} }
}
if( pViewShell->GetDoc()->IsExitAfterPresenting() )
{
pViewShell->GetDoc()->SetExitAfterPresenting( false );
if( pViewShell->GetDoc()->IsExitAfterPresenting() ) Reference<frame::XDispatchProvider> xProvider(pViewShell->GetViewShellBase().GetController()->getFrame(),
UNO_QUERY);
if( xProvider.is() )
{ {
pViewShell->GetDoc()->SetExitAfterPresenting( false ); util::URL aURL;
aURL.Complete = ".uno:CloseFrame";
Reference<frame::XDispatchProvider> xProvider(pViewShell->GetViewShellBase().GetController()->getFrame(), uno::Reference< frame::XDispatch > xDispatch(
UNO_QUERY); xProvider->queryDispatch(
if( xProvider.is() ) aURL, OUString(), 0));
if( xDispatch.is() )
{ {
util::URL aURL; xDispatch->dispatch(aURL,
aURL.Complete = ".uno:CloseFrame"; uno::Sequence< beans::PropertyValue >());
uno::Reference< frame::XDispatch > xDispatch(
xProvider->queryDispatch(
aURL, OUString(), 0));
if( xDispatch.is() )
{
xDispatch->dispatch(aURL,
uno::Sequence< beans::PropertyValue >());
}
} }
} }
} }
//Fire the acc focus event when focus is switched back. The above method mpCurrentViewShellBase->GetWindow()->GrabFocus() will
//set focus to WorkWindow instead of the sd::window, so here call Shell's method to fire the focus event
if (pViewShell)
pViewShell->SwitchActiveViewFireFocus();
} }
mpCurrentViewShellBase = nullptr; //Fire the acc focus event when focus is switched back. The above method mpCurrentViewShellBase->GetWindow()->GrabFocus() will
//set focus to WorkWindow instead of the sd::window, so here call Shell's method to fire the focus event
if (pViewShell)
pViewShell->SwitchActiveViewFireFocus();
} }
mpCurrentViewShellBase = nullptr;
} }
void SAL_CALL SlideShow::rehearseTimings() void SAL_CALL SlideShow::rehearseTimings()
...@@ -1083,25 +1083,25 @@ void SlideShow::StartInPlacePresentation() ...@@ -1083,25 +1083,25 @@ void SlideShow::StartInPlacePresentation()
CreateController( nullptr, nullptr, mxCurrentSettings->mpParentWindow ); CreateController( nullptr, nullptr, mxCurrentSettings->mpParentWindow );
} }
if( mxController.is() ) if( !mxController.is() )
return;
bool bSuccess = false;
if( mxCurrentSettings.get() && mxCurrentSettings->mbPreview )
{ {
bool bSuccess = false; bSuccess = mxController->startPreview(mxCurrentSettings->mxStartPage, mxCurrentSettings->mxAnimationNode, mxCurrentSettings->mpParentWindow );
if( mxCurrentSettings.get() && mxCurrentSettings->mbPreview ) }
{ else
bSuccess = mxController->startPreview(mxCurrentSettings->mxStartPage, mxCurrentSettings->mxAnimationNode, mxCurrentSettings->mpParentWindow ); {
} bSuccess = mxController->startShow(mxCurrentSettings.get());
else }
{
bSuccess = mxController->startShow(mxCurrentSettings.get());
}
if( !bSuccess ) if( !bSuccess )
end(); end();
else else
{ {
if( mpCurrentViewShellBase && ( !mxCurrentSettings.get() || ( mxCurrentSettings.get() && !mxCurrentSettings->mbPreview ) ) ) if( mpCurrentViewShellBase && ( !mxCurrentSettings.get() || ( mxCurrentSettings.get() && !mxCurrentSettings->mbPreview ) ) )
mpCurrentViewShellBase->GetWindow()->GrabFocus(); mpCurrentViewShellBase->GetWindow()->GrabFocus();
}
} }
} }
...@@ -1120,34 +1120,34 @@ void SlideShow::StartFullscreenPresentation( ) ...@@ -1120,34 +1120,34 @@ void SlideShow::StartFullscreenPresentation( )
pWorkWindow->StartPresentationMode( true, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PresentationFlags::HideAllApps : PresentationFlags::NONE, nDisplay); pWorkWindow->StartPresentationMode( true, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PresentationFlags::HideAllApps : PresentationFlags::NONE, nDisplay);
// pWorkWindow->ShowFullScreenMode(sal_False, nDisplay); // pWorkWindow->ShowFullScreenMode(sal_False, nDisplay);
if (pWorkWindow->IsVisible()) if (!pWorkWindow->IsVisible())
{ return;
// Initialize the new presentation view shell with a copy of the
// frame view of the current view shell. This avoids that
// changes made by the presentation have an effect on the other
// view shells.
FrameView* pOriginalFrameView = nullptr;
::std::shared_ptr<ViewShell> xShell(mpCurrentViewShellBase->GetMainViewShell());
if (xShell.get())
pOriginalFrameView = xShell->GetFrameView();
delete mpFullScreenFrameView;
mpFullScreenFrameView = new FrameView(mpDoc, pOriginalFrameView);
// The new frame is created hidden. To make it visible and activate the
// new view shell--a prerequisite to process slot calls and initialize
// its panes--a GrabFocus() has to be called later on.
SfxFrame* pNewFrame = SfxFrame::CreateHidden( *mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID );
pNewFrame->SetPresentationMode(true);
mpFullScreenViewShellBase = static_cast<ViewShellBase*>(pNewFrame->GetCurrentViewFrame()->GetViewShell()); // Initialize the new presentation view shell with a copy of the
if(mpFullScreenViewShellBase != nullptr) // frame view of the current view shell. This avoids that
{ // changes made by the presentation have an effect on the other
// The following GrabFocus() is responsible for activating the // view shells.
// new view shell. Without it the screen remains blank (under FrameView* pOriginalFrameView = nullptr;
// Windows and some Linux variants.) ::std::shared_ptr<ViewShell> xShell(mpCurrentViewShellBase->GetMainViewShell());
mpFullScreenViewShellBase->GetWindow()->GrabFocus(); if (xShell.get())
} pOriginalFrameView = xShell->GetFrameView();
delete mpFullScreenFrameView;
mpFullScreenFrameView = new FrameView(mpDoc, pOriginalFrameView);
// The new frame is created hidden. To make it visible and activate the
// new view shell--a prerequisite to process slot calls and initialize
// its panes--a GrabFocus() has to be called later on.
SfxFrame* pNewFrame = SfxFrame::CreateHidden( *mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID );
pNewFrame->SetPresentationMode(true);
mpFullScreenViewShellBase = static_cast<ViewShellBase*>(pNewFrame->GetCurrentViewFrame()->GetViewShell());
if(mpFullScreenViewShellBase != nullptr)
{
// The following GrabFocus() is responsible for activating the
// new view shell. Without it the screen remains blank (under
// Windows and some Linux variants.)
mpFullScreenViewShellBase->GetWindow()->GrabFocus();
} }
} }
......
...@@ -444,42 +444,42 @@ void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow ...@@ -444,42 +444,42 @@ void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow
{ {
const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber(); const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber();
if( xShow.is() && (nCurrentSlideNumber != -1 ) ) if( !(xShow.is() && (nCurrentSlideNumber != -1 )) )
{ return;
Reference< XDrawPage > xSlide;
Reference< XAnimationNode > xAnimNode;
::std::vector<PropertyValue> aProperties;
const sal_Int32 nNextSlideNumber = getNextSlideNumber(); Reference< XDrawPage > xSlide;
if( getSlideAPI( nNextSlideNumber, xSlide, xAnimNode ) ) Reference< XAnimationNode > xAnimNode;
{ ::std::vector<PropertyValue> aProperties;
Sequence< Any > aValue(2);
aValue[0] <<= xSlide;
aValue[1] <<= xAnimNode;
aProperties.emplace_back( "Prefetch" ,
-1,
Any(aValue),
PropertyState_DIRECT_VALUE);
}
if (bSkipAllMainSequenceEffects)
{
// Add one property that prevents the slide transition from being
// shown (to speed up the transition to the previous slide) and
// one to show all main sequence effects so that the user can
// continue to undo effects.
aProperties.emplace_back( "SkipAllMainSequenceEffects",
-1,
Any(true),
PropertyState_DIRECT_VALUE);
aProperties.emplace_back("SkipSlideTransition",
-1,
Any(true),
PropertyState_DIRECT_VALUE);
}
if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) ) const sal_Int32 nNextSlideNumber = getNextSlideNumber();
xShow->displaySlide( xSlide, xDrawPages, xAnimNode, comphelper::containerToSequence(aProperties) ); if( getSlideAPI( nNextSlideNumber, xSlide, xAnimNode ) )
{
Sequence< Any > aValue(2);
aValue[0] <<= xSlide;
aValue[1] <<= xAnimNode;
aProperties.emplace_back( "Prefetch" ,
-1,
Any(aValue),
PropertyState_DIRECT_VALUE);
}
if (bSkipAllMainSequenceEffects)
{
// Add one property that prevents the slide transition from being
// shown (to speed up the transition to the previous slide) and
// one to show all main sequence effects so that the user can
// continue to undo effects.
aProperties.emplace_back( "SkipAllMainSequenceEffects",
-1,
Any(true),
PropertyState_DIRECT_VALUE);
aProperties.emplace_back("SkipSlideTransition",
-1,
Any(true),
PropertyState_DIRECT_VALUE);
} }
if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) )
xShow->displaySlide( xSlide, xDrawPages, xAnimNode, comphelper::containerToSequence(aProperties) );
} }
static constexpr OUStringLiteral gsOnClick( "OnClick" ); static constexpr OUStringLiteral gsOnClick( "OnClick" );
...@@ -1196,7 +1196,10 @@ bool SlideshowImpl::longpress(const CommandLongPressData &rLongPressData) ...@@ -1196,7 +1196,10 @@ bool SlideshowImpl::longpress(const CommandLongPressData &rLongPressData)
void SlideshowImpl::removeShapeEvents() void SlideshowImpl::removeShapeEvents()
{ {
if( mxShow.is() && mxListenerProxy.is() ) try if( !(mxShow.is() && mxListenerProxy.is()) )
return;
try
{ {
for( const auto& rEntry : maShapeEventMap ) for( const auto& rEntry : maShapeEventMap )
{ {
...@@ -1215,7 +1218,10 @@ void SlideshowImpl::removeShapeEvents() ...@@ -1215,7 +1218,10 @@ void SlideshowImpl::removeShapeEvents()
void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber) void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber)
{ {
if( nSlideNumber >= 0 ) try if( nSlideNumber < 0 )
return;
try
{ {
Reference< XDrawPagesSupplier > xDrawPages( mxModel, UNO_QUERY_THROW ); Reference< XDrawPagesSupplier > xDrawPages( mxModel, UNO_QUERY_THROW );
Reference< XIndexAccess > xPages( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); Reference< XIndexAccess > xPages( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
...@@ -1362,7 +1368,10 @@ void SAL_CALL SlideshowImpl::pause() ...@@ -1362,7 +1368,10 @@ void SAL_CALL SlideshowImpl::pause()
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
if( !mbIsPaused ) try if( mbIsPaused )
return;
try
{ {
mbIsPaused = true; mbIsPaused = true;
if( mxShow.is() ) if( mxShow.is() )
...@@ -1845,75 +1854,75 @@ IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent&, rSimpleEvent, void ...@@ -1845,75 +1854,75 @@ IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent&, rSimpleEvent, void
if( !mxShow.is() || mbInputFreeze ) if( !mxShow.is() || mbInputFreeze )
return; return;
if( (rSimpleEvent.GetId() == VclEventId::WindowCommand) && static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData() ) if( !((rSimpleEvent.GetId() == VclEventId::WindowCommand) && static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData()) )
{ return;
const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData());
if( rEvent.GetCommand() == CommandEventId::Media ) const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData());
{
CommandMediaData* pMediaData = rEvent.GetMediaData(); if( rEvent.GetCommand() != CommandEventId::Media )
pMediaData->SetPassThroughToOS(false); return;
switch (pMediaData->GetMediaId())
{ CommandMediaData* pMediaData = rEvent.GetMediaData();
pMediaData->SetPassThroughToOS(false);
switch (pMediaData->GetMediaId())
{
#if defined( MACOSX ) #if defined( MACOSX )
case MediaCommand::Menu: case MediaCommand::Menu:
if( !mnContextMenuEvent ) if( !mnContextMenuEvent )
{ {
if( mpShowWindow ) if( mpShowWindow )
maPopupMousePos = mpShowWindow->GetPointerState().maPos; maPopupMousePos = mpShowWindow->GetPointerState().maPos;
mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) ); mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
} }
break; break;
case MediaCommand::VolumeDown: case MediaCommand::VolumeDown:
gotoPreviousSlide(); gotoPreviousSlide();
break; break;
case MediaCommand::VolumeUp: case MediaCommand::VolumeUp:
gotoNextEffect(); gotoNextEffect();
break; break;
#endif #endif
case MediaCommand::NextTrack: case MediaCommand::NextTrack:
gotoNextEffect(); gotoNextEffect();
break; break;
case MediaCommand::Pause: case MediaCommand::Pause:
if( !mbIsPaused ) if( !mbIsPaused )
blankScreen(0); blankScreen(0);
break; break;
case MediaCommand::Play: case MediaCommand::Play:
if( mbIsPaused ) if( mbIsPaused )
resume(); resume();
break; break;
case MediaCommand::PlayPause: case MediaCommand::PlayPause:
if( mbIsPaused ) if( mbIsPaused )
resume(); resume();
else else
blankScreen(0); blankScreen(0);
break; break;
case MediaCommand::PreviousTrack: case MediaCommand::PreviousTrack:
gotoPreviousSlide(); gotoPreviousSlide();
break; break;
case MediaCommand::NextTrackHold: case MediaCommand::NextTrackHold:
gotoLastSlide(); gotoLastSlide();
break; break;
case MediaCommand::Rewind: case MediaCommand::Rewind:
gotoFirstSlide(); gotoFirstSlide();
break; break;
case MediaCommand::Stop: case MediaCommand::Stop:
// in case the user cancels the presentation, switch to current slide // in case the user cancels the presentation, switch to current slide
// in edit mode // in edit mode
if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) ) if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
{ {
if( mpSlideController->getCurrentSlideNumber() != -1 ) if( mpSlideController->getCurrentSlideNumber() != -1 )
mnRestoreSlide = mpSlideController->getCurrentSlideNumber(); mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
}
endPresentation();
break;
default:
pMediaData->SetPassThroughToOS(true);
break;
}
} }
endPresentation();
break;
default:
pMediaData->SetPassThroughToOS(true);
break;
} }
} }
...@@ -2225,83 +2234,83 @@ void SlideshowImpl::createSlideList( bool bAll, const OUString& rPresSlide ) ...@@ -2225,83 +2234,83 @@ void SlideshowImpl::createSlideList( bool bAll, const OUString& rPresSlide )
{ {
const sal_uInt16 nSlideCount = mpDoc->GetSdPageCount( PageKind::Standard ); const sal_uInt16 nSlideCount = mpDoc->GetSdPageCount( PageKind::Standard );
if( nSlideCount ) if( !nSlideCount )
{ return;
SdCustomShow* pCustomShow;
if( mpDoc->GetCustomShowList() && maPresSettings.mbCustomShow ) SdCustomShow* pCustomShow;
pCustomShow = mpDoc->GetCustomShowList()->GetCurObject();
else
pCustomShow = nullptr;
// create animation slide controller if( mpDoc->GetCustomShowList() && maPresSettings.mbCustomShow )
AnimationSlideController::Mode eMode = pCustomShow = mpDoc->GetCustomShowList()->GetCurObject();
( pCustomShow && !pCustomShow->PagesVector().empty() ) ? AnimationSlideController::CUSTOM : else
(bAll ? AnimationSlideController::ALL : AnimationSlideController::FROM); pCustomShow = nullptr;
Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW ); // create animation slide controller
Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); AnimationSlideController::Mode eMode =
mpSlideController.reset( new AnimationSlideController( xSlides, eMode ) ); ( pCustomShow && !pCustomShow->PagesVector().empty() ) ? AnimationSlideController::CUSTOM :
(bAll ? AnimationSlideController::ALL : AnimationSlideController::FROM);
Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW );
Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
mpSlideController.reset( new AnimationSlideController( xSlides, eMode ) );
if( eMode != AnimationSlideController::CUSTOM ) if( eMode != AnimationSlideController::CUSTOM )
{
sal_Int32 nFirstVisibleSlide = 0;
// normal presentation
if( !rPresSlide.isEmpty() )
{ {
sal_Int32 nFirstVisibleSlide = 0; sal_Int32 nSlide;
bool bTakeNextAvailable = false;
// normal presentation for( nSlide = 0, nFirstVisibleSlide = -1;
if( !rPresSlide.isEmpty() ) ( nSlide < nSlideCount ) && ( -1 == nFirstVisibleSlide ); nSlide++ )
{ {
sal_Int32 nSlide; SdPage* pTestSlide = mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard );
bool bTakeNextAvailable = false;
for( nSlide = 0, nFirstVisibleSlide = -1; if( pTestSlide->GetName() == rPresSlide )
( nSlide < nSlideCount ) && ( -1 == nFirstVisibleSlide ); nSlide++ )
{ {
SdPage* pTestSlide = mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard ); if( pTestSlide->IsExcluded() )
bTakeNextAvailable = true;
if( pTestSlide->GetName() == rPresSlide ) else
{
if( pTestSlide->IsExcluded() )
bTakeNextAvailable = true;
else
nFirstVisibleSlide = nSlide;
}
else if( bTakeNextAvailable && !pTestSlide->IsExcluded() )
nFirstVisibleSlide = nSlide; nFirstVisibleSlide = nSlide;
} }
else if( bTakeNextAvailable && !pTestSlide->IsExcluded() )
if( -1 == nFirstVisibleSlide ) nFirstVisibleSlide = nSlide;
nFirstVisibleSlide = 0;
} }
for( sal_Int32 i = 0; i < nSlideCount; i++ ) if( -1 == nFirstVisibleSlide )
{ nFirstVisibleSlide = 0;
bool bVisible = ! mpDoc->GetSdPage( static_cast<sal_uInt16>(i), PageKind::Standard )->IsExcluded(); }
if( bVisible || (eMode == AnimationSlideController::ALL) )
mpSlideController->insertSlideNumber( i, bVisible );
}
mpSlideController->setStartSlideNumber( nFirstVisibleSlide ); for( sal_Int32 i = 0; i < nSlideCount; i++ )
{
bool bVisible = ! mpDoc->GetSdPage( static_cast<sal_uInt16>(i), PageKind::Standard )->IsExcluded();
if( bVisible || (eMode == AnimationSlideController::ALL) )
mpSlideController->insertSlideNumber( i, bVisible );
} }
else
mpSlideController->setStartSlideNumber( nFirstVisibleSlide );
}
else
{
if( meAnimationMode != ANIMATIONMODE_SHOW && !rPresSlide.isEmpty() )
{ {
if( meAnimationMode != ANIMATIONMODE_SHOW && !rPresSlide.isEmpty() ) sal_Int32 nSlide;
{ for( nSlide = 0; nSlide < nSlideCount; nSlide++ )
sal_Int32 nSlide; if( rPresSlide == mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard )->GetName() )
for( nSlide = 0; nSlide < nSlideCount; nSlide++ ) break;
if( rPresSlide == mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard )->GetName() )
break;
if( nSlide < nSlideCount ) if( nSlide < nSlideCount )
mpSlideController->insertSlideNumber( static_cast<sal_uInt16>(nSlide) ); mpSlideController->insertSlideNumber( static_cast<sal_uInt16>(nSlide) );
} }
for( const auto& rpPage : pCustomShow->PagesVector() ) for( const auto& rpPage : pCustomShow->PagesVector() )
{ {
const sal_uInt16 nSdSlide = ( rpPage->GetPageNum() - 1 ) / 2; const sal_uInt16 nSdSlide = ( rpPage->GetPageNum() - 1 ) / 2;
if( ! mpDoc->GetSdPage( nSdSlide, PageKind::Standard )->IsExcluded()) if( ! mpDoc->GetSdPage( nSdSlide, PageKind::Standard )->IsExcluded())
mpSlideController->insertSlideNumber( nSdSlide ); mpSlideController->insertSlideNumber( nSdSlide );
}
} }
} }
} }
...@@ -2325,22 +2334,22 @@ void SlideshowImpl::hideChildWindows() ...@@ -2325,22 +2334,22 @@ void SlideshowImpl::hideChildWindows()
{ {
mnChildMask = 0; mnChildMask = 0;
if( ANIMATIONMODE_SHOW == meAnimationMode ) if( ANIMATIONMODE_SHOW != meAnimationMode )
return;
SfxViewFrame* pViewFrame = getViewFrame();
if( !pViewFrame )
return;
for( sal_uLong i = 0; i < SAL_N_ELEMENTS( aShowChildren ); i++ )
{ {
SfxViewFrame* pViewFrame = getViewFrame(); const sal_uInt16 nId = ( *aShowChildren[ i ] )();
if( pViewFrame ) if( pViewFrame->GetChildWindow( nId ) )
{ {
for( sal_uLong i = 0; i < SAL_N_ELEMENTS( aShowChildren ); i++ ) pViewFrame->SetChildWindow( nId, false );
{ mnChildMask |= 1 << i;
const sal_uInt16 nId = ( *aShowChildren[ i ] )();
if( pViewFrame->GetChildWindow( nId ) )
{
pViewFrame->SetChildWindow( nId, false );
mnChildMask |= 1 << i;
}
}
} }
} }
} }
...@@ -2402,32 +2411,32 @@ void SlideshowImpl::setActiveXToolbarsVisible( bool bVisible ) ...@@ -2402,32 +2411,32 @@ void SlideshowImpl::setActiveXToolbarsVisible( bool bVisible )
{ {
// in case of ActiveX control the toolbars should not be visible if slide show runs in window mode // in case of ActiveX control the toolbars should not be visible if slide show runs in window mode
// actually it runs always in window mode in case of ActiveX control // actually it runs always in window mode in case of ActiveX control
if ( !maPresSettings.mbFullScreen && mpDocSh && mpDocSh->GetMedium() ) if ( !(!maPresSettings.mbFullScreen && mpDocSh && mpDocSh->GetMedium()) )
return;
const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(mpDocSh->GetMedium()->GetItemSet(), SID_VIEWONLY, false);
if ( !(pItem && pItem->GetValue()) )
return;
// this is a plugin/activex mode, no toolbars should be visible during slide show
// after the end of slide show they should be visible again
SfxViewFrame* pViewFrame = getViewFrame();
if( !pViewFrame )
return;
try
{ {
const SfxBoolItem* pItem = SfxItemSet::GetItem<SfxBoolItem>(mpDocSh->GetMedium()->GetItemSet(), SID_VIEWONLY, false); Reference< frame::XLayoutManager > xLayoutManager;
if ( pItem && pItem->GetValue() ) Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetFrameInterface(), UNO_QUERY_THROW );
if ( ( xFrameProps->getPropertyValue( "LayoutManager" )
>>= xLayoutManager )
&& xLayoutManager.is() )
{ {
// this is a plugin/activex mode, no toolbars should be visible during slide show xLayoutManager->setVisible( bVisible );
// after the end of slide show they should be visible again
SfxViewFrame* pViewFrame = getViewFrame();
if( pViewFrame )
{
try
{
Reference< frame::XLayoutManager > xLayoutManager;
Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetFrameInterface(), UNO_QUERY_THROW );
if ( ( xFrameProps->getPropertyValue( "LayoutManager" )
>>= xLayoutManager )
&& xLayoutManager.is() )
{
xLayoutManager->setVisible( bVisible );
}
}
catch( uno::Exception& )
{}
}
} }
} }
catch( uno::Exception& )
{}
} }
void SAL_CALL SlideshowImpl::activate() void SAL_CALL SlideshowImpl::activate()
...@@ -2436,37 +2445,37 @@ void SAL_CALL SlideshowImpl::activate() ...@@ -2436,37 +2445,37 @@ void SAL_CALL SlideshowImpl::activate()
maDeactivateTimer.Stop(); maDeactivateTimer.Stop();
if( !mbActive && mxShow.is() ) if( !(!mbActive && mxShow.is()) )
return;
mbActive = true;
if( ANIMATIONMODE_SHOW == meAnimationMode )
{ {
mbActive = true; if( mbAutoSaveWasOn )
setAutoSaveState( false );
if( ANIMATIONMODE_SHOW == meAnimationMode ) if( mpShowWindow )
{ {
if( mbAutoSaveWasOn ) SfxViewFrame* pViewFrame = getViewFrame();
setAutoSaveState( false ); SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : nullptr;
if( mpShowWindow )
{
SfxViewFrame* pViewFrame = getViewFrame();
SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : nullptr;
hideChildWindows(); hideChildWindows();
if( pDispatcher ) if( pDispatcher )
{ {
// filter all forbidden slots // filter all forbidden slots
pDispatcher->SetSlotFilter( SfxSlotFilterState::ENABLED, pAllowed ); pDispatcher->SetSlotFilter( SfxSlotFilterState::ENABLED, pAllowed );
} }
if( getBindings() ) if( getBindings() )
getBindings()->InvalidateAll(true); getBindings()->InvalidateAll(true);
mpShowWindow->GrabFocus(); mpShowWindow->GrabFocus();
}
} }
resume();
} }
resume();
} }
void SAL_CALL SlideshowImpl::deactivate() void SAL_CALL SlideshowImpl::deactivate()
...@@ -2481,21 +2490,21 @@ void SAL_CALL SlideshowImpl::deactivate() ...@@ -2481,21 +2490,21 @@ void SAL_CALL SlideshowImpl::deactivate()
IMPL_LINK_NOARG(SlideshowImpl, deactivateHdl, Timer *, void) IMPL_LINK_NOARG(SlideshowImpl, deactivateHdl, Timer *, void)
{ {
if( mbActive && mxShow.is() ) if( !(mbActive && mxShow.is()) )
{ return;
mbActive = false;
pause(); mbActive = false;
if( ANIMATIONMODE_SHOW == meAnimationMode ) pause();
{
if( mbAutoSaveWasOn )
setAutoSaveState( true );
if( mpShowWindow ) if( ANIMATIONMODE_SHOW == meAnimationMode )
{ {
showChildWindows(); if( mbAutoSaveWasOn )
} setAutoSaveState( true );
if( mpShowWindow )
{
showChildWindows();
} }
} }
} }
...@@ -2629,7 +2638,10 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) ...@@ -2629,7 +2638,10 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen )
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
mbUsePen = bMouseAsPen; mbUsePen = bMouseAsPen;
if( mxShow.is() ) try if( !mxShow.is() )
return;
try
{ {
// For Pencolor; // For Pencolor;
Any aValue; Any aValue;
...@@ -2690,21 +2702,24 @@ void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) ...@@ -2690,21 +2702,24 @@ void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor )
void SlideshowImpl::setEraseAllInk(bool bEraseAllInk) void SlideshowImpl::setEraseAllInk(bool bEraseAllInk)
{ {
if( bEraseAllInk ) if( !bEraseAllInk )
return;
SolarMutexGuard aSolarGuard;
if( !mxShow.is() )
return;
try
{ {
SolarMutexGuard aSolarGuard; beans::PropertyValue aPenPropEraseAllInk;
if( mxShow.is() ) try aPenPropEraseAllInk.Name = "EraseAllInk";
{ aPenPropEraseAllInk.Value <<= bEraseAllInk;
beans::PropertyValue aPenPropEraseAllInk; mxShow->setProperty( aPenPropEraseAllInk );
aPenPropEraseAllInk.Name = "EraseAllInk"; }
aPenPropEraseAllInk.Value <<= bEraseAllInk; catch( Exception& )
mxShow->setProperty( aPenPropEraseAllInk ); {
} SAL_WARN( "sd.slideshow", "sd::SlideshowImpl::setEraseAllInk(), "
catch( Exception& ) "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
{
SAL_WARN( "sd.slideshow", "sd::SlideshowImpl::setEraseAllInk(), "
"exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
}
} }
} }
...@@ -2719,25 +2734,25 @@ void SAL_CALL SlideshowImpl::gotoNextEffect( ) ...@@ -2719,25 +2734,25 @@ void SAL_CALL SlideshowImpl::gotoNextEffect( )
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
if( mxShow.is() && mpSlideController.get() && mpShowWindow ) if( !(mxShow.is() && mpSlideController.get() && mpShowWindow) )
{ return;
if( mbIsPaused )
resume();
const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); if( mbIsPaused )
if( eMode == SHOWWINDOWMODE_END ) resume();
{
endPresentation(); const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
} if( eMode == SHOWWINDOWMODE_END )
else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) {
{ endPresentation();
mpShowWindow->RestartShow(); }
} else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
else {
{ mpShowWindow->RestartShow();
mxShow->nextEffect(); }
update(); else
} {
mxShow->nextEffect();
update();
} }
} }
...@@ -2745,21 +2760,21 @@ void SAL_CALL SlideshowImpl::gotoPreviousEffect( ) ...@@ -2745,21 +2760,21 @@ void SAL_CALL SlideshowImpl::gotoPreviousEffect( )
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
if( mxShow.is() && mpSlideController.get() && mpShowWindow ) if( !(mxShow.is() && mpSlideController.get() && mpShowWindow) )
{ return;
if( mbIsPaused )
resume();
const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); if( mbIsPaused )
if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) resume();
{
mpShowWindow->RestartShow(); const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
} if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
else {
{ mpShowWindow->RestartShow();
mxShow->previousEffect(); }
update(); else
} {
mxShow->previousEffect();
update();
} }
} }
...@@ -2767,20 +2782,20 @@ void SAL_CALL SlideshowImpl::gotoFirstSlide( ) ...@@ -2767,20 +2782,20 @@ void SAL_CALL SlideshowImpl::gotoFirstSlide( )
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
if( mpShowWindow && mpSlideController.get() ) if( !(mpShowWindow && mpSlideController.get()) )
{ return;
if( mbIsPaused )
resume();
if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END ) if( mbIsPaused )
{ resume();
if( mpSlideController->getSlideIndexCount() )
mpShowWindow->RestartShow( 0); if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
} {
else if( mpSlideController->getSlideIndexCount() )
{ mpShowWindow->RestartShow( 0);
displaySlideIndex( 0 ); }
} else
{
displaySlideIndex( 0 );
} }
} }
...@@ -2864,7 +2879,10 @@ void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects) ...@@ -2864,7 +2879,10 @@ void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects)
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
if( mxShow.is() && mpSlideController.get() ) try if( !(mxShow.is() && mpSlideController.get()) )
return;
try
{ {
if( mbIsPaused ) if( mbIsPaused )
resume(); resume();
...@@ -2909,22 +2927,22 @@ void SAL_CALL SlideshowImpl::gotoLastSlide() ...@@ -2909,22 +2927,22 @@ void SAL_CALL SlideshowImpl::gotoLastSlide()
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
if( mpSlideController.get() ) if( !mpSlideController.get() )
{ return;
if( mbIsPaused )
resume();
const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1; if( mbIsPaused )
if( nLastSlideIndex >= 0 ) resume();
const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1;
if( nLastSlideIndex >= 0 )
{
if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
{ {
if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END ) mpShowWindow->RestartShow( nLastSlideIndex );
{ }
mpShowWindow->RestartShow( nLastSlideIndex ); else
} {
else displaySlideIndex( nLastSlideIndex );
{
displaySlideIndex( nLastSlideIndex );
}
} }
} }
} }
...@@ -2945,18 +2963,18 @@ void SAL_CALL SlideshowImpl::gotoSlide( const Reference< XDrawPage >& xSlide ) ...@@ -2945,18 +2963,18 @@ void SAL_CALL SlideshowImpl::gotoSlide( const Reference< XDrawPage >& xSlide )
{ {
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
if( mpSlideController.get() && xSlide.is() ) if( !(mpSlideController.get() && xSlide.is()) )
{ return;
if( mbIsPaused )
resume();
const sal_Int32 nSlideCount = mpSlideController->getSlideNumberCount(); if( mbIsPaused )
for( sal_Int32 nSlide = 0; nSlide < nSlideCount; nSlide++ ) resume();
const sal_Int32 nSlideCount = mpSlideController->getSlideNumberCount();
for( sal_Int32 nSlide = 0; nSlide < nSlideCount; nSlide++ )
{
if( mpSlideController->getSlideByNumber( nSlide ) == xSlide )
{ {
if( mpSlideController->getSlideByNumber( nSlide ) == xSlide ) displaySlideNumber( nSlide );
{
displaySlideNumber( nSlide );
}
} }
} }
} }
......
...@@ -487,22 +487,22 @@ awt::Rectangle SAL_CALL SlideShowView::getCanvasArea( ) ...@@ -487,22 +487,22 @@ awt::Rectangle SAL_CALL SlideShowView::getCanvasArea( )
void SlideShowView::updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow ) void SlideShowView::updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow )
{ {
if( pSlideShow ) if( !pSlideShow )
return;
::rtl::Reference< SlideshowImpl > aSLGuard( pSlideShow );
if( mbFirstPaint )
{ {
::rtl::Reference< SlideshowImpl > aSLGuard( pSlideShow ); mbFirstPaint = false;
SlideshowImpl* pTmpSlideShow = mpSlideShow;
rGuard.clear();
if( pTmpSlideShow )
pTmpSlideShow->onFirstPaint();
} else
rGuard.clear();
if( mbFirstPaint ) pSlideShow->startUpdateTimer();
{
mbFirstPaint = false;
SlideshowImpl* pTmpSlideShow = mpSlideShow;
rGuard.clear();
if( pTmpSlideShow )
pTmpSlideShow->onFirstPaint();
} else
rGuard.clear();
pSlideShow->startUpdateTimer();
}
} }
// XWindowListener methods // XWindowListener methods
...@@ -662,18 +662,18 @@ void SlideShowView::init() ...@@ -662,18 +662,18 @@ void SlideShowView::init()
// #i48939# only switch on kind of hacky scroll optimization, when // #i48939# only switch on kind of hacky scroll optimization, when
// running fullscreen. this minimizes the probability that other // running fullscreen. this minimizes the probability that other
// windows partially cover the show. // windows partially cover the show.
if( mbFullScreen ) if( !mbFullScreen )
return;
try
{
Reference< beans::XPropertySet > xCanvasProps( getCanvas(),
uno::UNO_QUERY_THROW );
xCanvasProps->setPropertyValue("UnsafeScrolling",
uno::makeAny( true ) );
}
catch( uno::Exception& )
{ {
try
{
Reference< beans::XPropertySet > xCanvasProps( getCanvas(),
uno::UNO_QUERY_THROW );
xCanvasProps->setPropertyValue("UnsafeScrolling",
uno::makeAny( true ) );
}
catch( uno::Exception& )
{
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment