update dev300-m58
[ooovba.git] / slideshow / source / inc / screenupdater.hxx
blob10d500b88cef1eb2aa7fac6fe9228a8094d65264
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: screenupdater.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_SCREENUPDATER_HXX
32 #define INCLUDED_SLIDESHOW_SCREENUPDATER_HXX
34 #include "viewupdate.hxx"
35 #include "unoviewcontainer.hxx"
36 #include <boost/noncopyable.hpp>
37 #include <boost/scoped_ptr.hpp>
39 /* Definition of ScreenUpdater class */
41 namespace slideshow
43 namespace internal
45 /** Screen updater
47 This class handles and synchronizes screen updates
48 centrally. Therefore, it can hold a number of ViewUpdate
49 objects, which are polled for pending updates on
50 commitUpdates(). Furthermore, external code can request
51 updates via notifyUpdate() calls. If neither such an
52 update was requested, nor any of the registered ViewUpdate
53 objects report any pending update, commitUpdates() does
54 nothing.
56 class ScreenUpdater : boost::noncopyable
58 public:
59 explicit ScreenUpdater( UnoViewContainer const& rViewContainer );
60 ~ScreenUpdater();
62 /** Notify screen update
64 This method records a screen content update request
65 for all views.
67 void notifyUpdate();
69 /** Notify screen update
71 This method records a screen content update request
72 for the given view.
74 @param rView
75 The view that needs an update
77 @param bViewClobbered
78 When true, notifies update that view content is
79 clobbered by external circumstances (e.g. by another
80 application), and needs update even if the
81 implementation 'thinks' it does not need to render
82 something to screen.
84 void notifyUpdate( const UnoViewSharedPtr& rView, bool bViewClobbered=false );
86 /** Commits collected update actions
88 void commitUpdates();
90 /** Register ViewUpdate
92 @param rViewUpdate
93 Add this ViewUpdate to the list that's asked for
94 pending updates
96 void addViewUpdate( ViewUpdateSharedPtr const& rViewUpdate );
98 /** Unregister ViewUpdate
100 @param rViewUpdate
101 Remove this ViewUpdate from the list that's asked for
102 pending updates
104 void removeViewUpdate( ViewUpdateSharedPtr const& );
106 /** A wart.
108 Used to fire an immediate screen update. Currently
109 needed for the wait symbol, since switching that on
110 and off does get to commitUpdates()
112 void requestImmediateUpdate();
114 class UpdateLock {public: virtual void Activate (void) = 0; };
116 /** Call this method to create a lock instead of calling
117 lockUpdates() and unlockUpdates() directly.
118 @param bStartLocked
119 When <TRUE/> then the UpdateLock is created already
120 locked. When <FALSE/> then Activate() has to be called in order
121 to lock the lock.
123 ::boost::shared_ptr<UpdateLock> createLock (const bool bStartLocked);
125 /** Lock updates to prevent intermediate repaints.
127 void lockUpdates (void);
129 /** When called as often as lockUpdates() then commitUpdates()
130 is called.
132 void unlockUpdates (void);
134 private:
135 struct ImplScreenUpdater;
136 boost::scoped_ptr<ImplScreenUpdater> mpImpl;
142 #endif /* INCLUDED_SLIDESHOW_SCREENUPDATER_HXX */