sd/source/ui/slideshow/slideshowimpl.cxx | 27 +++++++++++++++++++++++++++ sd/source/ui/slideshow/slideshowimpl.hxx | 4 ++++ slideshow/source/engine/slideshowimpl.cxx | 14 ++++++++++++++ 3 files changed, 45 insertions(+)
New commits: commit 052c668da38b70943d24770895abc8119aace2a6 Author: Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de> AuthorDate: Wed Apr 17 12:58:18 2024 +0200 Commit: Armin Le Grand <armin.le.gr...@me.com> CommitDate: Thu Apr 18 11:12:40 2024 +0200 tdf#160669 IASS: flush Prefetch for SLideShow as needed Change-Id: I3c0e2be658358ab5b412ab18cce197eb28e5c0db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166177 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 29870dc45783..f8163de5b34e 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -3434,6 +3434,21 @@ bool SlideshowImpl::isCurrentSlideInvolved(const SdrHint& rHint) return pHintPage == pCurrentSlide; } +void SlideshowImpl::sendHintSlideChanged(const SdrPage* pChangedPage) const +{ + if (nullptr == pChangedPage) + return; + + if (!mxShow.is()) + return; + + mxShow->setProperty( + beans::PropertyValue( "HintSlideChanged" , + -1, + Any( GetXDrawPageForSdrPage(const_cast<SdrPage*>(pChangedPage)) ), + beans::PropertyState_DIRECT_VALUE ) ); +} + void SlideshowImpl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { if (SfxHintId::ThisIsAnSdrHint != rHint.GetId()) @@ -3463,6 +3478,9 @@ void SlideshowImpl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) // avoid multiple events return; + // tdf#160669 IASS: inform about ALL changed slides due to prefetch + sendHintSlideChanged(rSdrHint.GetPage()); + if (!isCurrentSlideInvolved(rSdrHint)) // nothing to do when current slide is not involved return; @@ -3478,6 +3496,9 @@ void SlideshowImpl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) // avoid multiple events return; + // tdf#160669 IASS: inform about ALL changed slides due to prefetch + sendHintSlideChanged(rSdrHint.GetPage()); + if (!isCurrentSlideInvolved(rSdrHint)) // nothing to do when current slide is not involved return; @@ -3493,6 +3514,9 @@ void SlideshowImpl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) // avoid multiple events return; + // tdf#160669 IASS: inform about ALL changed slides due to prefetch + sendHintSlideChanged(rSdrHint.GetPage()); + if (!isCurrentSlideInvolved(rSdrHint)) // nothing to do when current slide is not involved return; @@ -3516,6 +3540,9 @@ void SlideshowImpl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) if (nullptr != mnEventPageOrderChange) Application::RemoveUserEvent( mnEventPageOrderChange ); + // tdf#160669 IASS: inform about ALL changed slides due to prefetch + sendHintSlideChanged(rSdrHint.GetPage()); + // order of pages (object pages or master pages) changed (Insert/Remove/ChangePos) uno::Reference< css::drawing::XDrawPage > XCurrentSlide(getCurrentSlide()); mnEventPageOrderChange = AsyncUpdateSlideshow_Impl::AsyncUpdateSlideshow(this, XCurrentSlide, eHintKind); diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index 7d0d759680f1..8b4e25a80e83 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -217,6 +217,10 @@ private: // helper to check if given hint is associated with CurrentSlide bool isCurrentSlideInvolved(const SdrHint& rHint); + // tdf#160669 IASS: helper to inform presentation::XSlideShow about change so that + // prefetch can be corrected/flushed + void sendHintSlideChanged(const SdrPage* pChangedPage) const; + // override WeakComponentImplHelperBase::disposing() // This function is called upon disposing the component, // if your component needs special work when it becomes diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 121416327191..ee02fc8d8f69 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1609,6 +1609,20 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) // precondition: must only be called from the main thread! DBG_TESTSOLARMUTEX(); + // tdf#160669 IASS: if hint is about PrefetchSlide, flush it to avoid errors + if ( rProperty.Name == "HintSlideChanged" ) + { + uno::Reference< drawing::XDrawPage > xDrawPage; + if (rProperty.Value >>= xDrawPage) + { + if (xDrawPage == mxPrefetchSlide) + { + mxPrefetchSlide.clear(); + mpPrefetchSlide.reset(); + } + } + } + if ( rProperty.Name == "AutomaticAdvancement" ) { double nTimeout(0.0);