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>
|
|
|
|
|
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
|
|
|
|
2004-05-20 09:36:28 +00:00
|
|
|
#include "controllers/ControlSearch.h"
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include <qcombobox.h>
|
2004-05-20 09:36:28 +00:00
|
|
|
#include <qpushbutton.h>
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2004-01-26 00:43:56 +00:00
|
|
|
typedef QController<ControlSearch, QView<QSearchDialog> > base_class;
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2004-01-26 00:43:56 +00:00
|
|
|
QSearch::QSearch(Dialog & parent)
|
|
|
|
: base_class(parent, _("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,
|
2003-11-04 12:01:15 +00:00
|
|
|
bool casesens, bool words, bool backwards, bool all)
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2003-11-04 12:01:15 +00:00
|
|
|
controller().replace(findstr, replacestr, casesens, words,
|
|
|
|
!backwards, all);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|