• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ap_Dialog_Options.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiWord
00004  * Copyright (C) 1998 AbiSource, Inc.
00005  * Copyright (C) 2003 Hubert Figuiere
00006  * Copyright (C) 2004 Francis James Franklin
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00021  * 02110-1301 USA.
00022  */
00023 
00024 #ifndef AP_DIALOG_OPTIONS_H
00025 #define AP_DIALOG_OPTIONS_H
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #include "config.h"
00029 #endif
00030 
00031 #include <string>
00032 #include <vector>
00033 #include <utility>
00034 
00035 #include "xap_Frame.h"
00036 #include "xap_Dialog.h"
00037 #include "xav_View.h"
00038 #include "ut_units.h"
00039 
00040 #include "fp_PageSize.h"
00041 
00042 class XAP_Frame;
00043 class UT_String;
00044 
00045 class ABI_EXPORT AP_Dialog_Options : public XAP_TabbedDialog_NonPersistent
00046 {
00047  public:
00048 
00049     AP_Dialog_Options(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00050     virtual ~AP_Dialog_Options(void);
00051 
00052     virtual void    runModal(XAP_Frame * pFrame) = 0;
00053 
00054     // answer from dialog
00055     typedef enum { a_OK, a_CANCEL, a_SAVE, a_APPLY } tAnswer;
00056 
00057     // control ids
00058     typedef enum { id_CHECK_SPELL_CHECK_AS_TYPE = 0, id_CHECK_SPELL_HIDE_ERRORS,
00059                    id_CHECK_SPELL_SUGGEST, id_CHECK_SPELL_MAIN_ONLY,
00060                    id_CHECK_SPELL_UPPERCASE, id_CHECK_SPELL_NUMBERS,
00061                    id_BUTTON_SPELL_AUTOREPLACE,
00062                    id_CHECK_GRAMMAR_CHECK,
00063 
00064                    id_CHECK_SMART_QUOTES_ENABLE,
00065                    id_CHECK_CUSTOM_SMART_QUOTES,
00066                    id_LIST_VIEW_OUTER_QUOTE_STYLE,
00067                    id_LIST_VIEW_INNER_QUOTE_STYLE,
00068 
00069                    id_CHECK_OTHER_DEFAULT_DIRECTION_RTL,
00070 
00071                    id_CHECK_AUTO_SAVE_FILE,
00072                    id_TEXT_AUTO_SAVE_FILE_EXT,
00073                    id_TEXT_AUTO_SAVE_FILE_PERIOD,
00074                    id_TEXT_AUTO_SAVE_FILE_PERIOD_SPIN,  // needed by Cocoa FE
00075                    id_CHECK_PREFS_AUTO_SAVE, id_COMBO_PREFS_SCHEME,
00076 
00077                    id_CHECK_VIEW_SHOW_RULER, id_LIST_VIEW_RULER_UNITS,
00078                    id_CHECK_VIEW_CURSOR_BLINK,
00079                    id_CHECK_VIEW_SHOW_STATUS_BAR,
00080                    id_CHECK_VIEW_ALL, id_CHECK_VIEW_HIDDEN_TEXT,
00081                    id_CHECK_VIEW_UNPRINTABLE,
00082                    id_CHECK_COLOR_FOR_TRANSPARENT_IS_WHITE,
00083                    id_PUSH_CHOOSE_COLOR_FOR_TRANSPARENT,
00084                    id_BUTTON_SAVE, id_BUTTON_DEFAULTS,
00085                    id_BUTTON_OK, id_BUTTON_CANCEL, id_BUTTON_APPLY,
00086 
00087                    id_CHECK_ENABLE_SMOOTH_SCROLLING,
00088                    id_CHECK_ENABLE_OVERWRITE,
00089                    id_CHECK_AUTO_LOAD_PLUGINS,
00090                    id_NOTEBOOK,
00091                    id_CHECK_LANG_WITH_KEYBOARD,
00092                    id_CHECK_DIR_MARKER_AFTER_CLOSING_PARENTHESIS,
00093                    id_last } tControl;
00094 
00095     // typedef enum { check_FALSE = 0, check_TRUE, check_INDETERMINATE } tCheckState;
00096 
00097     AP_Dialog_Options::tAnswer  getAnswer(void) const;
00098 
00099     virtual void _populateWindowData(void);
00100         // to be called when a control is toggled/changed
00101     void _enableDisableLogic( tControl id );
00102 
00103     virtual void _storeWindowData(void);    // calls the following functions to
00104                         // lookup values to set as preferences
00105     virtual void _storeDataForControl (tControl id);    // sets preferences for a particular control
00106                                 // needed by instant apply and friends
00107 
00108     void _event_SetDefaults(void);
00109 
00110     //
00111     // Screen Color stuff
00112     //
00113     const gchar * _gatherColorForTransparent(void);
00114     void _setColorForTransparent(const gchar * pzsColorForTransparent);
00115     bool  isInitialPopulationHappenning(void)
00116         { return m_bInitialPop; }
00117 
00118     typedef std::vector<std::pair<std::string, int> >   UnitMenuContent;
00119     void _getUnitMenuContent(const XAP_StringSet *pSS, UnitMenuContent & content);
00120 
00121  protected:
00122 
00123     // to enable/disable a control
00124     virtual void _controlEnable( tControl id, bool value )=0;
00125 
00126 
00127 
00128     // disable controls appropriately
00129     void _initEnableControls();
00130 
00131     // called by _initEnableControls() just before it returns
00132     // its purpose is to allow overriding of the enable logic on
00133     // platform basis
00134     virtual void _initEnableControlsPlatformSpecific(){};
00135 
00136 
00137     void _eventSave(void);
00138 
00139 
00140 #define SET_GATHER(a,u) virtual u _gather##a(void) = 0; \
00141                         virtual void    _set##a(const u) = 0
00142     SET_GATHER          (SpellCheckAsType,  bool);
00143     SET_GATHER          (SpellHideErrors,   bool);
00144     SET_GATHER          (SpellSuggest,      bool);
00145     SET_GATHER          (SpellMainOnly,     bool);
00146     SET_GATHER          (SpellUppercase,    bool);
00147     SET_GATHER          (SpellNumbers,      bool);
00148     SET_GATHER          (GrammarCheck,      bool);
00149     SET_GATHER          (CustomSmartQuotes,     bool);
00150     SET_GATHER          (SmartQuotes,       bool);
00151     SET_GATHER          (PrefsAutoSave,     bool);
00152     SET_GATHER          (EnableOverwrite,   bool);
00153 
00154 #if !defined (TOOLKIT_GTK_ALL) && !defined(TOOLKIT_COCOA)
00155     SET_GATHER          (ViewShowRuler,     bool);
00156     virtual bool _gatherViewShowToolbar(UT_uint32 t) = 0;
00157     virtual void _setViewShowToolbar(UT_uint32 row, bool b) = 0;
00158     SET_GATHER          (ViewShowStatusBar, bool);
00159 #endif
00160     SET_GATHER          (ViewRulerUnits,    UT_Dimension);
00161     SET_GATHER          (OuterQuoteStyle,   gint);
00162     SET_GATHER          (InnerQuoteStyle,   gint);
00163     SET_GATHER          (ViewCursorBlink,   bool);
00164 
00165     SET_GATHER          (ViewAll,           bool);
00166     SET_GATHER          (ViewHiddenText,    bool);
00167     SET_GATHER          (ViewUnprintable,   bool);
00168 #if defined(TOOLKIT_GTK_ALL)
00169     SET_GATHER          (EnableSmoothScrolling, bool);
00170 #endif
00171     SET_GATHER          (AutoLoadPlugins, bool);
00172 
00173     SET_GATHER          (OtherDirectionRtl, bool);
00174 
00175     SET_GATHER          (AutoSaveFile,      bool);
00176     virtual void _gatherAutoSaveFilePeriod(UT_String &stRetVal) = 0;
00177     virtual void _setAutoSaveFilePeriod(const UT_String &stPeriod) = 0;
00178     virtual void _gatherAutoSaveFileExt(UT_String &stRetVal) = 0;
00179     virtual void _setAutoSaveFileExt(const UT_String &stExt) = 0;
00180 
00181     // Jordi: For now this is just implemented in win32, we should make it
00182     // an abstract member if we decide to implemented in all platforms
00183     virtual void _gatherUILanguage(UT_String &stRetVal){stRetVal.clear();};
00184     virtual void _setUILanguage(const UT_String & /*stExt*/) {};
00185     virtual bool _gatherLanguageWithKeyboard() {return false;}
00186     virtual void _setLanguageWithKeyboard(const bool) {}
00187     virtual bool _gatherDirMarkerAfterClosingParenthesis(){return false;}
00188     virtual void _setDirMarkerAfterClosingParenthesis(const bool){}
00189 
00190     // so we can save and restore to the same page - must be able to return
00191     // the current page and reset it later (i.e., don't use a handle, but a
00192     // page index)
00193     SET_GATHER          (NotebookPageNum,   int );
00194 
00195 #undef SET_GATHER
00196  protected:
00197 
00198 
00199     tAnswer             m_answer;
00200     XAP_Frame *         m_pFrame;
00201     gchar           m_CurrentTransparentColor[10];
00202 
00203 private:
00204     bool                m_bInitialPop;
00205 
00206 };
00207 
00208 
00209 #endif /* AP_DIALOG_PARAGRAPH_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1