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>
This commit is contained in:
Armin Le Grand (allotropia)
2024-04-18 11:12:40 +02:00
committed by Armin Le Grand
parent f1c8804636
commit 052c668da3
3 changed files with 45 additions and 0 deletions
+27
View File
@@ -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);
+4
View File
@@ -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
+14
View File
@@ -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);