Branch libreoffice-5-0-4
[LibreOffice.git] / sfx2 / source / appl / imestatuswindow.hxx
blob27a17f2fb0af94eb5884e7885d71cc9468c692af
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_SFX2_SOURCE_APPL_IMESTATUSWINDOW_HXX
21 #define INCLUDED_SFX2_SOURCE_APPL_IMESTATUSWINDOW_HXX
23 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <cppuhelper/implbase1.hxx>
26 #include <osl/mutex.hxx>
28 namespace com { namespace sun { namespace star {
29 namespace beans { class XPropertySet; }
30 namespace lang { class XMultiServiceFactory; }
31 namespace uno { class XComponentContext; }
32 } } }
34 namespace sfx2 { namespace appl {
36 // The MS compiler needs this typedef work-around to accept the using
37 // declarations within ImeStatusWindow:
38 typedef cppu::WeakImplHelper1< com::sun::star::beans::XPropertyChangeListener >
39 ImeStatusWindow_Impl;
41 /** Control the behavior of any (platform-dependent) IME status windows.
43 The decision of whether a status window shall be displayed or not can be
44 stored permanently in the configuration (under key
45 org.openoffice.office.Common/I18N/InputMethod/ShowStatusWindow; if that
46 entry is nil, VCL is asked for a default).
48 class ImeStatusWindow: private ImeStatusWindow_Impl
50 public:
51 ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& rxContext );
53 /** Set up VCL according to the configuration.
55 Is it not strictly required that this method is called exactly once
56 (though that will be the typical use).
58 Must only be called with the Solar mutex locked.
60 void init();
62 /** Return true if the status window is toggled on.
64 This is only meaningful when canToggle returns true.
66 Can be called without the Solar mutex locked.
68 bool isShowing();
70 /** Toggle the status window on or off.
72 This only works if canToggle returns true (otherwise, any calls of this
73 method are ignored).
75 Must only be called with the Solar mutex locked.
77 void show(bool bShow);
79 /** Return true if the status window can be toggled on and off externally.
81 Must only be called with the Solar mutex locked.
83 static bool canToggle();
85 using ImeStatusWindow_Impl::acquire;
86 using ImeStatusWindow_Impl::release;
87 using ImeStatusWindow_Impl::operator new;
88 using ImeStatusWindow_Impl::operator delete;
90 private:
91 ImeStatusWindow(ImeStatusWindow &) SAL_DELETED_FUNCTION;
92 void operator =(const ImeStatusWindow&) SAL_DELETED_FUNCTION;
94 virtual ~ImeStatusWindow();
96 virtual void SAL_CALL
97 disposing(com::sun::star::lang::EventObject const & rSource)
98 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 virtual void SAL_CALL
101 propertyChange(com::sun::star::beans::PropertyChangeEvent const & rEvent)
102 throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >
105 getConfig();
107 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
108 m_xContext;
110 osl::Mutex m_aMutex;
111 com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >
112 m_xConfig;
113 com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >
114 m_xConfigListener;
115 bool m_bDisposed;
120 #endif // INCLUDED_SFX2_SOURCE_APPL_IMESTATUSWINDOW_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */