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"
25 class FindAndReplaceOptions;
29 class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
34 FindAndReplaceWidget(GuiView & view);
35 bool initialiseParams(std::string const & params);
36 void updateWorkAreas();
39 // return true if \c wa is one if the adv. F&R workareas
40 bool hasWorkArea(GuiWorkArea * wa) const;
44 void dockLocationChanged(Qt::DockWidgetArea area);
52 /// add a string to the combo if needed
53 void remember(std::string const & find, QComboBox & combo);
55 /// Perform the scope-related buffer switch while searching
56 bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
58 /// Collect options from the GUI elements, then perform the search
59 bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
61 /// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
62 bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
63 bool expandmacros, bool ignoreformat, bool replace,
64 bool keep_case, bool replace_all = false);
66 bool eventFilter(QObject *obj, QEvent *event) override;
68 void virtual showEvent(QShowEvent *ev) override;
69 void virtual hideEvent(QHideEvent *ev) override;
73 void setFormatIgnores(bool const b);
75 docstring const checkState(std::string const s, bool const b);
78 void on_findNextPB_clicked();
79 void on_replacePB_clicked();
80 void on_replaceallPB_clicked();
81 void on_searchbackCB_clicked();
82 void on_selectAllPB_clicked();
83 void on_deselectAllPB_clicked();
87 class FindAndReplace : public DockView
92 GuiView & parent, ///< the main window where to dock.
93 Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
94 Qt::WindowFlags flags = {});
98 bool initialiseParams(std::string const &) override;
99 void clearParams() override {}
100 void dispatchParams() override {}
101 bool isBufferDependent() const override { return false; }
102 bool canApplyToReadOnly() const override { return true; }
103 bool hasWorkArea(GuiWorkArea * wa) const { return widget_->hasWorkArea(wa); }
107 void updateView() override;
108 //virtual void update_contents() {}
111 bool wantInitialFocus() const override { return true; }
114 /// The encapsulated widget.
115 FindAndReplaceWidget * widget_;
119 } // namespace frontend
122 #endif // QSEARCHADV_H