00001 /* AbiWord 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * Copyright (C) 2001, 2003 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_COCOADIALOG_REPLACE_H 00022 #define AP_COCOADIALOG_REPLACE_H 00023 00024 #include "ap_Dialog_Replace.h" 00025 00026 class XAP_CocoaFrame; 00027 @class AP_CocoaDialog_ReplaceController; 00028 @protocol XAP_CocoaDialogProtocol; 00029 00030 /*****************************************************************/ 00031 00032 class AP_CocoaDialog_Replace: public AP_Dialog_Replace 00033 { 00034 public: 00035 AP_CocoaDialog_Replace(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id dlgid); 00036 virtual ~AP_CocoaDialog_Replace(void); 00037 00038 00039 virtual void runModal(XAP_Frame * /*pFrame*/){}; 00040 virtual void runModeless(XAP_Frame * pFrame); 00041 virtual void notifyActiveFrame(XAP_Frame *pFrame); 00042 virtual void notifyCloseFrame(XAP_Frame */*pFrame*/){}; 00043 virtual void destroy(void); 00044 virtual void activate(void); 00045 00046 static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id dlgid); 00047 00048 // callbacks can fire these events 00049 void event_Find(void); 00050 void event_Replace(void); 00051 void event_ReplaceAll(void); 00052 void event_MatchCaseToggled(void); 00053 void event_WholeWordToggled(void); 00054 void event_ReverseFindToggled(void); 00055 void event_Cancel(void); 00056 void event_CloseWindow(void); 00057 00058 private: 00059 void _updateLists(); 00060 void _storeWindowData(void) {}; 00061 void _populateWindowData(void); 00062 AP_CocoaDialog_ReplaceController* m_dlg; 00063 }; 00064 00065 00066 @interface AP_CocoaDialog_ReplaceController : NSWindowController <XAP_CocoaDialogProtocol> 00067 { 00068 IBOutlet NSButton *_findAndReplaceBtn; 00069 IBOutlet NSButton *_findBtn; 00070 IBOutlet NSButton *_findReverseBtn; 00071 IBOutlet NSButton *_matchCaseBtn; 00072 IBOutlet NSButton *_replaceAll; 00073 IBOutlet NSComboBox *_replaceCombo; 00074 IBOutlet NSTextField *_replaceLabel; 00075 IBOutlet NSComboBox *_whatCombo; 00076 IBOutlet NSTextField *_whatLabel; 00077 IBOutlet NSButton *_wholeWordBtn; 00078 AP_CocoaDialog_Replace* _xap; 00079 } 00080 - (void)windowToFront; 00081 00082 - (IBAction)findAction:(id)sender; 00083 - (IBAction)findAndReplaceAction:(id)sender; 00084 - (IBAction)findReverseAction:(id)sender; 00085 - (IBAction)matchCaseAction:(id)sender; 00086 - (IBAction)wholeWordAction:(id)sender; 00087 - (IBAction)replaceAllAction:(id)sender; 00088 00089 00090 - (NSString*)findWhat; 00091 - (void)setFindWhat:(NSString*)str; 00092 - (NSString*)replaceWith; 00093 - (void)setReplaceWith:(NSString*)str; 00094 - (bool)matchCase; 00095 - (void)setMatchCase:(bool)val; 00096 - (bool)wholeWord; 00097 - (void)setWholeWord:(bool)val; 00098 - (bool)findReverse; 00099 - (void)setFindReverse:(bool)val; 00100 00101 - (void)updateFindWhat:(UT_GenericVector<UT_UCS4Char*>*)list; 00102 - (void)updateReplaceWith:(UT_GenericVector<UT_UCS4Char*>*)list; 00103 - (void)_updateCombo:(NSComboBox*)combo withList:(UT_GenericVector<UT_UCS4Char*>*)list; 00104 @end 00105 00106 #endif /* AP_COCOADIALOG_REPLACE_H */