1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: screenupdater.hxx,v $
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 */
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
56 class ScreenUpdater
: boost::noncopyable
59 explicit ScreenUpdater( UnoViewContainer
const& rViewContainer
);
62 /** Notify screen update
64 This method records a screen content update request
69 /** Notify screen update
71 This method records a screen content update request
75 The view that needs an update
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
84 void notifyUpdate( const UnoViewSharedPtr
& rView
, bool bViewClobbered
=false );
86 /** Commits collected update actions
90 /** Register ViewUpdate
93 Add this ViewUpdate to the list that's asked for
96 void addViewUpdate( ViewUpdateSharedPtr
const& rViewUpdate
);
98 /** Unregister ViewUpdate
101 Remove this ViewUpdate from the list that's asked for
104 void removeViewUpdate( ViewUpdateSharedPtr
const& );
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.
119 When <TRUE/> then the UpdateLock is created already
120 locked. When <FALSE/> then Activate() has to be called in order
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()
132 void unlockUpdates (void);
135 struct ImplScreenUpdater
;
136 boost::scoped_ptr
<ImplScreenUpdater
> mpImpl
;
142 #endif /* INCLUDED_SLIDESHOW_SCREENUPDATER_HXX */