diff options
author | Andre Fischer <af@openoffice.org> | 2009-03-04 13:41:44 +0000 |
---|---|---|
committer | Andre Fischer <af@openoffice.org> | 2009-03-04 13:41:44 +0000 |
commit | 268c5a727b274916e0a0cc4bd61c3ed892a0b224 (patch) | |
tree | 4f359625494b5bcb69b6555564a2af07b313819c /slideshow/source/engine/screenupdater.cxx | |
parent | dc300a3643d1424bda0fba622abc2c467446c085 (diff) |
#i48179# Introduced EffectRewinder class that replays main sequence effects on current or previous slide.
Diffstat (limited to 'slideshow/source/engine/screenupdater.cxx')
-rw-r--r-- | slideshow/source/engine/screenupdater.cxx | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/slideshow/source/engine/screenupdater.cxx b/slideshow/source/engine/screenupdater.cxx index bf512dfca5db..940d45337919 100644 --- a/slideshow/source/engine/screenupdater.cxx +++ b/slideshow/source/engine/screenupdater.cxx @@ -36,6 +36,19 @@ #include <vector> #include <algorithm> +namespace { + class UpdateLock : public ::slideshow::internal::ScreenUpdater::UpdateLock + { + public: + UpdateLock (::slideshow::internal::ScreenUpdater& rUpdater, const bool bStartLocked); + virtual ~UpdateLock (void); + virtual void Activate (void); + private: + ::slideshow::internal::ScreenUpdater& mrUpdater; + bool mbIsActivated; + }; +} + namespace slideshow { namespace internal @@ -64,12 +77,16 @@ namespace internal /// True, if at least one notifyUpdate() call had bViewClobbered set bool mbViewClobbered; + /// The screen is updated only when mnLockCount==0 + sal_Int32 mnLockCount; + explicit ImplScreenUpdater( UnoViewContainer const& rViewContainer ) : maUpdaters(), maViewUpdateRequests(), mrViewContainer(rViewContainer), mbUpdateAllRequest(false), - mbViewClobbered(false) + mbViewClobbered(false), + mnLockCount(0) {} }; @@ -100,6 +117,9 @@ namespace internal void ScreenUpdater::commitUpdates() { + if (mpImpl->mnLockCount > 0) + return; + // cases: // // (a) no update necessary at all @@ -178,6 +198,9 @@ namespace internal void ScreenUpdater::requestImmediateUpdate() { + if (mpImpl->mnLockCount > 0) + return; + // TODO(F2): This will interfere with other updates, since it // happens out-of-sync with main animation loop. Might cause // artifacts. @@ -186,5 +209,63 @@ namespace internal boost::mem_fn(&View::updateScreen) ); } + void ScreenUpdater::lockUpdates (void) + { + ++mpImpl->mnLockCount; + OSL_ASSERT(mpImpl->mnLockCount>0); + } + + void ScreenUpdater::unlockUpdates (void) + { + OSL_ASSERT(mpImpl->mnLockCount>0); + if (mpImpl->mnLockCount > 0) + { + --mpImpl->mnLockCount; + if (mpImpl->mnLockCount) + commitUpdates(); + } + } + + ::boost::shared_ptr<ScreenUpdater::UpdateLock> ScreenUpdater::createLock (const bool bStartLocked) + { + return ::boost::shared_ptr<ScreenUpdater::UpdateLock>(new ::UpdateLock(*this, bStartLocked)); + } + + } // namespace internal } // namespace slideshow + +namespace { + +UpdateLock::UpdateLock ( + ::slideshow::internal::ScreenUpdater& rUpdater, + const bool bStartLocked) + : mrUpdater(rUpdater), + mbIsActivated(false) +{ + if (bStartLocked) + Activate(); +} + + + + +UpdateLock::~UpdateLock (void) +{ + if (mbIsActivated) + mrUpdater.unlockUpdates(); +} + + + + +void UpdateLock::Activate (void) +{ + if ( ! mbIsActivated) + { + mbIsActivated = true; + mrUpdater.lockUpdates(); + } +} + +} |