koReplace.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
00021 #ifndef KOREPLACE_H
00022 #define KOREPLACE_H
00023
00024 #include "koFind.h"
00025
00026 class KHistoryCombo;
00027 class QCheckBox;
00028 class QGroupBox;
00029 class QLabel;
00030 class QPopupMenu;
00031 class QPushButton;
00032 class QRect;
00033
00057 class KoReplaceDialog:
00058 public KoFindDialog
00059 {
00060 Q_OBJECT
00061
00062 public:
00063
00064
00065
00066 typedef enum
00067 {
00068
00069 PromptOnReplace = 256,
00070 BackReference = 512
00071 } Options;
00072
00084 KoReplaceDialog( QWidget *parent = 0, const char *name = 0, long options = 0,
00085 const QStringList &findStrings = QStringList(), const QStringList &replaceStrings = QStringList(),
00086 bool hasSelection = true );
00087
00091 virtual ~KoReplaceDialog();
00092
00100 void setReplacementHistory( const QStringList &strings );
00101
00107 QStringList replacementHistory() const;
00108
00114 void setOptions( long options );
00115
00122 long options() const;
00123
00127 QString replacement() const;
00128
00135 QWidget *replaceExtension();
00136
00137 protected slots:
00138
00139 void slotOk();
00140
00141 private:
00142
00143
00144 class KoReplaceDialogPrivate;
00145 KoReplaceDialogPrivate *d;
00146 };
00147
00185 class KoReplace :
00186 public KDialogBase
00187 {
00188 Q_OBJECT
00189
00190 public:
00191
00193 KoReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent = 0);
00194 ~KoReplace();
00195
00205 bool replace(QString &text, const QRect &expose);
00206
00212 virtual bool validateMatch( const QString &text, int index, int matchedlength );
00213
00214
00230 static int replace( QString &text, const QString &pattern, const QString &replacement, int index, long options, int *replacedLength );
00231 static int replace( QString &text, const QRegExp &pattern, const QString &replacement, int index, long options, int *replacedLength );
00232
00237 void abort();
00238
00239 signals:
00240
00245 void highlight(const QString &text, int matchingIndex, int matchedLength, const QRect &expose);
00246
00251 void replace(const QString &text, int replacementIndex, int replacedLength,int matchedLength, const QRect &expose);
00252
00253 private:
00254 void doReplace();
00255
00256 QString m_pattern;
00257 QRegExp *m_regExp;
00258 QString m_replacement;
00259 long m_options;
00260 QWidget *m_parent;
00261 unsigned m_replacements;
00262 QString m_text;
00263 int m_index;
00264 QRect m_expose;
00265 int m_matchedLength;
00266 bool m_cancelled;
00267
00268 static int replace( QString &text, const QString &replacement, int index, int length );
00269
00270
00271 class KoReplacePrivate;
00272 KoReplacePrivate *d;
00273
00274 private slots:
00275
00276 void slotUser1();
00277 void slotUser2();
00278 void slotUser3();
00279 void slotClose();
00280 };
00281 #endif
This file is part of the documentation for KDevelop Version 3.1.2.