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();
00313 void slotSpeakText();
00314
00315 protected:
00319 virtual bool event(QEvent*);
00320
00324 virtual void keyPressEvent( QKeyEvent* );
00325
00330 virtual void focusInEvent( QFocusEvent* );
00331
00336 virtual void wheelEvent( QWheelEvent* );
00337
00342 virtual void deleteWordBack();
00343
00348 virtual void deleteWordForward();
00349
00354 virtual void contextMenuEvent( QContextMenuEvent* );
00355
00356
00357
00358
00359
00360
00361
00367 void setCheckSpellingEnabledInternal(bool check);
00368
00374 bool checkSpellingEnabledInternal() const;
00375
00376 private:
00377 class Private;
00378 Private *const d;
00379
00380 Q_PRIVATE_SLOT( d, void spellCheckerMisspelling( const QString&, int ) )
00381 Q_PRIVATE_SLOT( d, void spellCheckerCorrected(const QString&, int,const QString&) )
00382 Q_PRIVATE_SLOT( d, void spellCheckerCanceled())
00383 Q_PRIVATE_SLOT( d, void spellCheckerAutoCorrect(const QString&,const QString&) )
00384 Q_PRIVATE_SLOT( d, void spellCheckerFinished() )
00385 Q_PRIVATE_SLOT( d, void undoableClear() )
00386 Q_PRIVATE_SLOT( d, void toggleAutoSpellCheck() )
00387 Q_PRIVATE_SLOT( d, void slotAllowTab() )
00388 Q_PRIVATE_SLOT( d, void menuActivated( QAction* ) )
00389 Q_PRIVATE_SLOT( d, void slotFindHighlight(const QString&, int, int))
00390 Q_PRIVATE_SLOT( d, void slotReplaceText(const QString &, int, int, int))
00391 };
00392
00393 #endif // KTEXTEDIT_H