sw a11y: clang-format SidebarWinAccessible code
[LibreOffice.git] / slideshow / source / inc / screenupdater.hxx
blob4ae4775190216c9eacede8a71c17d18a332a6667
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::internal
31 /** Screen updater
33 This class handles and synchronizes screen updates
34 centrally. Therefore, it can hold a number of ViewUpdate
35 objects, which are polled for pending updates on
36 commitUpdates(). Furthermore, external code can request
37 updates via notifyUpdate() calls. If neither such an
38 update was requested, nor any of the registered ViewUpdate
39 objects report any pending update, commitUpdates() does
40 nothing.
42 class ScreenUpdater
44 public:
45 explicit ScreenUpdater( UnoViewContainer const& rViewContainer );
46 ~ScreenUpdater();
47 ScreenUpdater(const ScreenUpdater&) = delete;
48 ScreenUpdater& operator=(const ScreenUpdater&) = delete;
50 /** Notify screen update
52 This method records a screen content update request
53 for all views.
55 void notifyUpdate();
57 /** Notify screen update
59 This method records a screen content update request
60 for the given view.
62 @param rView
63 The view that needs an update
65 @param bViewClobbered
66 When true, notifies update that view content is
67 clobbered by external circumstances (e.g. by another
68 application), and needs update even if the
69 implementation 'thinks' it does not need to render
70 something to screen.
72 void notifyUpdate( const UnoViewSharedPtr& rView, bool bViewClobbered );
74 /** Commits collected update actions
76 void commitUpdates();
78 /** Register ViewUpdate
80 @param rViewUpdate
81 Add this ViewUpdate to the list that's asked for
82 pending updates
84 void addViewUpdate( ViewUpdateSharedPtr const& rViewUpdate );
86 /** Unregister ViewUpdate
88 @param rViewUpdate
89 Remove this ViewUpdate from the list that's asked for
90 pending updates
92 void removeViewUpdate( ViewUpdateSharedPtr const& );
94 /** A wart.
96 Used to fire an immediate screen update. Currently
97 needed for the wait symbol, since switching that on
98 and off does get to commitUpdates()
100 void requestImmediateUpdate();
102 class UpdateLock {
103 public:
104 virtual void Activate() = 0;
106 protected:
107 ~UpdateLock() {}
110 /** Call this method to create a lock instead of calling
111 lockUpdates() and unlockUpdates() directly.
113 ::std::shared_ptr<UpdateLock> createLock();
115 /** Lock updates to prevent intermediate repaints.
117 void lockUpdates();
119 /** When called as often as lockUpdates() then commitUpdates()
120 is called.
122 void unlockUpdates();
124 private:
125 struct ImplScreenUpdater;
126 std::unique_ptr<ImplScreenUpdater> mpImpl;
132 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_SCREENUPDATER_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */