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