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

ap_Dialog_Spell.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998,1999 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_SPELL_H
00021 #define AP_DIALOG_SPELL_H
00022 
00023 #include "xap_Frame.h"
00024 #include "xap_Dialog.h"
00025 #include "fv_View.h"
00026 #include "xav_View.h"
00027 #include "fl_SectionLayout.h"
00028 #include "fl_SelectionPreserver.h"
00029 #include "fl_BlockLayout.h"
00030 #include "pt_Types.h"
00031 
00032 #include "spell_manager.h"
00033 
00034 class XAP_Frame;
00035 
00036 class ABI_EXPORT AP_Dialog_Spell : public XAP_Dialog_NonPersistent
00037 {
00038 
00039  public:
00040 
00041    AP_Dialog_Spell(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00042    virtual ~AP_Dialog_Spell(void);
00043 
00044    virtual void runModal(XAP_Frame * pFrame) = 0;
00045 
00046    bool isSelection(void) const { return m_bIsSelection; };
00047    bool isComplete(void) const { return !m_bCancelled; };
00048 
00049  protected:
00050 
00051     bool _spellCheckWord (const UT_UCSChar * word, UT_uint32 len);
00052     SpellChecker * _getDict();
00053 
00054    void _purgeSuggestions(void);
00055 
00056    PT_DocPosition m_iOrigInsPoint;
00057 
00058    // used to find misspelled words
00059    bool nextMisspelledWord(void);
00060 
00061    bool addIgnoreAll(void);
00062    void ignoreWord(void);
00063 
00064    bool inChangeAll(void);
00065    bool addChangeAll(const UT_UCSChar * newword);
00066    bool changeWordWith(const UT_UCSChar * newword);
00067 
00068    // make the word visible in the document behind the dialog
00069    bool makeWordVisible(void);
00070    // add the word to current user dictionary
00071    bool addToDict(void);
00072 
00073    // true if we're checking just a selction rather than entire doc
00074    bool m_bIsSelection;
00075 
00076    // change/ignore all hash tables
00077    UT_GenericStringMap<UT_UCSChar*> * m_pChangeAll;
00078    UT_GenericStringMap<UT_UCSChar*> * m_pIgnoreAll;
00079 
00080    // these variables keep track of the current
00081    // location/state of the search through the
00082    // document for misspelled words
00083    fl_BlockSpellIterator* m_pWordIterator;
00084    UT_sint32 m_iWordOffset;
00085    UT_sint32 m_iWordLength;
00086    const UT_UCSChar* m_pWord;
00087    bool m_bSkipWord;
00088 
00089    // section & block pairs for start, end,
00090    // and current position position within
00091    // the part of the document being checked
00092    fl_DocSectionLayout * m_pStartSection;
00093    fl_BlockLayout      * m_pStartBlock;
00094    UT_sint32             m_iStartIndex;
00095    fl_DocSectionLayout * m_pEndSection;
00096    fl_BlockLayout      * m_pEndBlock;
00097    UT_sint32             m_iEndLength;
00098    fl_DocSectionLayout * m_pCurrSection;
00099    fl_BlockLayout      * m_pCurrBlock;
00100 
00101    XAP_Frame * m_pFrame;
00102    FV_View * m_pView;
00103     FL_SelectionPreserver * m_pPreserver;
00104    PD_Document * m_pDoc;
00105 
00106    // current suggested corrections to the
00107    // most recently misspelled word
00108    UT_GenericVector<UT_UCSChar*> * m_Suggestions;
00109 
00110    bool m_bCancelled;
00111    short m_iSelectedRow;
00112 };
00113 
00114 #endif /* AP_DIALOG_SPELL_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1