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"
19 #include "support/docstring.h"
24 class FindAndReplaceOptions;
28 class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
33 FindAndReplaceWidget(GuiView & view);
34 bool initialiseParams(std::string const & params);
35 void updateWorkAreas();
38 // return true if \c wa is one if the adv. F&R workareas
39 bool hasWorkArea(GuiWorkArea * wa) const;
43 void dockLocationChanged(Qt::DockWidgetArea area);
51 /// add a string to the combo if needed
52 void remember(std::string const & find, QComboBox & combo);
54 /// Perform the scope-related buffer switch while searching
55 bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
57 /// Collect options from the GUI elements, then perform the search
58 bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
60 /// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
61 bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
62 bool expandmacros, bool ignoreformat, bool replace,
63 bool keep_case, bool replace_all = false);
65 bool eventFilter(QObject *obj, QEvent *event) override;
67 void virtual showEvent(QShowEvent *ev) override;
68 void virtual hideEvent(QHideEvent *ev) override;
72 void setFormatIgnores(bool const b);
74 docstring const checkState(std::string const s, bool const b);
77 void on_findNextPB_clicked();
78 void on_replacePB_clicked();
79 void on_replaceallPB_clicked();
80 void on_searchbackCB_clicked();
81 void on_selectAllPB_clicked();
82 void on_deselectAllPB_clicked();
86 class FindAndReplace : public DockView
91 GuiView & parent, ///< the main window where to dock.
92 Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
93 Qt::WindowFlags flags = {});
97 bool initialiseParams(std::string const &) override;
98 void clearParams() override {}
99 void dispatchParams() override {}
100 bool isBufferDependent() const override { return false; }
101 bool canApplyToReadOnly() const override { return true; }
102 bool hasWorkArea(GuiWorkArea * wa) const { return widget_->hasWorkArea(wa); }
106 void updateView() override;
107 //virtual void update_contents() {}
110 bool wantInitialFocus() const override { return true; }
113 /// The encapsulated widget.
114 FindAndReplaceWidget * widget_;
118 } // namespace frontend
121 #endif // QSEARCHADV_H