android: Update app-specific/MIME type icons
[LibreOffice.git] / include / tools / fontenum.hxx
blob5fac8dfdb918d9b662e64fa15375b0b0f13c7019
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_TOOLS_FONTENUM_HXX
20 #define INCLUDED_TOOLS_FONTENUM_HXX
22 #include <sal/types.h>
23 #include <sal/log.hxx>
24 #include <o3tl/typed_flags_set.hxx>
26 #include <ostream>
28 enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN,
29 FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
31 template< typename charT, typename traits >
32 inline std::basic_ostream<charT, traits> & operator <<(
33 std::basic_ostream<charT, traits> & stream, FontFamily const& family)
35 switch (family)
37 case FAMILY_DONTKNOW:
38 return stream << "unknown";
40 case FAMILY_DECORATIVE:
41 return stream << "decorative";
43 case FAMILY_MODERN:
44 return stream << "modern";
46 case FAMILY_ROMAN:
47 return stream << "roman";
49 case FAMILY_SCRIPT:
50 return stream << "script";
52 case FAMILY_SWISS:
53 return stream << "swiss";
55 case FAMILY_SYSTEM:
56 return stream << "system";
58 default:
59 SAL_WARN("vcl.gdi", "FontFamily out of bounds");
60 assert(false && "FontFamily out of bounds");
61 return stream << "unknown";
65 enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
67 template< typename charT, typename traits >
68 inline std::basic_ostream<charT, traits> & operator <<(
69 std::basic_ostream<charT, traits> & stream, FontPitch const& pitch)
71 switch (pitch)
73 case PITCH_DONTKNOW:
74 return stream << "unknown";
76 case PITCH_FIXED:
77 return stream << "fixed";
79 case PITCH_VARIABLE:
80 return stream << "variable";
82 default:
83 SAL_WARN("vcl.gdi", "FontPitch out of bounds");
84 assert(false && "FontPitch out of bounds");
85 return stream << "unknown";
89 enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
91 template< typename charT, typename traits >
92 inline std::basic_ostream<charT, traits> & operator <<(
93 std::basic_ostream<charT, traits> & stream, TextAlign const& align)
95 switch (align)
97 case ALIGN_TOP:
98 return stream << "top";
100 case ALIGN_BASELINE:
101 return stream << "baseline";
103 case ALIGN_BOTTOM:
104 return stream << "bottom";
106 default:
107 SAL_WARN("vcl.gdi", "TextAlign out of bounds");
108 assert(false && "TextAlign out of bounds");
109 return stream << "unknown";
113 enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT,
114 WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL,
115 WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD,
116 WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
118 template< typename charT, typename traits >
119 inline std::basic_ostream<charT, traits> & operator <<(
120 std::basic_ostream<charT, traits> & stream, FontWeight const& weight)
122 switch (weight)
124 case WEIGHT_DONTKNOW:
125 return stream << "unknown";
127 case WEIGHT_THIN:
128 return stream << "thin";
130 case WEIGHT_ULTRALIGHT:
131 return stream << "ultralight";
133 case WEIGHT_LIGHT:
134 return stream << "light";
136 case WEIGHT_SEMILIGHT:
137 return stream << "semilight";
139 case WEIGHT_NORMAL:
140 return stream << "normal";
142 case WEIGHT_MEDIUM:
143 return stream << "medium";
145 case WEIGHT_SEMIBOLD:
146 return stream << "semibold";
148 case WEIGHT_BOLD:
149 return stream << "bold";
151 case WEIGHT_ULTRABOLD:
152 return stream << "ultrabold";
154 case WEIGHT_BLACK:
155 return stream << "black";
157 default:
158 SAL_WARN("vcl.gdi", "FontWeight out of bounds");
159 assert(false && "FontWeight out of bounds");
160 return stream << "unknown";
164 enum FontWidth { WIDTH_DONTKNOW, WIDTH_ULTRA_CONDENSED, WIDTH_EXTRA_CONDENSED,
165 WIDTH_CONDENSED, WIDTH_SEMI_CONDENSED, WIDTH_NORMAL,
166 WIDTH_SEMI_EXPANDED, WIDTH_EXPANDED, WIDTH_EXTRA_EXPANDED,
167 WIDTH_ULTRA_EXPANDED,
168 FontWidth_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
170 template< typename charT, typename traits >
171 inline std::basic_ostream<charT, traits> & operator <<(
172 std::basic_ostream<charT, traits> & stream, FontWidth const& width)
174 switch (width)
176 case WIDTH_DONTKNOW:
177 return stream << "unknown";
179 case WIDTH_ULTRA_CONDENSED:
180 return stream << "ultra condensed";
182 case WIDTH_EXTRA_CONDENSED:
183 return stream << "extra ultra condensed";
185 case WIDTH_CONDENSED:
186 return stream << "condensed";
188 case WIDTH_SEMI_CONDENSED:
189 return stream << "semi condensed";
191 case WIDTH_NORMAL:
192 return stream << "normal";
194 case WIDTH_SEMI_EXPANDED:
195 return stream << "semi expanded";
197 case WIDTH_EXPANDED:
198 return stream << "expanded";
200 case WIDTH_EXTRA_EXPANDED:
201 return stream << "extra expanded";
203 case WIDTH_ULTRA_EXPANDED:
204 return stream << "ultra expanded";
206 default:
207 SAL_WARN("vcl.gdi", "FontWidth out of bounds");
208 assert(false && "FontWidth out of bounds");
209 return stream << "unknown";
213 enum FontItalic { ITALIC_NONE, ITALIC_OBLIQUE, ITALIC_NORMAL, ITALIC_DONTKNOW, FontItalic_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
215 template< typename charT, typename traits >
216 inline std::basic_ostream<charT, traits> & operator <<(
217 std::basic_ostream<charT, traits> & stream, FontItalic const& italic)
219 switch (italic)
221 case ITALIC_DONTKNOW:
222 return stream << "unknown";
224 case ITALIC_OBLIQUE:
225 return stream << "oblique";
227 case ITALIC_NORMAL:
228 return stream << "normal";
230 case ITALIC_NONE:
231 return stream << "none";
233 default:
234 SAL_WARN("vcl.gdi", "FontItalic out of bounds");
235 assert(false && "FontItalic out of bounds");
236 return stream << "unknown";
240 enum FontLineStyle { LINESTYLE_NONE, LINESTYLE_SINGLE, LINESTYLE_DOUBLE,
241 LINESTYLE_DOTTED, LINESTYLE_DONTKNOW,
242 LINESTYLE_DASH, LINESTYLE_LONGDASH,
243 LINESTYLE_DASHDOT, LINESTYLE_DASHDOTDOT,
244 LINESTYLE_SMALLWAVE,
245 LINESTYLE_WAVE, LINESTYLE_DOUBLEWAVE,
246 LINESTYLE_BOLD, LINESTYLE_BOLDDOTTED,
247 LINESTYLE_BOLDDASH, LINESTYLE_BOLDLONGDASH,
248 LINESTYLE_BOLDDASHDOT, LINESTYLE_BOLDDASHDOTDOT,
249 LINESTYLE_BOLDWAVE,
250 FontLineStyle_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
252 template< typename charT, typename traits >
253 inline std::basic_ostream<charT, traits> & operator <<(
254 std::basic_ostream<charT, traits> & stream, FontLineStyle const& linestyle)
256 switch (linestyle)
258 case LINESTYLE_NONE:
259 return stream << "none";
261 case LINESTYLE_SINGLE:
262 return stream << "single";
264 case LINESTYLE_DOUBLE:
265 return stream << "double";
267 case LINESTYLE_DOTTED:
268 return stream << "dotted";
270 case LINESTYLE_DONTKNOW:
271 return stream << "unknown";
273 case LINESTYLE_DASH:
274 return stream << "dash";
276 case LINESTYLE_LONGDASH:
277 return stream << "long dash";
279 case LINESTYLE_DASHDOT:
280 return stream << "dash dot";
282 case LINESTYLE_DASHDOTDOT:
283 return stream << "dash dot dot";
285 case LINESTYLE_SMALLWAVE:
286 return stream << "small wave";
288 case LINESTYLE_WAVE:
289 return stream << "wave";
291 case LINESTYLE_DOUBLEWAVE:
292 return stream << "double wave";
294 case LINESTYLE_BOLD:
295 return stream << "bold";
297 case LINESTYLE_BOLDDOTTED:
298 return stream << "bold dotted";
300 case LINESTYLE_BOLDDASH:
301 return stream << "bold dash";
303 case LINESTYLE_BOLDLONGDASH:
304 return stream << "bold long dash";
306 case LINESTYLE_BOLDDASHDOT:
307 return stream << "bold dash dot";
309 case LINESTYLE_BOLDDASHDOTDOT:
310 return stream << "bold dash dot dot";
312 case LINESTYLE_BOLDWAVE:
313 return stream << "bold wave";
315 default:
316 SAL_WARN("vcl.gdi", "FontLineStyle out of bounds");
317 assert(false && "FontLineStyle out of bounds");
318 return stream << "unknown";
322 enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE,
323 STRIKEOUT_DONTKNOW, STRIKEOUT_BOLD,
324 STRIKEOUT_SLASH, STRIKEOUT_X,
325 FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
327 template< typename charT, typename traits >
328 inline std::basic_ostream<charT, traits> & operator <<(
329 std::basic_ostream<charT, traits> & stream, FontStrikeout const& strikeout)
331 switch (strikeout)
333 case STRIKEOUT_NONE:
334 return stream << "none";
336 case STRIKEOUT_SINGLE:
337 return stream << "single";
339 case STRIKEOUT_DOUBLE:
340 return stream << "double";
342 case STRIKEOUT_DONTKNOW:
343 return stream << "unknown";
345 case STRIKEOUT_BOLD:
346 return stream << "bold";
348 case STRIKEOUT_SLASH:
349 return stream << "slash";
351 case STRIKEOUT_X:
352 return stream << "x";
354 default:
355 SAL_WARN("vcl.gdi", "FontStrikeout out of bounds");
356 assert(false && "FontStrikeout out of bounds");
357 return stream << "unknown";
361 enum class FontEmphasisMark {
362 NONE = 0x0000, // capitalisation to avoid conflict with X11 macro
363 Dot = 0x0001,
364 Circle = 0x0002,
365 Disc = 0x0003,
366 Accent = 0x0004,
367 Style = 0x000f,
368 PosAbove = 0x1000,
369 PosBelow = 0x2000
371 namespace o3tl
373 template<> struct typed_flags<FontEmphasisMark> : is_typed_flags<FontEmphasisMark, 0x300f> {};
376 template< typename charT, typename traits >
377 inline std::basic_ostream<charT, traits> & operator <<(
378 std::basic_ostream<charT, traits> & stream, FontEmphasisMark const& emphasismark)
380 switch (emphasismark)
382 case FontEmphasisMark::NONE:
383 return stream << "none";
385 case FontEmphasisMark::Dot:
386 return stream << "Dot";
388 case FontEmphasisMark::Circle:
389 return stream << "Circle";
391 case FontEmphasisMark::Disc:
392 return stream << "Disc";
394 case FontEmphasisMark::Accent:
395 return stream << "Accent";
397 case FontEmphasisMark::Style:
398 return stream << "Style";
400 case FontEmphasisMark::PosAbove:
401 return stream << "PosAbove";
403 case FontEmphasisMark::PosBelow:
404 return stream << "PosBelow";
406 default:
407 SAL_WARN("vcl.gdi", "FontEmphasisMark out of bounds");
408 assert(false && "FontEmphasisMark out of bounds");
409 return stream << "unknown";
413 enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE };
415 template< typename charT, typename traits >
416 inline std::basic_ostream<charT, traits> & operator <<(
417 std::basic_ostream<charT, traits> & stream, FontEmbeddedBitmap const& embeddedbitmap)
419 switch (embeddedbitmap)
421 case EMBEDDEDBITMAP_DONTKNOW:
422 return stream << "unknown";
424 case EMBEDDEDBITMAP_FALSE:
425 return stream << "false";
427 case EMBEDDEDBITMAP_TRUE:
428 return stream << "true";
431 return stream << "unknown";
434 enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE };
436 template< typename charT, typename traits >
437 inline std::basic_ostream<charT, traits> & operator <<(
438 std::basic_ostream<charT, traits> & stream, FontAntiAlias const& antialias)
440 switch (antialias)
442 case ANTIALIAS_DONTKNOW:
443 return stream << "unknown";
445 case ANTIALIAS_FALSE:
446 return stream << "false";
448 case ANTIALIAS_TRUE:
449 return stream << "true";
452 return stream << "unknown";
455 #endif
457 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */