1*353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*353d8f4dSAndrew Rist  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*353d8f4dSAndrew Rist  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19*353d8f4dSAndrew Rist  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #if !defined INCLUDED_SFX2_APPL_IMESTATUSWINDOW_HXX
25cdf0e10cSrcweir #define INCLUDED_SFX2_APPL_IMESTATUSWINDOW_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "com/sun/star/beans/XPropertyChangeListener.hpp"
28cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
29cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx"
30cdf0e10cSrcweir #include "osl/mutex.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace com { namespace sun { namespace star {
33cdf0e10cSrcweir     namespace beans { class XPropertySet; }
34cdf0e10cSrcweir     namespace lang { class XMultiServiceFactory; }
35cdf0e10cSrcweir } } }
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace sfx2 { namespace appl {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // The MS compiler needs this typedef work-around to accept the using
40cdf0e10cSrcweir // declarations within ImeStatusWindow:
41cdf0e10cSrcweir typedef cppu::WeakImplHelper1< com::sun::star::beans::XPropertyChangeListener >
42cdf0e10cSrcweir ImeStatusWindow_Impl;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir /** Control the behavior of any (platform-dependent) IME status windows.
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     The decision of whether a status window shall be displayed or not can be
47cdf0e10cSrcweir     stored permanently in the configuration (under key
48cdf0e10cSrcweir     org.openoffice.office.Common/I18N/InputMethod/ShowStatusWindow; if that
49cdf0e10cSrcweir     entry is nil, VCL is asked for a default).
50cdf0e10cSrcweir  */
51cdf0e10cSrcweir class ImeStatusWindow: private ImeStatusWindow_Impl
52cdf0e10cSrcweir {
53cdf0e10cSrcweir public:
54cdf0e10cSrcweir     ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const& rServiceFactory );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     /** Set up VCL according to the configuration.
57cdf0e10cSrcweir 
58cdf0e10cSrcweir         Is it not strictly required that this method is called exactly once
59cdf0e10cSrcweir         (though that will be the typical use).
60cdf0e10cSrcweir 
61cdf0e10cSrcweir         Must only be called with the Solar mutex locked.
62cdf0e10cSrcweir      */
63cdf0e10cSrcweir     void init();
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     /** Return true if the status window is toggled on.
66cdf0e10cSrcweir 
67cdf0e10cSrcweir         This is only meaningful when canToggle returns true.
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         Can be called without the Solar mutex locked.
70cdf0e10cSrcweir      */
71cdf0e10cSrcweir     bool isShowing();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     /** Toggle the status window on or off.
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         This only works if canToggle returns true (otherwise, any calls of this
76cdf0e10cSrcweir         method are ignored).
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         Must only be called with the Solar mutex locked.
79cdf0e10cSrcweir      */
80cdf0e10cSrcweir     void show(bool bShow);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     /** Return true if the status window can be toggled on and off externally.
83cdf0e10cSrcweir 
84cdf0e10cSrcweir         Must only be called with the Solar mutex locked.
85cdf0e10cSrcweir      */
86cdf0e10cSrcweir     bool canToggle() const;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     using ImeStatusWindow_Impl::acquire;
89cdf0e10cSrcweir     using ImeStatusWindow_Impl::release;
90cdf0e10cSrcweir     using ImeStatusWindow_Impl::operator new;
91cdf0e10cSrcweir     using ImeStatusWindow_Impl::operator delete;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir private:
94cdf0e10cSrcweir     ImeStatusWindow(ImeStatusWindow &); // not implemented
95cdf0e10cSrcweir     void operator =(ImeStatusWindow); // not implemented
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual ~ImeStatusWindow();
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     virtual void SAL_CALL
100cdf0e10cSrcweir     disposing(com::sun::star::lang::EventObject const & rSource)
101cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     virtual void SAL_CALL
104cdf0e10cSrcweir     propertyChange(com::sun::star::beans::PropertyChangeEvent const & rEvent)
105cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >
108cdf0e10cSrcweir     getConfig();
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
111cdf0e10cSrcweir         m_xServiceFactory;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     osl::Mutex m_aMutex;
114cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >
115cdf0e10cSrcweir         m_xConfig;
116cdf0e10cSrcweir     bool m_bDisposed;
117cdf0e10cSrcweir };
118cdf0e10cSrcweir 
119cdf0e10cSrcweir } }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir #endif // INCLUDED_SFX2_APPL_IMESTATUSWINDOW_HXX
122