]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/FindAndReplace.h
Remove obsolete (and false) comment.
[lyx.git] / src / frontends / qt / FindAndReplace.h
1 // -*- C++ -*-
2 /**
3  * \file FindAndReplace.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Tommaso Cucinotta
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef QSEARCHADV_H
13 #define QSEARCHADV_H
14
15 #include "DockView.h"
16 // This is needed so that ui_FindAndReplaceUi.h can find qt_()
17 #include "qt_helpers.h"
18 #include "ui_FindAndReplaceUi.h"
19
20 #include "lyxfind.h"
21
22 #include <string>
23
24 namespace lyx {
25 namespace frontend {
26
27 class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
28 {
29         Q_OBJECT
30
31 public:
32         FindAndReplaceWidget(GuiView & view);
33         bool initialiseParams(std::string const & params);
34         void updateGUI();
35
36 public Q_SLOTS:
37         ///
38         void dockLocationChanged(Qt::DockWidgetArea area);
39
40 private:
41         ///
42         GuiView & view_;
43         ///
44         Buffer * old_buffer_;
45
46         /// add a string to the combo if needed
47         void remember(std::string const & find, QComboBox & combo);
48
49         /// Perform the scope-related buffer switch while searching
50         bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
51
52         /// Collect options from the GUI elements, then perform the search
53         bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
54
55         /// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
56         bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
57                 bool expandmacros, bool ignoreformat, bool replace,
58                 bool keep_case, bool replace_all = false);
59
60         bool eventFilter(QObject *obj, QEvent *event);
61
62         void virtual showEvent(QShowEvent *ev);
63         void virtual hideEvent(QHideEvent *ev);
64
65         void hideDialog();
66
67 protected Q_SLOTS:
68         void on_findNextPB_clicked();
69         void on_replacePB_clicked();
70         void on_replaceallPB_clicked();
71 };
72
73
74 class FindAndReplace : public DockView
75 {
76         Q_OBJECT
77 public:
78         FindAndReplace(
79                 GuiView & parent, ///< the main window where to dock.
80                 Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
81                 Qt::WindowFlags flags = 0);
82
83         ~FindAndReplace();
84
85         bool initialiseParams(std::string const &);
86         void clearParams() {}
87         void dispatchParams() {}
88         bool isBufferDependent() const { return false; }
89         bool canApplyToReadOnly() const { return true; }
90         void selectAll();
91
92         /// update
93         void updateView();
94         //virtual void update_contents() {}
95
96 protected:
97         virtual bool wantInitialFocus() const { return true; }
98
99 private:
100         /// The encapsulated widget.
101         FindAndReplaceWidget * widget_;
102 };
103
104
105 } // namespace frontend
106 } // namespace lyx
107
108 #endif // QSEARCHADV_H