1 /***************************************************************************
2  *   copyright       : (C) 2003-2017 by Pascal Brachet                     *
3  *   http://www.xm1math.net/texmaker/                                      *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  ***************************************************************************/
11 
12 
13 #ifndef LIGHTLATEXHIGHLIGHTER_H
14 #define LIGHTLATEXHIGHLIGHTER_H
15 
16 
17 #include <QSyntaxHighlighter>
18 #include <QHash>
19 #include <QTextCharFormat>
20 #include <QColor>
21 #include <QTextBlockUserData>
22 //#include "latexeditor.h"
23 
24 class QTextDocument;
25 class LightLatexEditor;
26 
27 class LightLatexHighlighter : public QSyntaxHighlighter
28 {
29     Q_OBJECT
30 
31 public:
32     LightLatexHighlighter(QTextDocument *parent = 0);
33     ~LightLatexHighlighter();
34     QColor ColorStandard, ColorComment, ColorMath, ColorCommand, ColorKeyword, ColorVerbatim, ColorTodo, ColorKeywordGraphic, ColorNumberGraphic;
35     QStringList KeyWords, KeyWordsGraphic, KeyWordsGraphicBis;
36 public slots:
37 void setColors(QList<QColor> colors);
38 void SetEditor(LightLatexEditor *ed);
39 void setModeGraphic(bool m);
40 private :
41 bool isWordSeparator(QChar c) const;
42 bool isSpace(QChar c) const;
43 bool isGraphic;
44 protected:
45 LightLatexEditor *editor;
46 void highlightBlock(const QString &text);
47 };
48 
49 
50 #endif
51