Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef INCLUDED_SLIDESHOW_SCREENUPDATER_HXX
21 : : #define INCLUDED_SLIDESHOW_SCREENUPDATER_HXX
22 : :
23 : : #include "viewupdate.hxx"
24 : : #include "unoviewcontainer.hxx"
25 : : #include <boost/noncopyable.hpp>
26 : : #include <boost/scoped_ptr.hpp>
27 : :
28 : : /* Definition of ScreenUpdater class */
29 : :
30 : : namespace slideshow
31 : : {
32 : : namespace internal
33 : : {
34 : : /** Screen updater
35 : :
36 : : This class handles and synchronizes screen updates
37 : : centrally. Therefore, it can hold a number of ViewUpdate
38 : : objects, which are polled for pending updates on
39 : : commitUpdates(). Furthermore, external code can request
40 : : updates via notifyUpdate() calls. If neither such an
41 : : update was requested, nor any of the registered ViewUpdate
42 : : objects report any pending update, commitUpdates() does
43 : : nothing.
44 : : */
45 : : class ScreenUpdater : boost::noncopyable
46 : : {
47 : : public:
48 : : explicit ScreenUpdater( UnoViewContainer const& rViewContainer );
49 : : ~ScreenUpdater();
50 : :
51 : : /** Notify screen update
52 : :
53 : : This method records a screen content update request
54 : : for all views.
55 : : */
56 : : void notifyUpdate();
57 : :
58 : : /** Notify screen update
59 : :
60 : : This method records a screen content update request
61 : : for the given view.
62 : :
63 : : @param rView
64 : : The view that needs an update
65 : :
66 : : @param bViewClobbered
67 : : When true, notifies update that view content is
68 : : clobbered by external circumstances (e.g. by another
69 : : application), and needs update even if the
70 : : implementation 'thinks' it does not need to render
71 : : something to screen.
72 : : */
73 : : void notifyUpdate( const UnoViewSharedPtr& rView, bool bViewClobbered=false );
74 : :
75 : : /** Commits collected update actions
76 : : */
77 : : void commitUpdates();
78 : :
79 : : /** Register ViewUpdate
80 : :
81 : : @param rViewUpdate
82 : : Add this ViewUpdate to the list that's asked for
83 : : pending updates
84 : : */
85 : : void addViewUpdate( ViewUpdateSharedPtr const& rViewUpdate );
86 : :
87 : : /** Unregister ViewUpdate
88 : :
89 : : @param rViewUpdate
90 : : Remove this ViewUpdate from the list that's asked for
91 : : pending updates
92 : : */
93 : : void removeViewUpdate( ViewUpdateSharedPtr const& );
94 : :
95 : : /** A wart.
96 : :
97 : : Used to fire an immediate screen update. Currently
98 : : needed for the wait symbol, since switching that on
99 : : and off does get to commitUpdates()
100 : : */
101 : : void requestImmediateUpdate();
102 : :
103 : 0 : class UpdateLock {
104 : : public:
105 : : virtual void Activate (void) = 0;
106 : :
107 : : protected:
108 : 0 : ~UpdateLock() {}
109 : : };
110 : :
111 : : /** Call this method to create a lock instead of calling
112 : : lockUpdates() and unlockUpdates() directly.
113 : : @param bStartLocked
114 : : When <TRUE/> then the UpdateLock is created already
115 : : locked. When <FALSE/> then Activate() has to be called in order
116 : : to lock the lock.
117 : : */
118 : : ::boost::shared_ptr<UpdateLock> createLock (const bool bStartLocked);
119 : :
120 : : /** Lock updates to prevent intermediate repaints.
121 : : */
122 : : void lockUpdates (void);
123 : :
124 : : /** When called as often as lockUpdates() then commitUpdates()
125 : : is called.
126 : : */
127 : : void unlockUpdates (void);
128 : :
129 : : private:
130 : : struct ImplScreenUpdater;
131 : : boost::scoped_ptr<ImplScreenUpdater> mpImpl;
132 : :
133 : : };
134 : : }
135 : : }
136 : :
137 : : #endif /* INCLUDED_SLIDESHOW_SCREENUPDATER_HXX */
138 : :
139 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|