]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/FindAndReplace.h
f1f89b0b01ea0019c9a9485c5e7be5e813d11ecb
[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 FindAndReplace : public DockView, public Ui::FindAndReplaceUi
34 {
35         Q_OBJECT
36 public:
37         FindAndReplace(GuiView & parent);
38
39         bool initialiseParams(std::string const &);
40         void clearParams() {}
41         void dispatchParams() {}
42         bool isBufferDependent() const { return true; }
43         void selectAll();
44
45         /// update
46         void updateView() {}
47         //virtual void update_contents() {}
48
49 protected Q_SLOTS:
50         void on_findNextPB_clicked();
51         void on_findPrevPB_clicked();
52         void on_replacePB_clicked();
53         void on_replaceallPB_clicked();
54         void on_closePB_clicked();
55         void on_regexpInsertCombo_currentIndexChanged(int index);
56
57 protected:
58         void find(bool backwards);
59         virtual bool wantInitialFocus() const { return true; }
60
61 private:
62         // add a string to the combo if needed
63         void remember(std::string const & find, QComboBox & combo);
64         void findAdv(bool casesensitive,
65                         bool matchword, bool backwards,
66                         bool expandmacros, bool ignoreformat);
67
68         GuiView & parent_view_;
69
70         GuiWorkArea * searchWorkArea_;  // The work area defining what to search
71
72 private:
73         /// Apply changes
74         virtual void apply() {}
75
76         void find(docstring const & str, int len, bool casesens,
77                   bool words, bool backwards, bool expandmacros);
78
79         void replace(docstring const & findstr,
80                      docstring const & replacestr,
81                      bool casesens, bool words, bool backwards, bool expandmacros, bool all);
82         bool eventFilter(QObject *obj, QEvent *event);
83 };
84
85
86 } // namespace frontend
87 } // namespace lyx
88
89 #endif // QSEARCHADV_H