KDevelop API Documentation

editors/qeditor/koReplace.h

Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2001, S.R.Haque <srhaque@iee.org>. 00003 This file is part of the KDE project 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 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 // Options. 00065 00066 typedef enum 00067 { 00068 // Should the user be prompted before the replace operation? 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 // Binary compatible extensibility. 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*/ ) { return true; } 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 // Binary compatible extensibility. 00271 class KoReplacePrivate; 00272 KoReplacePrivate *d; 00273 00274 private slots: 00275 00276 void slotUser1(); // All 00277 void slotUser2(); // Skip 00278 void slotUser3(); // Yes 00279 void slotClose(); 00280 }; 00281 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:38:55 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003