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

ap_Dialog_Replace.h

Go to the documentation of this file.
00001 /* AbiWord
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 AP_DIALOG_REPLACE_H
00021 #define AP_DIALOG_REPLACE_H
00022 
00023 #include "xap_Frame.h"
00024 #include "xap_Dialog.h"
00025 #include "fv_View.h"
00026 #include "xav_View.h"
00027 #include "pt_Types.h"
00028 
00029 class ABI_EXPORT AP_Dialog_Replace : public XAP_Dialog_Modeless
00030 {
00031 public:
00032     AP_Dialog_Replace(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00033     virtual ~AP_Dialog_Replace(void);
00034 
00035     //------------------------------------------------------------
00036     // All these are needed for a modeless dialog
00037 
00038     virtual void     useStart(void);
00039     virtual void     useEnd(void);
00040     virtual void     runModal(XAP_Frame * pFrame) = 0;
00041     virtual void     runModeless(XAP_Frame * pFrame) = 0;
00042         virtual void     destroy(void)=0;
00043         virtual void     activate(void)=0;
00044     void         setActiveFrame(XAP_Frame *pFrame);
00045     virtual void        notifyActiveFrame(XAP_Frame *pFrame) = 0;
00046 
00047     typedef enum { find_FIND_NEXT, find_REPLACE, find_REPLACE_ALL } tFindType;
00048     typedef enum { a_VOID, a_FIND_NEXT, a_REPLACE, a_REPLACE_ALL, a_CANCEL }    tAnswer;
00049         void                                       ConstructWindowName(void);
00050     char *      getWindowName(void) { return m_WindowName; };
00051 
00052     AP_Dialog_Replace::tAnswer  getAnswer(void) const;
00053 
00054     // These are called from edit methods or from dialogs
00055     // to set or read the variables in the current
00056     // instance of the dialog.  These do not read the persistent
00057     // values.
00058     bool                        setView(AV_View * view);
00059     AV_View *                   getView(void);
00060     FV_View *                   getFvView(void);
00061 
00062     void                        setFindString(const UT_UCSChar * string);
00063     UT_UCSChar *                getFindString(void);
00064 
00065     void                        setReplaceString(const UT_UCSChar * string);
00066     UT_UCSChar *                getReplaceString(void);
00067 
00068     void                        setMatchCase(bool match);
00069     bool                        getMatchCase(void);
00070 
00071     void                        setReverseFind( bool newValue);
00072     bool                        getReverseFind(void);
00073 
00074     void                        setWholeWord( bool newValue);
00075     bool                        getWholeWord(void);
00076 
00077     // Action functions... set data using the accessors
00078     // above and call one of these.
00079     bool                        findNext(void);
00080     bool                        findPrev(void);
00081     bool                        findReplaceReverse(void);
00082     bool                        findReplace(void);
00083     bool                        findReplaceAll(void);
00084 
00085  protected:
00086 
00087     // These are the "current use" dialog data items,
00088     // which are liberally read and set by the
00089     // accessor methods above.  Note that the buffers
00090     // these may point to are destroyed when useEnd()
00091     // is done storing them away
00092     FV_View *                   m_pView;
00093     UT_UCSChar *                m_findString;
00094     UT_UCSChar *                m_replaceString;
00095 
00096     // Message boxes for events during search
00097     XAP_Frame *                 m_pFrame;
00098 
00099     void                        _messageFinishedFind(void);
00100     void                        _messageFinishedReplace(UT_uint32 numReplaced = 0);
00101     void                        _messageBox(const char * message);
00102 
00103     // is this used in a modeless dialog like this?
00104     tAnswer                     m_answer;
00105     char                        m_WindowName[100];
00106 
00107     // save a list of find a replace texts
00108     UT_GenericVector<UT_UCS4Char*>  m_findList;
00109     UT_GenericVector<UT_UCS4Char*>  m_replaceList;
00110     virtual void                _updateLists() = 0; // must be implemented in non-xp code
00111 
00112  private:
00113     // returns true when the internal list was changed
00114     bool                        _manageList(UT_GenericVector<UT_UCS4Char*>* list, UT_UCSChar* string);
00115 };
00116 
00117 #endif /* AP_DIALOG_REPLACE_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1