KDEUI
ktextedit.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KTEXTEDIT_H
00021 #define KTEXTEDIT_H
00022
00023 #include <kdeui_export.h>
00024 #include <sonnet/highlighter.h>
00025 #include <QtGui/QTextEdit>
00026
00041 class KTextEditSpellInterface
00042 {
00043 public:
00044
00048 virtual bool isSpellCheckingEnabled() const = 0;
00049
00054 virtual void setSpellCheckingEnabled(bool enable) = 0;
00055
00062 virtual bool shouldBlockBeSpellChecked(const QString& block) const = 0;
00063
00064 virtual ~KTextEditSpellInterface() {}
00065 };
00066
00084 class KDEUI_EXPORT KTextEdit : public QTextEdit
00085 {
00086 Q_OBJECT
00087
00088 public:
00093 explicit KTextEdit( const QString& text, QWidget *parent = 0 );
00094
00099 explicit KTextEdit( QWidget *parent = 0 );
00100
00104 ~KTextEdit();
00105
00109 virtual void setReadOnly( bool readOnly );
00110
00125 void setCheckSpellingEnabled( bool check );
00126
00138 bool checkSpellingEnabled() const;
00139
00148 void highlightWord( int length, int pos );
00149
00163 void setSpellCheckingConfigFileName(const QString &fileName);
00164
00179 virtual void createHighlighter();
00180
00189 Sonnet::Highlighter* highlighter() const;
00190
00204 void setHighlighter(Sonnet::Highlighter *_highLighter);
00205
00210 QMenu *mousePopupMenu();
00211
00216 void enableFindReplace( bool enabled);
00217
00226 void setSpellInterface( KTextEditSpellInterface *spellInterface );
00227
00234 const QString& spellCheckingLanguage() const;
00235
00236 Q_SIGNALS:
00242 void checkSpellingChanged( bool );
00243
00248 void spellCheckStatus(const QString &);
00249
00257 void languageChanged(const QString &language);
00258
00259 public Q_SLOTS:
00260
00269 void setSpellCheckingLanguage(const QString &language);
00270
00275 void checkSpelling();
00276
00291 void showSpellConfigDialog(const QString &configFileName,
00292 const QString &windowIcon = QString());
00293
00298 void replace();
00299
00300 protected Q_SLOTS:
00304 void slotDoReplace();
00305 void slotReplaceNext();
00306 void slotDoFind();
00307 void slotFind();
00308 void slotFindNext();
00309 void slotReplace();
00310
00311
00312 protected:
00316 virtual bool event(QEvent*);
00317
00321 virtual void keyPressEvent( QKeyEvent* );
00322
00327 virtual void focusInEvent( QFocusEvent* );
00328
00333 virtual void wheelEvent( QWheelEvent* );
00334
00339 virtual void deleteWordBack();
00340
00345 virtual void deleteWordForward();
00346
00351 virtual void contextMenuEvent( QContextMenuEvent* );
00352
00353
00354
00355
00356
00357
00358
00364 void setCheckSpellingEnabledInternal(bool check);
00365
00371 bool checkSpellingEnabledInternal() const;
00372
00373 private:
00374 class Private;
00375 Private *const d;
00376
00377 Q_PRIVATE_SLOT( d, void spellCheckerMisspelling( const QString&, int ) )
00378 Q_PRIVATE_SLOT( d, void spellCheckerCorrected(const QString&, int,const QString&) )
00379 Q_PRIVATE_SLOT( d, void spellCheckerCanceled())
00380 Q_PRIVATE_SLOT( d, void spellCheckerAutoCorrect(const QString&,const QString&) )
00381 Q_PRIVATE_SLOT( d, void spellCheckerFinished() )
00382 Q_PRIVATE_SLOT( d, void undoableClear() )
00383 Q_PRIVATE_SLOT( d, void toggleAutoSpellCheck() )
00384 Q_PRIVATE_SLOT( d, void slotAllowTab() )
00385 Q_PRIVATE_SLOT( d, void menuActivated( QAction* ) )
00386 Q_PRIVATE_SLOT( d, void slotFindHighlight(const QString&, int, int))
00387 Q_PRIVATE_SLOT( d, void slotReplaceText(const QString &, int, int, int))
00388 };
00389
00390 #endif // KTEXTEDIT_H