xref: /aoo42x/main/vcl/inc/unx/i18n_status.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SAL_I18N_STATUS_HXX
29 #define _SAL_I18N_STATUS_HXX
30 
31 #include <tools/string.hxx>
32 #include <tools/link.hxx>
33 #include <tools/gen.hxx>
34 
35 #include <rtl/ustring.hxx>
36 
37 #include <salimestatus.hxx>
38 
39 #include <vector>
40 
41 class SalFrame;
42 class WorkWindow;
43 class ListBox;
44 class FixedText;
45 class PushButton;
46 class SalI18N_InputContext;
47 
48 namespace vcl
49 {
50 
51 class StatusWindow;
52 
53 class X11ImeStatus : public SalI18NImeStatus
54 {
55 public:
56     X11ImeStatus() {}
57     virtual ~X11ImeStatus();
58 
59     virtual bool canToggle();
60     virtual void toggle();
61 };
62 
63 class I18NStatus
64 {
65 public:
66     struct ChoiceData
67     {
68         String	aString;
69         void*	pData;
70     };
71 private:
72     SalFrame*				        m_pParent;
73     StatusWindow*			        m_pStatusWindow;
74     String					        m_aCurrentIM;
75     ::std::vector< ChoiceData >     m_aChoices;
76 
77     I18NStatus();
78     ~I18NStatus();
79 
80     static I18NStatus* pInstance;
81 
82     static bool getStatusWindowMode();
83 
84 public:
85     static I18NStatus& get();
86     static bool exists();
87     static void free();
88 
89     void setParent( SalFrame* pParent );
90     SalFrame* getParent() const { return  m_pParent; }
91     SalFrame* getStatusFrame() const;
92 
93     void setStatusText( const String& rText );
94     String getStatusText() const;
95 
96     enum ShowReason { focus, presentation, contextmap };
97     void show( bool bShow, ShowReason eReason );
98 
99     const ::std::vector< ChoiceData >& getChoices() const { return m_aChoices; }
100     void clearChoices();
101     void addChoice( const String&, void* pData );
102 
103     void toTop() const;
104 
105     // for SwitchIMCallback
106     void changeIM( const String& );
107 
108     // External Control:
109 
110     /** Return true if the status window can be toggled on and off externally.
111      */
112     bool canToggleStatusWindow() const;
113 
114     /** Toggle the status window on or off.
115 
116         This only works if canToggleStatusWindow returns true (otherwise, any
117         calls of this method are ignored).
118      */
119     void toggleStatusWindow();
120 };
121 
122 } // namespace
123 
124 #endif // _SAL_I18N_STATUS_HXX
125