]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QViewSource.h
getting rid of even more qt3 convenience classes and unused headers...
[lyx.git] / src / frontends / qt4 / QViewSource.h
1 // -*- C++ -*-
2 /**
3  * \file QViewSource.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Bo Peng
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QVIEWSOURCE_H
14 #define QVIEWSOURCE_H
15
16 #include "QDialogView.h"
17 #include <QSyntaxHighlighter>
18
19 namespace lyx {
20 namespace frontend {
21
22 class ControlViewSource;
23 class QViewSourceDialog;
24 class latexHighlighter;
25
26 ///
27 class QViewSource
28         : public QController<ControlViewSource, QView<QViewSourceDialog> >
29 {
30 public:
31         ///
32         friend class QViewSourceDialog;
33         ///
34         QViewSource(Dialog &);
35 private:
36         /// Apply changes
37         virtual void apply() {}
38         /// update
39         virtual void update_contents();
40         /// build the dialog
41         virtual void build_dialog();
42         /// latex syntax highlighter
43         latexHighlighter * highlighter;
44 };
45
46
47 ///
48 class latexHighlighter : public QSyntaxHighlighter
49 {
50         Q_OBJECT
51         
52 public:
53         latexHighlighter(QTextDocument * parent);
54
55 protected:
56         void highlightBlock(QString const & text);
57
58 private:
59         QTextCharFormat commentFormat;
60         QTextCharFormat keywordFormat;
61         QTextCharFormat mathFormat;
62 };
63
64
65 } // namespace frontend
66 } // namespace lyx
67
68 #endif // QVIEWSOURCE_H