xref: /AOO41X/main/basctl/source/inc/managelang.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 _BASCTL_MANAGELANG_HXX
29 #define _BASCTL_MANAGELANG_HXX
30 
31 #include <vcl/dialog.hxx>
32 #ifndef _FIXED_HXX
33 #include <vcl/fixed.hxx>
34 #endif
35 #ifndef _LSTBOX_HXX
36 #include <vcl/lstbox.hxx>
37 #endif
38 #ifndef _BUTTON_HXX
39 #include <vcl/button.hxx>
40 #endif
41 #include <svx/langbox.hxx>
42 #include <svx/checklbx.hxx>
43 
44 class LocalizationMgr;
45 
46 struct LanguageEntry
47 {
48 	String							m_sLanguage;
49 	::com::sun::star::lang::Locale	m_aLocale;
50 	bool							m_bIsDefault;
51 
52 	LanguageEntry( const String& _rLanguage,
53 				   const ::com::sun::star::lang::Locale& _rLocale,
54 				   bool _bIsDefault ) :
55 		m_sLanguage( _rLanguage ),
56 		m_aLocale( _rLocale ),
57 		m_bIsDefault( _bIsDefault ) {}
58 };
59 
60 extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
61 							 const ::com::sun::star::lang::Locale& rLocaleRight );
62 
63 class ManageLanguageDialog : public ModalDialog
64 {
65 private:
66     FixedText       	m_aLanguageFT;
67     ListBox         	m_aLanguageLB;
68     PushButton     		m_aAddPB;
69     PushButton      	m_aDeletePB;
70     PushButton      	m_aMakeDefPB;
71     FixedText       	m_aInfoFT;
72 
73 	FixedLine			m_aBtnLine;
74     HelpButton      	m_aHelpBtn;
75     OKButton      		m_aCloseBtn;
76 
77 	LocalizationMgr*    m_pLocalizationMgr;
78 
79 	String				m_sDefLangStr;
80 	String				m_sDeleteStr;
81 	String				m_sCreateLangStr;
82 
83 	void				Init();
84 	void                CalcInfoSize();
85     void				FillLanguageBox();
86 	void				ClearLanguageBox();
87 
88     DECL_LINK( 			AddHdl, Button * );
89     DECL_LINK( 			DeleteHdl, Button * );
90     DECL_LINK( 			MakeDefHdl, Button * );
91     DECL_LINK( 			SelectHdl, ListBox * );
92 
93 public:
94     ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr );
95     ~ManageLanguageDialog();
96 };
97 
98 class SetDefaultLanguageDialog : public ModalDialog
99 {
100 private:
101     FixedText           m_aLanguageFT;
102     SvxLanguageBox*     m_pLanguageLB;
103 	SvxCheckListBox*    m_pCheckLangLB;
104     FixedText           m_aInfoFT;
105 
106 	FixedLine		    m_aBtnLine;
107     OKButton            m_aOKBtn;
108     CancelButton   	    m_aCancelBtn;
109     HelpButton          m_aHelpBtn;
110 
111 	bool				m_bIsDefaultMode;
112 	LocalizationMgr*    m_pLocalizationMgr;
113 
114 	void			    FillLanguageBox();
115 	void                CalcInfoSize();
116 
117 public:
118     SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr );
119     ~SetDefaultLanguageDialog();
120 
121 	::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale >	GetLocales() const;
122 };
123 
124 #endif //_BASCTL_MANAGELANG_HXX
125 
126