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 
20 #ifndef INCLUDED_VCL_VCLENUM_HXX
21 #define INCLUDED_VCL_VCLENUM_HXX
22 
23 #include <sal/types.h>
24 #include <o3tl/typed_flags_set.hxx>
25 
26 enum class SelectionMode { NONE, Single, Range, Multiple };
27 
28 enum class TimeFieldFormat : sal_Int32 { F_NONE, F_SEC, F_SEC_CS };
29 
30 enum class MenuItemType { DONTKNOW, STRING, IMAGE, STRINGIMAGE, SEPARATOR };
31 
32 enum class MenuItemBits : sal_Int16
33 {
34     NONE                = 0x0000,
35     CHECKABLE           = 0x0001,
36     RADIOCHECK          = 0x0002,
37     AUTOCHECK           = 0x0004,
38     HELP                = 0x0010,
39     POPUPSELECT         = 0x0020,
40     // These have been said to be a preliminary (sic) solution since 2007
41     NOSELECT            = 0x0040,
42     ICON                = 0x0080,
43     TEXT                = 0x0100,
44 };
45 namespace o3tl
46 {
47     template<> struct typed_flags<MenuItemBits> : is_typed_flags<MenuItemBits, 0x1f7> {};
48 }
49 
50 enum class ToolBoxItemBits
51 {
52     NONE                = 0x0000,
53     CHECKABLE           = 0x0001,
54     RADIOCHECK          = 0x0002,
55     AUTOCHECK           = 0x0004,
56     LEFT                = 0x0008,
57     AUTOSIZE            = 0x0010,
58     DROPDOWN            = 0x0020,
59     REPEAT              = 0x0040,
60     DROPDOWNONLY        = 0x00a0, // 0x0080 | DROPDOWN
61     TEXT_ONLY           = 0x0100,
62     ICON_ONLY           = 0x0200
63 };
64 namespace o3tl
65 {
66     template<> struct typed_flags<ToolBoxItemBits> : is_typed_flags<ToolBoxItemBits, 0x3ff> {};
67 }
68 
69 enum class ToolBoxItemType { DONTKNOW, BUTTON, SPACE, SEPARATOR, BREAK };
70 
71 enum class ButtonType { SYMBOLONLY, TEXT, SYMBOLTEXT };
72 
73 enum class SymbolType : sal_uInt16
74 {
75     DONTKNOW         = 0,
76     IMAGE            = 1,
77     ARROW_UP         = 2,
78     ARROW_DOWN       = 3,
79     ARROW_LEFT       = 4,
80     ARROW_RIGHT      = 5,
81     SPIN_UP          = 6,
82     SPIN_DOWN        = 7,
83     SPIN_LEFT        = 8,
84     SPIN_RIGHT       = 9,
85     FIRST            = 10,
86     LAST             = 11,
87     PREV             = 12,
88     NEXT             = 13,
89     PAGEUP           = 14,
90     PAGEDOWN         = 15,
91     PLAY             = 16,
92     STOP             = 19,
93     CLOSE            = 25,
94     CHECKMARK        = 28,
95     RADIOCHECKMARK   = 29,
96     FLOAT            = 31,
97     DOCK             = 32,
98     HIDE             = 33,
99     HELP             = 34,
100     PLUS             = 35,
101     MENU             = SymbolType::SPIN_DOWN
102 };
103 
104 
105 // Border styles for SetBorder()
106 enum class WindowBorderStyle : sal_Int16
107 {
108     NONE              = 0x0000,
109     NORMAL            = 0x0001,
110     MONO              = 0x0002,
111     MENU              = 0x0010,
112     NWF               = 0x0020,
113     NOBORDER          = 0x1000,
114     REMOVEBORDER      = 0x2000
115 };
116 namespace o3tl
117 {
118     template<> struct typed_flags<WindowBorderStyle> : is_typed_flags<WindowBorderStyle, 0x3033> {};
119 }
120 
121 enum class WindowStateMask {
122     NONE             = 0x0000,
123     X                = 0x0001,
124     Y                = 0x0002,
125     Width            = 0x0004,
126     Height           = 0x0008,
127     State            = 0x0010,
128     Minimized        = 0x0020,
129     MaximizedX       = 0x0100,
130     MaximizedY       = 0x0200,
131     MaximizedWidth   = 0x0400,
132     MaximizedHeight  = 0x0800,
133     Pos              = X | Y,
134     All              = X | Y | Width | Height | MaximizedX | MaximizedY | MaximizedWidth | MaximizedHeight | State | Minimized
135 };
136 namespace o3tl
137 {
138     template<> struct typed_flags<WindowStateMask> : is_typed_flags<WindowStateMask, 0x0f3f> {};
139 }
140 
141 enum class TimeFormat
142 {
143     Hour12, Hour24
144 };
145 
146 enum class ExtTimeFieldFormat
147 {
148     /** the first 4 of these are only used by base/dbaccess */
149     Short24H, Long24H,
150     Short12H, Long12H,
151     ShortDuration, LongDuration
152 };
153 
154 enum class ExtDateFieldFormat
155 {
156     SystemShort, SystemShortYY, SystemShortYYYY,
157     SystemLong,
158     ShortDDMMYY, ShortMMDDYY, ShortYYMMDD,
159     ShortDDMMYYYY, ShortMMDDYYYY, ShortYYYYMMDD,
160     ShortYYMMDD_DIN5008, ShortYYYYMMDD_DIN5008,
161     FORCE_EQUAL_SIZE=SAL_MAX_ENUM
162 };
163 
164 // this appears to be a direct copy of css::awt::GradientStyle
165 enum class GradientStyle
166 {
167     Linear = 0,
168     Axial = 1,
169     Radial = 2,
170     Elliptical = 3,
171     Square = 4,
172     Rect = 5,
173     FORCE_EQUAL_SIZE = SAL_MAX_ENUM
174 };
175 
176 enum class HatchStyle
177 {
178     Single = 0,
179     Double = 1,
180     Triple = 2,
181     FORCE_EQUAL_SIZE = SAL_MAX_ENUM
182 };
183 
184 enum class LineStyle
185 {
186     NONE = 0,
187     Solid = 1,
188     Dash = 2,
189     FORCE_EQUAL_SIZE = SAL_MAX_ENUM
190 };
191 
192 enum class RasterOp { OverPaint, Xor, N0, N1, Invert };
193 
194 typedef sal_uInt32 sal_UCS4;    // TODO: this should be moved to rtl
195 
196 enum class OutDevSupportType { TransparentRect, B2DDraw };
197 
198 struct ItalicMatrix
199 {
200     double xx, xy, yx, yy;
ItalicMatrixItalicMatrix201     ItalicMatrix() : xx(1), xy(0), yx(0), yy(1) {}
202 };
203 
operator ==(const ItalicMatrix & a,const ItalicMatrix & b)204 inline bool operator ==(const ItalicMatrix& a, const ItalicMatrix& b)
205 {
206     return a.xx == b.xx && a.xy == b.xy && a.yx == b.yx && a.yy == b.yy;
207 }
208 
operator !=(const ItalicMatrix & a,const ItalicMatrix & b)209 inline bool operator !=(const ItalicMatrix& a, const ItalicMatrix& b)
210 {
211     return !(a == b);
212 }
213 
214 enum class VclAlign
215 {
216     Fill,
217     Start,
218     End,
219     Center
220 };
221 
222 enum class VclPackType
223 {
224     Start = 0,
225     End = 1,
226     LAST = End
227 };
228 
229 // Return Values from Dialog::Execute
230 //!!! in case of changes adjust /basic/source/runtime/methods.cxx msgbox
231 
232 enum VclResponseType
233 {
234     RET_CANCEL  = 0,
235     RET_OK      = 1,
236     RET_YES     = 2,
237     RET_NO      = 3,
238     RET_RETRY   = 4,
239     RET_IGNORE  = 5,
240     RET_CLOSE   = 7,
241     RET_HELP    = 10
242 };
243 
244 enum class VclButtonsType
245 {
246     NONE,
247     Ok,
248     Close,
249     Cancel,
250     YesNo,
251     OkCancel
252 };
253 
254 enum class VclMessageType
255 {
256     Info,
257     Warning,
258     Question,
259     Error,
260     Other
261 };
262 
263 enum class VclSizeGroupMode
264 {
265     NONE,
266     Horizontal,
267     Vertical,
268     Both
269 };
270 
271 enum class VclPolicyType
272 {
273     ALWAYS,
274     AUTOMATIC,
275     NEVER
276 };
277 
278 enum class WizardButtonFlags : sal_Int16
279 {
280     NONE                = 0x0000,
281     NEXT                = 0x0001,
282     PREVIOUS            = 0x0002,
283     FINISH              = 0x0004,
284     CANCEL              = 0x0008,
285     HELP                = 0x0010,
286 };
287 
288 namespace o3tl
289 {
290     template<> struct typed_flags<WizardButtonFlags> : is_typed_flags<WizardButtonFlags, 0x001f> {};
291 }
292 
293 // small, large, size32 force an exact toolbox size for proper alignment
294 // DontCare will let the toolbox decide about its size
295 enum class ToolBoxButtonSize
296 {
297     DontCare,
298     Small,
299     Large,
300     Size32,
301 };
302 
303 enum class WindowStateState {
304     NONE           = 0x0000,
305     Normal         = 0x0001,
306     Minimized      = 0x0002,
307     Maximized      = 0x0004,
308     // Rollup is no longer used, but retained because WindowStateState is serialized
309     // from/to strings describing window state that are stored in a users config
310     Rollup         = 0x0008,
311     MaximizedHorz  = 0x0010,
312     MaximizedVert  = 0x0020,
313     FullScreen     = 0x0040,
314     SystemMask     = 0xffff
315 };
316 namespace o3tl
317 {
318     template<> struct typed_flags<WindowStateState> : is_typed_flags<WindowStateState, 0xffff> {};
319 }
320 
321 namespace vcl
322 {
323     // The exact sizes of the icons in each size grouping are not necessarily
324     // the exact size indicated by the name, but the upper limit of their size.
325     // e.g. many Size26 icons are often 24x24px and only some 26x26px
326     enum class ImageType
327     {
328         Size16,
329         Size26,
330         Size32,
331         Small = Size16,
332         LAST = Size32,
333     };
334 }
335 
336 enum class DrawFrameStyle
337 {
338     NONE                     = 0x0000,
339     In                       = 0x0001,
340     Out                      = 0x0002,
341     Group                    = 0x0003,
342     DoubleIn                 = 0x0004,
343     DoubleOut                = 0x0005,
344     NWF                      = 0x0006,
345 };
346 
347 // Flags for DrawFrame()
348 enum class DrawFrameFlags
349 {
350     NONE                     = 0x0000,
351     Menu                     = 0x0010,
352     WindowBorder             = 0x0020,
353     BorderWindowBorder       = 0x0040,
354     Mono                     = 0x1000,
355     NoDraw                   = 0x8000,
356 };
357 namespace o3tl
358 {
359     template<> struct typed_flags<DrawFrameFlags> : is_typed_flags<DrawFrameFlags, 0x9070> {};
360 }
361 
362 enum class TxtAlign
363 {
364     Left,
365     Center,
366     Right
367 };
368 
369 enum class FloatWinPopupFlags
370 {
371     NONE                 = 0x000000,
372     AllowTearOff         = 0x000001,
373     Down                 = 0x000002,
374     Up                   = 0x000004,
375     Left                 = 0x000008,
376     Right                = 0x000010,
377     NoKeyClose           = 0x000020,
378     AllMouseButtonClose  = 0x000040,
379     NoAppFocusClose      = 0x000080,
380     NewLevel             = 0x000100,
381     NoMouseUpClose       = 0x000200,
382     GrabFocus            = 0x000400,
383     NoHorzPlacement      = 0x000800,
384 };
385 namespace o3tl
386 {
387     template<> struct typed_flags<FloatWinPopupFlags> : is_typed_flags<FloatWinPopupFlags, 0x0fff> {};
388 }
389 
390 // Flags for Window::Show()
391 enum class ShowFlags
392 {
393     NONE                       = 0x0000,
394     NoFocusChange              = 0x0002,
395     NoActivate                 = 0x0004,
396     ForegroundTask             = 0x0008,
397 };
398 namespace o3tl
399 {
400     template<> struct typed_flags<ShowFlags> : is_typed_flags<ShowFlags, 0x000e> {};
401 }
402 
403 enum class TrackingEventFlags
404 {
405     NONE           = 0x0000,
406     Cancel         = 0x0001,
407     Key            = 0x0002,
408     Focus          = 0x0004,
409     Repeat         = 0x0100,
410     End            = 0x1000,
411 };
412 namespace o3tl
413 {
414     template<> struct typed_flags<TrackingEventFlags> : is_typed_flags<TrackingEventFlags, 0x1107> {};
415 }
416 
417 #endif // INCLUDED_VCL_VCLENUM_HXX
418 
419 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
420