]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/FindAndReplace.h
More notes.
[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 "LyXFunc.h"
24 #include "Text.h"
25
26 #include <QDialog>
27
28 #include <string>
29
30 namespace lyx {
31 namespace frontend {
32
33 class FindAndReplaceWidget : public QWidget, 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         void findAndReplace(
48                 bool casesensitive, bool matchword, bool backwards,
49                 bool expandmacros, bool ignoreformat, bool replace,
50                 bool keep_case
51         );
52 //      void find(docstring const & str, int len, bool casesens,
53 //                bool words, bool backwards, bool expandmacros);
54         void findAndReplace(bool backwards, bool replace);
55
56         bool eventFilter(QObject *obj, QEvent *event);
57
58         void virtual showEvent(QShowEvent *ev);
59         void virtual hideEvent(QHideEvent *ev);
60
61 protected Q_SLOTS:
62         void on_findNextPB_clicked();
63         void on_findPrevPB_clicked();
64         void on_replaceNextPB_clicked();
65         void on_replacePrevPB_clicked();
66         void on_replaceallPB_clicked();
67         void on_closePB_clicked();
68         void on_regexpInsertCombo_currentIndexChanged(int index);
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 true; }
87         void selectAll();
88
89         /// update
90         void updateView() {}
91         //virtual void update_contents() {}
92
93 protected:
94         virtual bool wantInitialFocus() const { return true; }
95
96 private:
97         /// The encapsulated widget.
98         FindAndReplaceWidget * widget_;
99 };
100
101
102 } // namespace frontend
103 } // namespace lyx
104
105 #endif // QSEARCHADV_H