xref: /aoo4110/main/vcl/inc/unx/i18n_status.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SAL_I18N_STATUS_HXX
25 #define _SAL_I18N_STATUS_HXX
26 
27 #include <tools/string.hxx>
28 #include <tools/link.hxx>
29 #include <tools/gen.hxx>
30 
31 #include <rtl/ustring.hxx>
32 
33 #include <salimestatus.hxx>
34 
35 #include <vector>
36 
37 class SalFrame;
38 class WorkWindow;
39 class ListBox;
40 class FixedText;
41 class PushButton;
42 class SalI18N_InputContext;
43 
44 namespace vcl
45 {
46 
47 class StatusWindow;
48 
49 class X11ImeStatus : public SalI18NImeStatus
50 {
51 public:
X11ImeStatus()52     X11ImeStatus() {}
53     virtual ~X11ImeStatus();
54 
55     virtual bool canToggle();
56     virtual void toggle();
57 };
58 
59 class I18NStatus
60 {
61 public:
62     struct ChoiceData
63     {
64         String	aString;
65         void*	pData;
66     };
67 private:
68     SalFrame*				        m_pParent;
69     StatusWindow*			        m_pStatusWindow;
70     String					        m_aCurrentIM;
71     ::std::vector< ChoiceData >     m_aChoices;
72 
73     I18NStatus();
74     ~I18NStatus();
75 
76     static I18NStatus* pInstance;
77 
78     static bool getStatusWindowMode();
79 
80 public:
81     static I18NStatus& get();
82     static bool exists();
83     static void free();
84 
85     void setParent( SalFrame* pParent );
getParent() const86     SalFrame* getParent() const { return  m_pParent; }
87     SalFrame* getStatusFrame() const;
88 
89     void setStatusText( const String& rText );
90     String getStatusText() const;
91 
92     enum ShowReason { focus, presentation, contextmap };
93     void show( bool bShow, ShowReason eReason );
94 
getChoices() const95     const ::std::vector< ChoiceData >& getChoices() const { return m_aChoices; }
96     void clearChoices();
97     void addChoice( const String&, void* pData );
98 
99     void toTop() const;
100 
101     // for SwitchIMCallback
102     void changeIM( const String& );
103 
104     // External Control:
105 
106     /** Return true if the status window can be toggled on and off externally.
107      */
108     bool canToggleStatusWindow() const;
109 
110     /** Toggle the status window on or off.
111 
112         This only works if canToggleStatusWindow returns true (otherwise, any
113         calls of this method are ignored).
114      */
115     void toggleStatusWindow();
116 };
117 
118 } // namespace
119 
120 #endif // _SAL_I18N_STATUS_HXX
121