2001-03-06 14:23:02 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QSearch.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-06 14:23:02 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author John Levon
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-03-06 14:23:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2003-09-29 10:50:51 +00:00
|
|
|
#include "debug.h"
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "ControlSearch.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QSearch.h"
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "QSearchDialog.h"
|
2001-08-31 02:34:10 +00:00
|
|
|
#include "Qt2BC.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qcombobox.h>
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
typedef Qt2CB<ControlSearch, Qt2DB<QSearchDialog> > base_class;
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
QSearch::QSearch()
|
2003-05-22 18:14:36 +00:00
|
|
|
: base_class(_("LyX: Find and Replace"))
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearch::build_dialog()
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
dialog_.reset(new QSearchDialog(this));
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2003-03-10 03:13:28 +00:00
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
bcview().addReadOnly(dialog_->replaceCO);
|
|
|
|
bcview().addReadOnly(dialog_->replacePB);
|
|
|
|
bcview().addReadOnly(dialog_->replaceallPB);
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
dialog_->replacePB->setEnabled(false);
|
|
|
|
dialog_->replaceallPB->setEnabled(false);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
void QSearch::find(string const & str, bool casesens,
|
|
|
|
bool words, bool backwards)
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
controller().find(str, casesens, words, !backwards);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearch::replace(string const & findstr, string const & replacestr,
|
|
|
|
bool casesens, bool words, bool all)
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
controller().replace(findstr, replacestr, casesens, words, all);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|