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 .
22 #include <com/sun/star/awt/XWindow2.hpp>
23 #include <com/sun/star/awt/XControlModel.hpp>
24 #include <rtl/ref.hxx>
33 class WindowStateGuard_Impl
;
35 /** a helper class which monitors certain states of an XWindow2, and ensures
36 that they're consistent with respective properties at an XModel.
38 For form controls, window states - such as "Enabled" - can be set by various
39 means. You can set the respective control model property, you can directly manipulate
40 the XWindow2, or the state can change implicitly due to VCL actions. In any case,
41 we need to ensure that the state does not contradict the model property "too much".
43 As an example, consider a form control which, according to its model's property, is disabled.
44 Now when the parent VCL window of the control's VCL window is enabled, then the control's
45 window is enabled, too - which contradicts the model property.
47 A WindowStateGuard helps you preventing such inconsistent states.
49 The class is not threadsafe.
51 class WindowStateGuard
54 ::rtl::Reference
< WindowStateGuard_Impl
> m_pImpl
;
61 const css::uno::Reference
< css::awt::XWindow2
>& _rxWindow
,
62 const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */