LibreOffice Module tools (master) 1
fontenum.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_TOOLS_FONTENUM_HXX
20#define INCLUDED_TOOLS_FONTENUM_HXX
21
22#include <sal/types.h>
23#include <sal/log.hxx>
25
26#include <ostream>
27
30
31template< typename charT, typename traits >
32inline std::basic_ostream<charT, traits> & operator <<(
33 std::basic_ostream<charT, traits> & stream, FontFamily const& family)
34{
35 switch (family)
36 {
37 case FAMILY_DONTKNOW:
38 return stream << "unknown";
39
41 return stream << "decorative";
42
43 case FAMILY_MODERN:
44 return stream << "modern";
45
46 case FAMILY_ROMAN:
47 return stream << "roman";
48
49 case FAMILY_SCRIPT:
50 return stream << "script";
51
52 case FAMILY_SWISS:
53 return stream << "swiss";
54
55 case FAMILY_SYSTEM:
56 return stream << "system";
57
58 default:
59 SAL_WARN("vcl.gdi", "FontFamily out of bounds");
60 assert(false && "FontFamily out of bounds");
61 return stream << "unknown";
62 }
63}
64
66
67template< typename charT, typename traits >
68inline std::basic_ostream<charT, traits> & operator <<(
69 std::basic_ostream<charT, traits> & stream, FontPitch const& pitch)
70{
71 switch (pitch)
72 {
73 case PITCH_DONTKNOW:
74 return stream << "unknown";
75
76 case PITCH_FIXED:
77 return stream << "fixed";
78
79 case PITCH_VARIABLE:
80 return stream << "variable";
81
82 default:
83 SAL_WARN("vcl.gdi", "FontPitch out of bounds");
84 assert(false && "FontPitch out of bounds");
85 return stream << "unknown";
86 }
87}
88
90
91template< typename charT, typename traits >
92inline std::basic_ostream<charT, traits> & operator <<(
93 std::basic_ostream<charT, traits> & stream, TextAlign const& align)
94{
95 switch (align)
96 {
97 case ALIGN_TOP:
98 return stream << "top";
99
100 case ALIGN_BASELINE:
101 return stream << "baseline";
102
103 case ALIGN_BOTTOM:
104 return stream << "bottom";
105
106 default:
107 SAL_WARN("vcl.gdi", "TextAlign out of bounds");
108 assert(false && "TextAlign out of bounds");
109 return stream << "unknown";
110 }
111}
112
117
118template< typename charT, typename traits >
119inline std::basic_ostream<charT, traits> & operator <<(
120 std::basic_ostream<charT, traits> & stream, FontWeight const& weight)
121{
122 switch (weight)
123 {
124 case WEIGHT_DONTKNOW:
125 return stream << "unknown";
126
127 case WEIGHT_THIN:
128 return stream << "thin";
129
131 return stream << "ultralight";
132
133 case WEIGHT_LIGHT:
134 return stream << "light";
135
136 case WEIGHT_SEMILIGHT:
137 return stream << "semilight";
138
139 case WEIGHT_NORMAL:
140 return stream << "normal";
141
142 case WEIGHT_MEDIUM:
143 return stream << "medium";
144
145 case WEIGHT_SEMIBOLD:
146 return stream << "semibold";
147
148 case WEIGHT_BOLD:
149 return stream << "bold";
150
151 case WEIGHT_ULTRABOLD:
152 return stream << "ultrabold";
153
154 case WEIGHT_BLACK:
155 return stream << "black";
156
157 default:
158 SAL_WARN("vcl.gdi", "FontWeight out of bounds");
159 assert(false && "FontWeight out of bounds");
160 return stream << "unknown";
161 }
162}
163
169
170template< typename charT, typename traits >
171inline std::basic_ostream<charT, traits> & operator <<(
172 std::basic_ostream<charT, traits> & stream, FontWidth const& width)
173{
174 switch (width)
175 {
176 case WIDTH_DONTKNOW:
177 return stream << "unknown";
178
180 return stream << "ultra condensed";
181
183 return stream << "extra ultra condensed";
184
185 case WIDTH_CONDENSED:
186 return stream << "condensed";
187
189 return stream << "semi condensed";
190
191 case WIDTH_NORMAL:
192 return stream << "normal";
193
195 return stream << "semi expanded";
196
197 case WIDTH_EXPANDED:
198 return stream << "expanded";
199
201 return stream << "extra expanded";
202
204 return stream << "ultra expanded";
205
206 default:
207 SAL_WARN("vcl.gdi", "FontWidth out of bounds");
208 assert(false && "FontWidth out of bounds");
209 return stream << "unknown";
210 }
211}
212
214
215template< typename charT, typename traits >
216inline std::basic_ostream<charT, traits> & operator <<(
217 std::basic_ostream<charT, traits> & stream, FontItalic const& italic)
218{
219 switch (italic)
220 {
221 case ITALIC_DONTKNOW:
222 return stream << "unknown";
223
224 case ITALIC_OBLIQUE:
225 return stream << "oblique";
226
227 case ITALIC_NORMAL:
228 return stream << "normal";
229
230 case ITALIC_NONE:
231 return stream << "none";
232
233 default:
234 SAL_WARN("vcl.gdi", "FontItalic out of bounds");
235 assert(false && "FontItalic out of bounds");
236 return stream << "unknown";
237 }
238}
239
251
252template< typename charT, typename traits >
253inline std::basic_ostream<charT, traits> & operator <<(
254 std::basic_ostream<charT, traits> & stream, FontLineStyle const& linestyle)
255{
256 switch (linestyle)
257 {
258 case LINESTYLE_NONE:
259 return stream << "none";
260
261 case LINESTYLE_SINGLE:
262 return stream << "single";
263
264 case LINESTYLE_DOUBLE:
265 return stream << "double";
266
267 case LINESTYLE_DOTTED:
268 return stream << "dotted";
269
271 return stream << "unknown";
272
273 case LINESTYLE_DASH:
274 return stream << "dash";
275
277 return stream << "long dash";
278
280 return stream << "dash dot";
281
283 return stream << "dash dot dot";
284
286 return stream << "small wave";
287
288 case LINESTYLE_WAVE:
289 return stream << "wave";
290
292 return stream << "double wave";
293
294 case LINESTYLE_BOLD:
295 return stream << "bold";
296
298 return stream << "bold dotted";
299
301 return stream << "bold dash";
302
304 return stream << "bold long dash";
305
307 return stream << "bold dash dot";
308
310 return stream << "bold dash dot dot";
311
313 return stream << "bold wave";
314
315 default:
316 SAL_WARN("vcl.gdi", "FontLineStyle out of bounds");
317 assert(false && "FontLineStyle out of bounds");
318 return stream << "unknown";
319 }
320}
321
326
327template< typename charT, typename traits >
328inline std::basic_ostream<charT, traits> & operator <<(
329 std::basic_ostream<charT, traits> & stream, FontStrikeout const& strikeout)
330{
331 switch (strikeout)
332 {
333 case STRIKEOUT_NONE:
334 return stream << "none";
335
336 case STRIKEOUT_SINGLE:
337 return stream << "single";
338
339 case STRIKEOUT_DOUBLE:
340 return stream << "double";
341
343 return stream << "unknown";
344
345 case STRIKEOUT_BOLD:
346 return stream << "bold";
347
348 case STRIKEOUT_SLASH:
349 return stream << "slash";
350
351 case STRIKEOUT_X:
352 return stream << "x";
353
354 default:
355 SAL_WARN("vcl.gdi", "FontStrikeout out of bounds");
356 assert(false && "FontStrikeout out of bounds");
357 return stream << "unknown";
358 }
359}
360
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
370};
371namespace o3tl
372{
373 template<> struct typed_flags<FontEmphasisMark> : is_typed_flags<FontEmphasisMark, 0x300f> {};
374}
375
376template< typename charT, typename traits >
377inline std::basic_ostream<charT, traits> & operator <<(
378 std::basic_ostream<charT, traits> & stream, FontEmphasisMark const& emphasismark)
379{
380 switch (emphasismark)
381 {
383 return stream << "none";
384
386 return stream << "Dot";
387
389 return stream << "Circle";
390
392 return stream << "Disc";
393
395 return stream << "Accent";
396
398 return stream << "Style";
399
401 return stream << "PosAbove";
402
404 return stream << "PosBelow";
405
406 default:
407 SAL_WARN("vcl.gdi", "FontEmphasisMark out of bounds");
408 assert(false && "FontEmphasisMark out of bounds");
409 return stream << "unknown";
410 }
411}
412
414
415template< typename charT, typename traits >
416inline std::basic_ostream<charT, traits> & operator <<(
417 std::basic_ostream<charT, traits> & stream, FontEmbeddedBitmap const& embeddedbitmap)
418{
419 switch (embeddedbitmap)
420 {
422 return stream << "unknown";
423
425 return stream << "false";
426
428 return stream << "true";
429 }
430
431 return stream << "unknown";
432}
433
435
436template< typename charT, typename traits >
437inline std::basic_ostream<charT, traits> & operator <<(
438 std::basic_ostream<charT, traits> & stream, FontAntiAlias const& antialias)
439{
440 switch (antialias)
441 {
443 return stream << "unknown";
444
445 case ANTIALIAS_FALSE:
446 return stream << "false";
447
448 case ANTIALIAS_TRUE:
449 return stream << "true";
450 }
451
452 return stream << "unknown";
453}
454
455#endif
456
457/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XOutputStream > stream
FontLineStyle
Definition: fontenum.hxx:240
@ LINESTYLE_BOLDDASHDOT
Definition: fontenum.hxx:248
@ LINESTYLE_BOLDDASHDOTDOT
Definition: fontenum.hxx:248
@ LINESTYLE_SINGLE
Definition: fontenum.hxx:240
@ LINESTYLE_BOLDLONGDASH
Definition: fontenum.hxx:247
@ LINESTYLE_BOLDWAVE
Definition: fontenum.hxx:249
@ LINESTYLE_DASHDOTDOT
Definition: fontenum.hxx:243
@ LINESTYLE_BOLDDASH
Definition: fontenum.hxx:247
@ LINESTYLE_BOLDDOTTED
Definition: fontenum.hxx:246
@ LINESTYLE_DOUBLEWAVE
Definition: fontenum.hxx:245
@ LINESTYLE_DOUBLE
Definition: fontenum.hxx:240
@ LINESTYLE_NONE
Definition: fontenum.hxx:240
@ LINESTYLE_DASH
Definition: fontenum.hxx:242
@ LINESTYLE_DONTKNOW
Definition: fontenum.hxx:241
@ LINESTYLE_SMALLWAVE
Definition: fontenum.hxx:244
@ LINESTYLE_DASHDOT
Definition: fontenum.hxx:243
@ LINESTYLE_DOTTED
Definition: fontenum.hxx:241
@ LINESTYLE_WAVE
Definition: fontenum.hxx:245
@ LINESTYLE_LONGDASH
Definition: fontenum.hxx:242
@ FontLineStyle_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:250
@ LINESTYLE_BOLD
Definition: fontenum.hxx:246
FontStrikeout
Definition: fontenum.hxx:322
@ STRIKEOUT_BOLD
Definition: fontenum.hxx:323
@ STRIKEOUT_DOUBLE
Definition: fontenum.hxx:322
@ STRIKEOUT_SINGLE
Definition: fontenum.hxx:322
@ STRIKEOUT_X
Definition: fontenum.hxx:324
@ STRIKEOUT_SLASH
Definition: fontenum.hxx:324
@ FontStrikeout_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:325
@ STRIKEOUT_NONE
Definition: fontenum.hxx:322
@ STRIKEOUT_DONTKNOW
Definition: fontenum.hxx:323
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, FontFamily const &family)
Definition: fontenum.hxx:32
FontPitch
Definition: fontenum.hxx:65
@ FontPitch_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:65
@ PITCH_VARIABLE
Definition: fontenum.hxx:65
@ PITCH_FIXED
Definition: fontenum.hxx:65
@ PITCH_DONTKNOW
Definition: fontenum.hxx:65
FontItalic
Definition: fontenum.hxx:213
@ ITALIC_NORMAL
Definition: fontenum.hxx:213
@ ITALIC_NONE
Definition: fontenum.hxx:213
@ ITALIC_DONTKNOW
Definition: fontenum.hxx:213
@ ITALIC_OBLIQUE
Definition: fontenum.hxx:213
@ FontItalic_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:213
FontEmphasisMark
Definition: fontenum.hxx:361
FontWidth
Definition: fontenum.hxx:164
@ WIDTH_CONDENSED
Definition: fontenum.hxx:165
@ WIDTH_EXPANDED
Definition: fontenum.hxx:166
@ WIDTH_EXTRA_CONDENSED
Definition: fontenum.hxx:164
@ WIDTH_ULTRA_EXPANDED
Definition: fontenum.hxx:167
@ WIDTH_EXTRA_EXPANDED
Definition: fontenum.hxx:166
@ WIDTH_SEMI_CONDENSED
Definition: fontenum.hxx:165
@ WIDTH_ULTRA_CONDENSED
Definition: fontenum.hxx:164
@ WIDTH_DONTKNOW
Definition: fontenum.hxx:164
@ WIDTH_SEMI_EXPANDED
Definition: fontenum.hxx:166
@ WIDTH_NORMAL
Definition: fontenum.hxx:165
@ FontWidth_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:168
@ TextAlign_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:89
@ ALIGN_BOTTOM
Definition: fontenum.hxx:89
@ ALIGN_TOP
Definition: fontenum.hxx:89
@ ALIGN_BASELINE
Definition: fontenum.hxx:89
FontEmbeddedBitmap
Definition: fontenum.hxx:413
@ EMBEDDEDBITMAP_TRUE
Definition: fontenum.hxx:413
@ EMBEDDEDBITMAP_DONTKNOW
Definition: fontenum.hxx:413
@ EMBEDDEDBITMAP_FALSE
Definition: fontenum.hxx:413
FontAntiAlias
Definition: fontenum.hxx:434
@ ANTIALIAS_TRUE
Definition: fontenum.hxx:434
@ ANTIALIAS_DONTKNOW
Definition: fontenum.hxx:434
@ ANTIALIAS_FALSE
Definition: fontenum.hxx:434
FontFamily
Definition: fontenum.hxx:28
@ FAMILY_DECORATIVE
Definition: fontenum.hxx:28
@ FAMILY_SYSTEM
Definition: fontenum.hxx:29
@ FAMILY_DONTKNOW
Definition: fontenum.hxx:28
@ FAMILY_SCRIPT
Definition: fontenum.hxx:29
@ FAMILY_SWISS
Definition: fontenum.hxx:29
@ FontFamily_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:29
@ FAMILY_MODERN
Definition: fontenum.hxx:28
@ FAMILY_ROMAN
Definition: fontenum.hxx:29
@ WEIGHT_ULTRALIGHT
Definition: fontenum.hxx:113
@ WEIGHT_ULTRABOLD
Definition: fontenum.hxx:116
@ WEIGHT_THIN
Definition: fontenum.hxx:113
@ WEIGHT_BOLD
Definition: fontenum.hxx:115
@ WEIGHT_NORMAL
Definition: fontenum.hxx:114
@ WEIGHT_LIGHT
Definition: fontenum.hxx:114
@ WEIGHT_DONTKNOW
Definition: fontenum.hxx:113
@ WEIGHT_SEMIBOLD
Definition: fontenum.hxx:115
@ WEIGHT_SEMILIGHT
Definition: fontenum.hxx:114
@ FontWeight_FORCE_EQUAL_SIZE
Definition: fontenum.hxx:116
@ WEIGHT_MEDIUM
Definition: fontenum.hxx:115
@ WEIGHT_BLACK
Definition: fontenum.hxx:116
#define SAL_WARN(area, stream)
NONE
TextAlign
FontWeight
#define SAL_MAX_ENUM