Mercurial > clickerconvert
comparison src/xlsx/xlsxformat.h @ 1:93d3106bb9a4
Add qt xlsx library
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 22 Mar 2016 10:38:08 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:49cd5cc0b072 | 1:93d3106bb9a4 |
---|---|
1 /**************************************************************************** | |
2 ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me> | |
3 ** All right reserved. | |
4 ** | |
5 ** Permission is hereby granted, free of charge, to any person obtaining | |
6 ** a copy of this software and associated documentation files (the | |
7 ** "Software"), to deal in the Software without restriction, including | |
8 ** without limitation the rights to use, copy, modify, merge, publish, | |
9 ** distribute, sublicense, and/or sell copies of the Software, and to | |
10 ** permit persons to whom the Software is furnished to do so, subject to | |
11 ** the following conditions: | |
12 ** | |
13 ** The above copyright notice and this permission notice shall be | |
14 ** included in all copies or substantial portions of the Software. | |
15 ** | |
16 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
19 ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
20 ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
21 ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
22 ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
23 ** | |
24 ****************************************************************************/ | |
25 #ifndef QXLSX_FORMAT_H | |
26 #define QXLSX_FORMAT_H | |
27 | |
28 #include "xlsxglobal.h" | |
29 #include <QFont> | |
30 #include <QColor> | |
31 #include <QByteArray> | |
32 #include <QList> | |
33 #include <QExplicitlySharedDataPointer> | |
34 #include <QVariant> | |
35 | |
36 class FormatTest; | |
37 | |
38 QT_BEGIN_NAMESPACE_XLSX | |
39 | |
40 class Styles; | |
41 class Worksheet; | |
42 class WorksheetPrivate; | |
43 class RichStringPrivate; | |
44 class SharedStrings; | |
45 | |
46 class FormatPrivate; | |
47 class Q_XLSX_EXPORT Format | |
48 { | |
49 public: | |
50 enum FontScript | |
51 { | |
52 FontScriptNormal, | |
53 FontScriptSuper, | |
54 FontScriptSub | |
55 }; | |
56 | |
57 enum FontUnderline | |
58 { | |
59 FontUnderlineNone, | |
60 FontUnderlineSingle, | |
61 FontUnderlineDouble, | |
62 FontUnderlineSingleAccounting, | |
63 FontUnderlineDoubleAccounting | |
64 }; | |
65 | |
66 enum HorizontalAlignment | |
67 { | |
68 AlignHGeneral, | |
69 AlignLeft, | |
70 AlignHCenter, | |
71 AlignRight, | |
72 AlignHFill, | |
73 AlignHJustify, | |
74 AlignHMerge, | |
75 AlignHDistributed | |
76 }; | |
77 | |
78 enum VerticalAlignment | |
79 { | |
80 AlignTop, | |
81 AlignVCenter, | |
82 AlignBottom, | |
83 AlignVJustify, | |
84 AlignVDistributed | |
85 }; | |
86 | |
87 enum BorderStyle | |
88 { | |
89 BorderNone, | |
90 BorderThin, | |
91 BorderMedium, | |
92 BorderDashed, | |
93 BorderDotted, | |
94 BorderThick, | |
95 BorderDouble, | |
96 BorderHair, | |
97 BorderMediumDashed, | |
98 BorderDashDot, | |
99 BorderMediumDashDot, | |
100 BorderDashDotDot, | |
101 BorderMediumDashDotDot, | |
102 BorderSlantDashDot | |
103 }; | |
104 | |
105 enum DiagonalBorderType | |
106 { | |
107 DiagonalBorderNone, | |
108 DiagonalBorderDown, | |
109 DiagonalBorderUp, | |
110 DiagnoalBorderBoth | |
111 }; | |
112 | |
113 enum FillPattern | |
114 { | |
115 PatternNone, | |
116 PatternSolid, | |
117 PatternMediumGray, | |
118 PatternDarkGray, | |
119 PatternLightGray, | |
120 PatternDarkHorizontal, | |
121 PatternDarkVertical, | |
122 PatternDarkDown, | |
123 PatternDarkUp, | |
124 PatternDarkGrid, | |
125 PatternDarkTrellis, | |
126 PatternLightHorizontal, | |
127 PatternLightVertical, | |
128 PatternLightDown, | |
129 PatternLightUp, | |
130 PatternLightTrellis, | |
131 PatternGray125, | |
132 PatternGray0625, | |
133 PatternLightGrid | |
134 }; | |
135 | |
136 Format(); | |
137 Format(const Format &other); | |
138 Format &operator=(const Format &rhs); | |
139 ~Format(); | |
140 | |
141 int numberFormatIndex() const; | |
142 void setNumberFormatIndex(int format); | |
143 QString numberFormat() const; | |
144 void setNumberFormat(const QString &format); | |
145 void setNumberFormat(int id, const QString &format); | |
146 bool isDateTimeFormat() const; | |
147 | |
148 int fontSize() const; | |
149 void setFontSize(int size); | |
150 bool fontItalic() const; | |
151 void setFontItalic(bool italic); | |
152 bool fontStrikeOut() const; | |
153 void setFontStrikeOut(bool); | |
154 QColor fontColor() const; | |
155 void setFontColor(const QColor &); | |
156 bool fontBold() const; | |
157 void setFontBold(bool bold); | |
158 FontScript fontScript() const; | |
159 void setFontScript(FontScript); | |
160 FontUnderline fontUnderline() const; | |
161 void setFontUnderline(FontUnderline); | |
162 bool fontOutline() const; | |
163 void setFontOutline(bool outline); | |
164 QString fontName() const; | |
165 void setFontName(const QString &); | |
166 QFont font() const; | |
167 void setFont(const QFont &font); | |
168 | |
169 HorizontalAlignment horizontalAlignment() const; | |
170 void setHorizontalAlignment(HorizontalAlignment align); | |
171 VerticalAlignment verticalAlignment() const; | |
172 void setVerticalAlignment(VerticalAlignment align); | |
173 bool textWrap() const; | |
174 void setTextWarp(bool textWrap); | |
175 int rotation() const; | |
176 void setRotation(int rotation); | |
177 int indent() const; | |
178 void setIndent(int indent); | |
179 bool shrinkToFit() const; | |
180 void setShrinkToFit(bool shink); | |
181 | |
182 void setBorderStyle(BorderStyle style); | |
183 void setBorderColor(const QColor &color); | |
184 BorderStyle leftBorderStyle() const; | |
185 void setLeftBorderStyle(BorderStyle style); | |
186 QColor leftBorderColor() const; | |
187 void setLeftBorderColor(const QColor &color); | |
188 BorderStyle rightBorderStyle() const; | |
189 void setRightBorderStyle(BorderStyle style); | |
190 QColor rightBorderColor() const; | |
191 void setRightBorderColor(const QColor &color); | |
192 BorderStyle topBorderStyle() const; | |
193 void setTopBorderStyle(BorderStyle style); | |
194 QColor topBorderColor() const; | |
195 void setTopBorderColor(const QColor &color); | |
196 BorderStyle bottomBorderStyle() const; | |
197 void setBottomBorderStyle(BorderStyle style); | |
198 QColor bottomBorderColor() const; | |
199 void setBottomBorderColor(const QColor &color); | |
200 BorderStyle diagonalBorderStyle() const; | |
201 void setDiagonalBorderStyle(BorderStyle style); | |
202 DiagonalBorderType diagonalBorderType() const; | |
203 void setDiagonalBorderType(DiagonalBorderType style); | |
204 QColor diagonalBorderColor() const; | |
205 void setDiagonalBorderColor(const QColor &color); | |
206 | |
207 FillPattern fillPattern() const; | |
208 void setFillPattern(FillPattern pattern); | |
209 QColor patternForegroundColor() const; | |
210 void setPatternForegroundColor(const QColor &color); | |
211 QColor patternBackgroundColor() const; | |
212 void setPatternBackgroundColor(const QColor &color); | |
213 | |
214 bool locked() const; | |
215 void setLocked(bool locked); | |
216 bool hidden() const; | |
217 void setHidden(bool hidden); | |
218 | |
219 void mergeFormat(const Format &modifier); | |
220 bool isValid() const; | |
221 bool isEmpty() const; | |
222 | |
223 bool operator == (const Format &format) const; | |
224 bool operator != (const Format &format) const; | |
225 | |
226 QVariant property(int propertyId, const QVariant &defaultValue=QVariant()) const; | |
227 void setProperty(int propertyId, const QVariant &value, const QVariant &clearValue=QVariant(), bool detach=true); | |
228 void clearProperty(int propertyId); | |
229 bool hasProperty(int propertyId) const; | |
230 | |
231 bool boolProperty(int propertyId, bool defaultValue=false) const; | |
232 int intProperty(int propertyId, int defaultValue=0) const; | |
233 double doubleProperty(int propertyId, double defaultValue = 0.0) const; | |
234 QString stringProperty(int propertyId, const QString &defaultValue = QString()) const; | |
235 QColor colorProperty(int propertyId, const QColor &defaultValue = QColor()) const; | |
236 | |
237 bool hasNumFmtData() const; | |
238 bool hasFontData() const; | |
239 bool hasFillData() const; | |
240 bool hasBorderData() const; | |
241 bool hasAlignmentData() const; | |
242 bool hasProtectionData() const; | |
243 | |
244 bool fontIndexValid() const; | |
245 int fontIndex() const; | |
246 QByteArray fontKey() const; | |
247 bool borderIndexValid() const; | |
248 QByteArray borderKey() const; | |
249 int borderIndex() const; | |
250 bool fillIndexValid() const; | |
251 QByteArray fillKey() const; | |
252 int fillIndex() const; | |
253 | |
254 QByteArray formatKey() const; | |
255 bool xfIndexValid() const; | |
256 int xfIndex() const; | |
257 bool dxfIndexValid() const; | |
258 int dxfIndex() const; | |
259 | |
260 void fixNumberFormat(int id, const QString &format); | |
261 void setFontIndex(int index); | |
262 void setBorderIndex(int index); | |
263 void setFillIndex(int index); | |
264 void setXfIndex(int index); | |
265 void setDxfIndex(int index); | |
266 private: | |
267 friend class Styles; | |
268 friend class ::FormatTest; | |
269 friend Q_XLSX_EXPORT QDebug operator<<(QDebug, const Format &f); | |
270 | |
271 int theme() const; | |
272 | |
273 QExplicitlySharedDataPointer<FormatPrivate> d; | |
274 }; | |
275 | |
276 #ifndef QT_NO_DEBUG_STREAM | |
277 Q_XLSX_EXPORT QDebug operator<<(QDebug dbg, const Format &f); | |
278 #endif | |
279 | |
280 QT_END_NAMESPACE_XLSX | |
281 | |
282 #endif // QXLSX_FORMAT_H |