00001 /* AbiSource Application Framework 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #ifndef XAP_DIALOG_LANGUAGE_H 00021 #define XAP_DIALOG_LANGUAGE_H 00022 00023 #ifdef HAVE_CONFIG_H 00024 #include "config.h" 00025 #endif 00026 00027 /* pre-emptive dismissal; ut_types.h is needed by just about everything, 00028 * so even if it's commented out in-file that's still a lot of work for 00029 * the preprocessor to do... 00030 */ 00031 #ifndef UT_TYPES_H 00032 #include "ut_types.h" 00033 #endif 00034 00035 #include <string> 00036 00037 #include "xap_Dialog.h" 00038 00039 #ifdef ENABLE_SPELL 00040 #include "spell_manager.h" 00041 #endif 00042 00043 #include "ut_vector.h" 00044 00045 class UT_Language; 00046 class UT_UTF8String; 00047 00048 /******************************************************************** 00049 INSTRUCTIONS FOR DESIGN OF THE PLATFORM VERSIONS OF THIS DIALOGUE 00050 00051 (1) implement runModal(); at the moment we display a single listbox 00052 00053 (2) m_iLangCount will tell you how many list entries there will be; 00054 the language strings are then in m_ppLanguages (already sorted) 00055 00056 (3) use _setLanguage() to set the member variables in response 00057 to the user selection when the dialog is closing. 00058 *********************************************************************/ 00059 00060 00061 00062 class ABI_EXPORT XAP_Dialog_Language : public XAP_Dialog_NonPersistent 00063 { 00064 public: 00065 typedef enum { a_OK, a_CANCEL, a_YES, a_NO } tAnswer; 00066 00067 XAP_Dialog_Language(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00068 virtual ~XAP_Dialog_Language(void); 00069 00070 virtual void runModal(XAP_Frame * pFrame) = 0; 00071 void setLanguageProperty(const gchar * pLangProp); 00072 bool getChangedLangProperty(const gchar ** pszLangProp) const; 00073 00074 bool isMakeDocumentDefault() const {return m_bDocDefault;} 00075 void setMakeDocumentDefault(bool b) {m_bDocDefault = b;} 00076 00077 void getDocDefaultLangDescription(UT_UTF8String &s); 00078 void getDocDefaultLangDescription(std::string &s); 00079 void getDocDefaultLangCheckboxLabel(UT_UTF8String &s); 00080 void getDocDefaultLangCheckboxLabel(std::string &s); 00081 void setDocumentLanguage(const gchar * pLang); 00082 00083 XAP_Dialog_Language::tAnswer getAnswer(void) const; 00084 00085 inline bool getSpellCheck(void) const {return m_bSpellCheck;} 00086 UT_Vector* getAvailableDictionaries(); 00087 00088 protected: 00089 void _setLanguage(const gchar * pLang); 00090 00091 XAP_Dialog_Language::tAnswer m_answer; 00092 00093 // the following keeps the string that the user sees in the dialogue; this is locale-dependent 00094 const gchar * m_pLanguage; 00095 // this keeps the actual property string corresponding to m_pLanguage 00096 const gchar * m_pLangProperty; 00097 bool m_bChangedLanguage; 00098 UT_Language * m_pLangTable; 00099 const gchar ** m_ppLanguages; 00100 const gchar ** m_ppLanguagesCode; 00101 UT_uint32 m_iLangCount; 00102 bool m_bSpellCheck; 00103 bool m_bDocDefault; 00104 std::string m_docLang; 00105 }; 00106 #endif /* XAP_DIALOG_LANGUAGE_H */ 00107