]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/FindAndReplace.h
Add missing initialization
[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 "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         /// add a string to the combo if needed
45         void remember(std::string const & find, QComboBox & combo);
46
47         /// Perform the scope-related buffer switch while searching
48         bool findAndReplaceScope(FindAndReplaceOptions & opt, bool replace_all = false);
49
50         /// Collect options from the GUI elements, then perform the search
51         bool findAndReplace(bool backwards, bool replace, bool replace_all = false);
52
53         /// FIXME Probably to be merged with findAndReplace(bool, bool, bool)
54         bool findAndReplace(bool casesensitive, bool matchword, bool backwards,
55                 bool expandmacros, bool ignoreformat, bool replace,
56                 bool keep_case, bool replace_all = false);
57
58         bool eventFilter(QObject *obj, QEvent *event);
59
60         void virtual showEvent(QShowEvent *ev);
61         void virtual hideEvent(QHideEvent *ev);
62
63         void hideDialog();
64
65 protected Q_SLOTS:
66         void on_findNextPB_clicked();
67         void on_replacePB_clicked();
68         void on_replaceallPB_clicked();
69 };
70
71
72 class FindAndReplace : public DockView
73 {
74         Q_OBJECT
75 public:
76         FindAndReplace(
77                 GuiView & parent, ///< the main window where to dock.
78                 Qt::DockWidgetArea area = Qt::RightDockWidgetArea, ///< Position of the dock (and also drawer)
79                 Qt::WindowFlags flags = 0);
80
81         ~FindAndReplace();
82
83         bool initialiseParams(std::string const &);
84         void clearParams() {}
85         void dispatchParams() {}
86         bool isBufferDependent() const { return false; }
87         bool canApplyToReadOnly() 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