1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_FORMS_SOURCE_INC_WINDOWSTATEGUARD_HXX
21 #define INCLUDED_FORMS_SOURCE_INC_WINDOWSTATEGUARD_HXX
23 #include <com/sun/star/awt/XWindow2.hpp>
24 #include <com/sun/star/awt/XControlModel.hpp>
25 #include <rtl/ref.hxx>
34 class WindowStateGuard_Impl
;
36 /** a helper class which monitors certain states of an XWindow2, and ensures
37 that they're consistent with respective properties at an XModel.
39 For form controls, window states - such as "Enabled" - can be set by various
40 means. You can set the respective control model property, you can directly manipulate
41 the XWindow2, or the state can change implicitly due to VCL actions. In any case,
42 we need to ensure that the state does not contradict the model property "too much".
44 As an example, consider a form control which, according to its model's property, is disabled.
45 Now when the parent VCL window of the control's VCL window is enabled, then the control's
46 window is enabled, too - which contradicts the model property.
48 A WindowStateGuard helps you preventing such inconsistent states.
50 The class is not threadsafe.
52 class WindowStateGuard
55 ::rtl::Reference
< WindowStateGuard_Impl
> m_pImpl
;
62 const css::uno::Reference
< css::awt::XWindow2
>& _rxWindow
,
63 const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
71 #endif // INCLUDED_FORMS_SOURCE_INC_WINDOWSTATEGUARD_HXX
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */