sd/source/ui/sidebar/MasterPageContainer.cxx | 58 +- sd/source/ui/sidebar/MasterPageObserver.cxx | 138 ++-- sd/source/ui/sidebar/MasterPagesSelector.cxx | 56 +- sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx | 49 - sd/source/ui/slideshow/PaneHider.cxx | 5 sd/source/ui/slideshow/SlideShowRestarter.cxx | 78 +- sd/source/ui/slideshow/showwin.cxx | 24 sd/source/ui/slideshow/slideshow.cxx | 278 ++++----- sd/source/ui/slideshow/slideshowimpl.cxx | 640 +++++++++++------------ sd/source/ui/slideshow/slideshowviewimpl.cxx | 50 - 10 files changed, 698 insertions(+), 678 deletions(-)
New commits: commit 954397df73b182e105e3ae5dff40c36a96239b08 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 14 09:11:43 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Feb 15 07:51:58 2019 +0100 loplugin:flatten in sd/source/ui/sidebar Change-Id: I1a636fdfc505e7927b8833ad55110f6ed8fe360d Reviewed-on: https://gerrit.libreoffice.org/67832 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index 1368400e6626..f96cb090ad25 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -264,24 +264,24 @@ void MasterPageContainer::AcquireToken (Token aToken) void MasterPageContainer::ReleaseToken (Token aToken) { SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken); - if (pDescriptor.get() != nullptr) - { - OSL_ASSERT(pDescriptor->mnUseCount>0); - --pDescriptor->mnUseCount; - if (pDescriptor->mnUseCount <= 0) - { - switch (pDescriptor->meOrigin) - { - case DEFAULT: - case TEMPLATE: - default: - break; + if (pDescriptor.get() == nullptr) + return; - case MASTERPAGE: - mpImpl->ReleaseDescriptor(aToken); - break; - } - } + OSL_ASSERT(pDescriptor->mnUseCount>0); + --pDescriptor->mnUseCount; + if (pDescriptor->mnUseCount > 0) + return; + + switch (pDescriptor->meOrigin) + { + case DEFAULT: + case TEMPLATE: + default: + break; + + case MASTERPAGE: + mpImpl->ReleaseDescriptor(aToken); + break; } } @@ -522,21 +522,21 @@ void MasterPageContainer::Implementation::LateInit() { const ::osl::MutexGuard aGuard (maMutex); - if (meInitializationState == NOT_INITIALIZED) - { - meInitializationState = INITIALIZING; + if (meInitializationState != NOT_INITIALIZED) + return; - OSL_ASSERT(Instance().get()==this); - mpRequestQueue.reset(MasterPageContainerQueue::Create( - std::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance()))); + meInitializationState = INITIALIZING; - mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create( - std::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)), - 5, - 50); + OSL_ASSERT(Instance().get()==this); + mpRequestQueue.reset(MasterPageContainerQueue::Create( + std::shared_ptr<MasterPageContainerQueue::ContainerAdapter>(Instance()))); - meInitializationState = INITIALIZED; - } + mpFillerTask = ::sd::tools::TimerBasedTaskExecution::Create( + std::shared_ptr<tools::AsynchronousTask>(new MasterPageContainerFiller(*this)), + 5, + 50); + + meInitializationState = INITIALIZED; } void MasterPageContainer::Implementation::AddChangeListener (const Link<MasterPageContainerChangeEvent&,void>& rLink) diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx index d13a418fc918..eee288d021c3 100644 --- a/sd/source/ui/sidebar/MasterPageObserver.cxx +++ b/sd/source/ui/sidebar/MasterPageObserver.cxx @@ -186,24 +186,24 @@ void MasterPageObserver::Implementation::AddEventListener ( if (::std::find ( maListeners.begin(), maListeners.end(), - rEventListener) == maListeners.end()) - { - maListeners.push_back (rEventListener); + rEventListener) != maListeners.end()) + return; + + maListeners.push_back (rEventListener); - // Tell the new listener about all the master pages that are - // currently in use. - for (const auto& rDocument : maUsedMasterPages) + // Tell the new listener about all the master pages that are + // currently in use. + for (const auto& rDocument : maUsedMasterPages) + { + ::std::set<OUString>::reverse_iterator aNameIterator; + for (aNameIterator=rDocument.second.rbegin(); + aNameIterator!=rDocument.second.rend(); + ++aNameIterator) { - ::std::set<OUString>::reverse_iterator aNameIterator; - for (aNameIterator=rDocument.second.rbegin(); - aNameIterator!=rDocument.second.rend(); - ++aNameIterator) - { - MasterPageObserverEvent aEvent ( - MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS, - *aNameIterator); - SendEvent (aEvent); - } + MasterPageObserverEvent aEvent ( + MasterPageObserverEvent::ET_MASTER_PAGE_EXISTS, + *aNameIterator); + SendEvent (aEvent); } } } @@ -223,31 +223,31 @@ void MasterPageObserver::Implementation::Notify( const SfxHint& rHint) { const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint); - if (pSdrHint) + if (!pSdrHint) + return; + + switch (pSdrHint->GetKind()) { - switch (pSdrHint->GetKind()) - { - case SdrHintKind::PageOrderChange: - // Process the modified set of pages only when the number of - // standard and notes master pages are equal. This test - // filters out events that are sent in between the insertion - // of a new standard master page and a new notes master - // page. - if (dynamic_cast< const SdDrawDocument *>( &rBroadcaster ) != nullptr) + case SdrHintKind::PageOrderChange: + // Process the modified set of pages only when the number of + // standard and notes master pages are equal. This test + // filters out events that are sent in between the insertion + // of a new standard master page and a new notes master + // page. + if (dynamic_cast< const SdDrawDocument *>( &rBroadcaster ) != nullptr) + { + SdDrawDocument& rDocument ( + static_cast<SdDrawDocument&>(rBroadcaster)); + if (rDocument.GetMasterSdPageCount(PageKind::Standard) + == rDocument.GetMasterSdPageCount(PageKind::Notes)) { - SdDrawDocument& rDocument ( - static_cast<SdDrawDocument&>(rBroadcaster)); - if (rDocument.GetMasterSdPageCount(PageKind::Standard) - == rDocument.GetMasterSdPageCount(PageKind::Notes)) - { - AnalyzeUsedMasterPages (rDocument); - } + AnalyzeUsedMasterPages (rDocument); } - break; + } + break; - default: - break; - } + default: + break; } } @@ -268,41 +268,41 @@ void MasterPageObserver::Implementation::AnalyzeUsedMasterPages ( std::vector<OUString> aRemovedMasterPages; MasterPageContainer::iterator aOldMasterPagesDescriptor ( maUsedMasterPages.find(&rDocument)); - if (aOldMasterPagesDescriptor != maUsedMasterPages.end()) + if (aOldMasterPagesDescriptor == maUsedMasterPages.end()) + return; + + // Send events about the newly used master pages. + ::std::set_difference ( + aCurrentMasterPages.begin(), + aCurrentMasterPages.end(), + aOldMasterPagesDescriptor->second.begin(), + aOldMasterPagesDescriptor->second.end(), + std::back_inserter(aNewMasterPages)); + for (auto& aNewMasterPage : aNewMasterPages) { - // Send events about the newly used master pages. - ::std::set_difference ( - aCurrentMasterPages.begin(), - aCurrentMasterPages.end(), - aOldMasterPagesDescriptor->second.begin(), - aOldMasterPagesDescriptor->second.end(), - std::back_inserter(aNewMasterPages)); - for (auto& aNewMasterPage : aNewMasterPages) - { - MasterPageObserverEvent aEvent ( - MasterPageObserverEvent::ET_MASTER_PAGE_ADDED, - aNewMasterPage); - SendEvent (aEvent); - } - - // Send events about master pages that are not used any longer. - ::std::set_difference ( - aOldMasterPagesDescriptor->second.begin(), - aOldMasterPagesDescriptor->second.end(), - aCurrentMasterPages.begin(), - aCurrentMasterPages.end(), - std::back_inserter(aRemovedMasterPages)); - for (auto& aRemovedMasterPage : aRemovedMasterPages) - { - MasterPageObserverEvent aEvent ( - MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED, - aRemovedMasterPage); - SendEvent (aEvent); - } + MasterPageObserverEvent aEvent ( + MasterPageObserverEvent::ET_MASTER_PAGE_ADDED, + aNewMasterPage); + SendEvent (aEvent); + } - // Store the new list of master pages. - aOldMasterPagesDescriptor->second = aCurrentMasterPages; + // Send events about master pages that are not used any longer. + ::std::set_difference ( + aOldMasterPagesDescriptor->second.begin(), + aOldMasterPagesDescriptor->second.end(), + aCurrentMasterPages.begin(), + aCurrentMasterPages.end(), + std::back_inserter(aRemovedMasterPages)); + for (auto& aRemovedMasterPage : aRemovedMasterPages) + { + MasterPageObserverEvent aEvent ( + MasterPageObserverEvent::ET_MASTER_PAGE_REMOVED, + aRemovedMasterPage); + SendEvent (aEvent); } + + // Store the new list of master pages. + aOldMasterPagesDescriptor->second = aCurrentMasterPages; } void MasterPageObserver::Implementation::SendEvent ( diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index 9e3eb76c7fc5..1bf528861cc8 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -466,40 +466,40 @@ void MasterPagesSelector::SetItem ( RemoveTokenToIndexEntry(nIndex,aToken); - if (nIndex > 0) + if (nIndex <= 0) + return; + + if (aToken != MasterPageContainer::NIL_TOKEN) { - if (aToken != MasterPageContainer::NIL_TOKEN) - { - Image aPreview (mpContainer->GetPreviewForToken(aToken)); - MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken)); + Image aPreview (mpContainer->GetPreviewForToken(aToken)); + MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken)); - if (aPreview.GetSizePixel().Width()>0) + if (aPreview.GetSizePixel().Width()>0) + { + if (PreviewValueSet::GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND) { - if (PreviewValueSet::GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND) - { - PreviewValueSet::SetItemImage(nIndex,aPreview); - PreviewValueSet::SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken)); - } - else - { - PreviewValueSet::InsertItem ( - nIndex, - aPreview, - mpContainer->GetPageNameForToken(aToken), - nIndex); - } - SetUserData(nIndex, std::make_unique<UserData>(nIndex,aToken)); - - AddTokenToIndexEntry(nIndex,aToken); + PreviewValueSet::SetItemImage(nIndex,aPreview); + PreviewValueSet::SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken)); } + else + { + PreviewValueSet::InsertItem ( + nIndex, + aPreview, + mpContainer->GetPageNameForToken(aToken), + nIndex); + } + SetUserData(nIndex, std::make_unique<UserData>(nIndex,aToken)); - if (eState == MasterPageContainer::PS_CREATABLE) - mpContainer->RequestPreview(aToken); - } - else - { - PreviewValueSet::RemoveItem(nIndex); + AddTokenToIndexEntry(nIndex,aToken); } + + if (eState == MasterPageContainer::PS_CREATABLE) + mpContainer->RequestPreview(aToken); + } + else + { + PreviewValueSet::RemoveItem(nIndex); } } diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx index 2df198079bf5..cabb628a42d7 100644 --- a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -320,35 +320,34 @@ void RecentlyUsedMasterPages::AddMasterPage ( // For the page to be inserted the token has to be valid and the page // has to have a valid URL. This excludes master pages that do not come // from template files. - if (aToken != MasterPageContainer::NIL_TOKEN - && !mpContainer->GetURLForToken(aToken).isEmpty()) + if (aToken == MasterPageContainer::NIL_TOKEN + || mpContainer->GetURLForToken(aToken).isEmpty()) + return; + + MasterPageList::iterator aIterator ( + ::std::find_if(mvMasterPages.begin(),mvMasterPages.end(), + Descriptor::TokenComparator(aToken))); + if (aIterator != mvMasterPages.end()) { + // When an entry for the given token already exists then remove + // it now and insert it later at the head of the list. + mvMasterPages.erase (aIterator); + } - MasterPageList::iterator aIterator ( - ::std::find_if(mvMasterPages.begin(),mvMasterPages.end(), - Descriptor::TokenComparator(aToken))); - if (aIterator != mvMasterPages.end()) - { - // When an entry for the given token already exists then remove - // it now and insert it later at the head of the list. - mvMasterPages.erase (aIterator); - } - - mvMasterPages.insert(mvMasterPages.begin(), - Descriptor( - aToken, - mpContainer->GetURLForToken(aToken), - mpContainer->GetStyleNameForToken(aToken))); - - // Shorten list to maximal size. - while (mvMasterPages.size() > gnMaxListSize) - { - mvMasterPages.pop_back (); - } + mvMasterPages.insert(mvMasterPages.begin(), + Descriptor( + aToken, + mpContainer->GetURLForToken(aToken), + mpContainer->GetStyleNameForToken(aToken))); - SavePersistentValues (); - SendEvent(); + // Shorten list to maximal size. + while (mvMasterPages.size() > gnMaxListSize) + { + mvMasterPages.pop_back (); } + + SavePersistentValues (); + SendEvent(); } void RecentlyUsedMasterPages::ResolveList() commit b104e6e979bab16605840c2a14914917d5e552b3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 14 09:11:33 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Feb 15 07:51:48 2019 +0100 loplugin:flatten in sd/source/ui/slideshow Change-Id: Id820f0f7ac51928ba1a783615c3e9d6c268affdd Reviewed-on: https://gerrit.libreoffice.org/67831 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/slideshow/PaneHider.cxx b/sd/source/ui/slideshow/PaneHider.cxx index 2c80e67f2f50..d4265dbbb80f 100644 --- a/sd/source/ui/slideshow/PaneHider.cxx +++ b/sd/source/ui/slideshow/PaneHider.cxx @@ -45,7 +45,10 @@ PaneHider::PaneHider (const ViewShell& rViewShell, SlideshowImpl* pSlideShow) { // Hide the left and right pane windows when a slideshow exists and is // not full screen. - if (pSlideShow!=nullptr && !pSlideShow->isFullScreen()) try + if (pSlideShow==nullptr || pSlideShow->isFullScreen()) + return; + + try { Reference<XControllerManager> xControllerManager ( mrViewShell.GetViewShellBase().GetController(), UNO_QUERY_THROW); diff --git a/sd/source/ui/slideshow/SlideShowRestarter.cxx b/sd/source/ui/slideshow/SlideShowRestarter.cxx index 597f30ddb1cc..957ad4496af0 100644 --- a/sd/source/ui/slideshow/SlideShowRestarter.cxx +++ b/sd/source/ui/slideshow/SlideShowRestarter.cxx @@ -81,46 +81,46 @@ void SlideShowRestarter::Restart (bool bForce) IMPL_LINK_NOARG(SlideShowRestarter, EndPresentation, void*, void) { 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())) - { - 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) - { - ::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(); - } - } - } + ::sd::framework::ConfigurationController::Lock aLock ( + pHelper->GetConfigurationController()); + + pHelper->RunOnConfigurationEvent( + FrameworkHelper::msConfigurationUpdateEndEvent, + ::std::bind(&SlideShowRestarter::StartPresentation, shared_from_this())); + pHelper->UpdateConfiguration(); + } + else + { + StartPresentation(); } } diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx index 9af16e40e4a6..952dcd960478 100644 --- a/sd/source/ui/slideshow/showwin.cxx +++ b/sd/source/ui/slideshow/showwin.cxx @@ -294,21 +294,21 @@ void ShowWindow::LoseFocus() void ShowWindow::SetEndMode() { - if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() ) - { - DeleteWindowFromPaintView(); - meShowWindowMode = SHOWWINDOWMODE_END; - maShowBackground = Wallpaper( COL_BLACK ); + if( !(( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView()) ) + return; - // hide navigator if it is visible - if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) ) - { - mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, false ); - mbShowNavigatorAfterSpecialMode = true; - } + DeleteWindowFromPaintView(); + meShowWindowMode = SHOWWINDOWMODE_END; + maShowBackground = Wallpaper( COL_BLACK ); - 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 ) diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 864cc4a8b2bb..ccb2924e7a08 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -650,135 +650,135 @@ void SAL_CALL SlideShow::end() mbIsInStartup = false; rtl::Reference< SlideshowImpl > xController( mxController ); - if( xController.is() ) + if( !xController.is() ) + return; + + mxController.clear(); + + if( mpFullScreenFrameView ) { - mxController.clear(); + delete mpFullScreenFrameView; + mpFullScreenFrameView = nullptr; + } - if( mpFullScreenFrameView ) - { - delete mpFullScreenFrameView; - mpFullScreenFrameView = nullptr; - } + ViewShellBase* pFullScreenViewShellBase = mpFullScreenViewShellBase; + mpFullScreenViewShellBase = nullptr; - ViewShellBase* pFullScreenViewShellBase = mpFullScreenViewShellBase; - mpFullScreenViewShellBase = nullptr; + // dispose before fullscreen window changes screens + // (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 - // (potentially). If this needs to be moved behind - // pWorkWindow->StartPresentationMode() again, read issue - // pWorkWindow->i94007 & implement the solution outlined - // there. - xController->dispose(); + if( pFullScreenViewShellBase ) + { + PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>(pFullScreenViewShellBase->GetMainViewShell().get()); - if( pFullScreenViewShellBase ) + if( pShell && pShell->GetViewFrame() ) { - PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>(pFullScreenViewShellBase->GetMainViewShell().get()); - - if( pShell && pShell->GetViewFrame() ) + WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pShell->GetViewFrame()->GetFrame().GetWindow().GetParent()); + if( pWorkWindow ) { - WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pShell->GetViewFrame()->GetFrame().GetWindow().GetParent()); - if( pWorkWindow ) - { - pWorkWindow->StartPresentationMode( (mxController.is() && mxController->maPresSettings.mbAlwaysOnTop) - ? 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() - // is called. - ::std::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->GetMainViewShell()); - pShell = dynamic_cast<PresentationViewShell*>(pSharedView.get()); - } - if( pShell && pShell->GetViewFrame() ) - pShell->GetViewFrame()->DoClose(); + // Get the shell pointer in its own scope to be sure that + // the shared_ptr to the shell is released before DoClose() + // is called. + ::std::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->GetMainViewShell()); + pShell = dynamic_cast<PresentationViewShell*>(pSharedView.get()); } - 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(); - - if( pFrameView && (pFrameView->GetPresentationViewShellId() != SID_VIEWSHELL0) ) - { - ViewShell::ShellType ePreviousType (pFrameView->GetPreviousViewShellType()); - pFrameView->SetPreviousViewShellType(ViewShell::ST_NONE); + ViewShell::ShellType ePreviousType (pFrameView->GetPreviousViewShellType()); + pFrameView->SetPreviousViewShellType(ViewShell::ST_NONE); - pFrameView->SetPresentationViewShellId(SID_VIEWSHELL0); - pFrameView->SetPreviousViewShellType(pViewShell->GetShellType()); + pFrameView->SetPresentationViewShellId(SID_VIEWSHELL0); + pFrameView->SetPreviousViewShellType(pViewShell->GetShellType()); - framework::FrameworkHelper::Instance(*mpCurrentViewShellBase)->RequestView( - framework::FrameworkHelper::GetViewURL(ePreviousType), - framework::FrameworkHelper::msCenterPaneURL); + framework::FrameworkHelper::Instance(*mpCurrentViewShellBase)->RequestView( + framework::FrameworkHelper::GetViewURL(ePreviousType), + 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(); - if( pViewShell ) - { - // invalidate the view shell so the presentation slot will be re-enabled - // 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 - DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>( pViewShell ); - if( pDrawViewShell ) - pDrawViewShell->SwitchPage( static_cast<sal_uInt16>(xController->getRestoreSlide()) ); - else - { - Reference<XDrawView> xDrawView ( - Reference<XWeak>(&mpCurrentViewShellBase->GetDrawController()), UNO_QUERY); - if (xDrawView.is()) - xDrawView->setCurrentPage( - Reference<XDrawPage>( - mpDoc->GetSdPage(xController->getRestoreSlide(), PageKind::Standard)->getUnoPage(), - UNO_QUERY)); - } + Reference<XDrawView> xDrawView ( + 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_QUERY); - if( xProvider.is() ) + uno::Reference< frame::XDispatch > xDispatch( + xProvider->queryDispatch( + aURL, OUString(), 0)); + if( xDispatch.is() ) { - util::URL aURL; - aURL.Complete = ".uno:CloseFrame"; - - uno::Reference< frame::XDispatch > xDispatch( - xProvider->queryDispatch( - aURL, OUString(), 0)); - if( xDispatch.is() ) - { - xDispatch->dispatch(aURL, - uno::Sequence< beans::PropertyValue >()); - } + 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() @@ -1083,25 +1083,25 @@ void SlideShow::StartInPlacePresentation() CreateController( nullptr, nullptr, mxCurrentSettings->mpParentWindow ); } - if( mxController.is() ) + if( !mxController.is() ) + return; + + bool bSuccess = false; + if( mxCurrentSettings.get() && mxCurrentSettings->mbPreview ) { - bool bSuccess = false; - if( mxCurrentSettings.get() && mxCurrentSettings->mbPreview ) - { - bSuccess = mxController->startPreview(mxCurrentSettings->mxStartPage, mxCurrentSettings->mxAnimationNode, mxCurrentSettings->mpParentWindow ); - } - else - { - bSuccess = mxController->startShow(mxCurrentSettings.get()); - } + bSuccess = mxController->startPreview(mxCurrentSettings->mxStartPage, mxCurrentSettings->mxAnimationNode, mxCurrentSettings->mpParentWindow ); + } + else + { + bSuccess = mxController->startShow(mxCurrentSettings.get()); + } - if( !bSuccess ) - end(); - else - { - if( mpCurrentViewShellBase && ( !mxCurrentSettings.get() || ( mxCurrentSettings.get() && !mxCurrentSettings->mbPreview ) ) ) - mpCurrentViewShellBase->GetWindow()->GrabFocus(); - } + if( !bSuccess ) + end(); + else + { + if( mpCurrentViewShellBase && ( !mxCurrentSettings.get() || ( mxCurrentSettings.get() && !mxCurrentSettings->mbPreview ) ) ) + mpCurrentViewShellBase->GetWindow()->GrabFocus(); } } @@ -1120,34 +1120,34 @@ void SlideShow::StartFullscreenPresentation( ) pWorkWindow->StartPresentationMode( true, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PresentationFlags::HideAllApps : PresentationFlags::NONE, nDisplay); // pWorkWindow->ShowFullScreenMode(sal_False, nDisplay); - if (pWorkWindow->IsVisible()) - { - // 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); + if (!pWorkWindow->IsVisible()) + return; - 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(); - } + // 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()); + 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(); } } diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 330e37b24c6c..30229e0cfeb9 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -444,42 +444,42 @@ void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow { const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber(); - if( xShow.is() && (nCurrentSlideNumber != -1 ) ) - { - Reference< XDrawPage > xSlide; - Reference< XAnimationNode > xAnimNode; - ::std::vector<PropertyValue> aProperties; + if( !(xShow.is() && (nCurrentSlideNumber != -1 )) ) + return; - const sal_Int32 nNextSlideNumber = getNextSlideNumber(); - 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); - } + Reference< XDrawPage > xSlide; + Reference< XAnimationNode > xAnimNode; + ::std::vector<PropertyValue> aProperties; - if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) ) - xShow->displaySlide( xSlide, xDrawPages, xAnimNode, comphelper::containerToSequence(aProperties) ); + const sal_Int32 nNextSlideNumber = getNextSlideNumber(); + 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" ); @@ -1196,7 +1196,10 @@ bool SlideshowImpl::longpress(const CommandLongPressData &rLongPressData) void SlideshowImpl::removeShapeEvents() { - if( mxShow.is() && mxListenerProxy.is() ) try + if( !(mxShow.is() && mxListenerProxy.is()) ) + return; + + try { for( const auto& rEntry : maShapeEventMap ) { @@ -1215,7 +1218,10 @@ void SlideshowImpl::removeShapeEvents() void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber) { - if( nSlideNumber >= 0 ) try + if( nSlideNumber < 0 ) + return; + + try { Reference< XDrawPagesSupplier > xDrawPages( mxModel, UNO_QUERY_THROW ); Reference< XIndexAccess > xPages( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); @@ -1362,7 +1368,10 @@ void SAL_CALL SlideshowImpl::pause() { SolarMutexGuard aSolarGuard; - if( !mbIsPaused ) try + if( mbIsPaused ) + return; + + try { mbIsPaused = true; if( mxShow.is() ) @@ -1845,75 +1854,75 @@ IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent&, rSimpleEvent, void if( !mxShow.is() || mbInputFreeze ) return; - if( (rSimpleEvent.GetId() == VclEventId::WindowCommand) && static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData() ) - { - const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData()); + if( !((rSimpleEvent.GetId() == VclEventId::WindowCommand) && static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData()) ) + return; - if( rEvent.GetCommand() == CommandEventId::Media ) - { - CommandMediaData* pMediaData = rEvent.GetMediaData(); - pMediaData->SetPassThroughToOS(false); - switch (pMediaData->GetMediaId()) - { + const CommandEvent& rEvent = *static_cast<const CommandEvent*>(static_cast<VclWindowEvent*>(&rSimpleEvent)->GetData()); + + if( rEvent.GetCommand() != CommandEventId::Media ) + return; + + CommandMediaData* pMediaData = rEvent.GetMediaData(); + pMediaData->SetPassThroughToOS(false); + switch (pMediaData->GetMediaId()) + { #if defined( MACOSX ) - case MediaCommand::Menu: - if( !mnContextMenuEvent ) - { - if( mpShowWindow ) - maPopupMousePos = mpShowWindow->GetPointerState().maPos; - mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) ); - } - break; - case MediaCommand::VolumeDown: - gotoPreviousSlide(); - break; - case MediaCommand::VolumeUp: - gotoNextEffect(); - break; + case MediaCommand::Menu: + if( !mnContextMenuEvent ) + { + if( mpShowWindow ) + maPopupMousePos = mpShowWindow->GetPointerState().maPos; + mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) ); + } + break; + case MediaCommand::VolumeDown: + gotoPreviousSlide(); + break; + case MediaCommand::VolumeUp: + gotoNextEffect(); + break; #endif - case MediaCommand::NextTrack: - gotoNextEffect(); - break; - case MediaCommand::Pause: - if( !mbIsPaused ) - blankScreen(0); - break; - case MediaCommand::Play: - if( mbIsPaused ) - resume(); - break; + case MediaCommand::NextTrack: + gotoNextEffect(); + break; + case MediaCommand::Pause: + if( !mbIsPaused ) + blankScreen(0); + break; + case MediaCommand::Play: + if( mbIsPaused ) + resume(); + break; - case MediaCommand::PlayPause: - if( mbIsPaused ) - resume(); - else - blankScreen(0); - break; - case MediaCommand::PreviousTrack: - gotoPreviousSlide(); - break; - case MediaCommand::NextTrackHold: - gotoLastSlide(); - break; + case MediaCommand::PlayPause: + if( mbIsPaused ) + resume(); + else + blankScreen(0); + break; + case MediaCommand::PreviousTrack: + gotoPreviousSlide(); + break; + case MediaCommand::NextTrackHold: + gotoLastSlide(); + break; - case MediaCommand::Rewind: - gotoFirstSlide(); - break; - case MediaCommand::Stop: - // in case the user cancels the presentation, switch to current slide - // in edit mode - if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) ) - { - if( mpSlideController->getCurrentSlideNumber() != -1 ) - mnRestoreSlide = mpSlideController->getCurrentSlideNumber(); - } - endPresentation(); - break; - default: - pMediaData->SetPassThroughToOS(true); - break; - } + case MediaCommand::Rewind: + gotoFirstSlide(); + break; + case MediaCommand::Stop: + // in case the user cancels the presentation, switch to current slide + // in edit mode + if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) ) + { + if( mpSlideController->getCurrentSlideNumber() != -1 ) + mnRestoreSlide = mpSlideController->getCurrentSlideNumber(); } + endPresentation(); + break; + default: + pMediaData->SetPassThroughToOS(true); + break; } } @@ -2225,83 +2234,83 @@ void SlideshowImpl::createSlideList( bool bAll, const OUString& rPresSlide ) { const sal_uInt16 nSlideCount = mpDoc->GetSdPageCount( PageKind::Standard ); - if( nSlideCount ) - { - SdCustomShow* pCustomShow; + if( !nSlideCount ) + return; - if( mpDoc->GetCustomShowList() && maPresSettings.mbCustomShow ) - pCustomShow = mpDoc->GetCustomShowList()->GetCurObject(); - else - pCustomShow = nullptr; + SdCustomShow* pCustomShow; - // create animation slide controller - AnimationSlideController::Mode eMode = - ( pCustomShow && !pCustomShow->PagesVector().empty() ) ? AnimationSlideController::CUSTOM : - (bAll ? AnimationSlideController::ALL : AnimationSlideController::FROM); + if( mpDoc->GetCustomShowList() && maPresSettings.mbCustomShow ) + pCustomShow = mpDoc->GetCustomShowList()->GetCurObject(); + else + pCustomShow = nullptr; - Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW ); - Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW ); - mpSlideController.reset( new AnimationSlideController( xSlides, eMode ) ); + // create animation slide controller + AnimationSlideController::Mode 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 - if( !rPresSlide.isEmpty() ) + for( nSlide = 0, nFirstVisibleSlide = -1; + ( nSlide < nSlideCount ) && ( -1 == nFirstVisibleSlide ); nSlide++ ) { - sal_Int32 nSlide; - bool bTakeNextAvailable = false; + SdPage* pTestSlide = mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard ); - for( nSlide = 0, nFirstVisibleSlide = -1; - ( nSlide < nSlideCount ) && ( -1 == nFirstVisibleSlide ); nSlide++ ) + if( pTestSlide->GetName() == rPresSlide ) { - SdPage* pTestSlide = mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard ); - - if( pTestSlide->GetName() == rPresSlide ) - { - if( pTestSlide->IsExcluded() ) - bTakeNextAvailable = true; - else - nFirstVisibleSlide = nSlide; - } - else if( bTakeNextAvailable && !pTestSlide->IsExcluded() ) + if( pTestSlide->IsExcluded() ) + bTakeNextAvailable = true; + else nFirstVisibleSlide = nSlide; } - - if( -1 == nFirstVisibleSlide ) - nFirstVisibleSlide = 0; + else if( bTakeNextAvailable && !pTestSlide->IsExcluded() ) + nFirstVisibleSlide = nSlide; } - 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 ); - } + if( -1 == nFirstVisibleSlide ) + nFirstVisibleSlide = 0; + } - 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++ ) - if( rPresSlide == mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard )->GetName() ) - break; + sal_Int32 nSlide; + for( nSlide = 0; nSlide < nSlideCount; nSlide++ ) + if( rPresSlide == mpDoc->GetSdPage( static_cast<sal_uInt16>(nSlide), PageKind::Standard )->GetName() ) + break; - if( nSlide < nSlideCount ) - mpSlideController->insertSlideNumber( static_cast<sal_uInt16>(nSlide) ); - } + if( nSlide < nSlideCount ) + mpSlideController->insertSlideNumber( static_cast<sal_uInt16>(nSlide) ); + } - for( const auto& rpPage : pCustomShow->PagesVector() ) - { - const sal_uInt16 nSdSlide = ( rpPage->GetPageNum() - 1 ) / 2; + for( const auto& rpPage : pCustomShow->PagesVector() ) + { + const sal_uInt16 nSdSlide = ( rpPage->GetPageNum() - 1 ) / 2; - if( ! mpDoc->GetSdPage( nSdSlide, PageKind::Standard )->IsExcluded()) - mpSlideController->insertSlideNumber( nSdSlide ); - } + if( ! mpDoc->GetSdPage( nSdSlide, PageKind::Standard )->IsExcluded()) + mpSlideController->insertSlideNumber( nSdSlide ); } } } @@ -2325,22 +2334,22 @@ void SlideshowImpl::hideChildWindows() { 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++ ) - { - const sal_uInt16 nId = ( *aShowChildren[ i ] )(); - - if( pViewFrame->GetChildWindow( nId ) ) - { - pViewFrame->SetChildWindow( nId, false ); - mnChildMask |= 1 << i; - } - } + pViewFrame->SetChildWindow( nId, false ); + mnChildMask |= 1 << i; } } } @@ -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 // 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); - if ( pItem && pItem->GetValue() ) + Reference< frame::XLayoutManager > xLayoutManager; + 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 - // 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& ) - {} - } + xLayoutManager->setVisible( bVisible ); } } + catch( uno::Exception& ) + {} } void SAL_CALL SlideshowImpl::activate() @@ -2436,37 +2445,37 @@ void SAL_CALL SlideshowImpl::activate() 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 ) - setAutoSaveState( false ); - - if( mpShowWindow ) - { - SfxViewFrame* pViewFrame = getViewFrame(); - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : nullptr; + SfxViewFrame* pViewFrame = getViewFrame(); + SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : nullptr; - hideChildWindows(); + hideChildWindows(); - if( pDispatcher ) - { - // filter all forbidden slots - pDispatcher->SetSlotFilter( SfxSlotFilterState::ENABLED, pAllowed ); - } + if( pDispatcher ) + { + // filter all forbidden slots + pDispatcher->SetSlotFilter( SfxSlotFilterState::ENABLED, pAllowed ); + } - if( getBindings() ) - getBindings()->InvalidateAll(true); + if( getBindings() ) + getBindings()->InvalidateAll(true); - mpShowWindow->GrabFocus(); - } + mpShowWindow->GrabFocus(); } - - resume(); } + + resume(); } void SAL_CALL SlideshowImpl::deactivate() @@ -2481,21 +2490,21 @@ void SAL_CALL SlideshowImpl::deactivate() IMPL_LINK_NOARG(SlideshowImpl, deactivateHdl, Timer *, void) { - if( mbActive && mxShow.is() ) - { - mbActive = false; + if( !(mbActive && mxShow.is()) ) + return; - pause(); + mbActive = false; - if( ANIMATIONMODE_SHOW == meAnimationMode ) - { - if( mbAutoSaveWasOn ) - setAutoSaveState( true ); + pause(); - if( mpShowWindow ) - { - showChildWindows(); - } + if( ANIMATIONMODE_SHOW == meAnimationMode ) + { + if( mbAutoSaveWasOn ) + setAutoSaveState( true ); + + if( mpShowWindow ) + { + showChildWindows(); } } } @@ -2629,7 +2638,10 @@ void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) { SolarMutexGuard aSolarGuard; mbUsePen = bMouseAsPen; - if( mxShow.is() ) try + if( !mxShow.is() ) + return; + + try { // For Pencolor; Any aValue; @@ -2690,21 +2702,24 @@ void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) void SlideshowImpl::setEraseAllInk(bool bEraseAllInk) { - if( bEraseAllInk ) + if( !bEraseAllInk ) + return; + + SolarMutexGuard aSolarGuard; + if( !mxShow.is() ) + return; + + try { - SolarMutexGuard aSolarGuard; - if( mxShow.is() ) try - { - beans::PropertyValue aPenPropEraseAllInk; - aPenPropEraseAllInk.Name = "EraseAllInk"; - aPenPropEraseAllInk.Value <<= bEraseAllInk; - mxShow->setProperty( aPenPropEraseAllInk ); - } - catch( Exception& ) - { - SAL_WARN( "sd.slideshow", "sd::SlideshowImpl::setEraseAllInk(), " - "exception caught: " << comphelper::anyToString( cppu::getCaughtException() )); - } + beans::PropertyValue aPenPropEraseAllInk; + aPenPropEraseAllInk.Name = "EraseAllInk"; + aPenPropEraseAllInk.Value <<= bEraseAllInk; + mxShow->setProperty( aPenPropEraseAllInk ); + } + catch( Exception& ) + { + SAL_WARN( "sd.slideshow", "sd::SlideshowImpl::setEraseAllInk(), " + "exception caught: " << comphelper::anyToString( cppu::getCaughtException() )); } } @@ -2719,25 +2734,25 @@ void SAL_CALL SlideshowImpl::gotoNextEffect( ) { SolarMutexGuard aSolarGuard; - if( mxShow.is() && mpSlideController.get() && mpShowWindow ) - { - if( mbIsPaused ) - resume(); + if( !(mxShow.is() && mpSlideController.get() && mpShowWindow) ) + return; - const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); - if( eMode == SHOWWINDOWMODE_END ) - { - endPresentation(); - } - else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) - { - mpShowWindow->RestartShow(); - } - else - { - mxShow->nextEffect(); - update(); - } + if( mbIsPaused ) + resume(); + + const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); + if( eMode == SHOWWINDOWMODE_END ) + { + endPresentation(); + } + else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) + { + mpShowWindow->RestartShow(); + } + else + { + mxShow->nextEffect(); + update(); } } @@ -2745,21 +2760,21 @@ void SAL_CALL SlideshowImpl::gotoPreviousEffect( ) { SolarMutexGuard aSolarGuard; - if( mxShow.is() && mpSlideController.get() && mpShowWindow ) - { - if( mbIsPaused ) - resume(); + if( !(mxShow.is() && mpSlideController.get() && mpShowWindow) ) + return; - const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); - if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) - { - mpShowWindow->RestartShow(); - } - else - { - mxShow->previousEffect(); - update(); - } + if( mbIsPaused ) + resume(); + + const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode(); + if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) ) + { + mpShowWindow->RestartShow(); + } + else + { + mxShow->previousEffect(); + update(); } } @@ -2767,20 +2782,20 @@ void SAL_CALL SlideshowImpl::gotoFirstSlide( ) { SolarMutexGuard aSolarGuard; - if( mpShowWindow && mpSlideController.get() ) - { - if( mbIsPaused ) - resume(); + if( !(mpShowWindow && mpSlideController.get()) ) + return; - if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END ) - { - if( mpSlideController->getSlideIndexCount() ) - mpShowWindow->RestartShow( 0); - } - else - { - displaySlideIndex( 0 ); - } + if( mbIsPaused ) + resume(); + + if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END ) + { + if( mpSlideController->getSlideIndexCount() ) + mpShowWindow->RestartShow( 0); + } + else + { + displaySlideIndex( 0 ); } } @@ -2864,7 +2879,10 @@ void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects) { SolarMutexGuard aSolarGuard; - if( mxShow.is() && mpSlideController.get() ) try + if( !(mxShow.is() && mpSlideController.get()) ) + return; + + try { if( mbIsPaused ) resume(); @@ -2909,22 +2927,22 @@ void SAL_CALL SlideshowImpl::gotoLastSlide() { SolarMutexGuard aSolarGuard; - if( mpSlideController.get() ) - { - if( mbIsPaused ) - resume(); + if( !mpSlideController.get() ) + return; - const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1; - if( nLastSlideIndex >= 0 ) + if( mbIsPaused ) + resume(); + + const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1; + if( nLastSlideIndex >= 0 ) + { + if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END ) { - if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END ) - { - mpShowWindow->RestartShow( nLastSlideIndex ); - } - else - { - displaySlideIndex( nLastSlideIndex ); - } + mpShowWindow->RestartShow( nLastSlideIndex ); + } + else + { + displaySlideIndex( nLastSlideIndex ); } } } @@ -2945,18 +2963,18 @@ void SAL_CALL SlideshowImpl::gotoSlide( const Reference< XDrawPage >& xSlide ) { SolarMutexGuard aSolarGuard; - if( mpSlideController.get() && xSlide.is() ) - { - if( mbIsPaused ) - resume(); + if( !(mpSlideController.get() && xSlide.is()) ) + return; - const sal_Int32 nSlideCount = mpSlideController->getSlideNumberCount(); - for( sal_Int32 nSlide = 0; nSlide < nSlideCount; nSlide++ ) + if( mbIsPaused ) + 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 ); } } } diff --git a/sd/source/ui/slideshow/slideshowviewimpl.cxx b/sd/source/ui/slideshow/slideshowviewimpl.cxx index dc14d5735af8..fd54279e18ed 100644 --- a/sd/source/ui/slideshow/slideshowviewimpl.cxx +++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx @@ -487,22 +487,22 @@ awt::Rectangle SAL_CALL SlideShowView::getCanvasArea( ) 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 ) - { - mbFirstPaint = false; - SlideshowImpl* pTmpSlideShow = mpSlideShow; - rGuard.clear(); - if( pTmpSlideShow ) - pTmpSlideShow->onFirstPaint(); - } else - rGuard.clear(); - - pSlideShow->startUpdateTimer(); - } + pSlideShow->startUpdateTimer(); } // XWindowListener methods @@ -662,18 +662,18 @@ void SlideShowView::init() // #i48939# only switch on kind of hacky scroll optimization, when // running fullscreen. this minimizes the probability that other // 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& ) - { - } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits