Bump version to 6.0-36
[LibreOffice.git] / slideshow / source / inc / screenupdater.hxx
blobdcf299b18586e964b145f5711790d1d606022a64
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_SCREENUPDATER_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_SCREENUPDATER_HXX
23 #include "viewupdate.hxx"
24 #include "unoviewcontainer.hxx"
25 #include <memory>
27 /* Definition of ScreenUpdater class */
29 namespace slideshow
31 namespace internal
33 /** Screen updater
35 This class handles and synchronizes screen updates
36 centrally. Therefore, it can hold a number of ViewUpdate
37 objects, which are polled for pending updates on
38 commitUpdates(). Furthermore, external code can request
39 updates via notifyUpdate() calls. If neither such an
40 update was requested, nor any of the registered ViewUpdate
41 objects report any pending update, commitUpdates() does
42 nothing.
44 class ScreenUpdater
46 public:
47 explicit ScreenUpdater( UnoViewContainer const& rViewContainer );
48 ~ScreenUpdater();
49 ScreenUpdater(const ScreenUpdater&) = delete;
50 ScreenUpdater& operator=(const ScreenUpdater&) = delete;
52 /** Notify screen update
54 This method records a screen content update request
55 for all views.
57 void notifyUpdate();
59 /** Notify screen update
61 This method records a screen content update request
62 for the given view.
64 @param rView
65 The view that needs an update
67 @param bViewClobbered
68 When true, notifies update that view content is
69 clobbered by external circumstances (e.g. by another
70 application), and needs update even if the
71 implementation 'thinks' it does not need to render
72 something to screen.
74 void notifyUpdate( const UnoViewSharedPtr& rView, bool bViewClobbered );
76 /** Commits collected update actions
78 void commitUpdates();
80 /** Register ViewUpdate
82 @param rViewUpdate
83 Add this ViewUpdate to the list that's asked for
84 pending updates
86 void addViewUpdate( ViewUpdateSharedPtr const& rViewUpdate );
88 /** Unregister ViewUpdate
90 @param rViewUpdate
91 Remove this ViewUpdate from the list that's asked for
92 pending updates
94 void removeViewUpdate( ViewUpdateSharedPtr const& );
96 /** A wart.
98 Used to fire an immediate screen update. Currently
99 needed for the wait symbol, since switching that on
100 and off does get to commitUpdates()
102 void requestImmediateUpdate();
104 class UpdateLock {
105 public:
106 virtual void Activate() = 0;
108 protected:
109 ~UpdateLock() {}
112 /** Call this method to create a lock instead of calling
113 lockUpdates() and unlockUpdates() directly.
115 ::std::shared_ptr<UpdateLock> createLock();
117 /** Lock updates to prevent intermediate repaints.
119 void lockUpdates();
121 /** When called as often as lockUpdates() then commitUpdates()
122 is called.
124 void unlockUpdates();
126 private:
127 struct ImplScreenUpdater;
128 std::unique_ptr<ImplScreenUpdater> mpImpl;
134 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_SCREENUPDATER_HXX
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */