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_ENCODING_H 00021 #define XAP_DIALOG_ENCODING_H 00022 00023 /* pre-emptive dismissal; ut_types.h is needed by just about everything, 00024 * so even if it's commented out in-file that's still a lot of work for 00025 * the preprocessor to do... 00026 */ 00027 #ifndef UT_TYPES_H 00028 #include "ut_types.h" 00029 #endif 00030 /* #include "ut_Encoding.h" */ 00031 /* #include "ut_assert.h" */ 00032 /* #include "ut_debugmsg.h" */ 00033 00034 #include "xap_Dialog.h" 00035 00036 class UT_Encoding; 00037 00038 /******************************************************************** 00039 INSTRUCTIONS FOR DESIGN OF THE PLATFORM VERSIONS OF THIS DIALOGUE 00040 00041 (1) implement runModal(); at the moment we display a single listbox 00042 00043 (2) m_iEncCount will tell you how many list entries there will be; 00044 the encoding strings are then in m_ppEncodings (already sorted) 00045 00046 (3) use _setEncoding() to set the member variables in response 00047 to the user selection when the dialog is closing. 00048 *********************************************************************/ 00049 00050 00051 00052 class ABI_EXPORT XAP_Dialog_Encoding : public XAP_Dialog_NonPersistent 00053 { 00054 public: 00055 typedef enum { a_OK, a_CANCEL, a_YES, a_NO } tAnswer; 00056 00057 XAP_Dialog_Encoding(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00058 virtual ~XAP_Dialog_Encoding(void); 00059 00060 virtual void runModal(XAP_Frame * pFrame) = 0; 00061 void setEncoding(const gchar * pEncoding); 00062 const gchar * getEncoding() const; 00063 XAP_Dialog_Encoding::tAnswer getAnswer(void) const; 00064 00065 protected: 00066 void _setEncoding(const gchar * pEnc); 00067 00068 void _setAnswer (XAP_Dialog_Encoding::tAnswer answer) 00069 { m_answer = answer; }; 00070 void _setSelectionIndex (UT_uint32 index) 00071 { m_iSelIndex = index; }; 00072 UT_uint32 _getSelectionIndex () const 00073 { return m_iSelIndex; }; 00074 const gchar ** _getAllEncodings () const 00075 { return m_ppEncodings; }; 00076 UT_uint32 _getEncodingsCount() const 00077 { return m_iEncCount; }; 00078 00079 private: 00080 XAP_Dialog_Encoding::tAnswer m_answer; 00081 00082 // the following keeps the string that the user sees in the dialogue; this is locale-dependent 00083 const gchar * m_pDescription; 00084 // this keeps the actual encoding string corresponding to m_pDescription 00085 const gchar * m_pEncoding; 00086 UT_Encoding * m_pEncTable; 00087 const gchar ** m_ppEncodings; 00088 UT_uint32 m_iEncCount; 00089 UT_uint32 m_iSelIndex; 00090 }; 00091 #endif /* XAP_DIALOG_ENCODING_H */ 00092 00093