summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2024-04-17 12:58:18 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-04-30 13:07:22 +0200
commitc53a948107eb388db29ed2b747195db840fe124f (patch)
tree9235d09bdb53994a3e9883f9d26c8400a6b4e3df
parent703613799086aa6b98d6eb8480e3fcc2cbf6f623 (diff)
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.Grand@me.com>
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx27
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.hxx4
-rw-r--r--slideshow/source/engine/slideshowimpl.cxx14
3 files changed, 45 insertions, 0 deletions
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index d20b2c750709..617e37d2be81 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);