2008-11-16 00:15:51 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file FindAndReplace.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Tommaso Cucinotta
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QSEARCHADV_H
|
|
|
|
#define QSEARCHADV_H
|
|
|
|
|
|
|
|
#include "DockView.h"
|
2011-10-16 22:48:26 +00:00
|
|
|
// This is needed so that ui_FindAndReplaceUi.h can find qt_()
|
|
|
|
#include "qt_helpers.h"
|
2008-11-16 00:15:51 +00:00
|
|
|
#include "ui_FindAndReplaceUi.h"
|
|
|
|
|
2010-01-04 12:29:38 +00:00
|
|
|
#include "lyxfind.h"
|
2008-11-16 00:15:51 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2010-03-27 17:37:41 +00:00
|
|
|
class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
|
2008-11-16 00:15:51 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2008-12-23 08:18:11 +00:00
|
|
|
|
2008-11-16 00:15:51 +00:00
|
|
|
public:
|
2008-12-23 08:18:11 +00:00
|
|
|
FindAndReplaceWidget(GuiView & view);
|
|
|
|
bool initialiseParams(std::string const & params);
|
2011-12-30 21:26:51 +00:00
|
|
|
void updateGUI();
|
2008-11-16 00:15:51 +00:00
|
|
|
|
2013-05-05 13:05:50 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
///
|
|
|
|
void dockLocationChanged(Qt::DockWidgetArea area);
|
|
|
|
|
2008-12-23 08:18:11 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
GuiView & view_;
|
2008-11-16 00:15:51 +00:00
|
|
|
|
2010-01-04 12:29:38 +00:00
|
|
|
/// add a string to the combo if needed
|
2008-12-23 08:18:11 +00:00
|
|
|
void remember(std::string const & find, QComboBox & combo);
|
2010-01-04 12:29:38 +00:00
|
|
|
|
|
|
|
/// Perform the scope-related buffer switch while searching
|
2011-03-05 16:06:54 +00:00
|
|
|
bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
|
2010-01-04 12:29:38 +00:00
|
|
|
|
|
|
|
/// Collect options from the GUI elements, then perform the search
|
2011-03-05 13:45:39 +00:00
|
|
|
bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
|
|
|
|
|
2011-03-05 16:06:54 +00:00
|
|
|
/// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
|
2011-03-05 13:45:39 +00:00
|
|
|
bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
|
|
|
|
bool expandmacros, bool ignoreformat, bool replace,
|
2011-03-05 16:06:54 +00:00
|
|
|
bool keep_case, bool replace_all = false);
|
2008-12-23 08:18:11 +00:00
|
|
|
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
|
|
|
|
void virtual showEvent(QShowEvent *ev);
|
|
|
|
void virtual hideEvent(QHideEvent *ev);
|
2008-11-16 00:15:51 +00:00
|
|
|
|
2010-01-27 18:38:43 +00:00
|
|
|
void hideDialog();
|
|
|
|
|
2008-11-16 00:15:51 +00:00
|
|
|
protected Q_SLOTS:
|
|
|
|
void on_findNextPB_clicked();
|
2010-03-25 16:57:39 +00:00
|
|
|
void on_replacePB_clicked();
|
2008-11-16 00:15:51 +00:00
|
|
|
void on_replaceallPB_clicked();
|
2008-12-23 08:18:11 +00:00
|
|
|
};
|
2008-11-16 00:15:51 +00:00
|
|
|
|
|
|
|
|
2008-12-23 08:18:11 +00:00
|
|
|
class FindAndReplace : public DockView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
FindAndReplace(
|
|
|
|
GuiView & parent, ///< the main window where to dock.
|
|
|
|
Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
|
|
|
|
Qt::WindowFlags flags = 0);
|
2008-11-16 00:15:51 +00:00
|
|
|
|
2008-12-23 08:18:11 +00:00
|
|
|
~FindAndReplace();
|
2008-11-16 00:15:51 +00:00
|
|
|
|
2008-12-23 08:18:11 +00:00
|
|
|
bool initialiseParams(std::string const &);
|
|
|
|
void clearParams() {}
|
|
|
|
void dispatchParams() {}
|
2012-01-07 11:41:04 +00:00
|
|
|
bool isBufferDependent() const { return false; }
|
|
|
|
bool canApplyToReadOnly() const { return true; }
|
2008-12-23 08:18:11 +00:00
|
|
|
void selectAll();
|
2008-11-16 00:15:51 +00:00
|
|
|
|
2008-12-23 08:18:11 +00:00
|
|
|
/// update
|
2011-12-30 21:26:51 +00:00
|
|
|
void updateView();
|
2008-12-23 08:18:11 +00:00
|
|
|
//virtual void update_contents() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool wantInitialFocus() const { return true; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// The encapsulated widget.
|
|
|
|
FindAndReplaceWidget * widget_;
|
2008-11-16 00:15:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // QSEARCHADV_H
|