sd/source/ui/inc/ViewShell.hxx | 3 + sd/source/ui/slideshow/slideshowimpl.cxx | 12 ++++ sd/source/ui/view/viewshel.cxx | 80 +++++++++++++++++++----------- slideshow/source/engine/slideshowimpl.cxx | 8 +++ 4 files changed, 74 insertions(+), 29 deletions(-)
New commits: commit fef23144a13cd8d3f14236e11bc2db85402e2943 Author: Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de> AuthorDate: Thu Apr 11 16:37:30 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Thu Apr 11 23:18:30 2024 +0200 IASS: Correct Buffering of last Slide There is a mechanism to pre-fetch the next slide, but at the last slide that just gets not reset/refreshed. Thus the last slide *is* the buffered slide. When making changes and refreshing the SlideShow display for the last slide this pe-fetched one is just used, so the slide content gets not re-created and thus not updated. I added needed code to do that now when reacing the last slide to make that work. Change-Id: Ie57e6917e0996d5fce46021aeb933064c47dd90f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166011 Tested-by: Jenkins Reviewed-by: Armin Le Grand <armin.le.gr...@me.com> diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 8b5a5977c8cb..bf4ce08cfe4e 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -498,6 +498,18 @@ void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow Any(aValue), PropertyState_DIRECT_VALUE); } + else if (-1 == nNextSlideNumber) + { + // IASS: next slide does not exist, thus current slide is the last one. + // we need to signal to stop Prefetch since else SlideShowImpl *keeps* the + // last slide buffered and will just re-use it when asked to update, thus + // updates will not work. + aProperties.emplace_back( "Prefetch" , + -1, + Any(false), + PropertyState_DIRECT_VALUE); + } + if (bSkipAllMainSequenceEffects) { // Add one property that prevents the slide transition from being diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index fd4d984b6e32..db8597eb5e58 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1039,6 +1039,14 @@ public: seq[0] >>= mpSlideShowImpl->mxPrefetchSlide; seq[1] >>= mpSlideShowImpl->mxPrefetchAnimationNode; } + else // rProperty.Value might be tested to 'bool' and 'false' + { + // IASS: There is no 'next' slide (last one is displayed), + // so end/flush Prefetch since that might still hold the + // last slide what would prevent updating/re-creating it + mpSlideShowImpl->mxPrefetchSlide.clear(); + mpSlideShowImpl->mpPrefetchSlide.reset(); + } } else if ( rProperty.Name == "SkipAllMainSequenceEffects" ) { commit 3dff176ab5a946b13628d857bdeac27ee5bfaa48 Author: Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de> AuthorDate: Wed Apr 10 15:29:13 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Thu Apr 11 23:18:17 2024 +0200 IASS: Support Mouse-Wheel Actions The support for MouseWheel was missing. That showed when using it in IASS the scroll commands were always feeded to the SlideShow. Thus it was not possible to e.g. scroll using MouseWheel in EditView when IASS was active and SlideShow running. This happens in ViewShell::HandleScrollCommand. It needs to be made focus-dependent when IASS is active. This is the same as already done for keyboard input, so I consolidated this now to a method called ViewShell::useInputForSlideShow() that does all the necessary stuff and answers as needed. Using that in various places: keyboard and MouseWheel, but also adapted other places where the same has to happen, mainly some gesture stuff. Change-Id: I1a697e4b35b195695f1a5ea2305a3cee8851fa8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165929 Tested-by: Jenkins Reviewed-by: Armin Le Grand <armin.le.gr...@me.com> diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 8375c5a4d837..85bc43e86c09 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -548,6 +548,9 @@ private: /** Create the rulers. */ void SetupRulers(); + + // IASS: Check if commands should be used for SlideShow + bool useInputForSlideShow() const; }; SdrView* ViewShell::GetDrawView() const diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index bcea2f333062..87d4c63565e6 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -388,6 +388,34 @@ void ViewShell::Shutdown() Exit (); } +// IASS: Check if commands should be used for SlideShow +// This is the case when IASS is on, SlideShow is active +// and the SlideShow Window has the focus +bool ViewShell::useInputForSlideShow() const +{ + rtl::Reference< SlideShow > xSlideShow(SlideShow::GetSlideShow(GetViewShellBase())); + + if (!xSlideShow.is()) + // no SlideShow, do not use + return false; + + if (!xSlideShow->isRunning()) + // SlideShow not running, do not use + return false; + + if(!xSlideShow->IsInteractiveSlideshow()) + // if IASS is deactivated, do what was done before when + // SlideSHow is running: use for SlideShow + return true; + + // else, check if SlideShow Window has the focus + OutputDevice* pShOut(xSlideShow->getShowWindow()); + vcl::Window* pShWin(pShOut ? pShOut->GetOwnerWindow() : nullptr); + + // return true if we got the SlideShow Window and it has the focus + return nullptr != pShWin && pShWin->HasFocus(); +} + bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) { bool bReturn(false); @@ -403,20 +431,10 @@ bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) const size_t OriCount = GetView()->GetMarkedObjectList().GetMarkCount(); if(!bReturn) { - rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); - const bool bSlideShowRunning(xSlideShow.is() && xSlideShow->isRunning()); - bool bUseForSlideShow(bSlideShowRunning); - - if(bSlideShowRunning && xSlideShow->IsInteractiveSlideshow()) - { - // IASS - OutputDevice* pShOut(xSlideShow->getShowWindow()); - vcl::Window* pShWin(pShOut ? pShOut->GetOwnerWindow() : nullptr); - bUseForSlideShow = pShWin && pShWin->HasFocus(); - } - - if(bUseForSlideShow) //IASS + if(useInputForSlideShow()) //IASS { + // use for SlideShow + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); bReturn = xSlideShow->keyInput(rKEvt); } else @@ -674,9 +692,10 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi { case CommandEventId::GestureSwipe: { - rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); - if (xSlideShow.is()) + if(useInputForSlideShow()) //IASS { + // use for SlideShow + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); const CommandGestureSwipeData* pSwipeData = rCEvt.GetGestureSwipeData(); bDone = xSlideShow->swipe(*pSwipeData); } @@ -684,9 +703,10 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi break; case CommandEventId::GestureLongPress: { - rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); - if (xSlideShow.is()) + if(useInputForSlideShow()) //IASS { + // use for SlideShow + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); const CommandGestureLongPressData* pLongPressData = rCEvt.GetLongPressData(); bDone = xSlideShow->longpress(*pLongPressData); } @@ -698,17 +718,21 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) ); if( xSlideShowController.is() ) { - // We ignore zooming with control+mouse wheel. - const CommandWheelData* pData = rCEvt.GetWheelData(); - if( pData && !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) && !pData->IsHorz() ) + if(useInputForSlideShow()) //IASS { - ::tools::Long nDelta = pData->GetDelta(); - if( nDelta > 0 ) - xSlideShowController->gotoPreviousSlide(); - else if( nDelta < 0 ) - xSlideShowController->gotoNextEffect(); + // use for SlideShow + // We ignore zooming with control+mouse wheel. + const CommandWheelData* pData = rCEvt.GetWheelData(); + if( pData && !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) && !pData->IsHorz() ) + { + ::tools::Long nDelta = pData->GetDelta(); + if( nDelta > 0 ) + xSlideShowController->gotoPreviousSlide(); + else if( nDelta < 0 ) + xSlideShowController->gotoNextEffect(); + } + break; } - break; } } [[fallthrough]]; @@ -767,8 +791,6 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi { const CommandGestureZoomData* pData = rCEvt.GetGestureZoomData(); - Reference<XSlideShowController> xSlideShowController(SlideShow::GetSlideShowController(GetViewShellBase())); - if (pData->meEventType == GestureEventZoomType::Begin) { mfLastZoomScale = pData->mfScaleDelta; @@ -781,7 +803,7 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi double deltaBetweenEvents = (pData->mfScaleDelta - mfLastZoomScale) / mfLastZoomScale; mfLastZoomScale = pData->mfScaleDelta; - if (!GetDocSh()->IsUIActive() && !xSlideShowController.is()) + if (!GetDocSh()->IsUIActive() && !useInputForSlideShow()) //IASS { const ::tools::Long nOldZoom = GetActiveWindow()->GetZoom(); ::tools::Long nNewZoom;