summaryrefslogtreecommitdiff
path: root/support/highlight/src/core/documentstyle.h
blob: 46d8aa5e7a62ccc81b20412960018661b3f4d777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/***************************************************************************
                          documentstyle.h  -  description
                             -------------------
    begin                : Son Nov 10 2002
    copyright            : (C) 2002-2007 by Andre Simon
    email                : andre.simon1@gmx.de
 ***************************************************************************/


/*
This file is part of Highlight.

Highlight is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Highlight is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Highlight.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef DOCUMENTSTYLE_H
#define DOCUMENTSTYLE_H

#include <string>
#include "configurationreader.h"
#include "elementstyle.h"
#include "stylecolour.h"

using namespace std;

namespace highlight
{

	/** maps keyword class names and the corresponding formatting information*/
	typedef map <string, ElementStyle> KeywordStyles;

	/** iterator for keyword styles*/
	typedef KeywordStyles::const_iterator KSIterator;

	/** \brief Contains information about document formatting properties.
	 * @author Andre Simon
	 */

	class DocumentStyle
	{
		private:
			ElementStyle comment, slcomment, str, dstr,
			escapeChar, number, directive, line, symbol;
			ElementStyle defaultElem;
			Colour  bgColour;
			Colour  markLineColour;

			string fontsize;
			bool fileFound;

			KeywordStyles keywordStyles;

		public:
			/** Constructor
			    \param styleDefinitionPath Style definition path */
			DocumentStyle ( const string & styleDefinitionPath );

			/** Constructor */
			DocumentStyle();
			~DocumentStyle();

			/** load style definition
			      \param styleDefinitionFile Style definition path
			      \return True if successfull */
			bool load ( const string & styleDefinitionFile );

			/** \return class names defined in the theme file */
			vector <string> getClassNames() const;

			/** \return keyword styles */
			KeywordStyles getKeywordStyles() const;

			/** \return Font size */
			string getFontSize() const;

			/** \return Background colour*/
			Colour getBgColour() const;

			/** \return Mark line colour*/
			Colour getMarkLineColour() const;

			/** \return Style of default (unrecognized) strings */
			ElementStyle getDefaultStyle() const;

			/** \return Comment style*/
			ElementStyle getCommentStyle() const;

			/** \return Single line comment style*/
			ElementStyle getSingleLineCommentStyle() const;

			/** \return String style*/
			ElementStyle getStringStyle() const;

			/** \return Directive line string style*/
			ElementStyle getDirectiveStringStyle() const;

			/** \return Escape character style*/
			ElementStyle getEscapeCharStyle() const;

			/** \return Number style*/
			ElementStyle getNumberStyle() const;

			/** \return Directive style*/
			ElementStyle getDirectiveStyle() const;

			/** \return Type style*/
			ElementStyle getTypeStyle() const;

			/** \return Line number style*/
			ElementStyle getLineStyle() const;

			/** \return Bracket style*/
			ElementStyle getSymbolStyle() const;

			/** \param className Name of keyword class (eg kwa, kwb, .., kwd)
			    \return keyword style of the given className
			*/
			ElementStyle getKeywordStyle ( const string &className ) ;

			/** \return True if language definition was found */
			bool found() const ;
	};

}

#endif