xref: /aoo4110/main/svx/inc/svx/langbox.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 #ifndef _SVX_LANGBOX_HXX
24 #define _SVX_LANGBOX_HXX
25 
26 // include ---------------------------------------------------------------
27 
28 #include <com/sun/star/uno/Sequence.hxx>
29 #include <vcl/lstbox.hxx>
30 #include "svx/svxdllapi.h"
31 #include <vcl/image.hxx>
32 #include <tools/solar.h>
33 #include <layout/layout.hxx>
34 
35 class SvtLanguageTable;
36 
37 #define LANG_LIST_EMPTY             0x0000
38 #define LANG_LIST_ALL               0x0001
39 #define LANG_LIST_WESTERN           0x0002
40 #define LANG_LIST_CTL               0x0004
41 #define LANG_LIST_CJK               0x0008
42 #define LANG_LIST_FBD_CHARS         0x0010
43 #define LANG_LIST_SPELL_AVAIL       0x0020
44 #define LANG_LIST_HYPH_AVAIL        0x0040
45 #define LANG_LIST_THES_AVAIL        0x0080
46 #define LANG_LIST_ONLY_KNOWN        0x0100  // list only locales provided by I18N
47 #define LANG_LIST_SPELL_USED        0x0200
48 #define LANG_LIST_HYPH_USED         0x0400
49 #define LANG_LIST_THES_USED         0x0800
50 #define LANG_LIST_ALSO_PRIMARY_ONLY 0x1000  // Do not exclude primary-only
51                                             // languages that do not form a
52                                             // locale, such as Arabic as
53                                             // opposed to Arabic-Egypt.
54 
55 
56 // load language strings from resource
57 SVX_DLLPUBLIC String 	GetDicInfoStr( const String& rName, const sal_uInt16 nLang, sal_Bool bNeg );
58 
59 class SVX_DLLPUBLIC SvxLanguageBox : public ListBox
60 {
61 public:
62 
63 private:
64 	Image					m_aNotCheckedImage;
65 	Image					m_aCheckedImage;
66     Image                   m_aCheckedImageHC;
67 	String					m_aAllString;
68     com::sun::star::uno::Sequence< sal_Int16 >  *m_pSpellUsedLang;
69     SvtLanguageTable*       m_pLangTable;
70 	sal_Int16					m_nLangList;
71 	sal_Bool                    m_bHasLangNone;
72 	sal_Bool					m_bLangNoneIsLangAll;
73 	sal_Bool					m_bWithCheckmark;
74 
75     SVX_DLLPRIVATE void                    Init();
76     SVX_DLLPRIVATE sal_uInt16                  ImplInsertImgEntry( const String& rEntry, sal_uInt16 nPos, bool bChecked );
77     SVX_DLLPRIVATE sal_uInt16                  ImplInsertLanguage(LanguageType, sal_uInt16, sal_Int16 );
78 
79 public:
80     SvxLanguageBox( Window* pParent, WinBits nWinStyle, sal_Bool bCheck = sal_False);
81     SvxLanguageBox( Window* pParent, const ResId& rResId, sal_Bool bCheck = sal_False);
82 	~SvxLanguageBox();
83 
84 	void			SetLanguageList( sal_Int16 nLangList,
85 							sal_Bool bHasLangNone, sal_Bool bLangNoneIsLangAll = sal_False,
86 							sal_Bool bCheckSpellAvail = sal_False );
87 
88 	sal_uInt16			InsertLanguage( const LanguageType eLangType, sal_uInt16 nPos = LISTBOX_APPEND );
89 	sal_uInt16			InsertDefaultLanguage( sal_Int16 nType, sal_uInt16 nPos = LISTBOX_APPEND );
90     sal_uInt16          InsertLanguage( const LanguageType eLangType,
91                             sal_Bool bCheckEntry, sal_uInt16 nPos = LISTBOX_APPEND );
92 	void			RemoveLanguage( const LanguageType eLangType );
93 	void			SelectLanguage( const LanguageType eLangType, sal_Bool bSelect = sal_True );
94 	LanguageType	GetSelectLanguage() const;
95 	sal_Bool			IsLanguageSelected( const LanguageType eLangType ) const;
96 };
97 
98 #if ENABLE_LAYOUT
99 namespace layout
100 {
101 class SvxLanguageBoxImpl;
102 class SVX_DLLPUBLIC SvxLanguageBox : public ListBox
103 {
104     /*DECL_GET_IMPL( SvxLanguageBox );
105     DECL_CONSTRUCTORS( SvxLanguageBox, ListBox, WB_BORDER );
106     DECL_GET_WINDOW (SvxLanguageBox);*/
107 
108 public:
109 	SvxLanguageBox( Context*, const char*, sal_Bool bCheck = sal_False );
110     ~SvxLanguageBox ();
111     void SetLanguageList (sal_Int16 list, bool hasLangNone, bool langNoneIsLangAll=false, bool checkSpellAvailable=false);
112 
113     sal_uInt16 InsertLanguage (LanguageType const type, sal_uInt16 pos=LISTBOX_APPEND);
114     sal_uInt16 InsertLanguage (LanguageType const type, bool checkEntry, sal_uInt16 pos=LISTBOX_APPEND);
115     void RemoveLanguage (LanguageType const type);
116     void SelectLanguage (LanguageType const type, bool select=true);
117     LanguageType GetSelectLanguage () const;
118     bool IsLanguageSelected( LanguageType const type) const;
119 };
120 };
121 #endif
122 
123 #endif
124 
125