Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / svx / langbox.hxx
blob410b2405f30d49375ad0431881ebeea5e8cab28b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVX_LANGBOX_HXX
20 #define INCLUDED_SVX_LANGBOX_HXX
22 #include <com/sun/star/uno/Sequence.hxx>
23 #include <svx/svxdllapi.h>
24 #include <vcl/image.hxx>
25 #include <vcl/lstbox.hxx>
26 #include <vcl/combobox.hxx>
27 #include <boost/noncopyable.hpp>
30 #define LANG_LIST_EMPTY 0x0000
31 #define LANG_LIST_ALL 0x0001
32 #define LANG_LIST_WESTERN 0x0002
33 #define LANG_LIST_CTL 0x0004
34 #define LANG_LIST_CJK 0x0008
35 #define LANG_LIST_FBD_CHARS 0x0010
36 #define LANG_LIST_SPELL_AVAIL 0x0020
37 #define LANG_LIST_HYPH_AVAIL 0x0040
38 #define LANG_LIST_THES_AVAIL 0x0080
39 #define LANG_LIST_ONLY_KNOWN 0x0100 // list only locales provided by I18N
40 #define LANG_LIST_SPELL_USED 0x0200
41 #define LANG_LIST_HYPH_USED 0x0400
42 #define LANG_LIST_THES_USED 0x0800
43 #define LANG_LIST_ALSO_PRIMARY_ONLY 0x1000 // Do not exclude primary-only
44 // languages that do not form a
45 // locale, such as Arabic as
46 // opposed to Arabic-Egypt.
49 // load language strings from resource
50 SVX_DLLPUBLIC OUString GetDicInfoStr( const OUString& rName, const sal_uInt16 nLang, bool bNeg );
52 class SVX_DLLPUBLIC SvxLanguageBoxBase : boost::noncopyable
54 public:
55 explicit SvxLanguageBoxBase( bool bCheck );
56 virtual ~SvxLanguageBoxBase();
58 void SetLanguageList( sal_Int16 nLangList,
59 bool bHasLangNone, bool bLangNoneIsLangAll = false,
60 bool bCheckSpellAvail = false );
62 sal_Int32 InsertLanguage( const LanguageType eLangType, sal_Int32 nPos = LISTBOX_APPEND );
63 sal_Int32 InsertDefaultLanguage( sal_Int16 nType, sal_Int32 nPos = LISTBOX_APPEND );
64 sal_Int32 InsertSystemLanguage( sal_Int32 nPos = LISTBOX_APPEND );
65 sal_Int32 InsertLanguage( const LanguageType eLangType,
66 bool bCheckEntry, sal_Int32 nPos = LISTBOX_APPEND );
67 void RemoveLanguage( const LanguageType eLangType );
68 void SelectLanguage( const LanguageType eLangType, bool bSelect = true );
69 LanguageType GetSelectLanguage() const;
70 bool IsLanguageSelected( const LanguageType eLangType ) const;
72 void SetNoSelectionLBB();
73 void HideLBB();
74 void DisableLBB();
75 void SaveValueLBB();
76 sal_Int32 GetSelectEntryPosLBB( sal_Int32 nSelIndex = 0 ) const;
77 void* GetEntryDataLBB( sal_Int32 nPos ) const;
78 sal_Int32 GetSavedValueLBB() const;
80 protected:
81 Image m_aNotCheckedImage;
82 Image m_aCheckedImage;
83 OUString m_aAllString;
84 com::sun::star::uno::Sequence< sal_Int16 > *m_pSpellUsedLang;
85 sal_Int16 m_nLangList;
86 bool m_bHasLangNone;
87 bool m_bLangNoneIsLangAll;
88 bool m_bWithCheckmark;
90 SVX_DLLPRIVATE void ImplLanguageBoxBaseInit();
91 SVX_DLLPRIVATE sal_Int32 ImplInsertLanguage(LanguageType, sal_Int32 nPos, sal_Int16 nType);
92 SVX_DLLPRIVATE sal_Int32 ImplTypeToPos( LanguageType eType ) const;
94 SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) = 0;
95 SVX_DLLPRIVATE virtual void ImplRemoveEntryAt( sal_Int32 nPos ) = 0;
97 SVX_DLLPRIVATE virtual void ImplClear() = 0;
98 SVX_DLLPRIVATE virtual sal_Int32 ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) = 0;
99 SVX_DLLPRIVATE virtual void ImplSetEntryData( sal_Int32 nPos, void* pData ) = 0;
100 SVX_DLLPRIVATE virtual sal_Int32 ImplGetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const = 0;
101 SVX_DLLPRIVATE virtual void* ImplGetEntryData( sal_Int32 nPos ) const = 0;
102 SVX_DLLPRIVATE virtual void ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) = 0;
103 SVX_DLLPRIVATE virtual bool ImplIsEntryPosSelected( sal_Int32 nPos ) const = 0;
104 SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryPos( const void* pData ) const = 0;
105 SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryCount() const = 0;
106 SVX_DLLPRIVATE virtual void ImplSetNoSelection() = 0;
107 SVX_DLLPRIVATE virtual void ImplHide() = 0;
108 SVX_DLLPRIVATE virtual void ImplDisable() = 0;
109 SVX_DLLPRIVATE virtual void ImplSaveValue() = 0;
110 SVX_DLLPRIVATE virtual sal_Int32 ImplGetSavedValue() const = 0;
114 class SVX_DLLPUBLIC SvxLanguageBox : public ListBox, public SvxLanguageBoxBase
116 public:
117 SvxLanguageBox( Window* pParent, WinBits nBits, bool bCheck = false );
118 virtual ~SvxLanguageBox();
120 private:
121 SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) SAL_OVERRIDE;
122 SVX_DLLPRIVATE virtual void ImplRemoveEntryAt( sal_Int32 nPos ) SAL_OVERRIDE;
124 SVX_DLLPRIVATE virtual void ImplClear() SAL_OVERRIDE;
125 SVX_DLLPRIVATE virtual sal_Int32 ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) SAL_OVERRIDE;
126 SVX_DLLPRIVATE virtual void ImplSetEntryData( sal_Int32 nPos, void* pData ) SAL_OVERRIDE;
127 SVX_DLLPRIVATE virtual sal_Int32 ImplGetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const SAL_OVERRIDE;
128 SVX_DLLPRIVATE virtual void* ImplGetEntryData( sal_Int32 nPos ) const SAL_OVERRIDE;
129 SVX_DLLPRIVATE virtual void ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) SAL_OVERRIDE;
130 SVX_DLLPRIVATE virtual bool ImplIsEntryPosSelected( sal_Int32 nPos ) const SAL_OVERRIDE;
131 SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryPos( const void* pData ) const SAL_OVERRIDE;
132 SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryCount() const SAL_OVERRIDE;
133 SVX_DLLPRIVATE virtual void ImplSetNoSelection() SAL_OVERRIDE;
134 SVX_DLLPRIVATE virtual void ImplHide() SAL_OVERRIDE;
135 SVX_DLLPRIVATE virtual void ImplDisable() SAL_OVERRIDE;
136 SVX_DLLPRIVATE virtual void ImplSaveValue() SAL_OVERRIDE;
137 SVX_DLLPRIVATE virtual sal_Int32 ImplGetSavedValue() const SAL_OVERRIDE;
141 class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBoxBase
143 public:
144 SvxLanguageComboBox( Window* pParent, WinBits nBits, bool bCheck = false );
145 virtual ~SvxLanguageComboBox();
147 private:
148 sal_Int32 mnSavedValuePos;
150 SVX_DLLPRIVATE virtual sal_Int32 ImplInsertImgEntry( const OUString& rEntry, sal_Int32 nPos, bool bChecked ) SAL_OVERRIDE;
151 SVX_DLLPRIVATE virtual void ImplRemoveEntryAt( sal_Int32 nPos ) SAL_OVERRIDE;
153 SVX_DLLPRIVATE virtual void ImplClear() SAL_OVERRIDE;
154 SVX_DLLPRIVATE virtual sal_Int32 ImplInsertEntry( const OUString& rEntry, sal_Int32 nPos ) SAL_OVERRIDE;
155 SVX_DLLPRIVATE virtual void ImplSetEntryData( sal_Int32 nPos, void* pData ) SAL_OVERRIDE;
156 SVX_DLLPRIVATE virtual sal_Int32 ImplGetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const SAL_OVERRIDE;
157 SVX_DLLPRIVATE virtual void* ImplGetEntryData( sal_Int32 nPos ) const SAL_OVERRIDE;
158 SVX_DLLPRIVATE virtual void ImplSelectEntryPos( sal_Int32 nPos, bool bSelect ) SAL_OVERRIDE;
159 SVX_DLLPRIVATE virtual bool ImplIsEntryPosSelected( sal_Int32 nPos ) const SAL_OVERRIDE;
160 SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryPos( const void* pData ) const SAL_OVERRIDE;
161 SVX_DLLPRIVATE virtual sal_Int32 ImplGetEntryCount() const SAL_OVERRIDE;
162 SVX_DLLPRIVATE virtual void ImplSetNoSelection() SAL_OVERRIDE;
163 SVX_DLLPRIVATE virtual void ImplHide() SAL_OVERRIDE;
164 SVX_DLLPRIVATE virtual void ImplDisable() SAL_OVERRIDE;
165 SVX_DLLPRIVATE virtual void ImplSaveValue() SAL_OVERRIDE;
166 SVX_DLLPRIVATE virtual sal_Int32 ImplGetSavedValue() const SAL_OVERRIDE;
169 #endif
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */