merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / inc / UpdateLockManager.hxx
blob87a16a1a6665c8b9dbee34f1fa2b03f85f25e84d
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: UpdateLockManager.hxx,v $
10 * $Revision: 1.4 $
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 SD_UPDATE_LOCK_MANAGER_HXX
32 #define SD_UPDATE_LOCK_MANAGER_HXX
34 #include <memory>
36 namespace sd {
38 class ViewShellBase;
40 /** Manage update locks of ViewShellBase objects.
41 A ViewShellBase object is locked while views are switched in order to
42 avoid unnecessary repaints of views and object bars.
43 Locking a ViewShellBase locks the frame::XLayoutManager and prevents
44 Activate() and Deactivate() calls at ViewShell objects being processed.
46 The main responsibility of this class is find the right moment to unlock
47 the managed ViewShellBase object: Only Lock() has to be called from the
48 outside (usually from PaneManager). Unlock() is called by this class
49 itself. When all else fails it has a timer that calls Unlock()
50 eventually.
52 class UpdateLockManager
54 public:
55 /** The newly created instance supports locking for the specified
56 ViewShellBase object by default. Call Disable() for Lock() and
57 Unlock() calls being ignored.
59 UpdateLockManager (ViewShellBase& rBase);
60 ~UpdateLockManager (void);
62 /** For e.g. the PresentationViewShellBase locking is not necessary and
63 does lead to problems. This method lets Lock() and Unlock() calls
64 be ignored and thus turns locking essentially off.
66 void Disable (void);
68 /** Lock some UI updates. For every call to this method a call to
69 Unlock() is required to really unlock.
71 void Lock (void);
73 /** When called as many times as Lock() has been called before then the
74 ViewShellBase object is unlocked.
76 void Unlock (void);
78 /** Return whether the ViewShellBase object is locked. When locking is
79 disabled, i.e. Disable() has been called before, then this method
80 always returns <FALSE/>.
82 bool IsLocked (void) const;
84 private:
85 class Implementation;
86 Implementation* mpImpl;
88 UpdateLockManager (const UpdateLockManager&); // Not supported.
89 UpdateLockManager& operator= (const UpdateLockManager&); // Not supported.
92 } // end of namespace sd
94 #endif