]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/FindAndReplace.h
Fix the tab ordering of GuiDocument components.
[lyx.git] / src / frontends / qt4 / 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 "GuiWorkArea.h"
16
17 #include "DockView.h"
18 #include "ui_FindAndReplaceUi.h"
19
20 #include "BufferView.h"
21 #include "Buffer.h"
22 #include "LyX.h"
23 #include "Text.h"
24 #include "lyxfind.h"
25
26 #include <QDialog>
27
28 #include <string>
29
30 namespace lyx {
31 namespace frontend {
32
33 class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
34 {
35         Q_OBJECT
36
37 public:
38         FindAndReplaceWidget(GuiView & view);
39         bool initialiseParams(std::string const & params);
40
41 private:
42         ///
43         GuiView & view_;
44
45         /// add a string to the combo if needed
46         void remember(std::string const & find, QComboBox & combo);
47
48         /// Perform the scope-related buffer switch while searching
49         bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
50
51         /// Collect options from the GUI elements, then perform the search
52         bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
53
54         /// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
55         bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
56                 bool expandmacros, bool ignoreformat, bool replace,
57                 bool keep_case, bool replace_all = false);
58
59         bool eventFilter(QObject *obj, QEvent *event);
60
61         void virtual showEvent(QShowEvent *ev);
62         void virtual hideEvent(QHideEvent *ev);
63
64         void hideDialog();
65
66 protected Q_SLOTS:
67         void on_findNextPB_clicked();
68         void on_replacePB_clicked();
69         void on_replaceallPB_clicked();
70 };
71
72
73 class FindAndReplace : public DockView
74 {
75         Q_OBJECT
76 public:
77         FindAndReplace(
78                 GuiView & parent, ///< the main window where to dock.
79                 Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
80                 Qt::WindowFlags flags = 0);
81
82         ~FindAndReplace();
83
84         bool initialiseParams(std::string const &);
85         void clearParams() {}
86         void dispatchParams() {}
87         bool isBufferDependent() const { return true; }
88         void selectAll();
89
90         /// update
91         void updateView() {}
92         //virtual void update_contents() {}
93
94 protected:
95         virtual bool wantInitialFocus() const { return true; }
96
97 private:
98         /// The encapsulated widget.
99         FindAndReplaceWidget * widget_;
100 };
101
102
103 } // namespace frontend
104 } // namespace lyx
105
106 #endif // QSEARCHADV_H