]> git.lyx.org Git - features.git/blob - src/frontends/qt/LaTeXHighlighter.h
Add basic support for \DeclareMetadata
[features.git] / src / frontends / qt / LaTeXHighlighter.h
1 // -*- C++ -*-
2 /**
3  * \file LaTeXHighlighter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Bo Peng
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef LATEXHIGHLIGHTER_H
13 #define LATEXHIGHLIGHTER_H
14
15 #include <QSyntaxHighlighter>
16 #include <QTextCharFormat>
17
18 class QTextDocument;
19 class QString;
20
21 namespace lyx {
22 namespace frontend {
23
24 // used already twice...
25 class LaTeXHighlighter : public QSyntaxHighlighter
26 {
27 public:
28         explicit LaTeXHighlighter(QTextDocument * parent,
29                                   bool at_letter = false,
30                                   bool keyval = false);
31
32 protected:
33         void highlightBlock(QString const & text) override;
34
35 private:
36         QTextCharFormat commentFormat;
37         QTextCharFormat keywordFormat;
38         QTextCharFormat mathFormat;
39         QTextCharFormat warningFormat;
40         QTextCharFormat keyFormat;
41         QTextCharFormat valFormat;
42         // is at a letter? (as in the preamble)
43         bool const at_letter_;
44         // highlight keyval options?
45         bool const keyval_;
46 };
47
48 } // namespace frontend
49 } // namespace lyx
50
51 #endif // LATEXHIGHLIGHTER