| 1 |
/* AbiSource Application Framework |
| 2 |
* Copyright (C) 1998 AbiSource, Inc. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU General Public License |
| 6 |
* as published by the Free Software Foundation; either version 2 |
| 7 |
* of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This program is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with this program; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 17 |
* 02110-1301 USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef XAP_DIALOG_LANGUAGE_H |
| 21 |
#define XAP_DIALOG_LANGUAGE_H |
| 22 |
|
| 23 |
#ifdef HAVE_CONFIG_H |
| 24 |
#include "config.h" |
| 25 |
#endif |
| 26 |
|
| 27 |
/* pre-emptive dismissal; ut_types.h is needed by just about everything, |
| 28 |
* so even if it's commented out in-file that's still a lot of work for |
| 29 |
* the preprocessor to do... |
| 30 |
*/ |
| 31 |
#ifndef UT_TYPES_H |
| 32 |
#include "ut_types.h" |
| 33 |
#endif |
| 34 |
|
| 35 |
#include <string> |
| 36 |
|
| 37 |
#include "xap_Dialog.h" |
| 38 |
|
| 39 |
#ifdef ENABLE_SPELL |
| 40 |
#include "spell_manager.h" |
| 41 |
#endif |
| 42 |
|
| 43 |
#include "ut_vector.h" |
| 44 |
|
| 45 |
class UT_Language; |
| 46 |
class UT_UTF8String; |
| 47 |
|
| 48 |
/******************************************************************** |
| 49 |
INSTRUCTIONS FOR DESIGN OF THE PLATFORM VERSIONS OF THIS DIALOGUE |
| 50 |
|
| 51 |
(1) implement runModal(); at the moment we display a single listbox |
| 52 |
|
| 53 |
(2) m_iLangCount will tell you how many list entries there will be; |
| 54 |
the language strings are then in m_ppLanguages (already sorted) |
| 55 |
|
| 56 |
(3) use _setLanguage() to set the member variables in response |
| 57 |
to the user selection when the dialog is closing. |
| 58 |
*********************************************************************/ |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
class ABI_EXPORT XAP_Dialog_Language : public XAP_Dialog_NonPersistent |
| 63 |
{ |
| 64 |
public: |
| 65 |
typedef enum { a_OK, a_CANCEL, a_YES, a_NO } tAnswer; |
| 66 |
|
| 67 |
XAP_Dialog_Language(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); |
| 68 |
virtual ~XAP_Dialog_Language(void); |
| 69 |
|
| 70 |
virtual void runModal(XAP_Frame * pFrame) = 0; |
| 71 |
void setLanguageProperty(const gchar * pLangProp); |
| 72 |
bool getChangedLangProperty(const gchar ** pszLangProp) const; |
| 73 |
|
| 74 |
bool isMakeDocumentDefault() const {return m_bDocDefault;} |
| 75 |
void setMakeDocumentDefault(bool b) {m_bDocDefault = b;} |
| 76 |
|
| 77 |
void getDocDefaultLangDescription(UT_UTF8String &s); |
| 78 |
void getDocDefaultLangDescription(std::string &s); |
| 79 |
void getDocDefaultLangCheckboxLabel(UT_UTF8String &s); |
| 80 |
void getDocDefaultLangCheckboxLabel(std::string &s); |
| 81 |
void setDocumentLanguage(const gchar * pLang); |
| 82 |
|
| 83 |
XAP_Dialog_Language::tAnswer getAnswer(void) const; |
| 84 |
|
| 85 |
inline bool getSpellCheck(void) const {return m_bSpellCheck;} |
| 86 |
UT_Vector* getAvailableDictionaries(); |
| 87 |
|
| 88 |
protected: |
| 89 |
void _setLanguage(const gchar * pLang); |
| 90 |
|
| 91 |
XAP_Dialog_Language::tAnswer m_answer; |
| 92 |
|
| 93 |
// the following keeps the string that the user sees in the dialogue; this is locale-dependent |
| 94 |
const gchar * m_pLanguage; |
| 95 |
// this keeps the actual property string corresponding to m_pLanguage |
| 96 |
const gchar * m_pLangProperty; |
| 97 |
bool m_bChangedLanguage; |
| 98 |
UT_Language * m_pLangTable; |
| 99 |
const gchar ** m_ppLanguages; |
| 100 |
const gchar ** m_ppLanguagesCode; |
| 101 |
UT_uint32 m_iLangCount; |
| 102 |
bool m_bSpellCheck; |
| 103 |
bool m_bDocDefault; |
| 104 |
std::string m_docLang; |
| 105 |
}; |
| 106 |
#endif /* XAP_DIALOG_LANGUAGE_H */ |
| 107 |
|