OSDN Git Service

dcd94a94fce2270a96bbf2d6acf8902279d37391
[qt-creator-jp/qt-creator-jp.git] / src / plugins / texteditor / generichighlighter / itemdata.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #include "itemdata.h"
35 #include "reuse.h"
36
37 using namespace TextEditor;
38 using namespace Internal;
39
40 ItemData::ItemData() :
41     m_italic(false),
42     m_italicSpecified(false),
43     m_bold(false),
44     m_boldSpecified(false),
45     m_underlined(false),
46     m_underlinedSpecified(false),
47     m_strikedOut(false),
48     m_strikeOutSpecified(false),
49     m_isCustomized(false)
50 {}
51
52 void ItemData::setStyle(const QString &style)
53 { m_style = style; }
54
55 const QString &ItemData::style() const
56 { return m_style; }
57
58 void ItemData::setColor(const QString &color)
59 {
60     if (!color.isEmpty()) {
61         m_color.setNamedColor(color);
62         m_isCustomized = true;
63     }
64 }
65
66 const QColor &ItemData::color() const
67 { return m_color; }
68
69 void ItemData::setSelectionColor(const QString &color)
70 {
71     if (!color.isEmpty()) {
72         m_selectionColor.setNamedColor(color);
73         m_isCustomized = true;
74     }
75 }
76
77 const QColor &ItemData::selectionColor() const
78 { return m_selectionColor; }
79
80 void ItemData::setItalic(const QString &italic)
81 {
82     if (!italic.isEmpty()) {
83         m_italic = toBool(italic);
84         m_italicSpecified = true;
85         m_isCustomized = true;
86     }
87 }
88
89 bool ItemData::isItalic() const
90 { return m_italic; }
91
92 bool ItemData::isItalicSpecified() const
93 { return m_italicSpecified; }
94
95 void ItemData::setBold(const QString &bold)
96 {
97     if (!bold.isEmpty()) {
98         m_bold = toBool(bold);
99         m_boldSpecified = true;
100         m_isCustomized = true;
101     }
102 }
103
104 bool ItemData::isBold() const
105 { return m_bold; }
106
107 bool ItemData::isBoldSpecified() const
108 { return m_boldSpecified; }
109
110 void ItemData::setUnderlined(const QString &underlined)
111 {
112     if (!underlined.isEmpty()) {
113         m_underlined = toBool(underlined);
114         m_underlinedSpecified = true;
115         m_isCustomized = true;
116     }
117 }
118
119 bool ItemData::isUnderlined() const
120 { return m_underlined; }
121
122 bool ItemData::isUnderlinedSpecified() const
123 { return m_underlinedSpecified; }
124
125 void ItemData::setStrikeOut(const QString &strike)
126 {
127     if (!strike.isEmpty()) {
128         m_strikedOut = toBool(strike);
129         m_strikeOutSpecified = true;
130         m_isCustomized = true;
131     }
132 }
133
134 bool ItemData::isStrikeOut() const
135 { return m_strikedOut; }
136
137 bool ItemData::isStrikeOutSpecified() const
138 { return m_strikeOutSpecified; }
139
140 bool ItemData::isCustomized() const
141 { return m_isCustomized; }