1 | /* |
2 | SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> |
3 | |
4 | SPDX-License-Identifier: MIT |
5 | */ |
6 | |
7 | #ifndef KSYNTAXHIGHLIGHTING_FORMAT_P_H |
8 | #define KSYNTAXHIGHLIGHTING_FORMAT_P_H |
9 | |
10 | #include "textstyledata_p.h" |
11 | #include "theme.h" |
12 | |
13 | #include <QSharedData> |
14 | #include <QString> |
15 | |
16 | QT_BEGIN_NAMESPACE |
17 | class QXmlStreamReader; |
18 | QT_END_NAMESPACE |
19 | |
20 | namespace KSyntaxHighlighting |
21 | { |
22 | class FormatPrivate : public QSharedData |
23 | { |
24 | public: |
25 | FormatPrivate() = default; |
26 | static FormatPrivate *detachAndGet(Format &format); |
27 | |
28 | static std::intptr_t ptrId(const Format &format) |
29 | { |
30 | return std::intptr_t(format.d.data()); |
31 | } |
32 | |
33 | TextStyleData styleOverride(const Theme &theme) const; |
34 | void load(QXmlStreamReader &reader); |
35 | |
36 | using StyleColor = QRgb(TextStyleData::*); |
37 | using ThemeColor = QRgb (Theme::*)(Theme::TextStyle) const; |
38 | bool hasColor(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const; |
39 | QColor color(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const; |
40 | |
41 | QString definitionName; |
42 | QString name; |
43 | TextStyleData style; |
44 | Theme::TextStyle defaultStyle = Theme::Normal; |
45 | int id = 0; |
46 | bool spellCheck = true; |
47 | }; |
48 | |
49 | } |
50 | |
51 | #endif |
52 | |