00001 /* AbiWord 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * Copyright (c) 2009 Hubert Figuiere 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 */ 00020 00021 #ifndef AP_UnixDialog_Styles_H 00022 #define AP_UnixDialog_Styles_H 00023 00024 #include <string> 00025 #include <list> 00026 00027 #include "ap_Dialog_Columns.h" 00028 00029 #include "ut_types.h" 00030 #include "ut_string.h" 00031 #include "ap_Dialog_Styles.h" 00032 00033 00034 class XAP_UnixFrame; 00035 class GR_CairoGraphics; 00036 00037 /*****************************************************************/ 00038 00039 class AP_UnixDialog_Styles: public AP_Dialog_Styles 00040 { 00041 public: 00042 typedef enum _StyleType 00043 {USED_STYLES, ALL_STYLES, USER_STYLES} StyleType; 00044 00045 AP_UnixDialog_Styles(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00046 virtual ~AP_UnixDialog_Styles(void); 00047 00048 virtual void runModal(XAP_Frame * pFrame); 00049 00050 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id); 00051 00052 // callbacks can fire these events 00053 00054 void event_paraPreviewExposed(void); 00055 void event_charPreviewExposed(void); 00056 00057 virtual void event_Apply(void); 00058 virtual void event_Close(void); 00059 00060 virtual void event_DeleteClicked(void); 00061 virtual void event_NewClicked(void); 00062 virtual void event_ModifyClicked(void); 00063 virtual void event_SelectionChanged(GtkTreeSelection * selection); 00064 virtual void event_ListClicked(const char * which); 00065 virtual void event_WindowDelete(void); 00066 void new_styleName(void); 00067 00069 // Modify window 00071 00072 bool event_Modify_OK(void); 00073 void event_Modify_Cancel(void); 00074 void event_ModifyDelete(void); 00075 void event_ModifyParagraph(); 00076 void event_ModifyFont(); 00077 void event_ModifyNumbering(); 00078 void event_ModifyTabs(); 00079 void event_ModifyLanguage(); 00080 void event_ModifyPreviewExposed(); 00081 void event_RemoveProperty(void); 00082 void rebuildDeleteProps(void); 00083 void event_basedOn(void); 00084 void event_followedBy(void); 00085 void event_styleType(void); 00086 void modifyRunModal(void); 00087 void setModifySignalBlocked( bool val); 00088 bool isModifySignalBlocked(void) const; 00089 void setIsNew(bool bIsNew) {m_bIsNew = bIsNew;} 00090 bool isNew(void) const { return m_bIsNew;} 00091 const gchar * getNewStyleName(void) const {return m_newStyleName;} 00092 const gchar * getBasedonName(void) const {return m_basedonName;} 00093 const gchar * getFollowedbyName(void) const {return m_followedbyName;} 00094 const gchar * getStyleType(void) const {return m_styleType;} 00095 protected: 00096 00097 enum 00098 { 00099 BUTTON_APPLY = GTK_RESPONSE_APPLY, 00100 BUTTON_CLOSE = GTK_RESPONSE_CLOSE, 00101 BUTTON_MODIFY_OK = GTK_RESPONSE_OK, 00102 BUTTON_MODIFY_CANCEL = GTK_RESPONSE_CANCEL 00103 } ResponseId; 00104 00105 // private construction functions 00106 virtual GtkWidget * _constructWindow(void); 00107 GtkWidget * _constructWindowContents(GtkWidget * parent); 00108 void _populateWindowData(void); 00109 void _populateCList(void); 00110 void _storeWindowData(void) const; 00111 void _connectSignals(void) const; 00112 virtual const char * getCurrentStyle (void) const; 00113 virtual void setDescription (const char * desc) const; 00114 00115 GR_CairoGraphics * m_pParaPreviewWidget; 00116 GR_CairoGraphics * m_pCharPreviewWidget; 00117 00118 // pointers to widgets we need to query/set 00119 GtkWidget * m_windowMain; 00120 00121 GtkWidget * m_btApply; 00122 GtkWidget * m_btClose; 00123 GtkWidget * m_btNew; 00124 GtkWidget * m_btModify; 00125 GtkWidget * m_btDelete; 00126 GtkWidget * m_wParaPreviewArea; 00127 GtkWidget * m_wCharPreviewArea; 00128 GtkWidget * m_wGnomeButtons; 00129 00130 GtkListStore * m_listStyles; 00131 GtkWidget * m_tvStyles; 00132 GtkWidget * m_rbList1; 00133 GtkWidget * m_rbList2; 00134 GtkWidget * m_rbList3; 00135 GtkWidget * m_lbAttributes; 00136 00137 GtkTreePath * m_selectedStyle; 00138 StyleType m_whichType; 00139 00141 // Modify window 00143 00144 virtual GtkWidget * _constructModifyDialog(void); 00145 virtual void _constructGnomeModifyButtons(); 00146 void _constructFormatList(GtkWidget * FormatMenu); 00147 void _connectModifySignals(void); 00148 void _constructModifyDialogContents(GtkWidget * modifyDialog); 00149 virtual void setModifyDescription( const char * desc); 00150 bool _populateModify(void); 00151 00152 GR_CairoGraphics * m_pAbiPreviewWidget; 00153 00154 GtkWidget * m_wModifyDialog; 00155 GtkWidget * m_wStyleNameEntry; 00156 GtkWidget * m_wBasedOnCombo; 00157 GtkWidget * m_wBasedOnEntry; 00158 GtkWidget * m_wFollowingCombo; 00159 GtkWidget * m_wFollowingEntry; 00160 GtkWidget * m_wStyleTypeCombo; 00161 GtkWidget * m_wStyleTypeEntry; 00162 GtkWidget * m_wModifyDrawingArea; 00163 GtkWidget * m_wLabDescription; 00164 GtkWidget * m_wDeletePropCombo; 00165 GtkWidget * m_wDeletePropEntry; 00166 GtkWidget * m_wDeletePropButton; 00167 GtkWidget * m_wModifyOk; 00168 GtkWidget * m_wModifyCancel; 00169 GtkWidget * m_wFormatMenu; 00170 GtkWidget * m_wModifyShortCutKey; 00171 00172 std::list<std::string> m_gbasedOnStyles; 00173 std::list<std::string> m_gfollowedByStyles; 00174 std::list<std::string> m_gStyleType; 00175 gchar m_newStyleName[40]; 00176 gchar m_basedonName[40]; 00177 gchar m_followedbyName[40]; 00178 gchar m_styleType[40]; 00179 private: 00180 bool m_bIsNew; 00181 bool m_bBlockModifySignal; 00182 std::string m_sNewStyleName; 00183 }; 00184 00185 #endif /* AP_UnixDialog_Styles_H */