3 * \file FindAndReplace.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Tommaso Cucinotta
9 * Full author contact details are available in file CREDITS.
16 // This is needed so that ui_FindAndReplaceUi.h can find qt_()
17 #include "qt_helpers.h"
18 #include "ui_FindAndReplaceUi.h"
24 class FindAndReplaceOptions;
28 class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
33 FindAndReplaceWidget(GuiView & view);
34 bool initialiseParams(std::string const & params);
40 void dockLocationChanged(Qt::DockWidgetArea area);
48 /// add a string to the combo if needed
49 void remember(std::string const & find, QComboBox & combo);
51 /// Perform the scope-related buffer switch while searching
52 bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
54 /// Collect options from the GUI elements, then perform the search
55 bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
57 /// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
58 bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
59 bool expandmacros, bool ignoreformat, bool replace,
60 bool keep_case, bool replace_all = false);
62 bool eventFilter(QObject *obj, QEvent *event) override;
64 void virtual showEvent(QShowEvent *ev) override;
65 void virtual hideEvent(QHideEvent *ev) override;
70 void on_findNextPB_clicked();
71 void on_replacePB_clicked();
72 void on_replaceallPB_clicked();
73 void on_searchbackCB_clicked();
77 class FindAndReplace : public DockView
82 GuiView & parent, ///< the main window where to dock.
83 Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
84 Qt::WindowFlags flags = {});
88 bool initialiseParams(std::string const &) override;
89 void clearParams() override {}
90 void dispatchParams() override {}
91 bool isBufferDependent() const override { return false; }
92 bool canApplyToReadOnly() const override { return true; }
96 void updateView() override;
97 //virtual void update_contents() {}
100 bool wantInitialFocus() const override { return true; }
103 /// The encapsulated widget.
104 FindAndReplaceWidget * widget_;
108 } // namespace frontend
111 #endif // QSEARCHADV_H