23#include <osl/diagnose.h>
94 mpImpl->mbUpdateAllRequest =
true;
100 mpImpl->maViewUpdateRequests.emplace_back(rView, bViewClobbered );
103 mpImpl->mbViewClobbered =
true;
108 if (
mpImpl->mnLockCount > 0)
123 const bool bViewUpdatesNeeded(
127 if( bViewUpdatesNeeded )
129 mpImpl->maUpdaters.applyAll(
133 if( bViewUpdatesNeeded ||
134 mpImpl->mbUpdateAllRequest )
137 for(
const auto& pView :
mpImpl->mrViewContainer )
139 if(
mpImpl->mbViewClobbered )
140 pView->paintScreen();
142 pView->updateScreen();
145 else if( !
mpImpl->maViewUpdateRequests.empty() )
148 for(
const auto& rViewUpdateRequest :
mpImpl->maViewUpdateRequests )
152 const UnoViewVector::const_iterator aEndOfViews(
153 mpImpl->mrViewContainer.end() );
154 UnoViewVector::const_iterator aFoundView;
155 if( (aFoundView=std::find(
mpImpl->mrViewContainer.begin(),
157 rViewUpdateRequest.first)) != aEndOfViews )
159 if( rViewUpdateRequest.second )
160 (*aFoundView)->paintScreen();
162 (*aFoundView)->updateScreen();
168 mpImpl->mbViewClobbered =
false;
169 mpImpl->mbUpdateAllRequest =
false;
175 mpImpl->maUpdaters.add( rViewUpdate );
180 mpImpl->maUpdaters.remove( rViewUpdate );
185 if (
mpImpl->mnLockCount > 0)
191 for(
auto const& pView :
mpImpl->mrViewContainer )
192 pView->updateScreen();
198 OSL_ASSERT(
mpImpl->mnLockCount>0);
203 OSL_ASSERT(
mpImpl->mnLockCount>0);
204 if (
mpImpl->mnLockCount > 0)
214 return ::std::make_shared<::UpdateLock>(*
this);
222UpdateLock::UpdateLock (
230UpdateLock::~UpdateLock()
237void UpdateLock::Activate()
239 if ( ! mbIsActivated)
241 mbIsActivated =
true;
virtual void Activate()=0
void requestImmediateUpdate()
A wart.
void removeViewUpdate(ViewUpdateSharedPtr const &)
Unregister ViewUpdate.
void addViewUpdate(ViewUpdateSharedPtr const &rViewUpdate)
Register ViewUpdate.
ScreenUpdater(UnoViewContainer const &rViewContainer)
::std::shared_ptr< UpdateLock > createLock()
Call this method to create a lock instead of calling lockUpdates() and unlockUpdates() directly.
void notifyUpdate()
Notify screen update.
void unlockUpdates()
When called as often as lockUpdates() then commitUpdates() is called.
void lockUpdates()
Lock updates to prevent intermediate repaints.
std::unique_ptr< ImplScreenUpdater > mpImpl
void commitUpdates()
Commits collected update actions.
ListenerContainer variant that does not serialize access.
virtual bool update()=0
Perform the update action on all views.
virtual bool needsUpdate() const =0
Query whether updates are pending.
std::vector< std::pair< UnoViewSharedPtr, bool > > UpdateRequestVector
::std::shared_ptr< ViewUpdate > ViewUpdateSharedPtr
std::shared_ptr< UnoView > UnoViewSharedPtr
SpriteRedrawManager::SpriteConnectedRanges & mrUpdater
bool mbUpdateAllRequest
True, if a notifyUpdate() for all views has been issued.
ImplScreenUpdater(UnoViewContainer const &rViewContainer)
UnoViewContainer const & mrViewContainer
List of View. Used to issue screen updates on.
ThreadUnsafeListenerContainer< ViewUpdateSharedPtr, std::vector< ViewUpdateSharedPtr > > maUpdaters
List of registered ViewUpdaters, to consult for necessary updates.
sal_Int32 mnLockCount
The screen is updated only when mnLockCount==0.
UpdateRequestVector maViewUpdateRequests
Views that have been notified for update.
bool mbViewClobbered
True, if at least one notifyUpdate() call had bViewClobbered set.