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 | namespace KSyntaxHighlighting |
17 | { |
18 | class FormatPrivate : public QSharedData |
19 | { |
20 | public: |
21 | FormatPrivate() = default; |
22 | static FormatPrivate *detachAndGet(Format &format); |
23 | |
24 | static std::intptr_t ptrId(const Format &format) |
25 | { |
26 | return std::intptr_t(format.d.data()); |
27 | } |
28 | |
29 | TextStyleData styleOverride(const Theme &theme) const; |
30 | void load(QXmlStreamReader &reader); |
31 | |
32 | using StyleColor = QRgb(TextStyleData::*); |
33 | using ThemeColor = QRgb (Theme::*)(Theme::TextStyle) const; |
34 | bool hasColor(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const; |
35 | QColor color(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const; |
36 | |
37 | QString definitionName; |
38 | QString name; |
39 | TextStyleData style; |
40 | Theme::TextStyle defaultStyle = Theme::Normal; |
41 | int id = 0; |
42 | bool spellCheck = true; |
43 | }; |
44 | |
45 | } |
46 | |
47 | #endif |
48 | |