1 /*
2   Copyright 2008 Brad Hards <bradh@frogmouth.net>
3   Copyright 2009-2011 Inge Wallin <inge@lysator.liu.se>
4 
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9 
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14 
15   You should have received a copy of the GNU Lesser General Public
16   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef EMFENUMS_H
20 #define EMFENUMS_H
21 
22 #include <QDataStream>
23 #include <QRect> // also provides QSize
24 #include <QString>
25 
26 /**
27    \file
28 
29    Enumerations used in various parts of EMF files
30 */
31 
32 
33 // We need most of the WMF enums and flags as well in an EMF file.
34 #include <WmfEnums.h>
35 
36 using namespace Libwmf;
37 
38 
39 /**
40    Namespace for Enhanced Metafile (EMF) classes
41 */
42 namespace Libemf
43 {
44 
45 /**
46    Background fill mode
47 
48    See [MS-EMF] Section 2.1.4
49 */
50 #if 0
51     enum BackgroundMode {
52         TRANSPARENT = 0x01, ///< Equivalent to Qt::TransparentMode
53         OPAQUE      = 0x02  ///< Equivalent to Qt::OpaqueMode
54     };
55 #else
56     typedef Libwmf::WmfMixMode EmfBackgroundMode; // This is exactly the same.
57 #endif
58 
59     /**
60        Parameters for text output.
61 
62        See [MS-EMF] Section 2.1.11
63     */
64     enum TextOutOptions {
65         //ETO_OPAQUE            = 0x000002,    // Already defined in WmfEnums.h
66         //ETO_CLIPPED           = 0x000004,
67         //ETO_GLYPH_INDEX       = 0x000010,
68         //ETO_RTLREADING        = 0x000080,
69         ETO_NO_RECT           = 0x000100,
70         ETO_SMALL_CHARS       = 0x000200,
71         //ETO_NUMERICSLOCAL     = 0x000400,
72         //ETO_NUMERICSLATIN     = 0x000800,
73         ETO_IGNORELANGUAGE    = 0x001000,
74         //ETO_PDY               = 0x002000,
75         ETO_REVERSE_INDEX_MAP = 0x010000
76     };
77 
78     /**
79        Graphics mode, used to interpret shape data such as rectangles
80 
81        See [MS-EMF] Section 2.1.16
82     */
83     enum GraphicsMode {
84         GM_COMPATIBLE = 0x01,
85         GM_ADVANCED   = 0x02
86     };
87 
88     /**
89        MapModes
90 
91        See [MS-EMF] Section 2.1.21
92     */
93     typedef enum {
94         MM_TEXT        = 0x01,
95         MM_LOMETRIC    = 0x02,
96         MM_HIMETRIC    = 0x03,
97         MM_LOENGLISH   = 0x04,
98         MM_HIENGLISH   = 0x05,
99         MM_TWIPS       = 0x06,
100         MM_ISOTROPIC   = 0x07,
101         MM_ANISOTROPIC = 0x08
102     } MapMode;
103 
104     /**
105        World Transform modification modes
106 
107        See [MS-EMF] Section 2.1.24
108     */
109     enum ModifyWorldTransformMode {
110         MWT_IDENTITY            = 0x01,
111         MWT_LEFTMULTIPLY        = 0x02,
112         MWT_RIGHTMULTIPLY       = 0x03,
113         MWT_SET                 = 0x04
114     };
115 
116     /**
117        Pen Styles
118 
119        See [MS-EMF] Section 2.1.25
120     */
121     enum PenStyle {
122 	PS_COSMETIC      = 0x00000000,
123 	PS_ENDCAP_ROUND  = 0x00000000,
124 	PS_JOIN_ROUND    = 0x00000000,
125 	PS_SOLID         = 0x00000000,
126 	PS_DASH          = 0x00000001,
127 	PS_DOT           = 0x00000002,
128 	PS_DASHDOT       = 0x00000003,
129 	PS_DASHDOTDOT    = 0x00000004,
130 	PS_NULL          = 0x00000005,
131 	PS_INSIDEFRAME   = 0x00000006,
132 	PS_USERSTYLE     = 0x00000007,
133 	PS_ALTERNATE     = 0x00000008,
134 	PS_ENDCAP_SQUARE = 0x00000100,
135 	PS_ENDCAP_FLAT   = 0x00000200,
136 	PS_JOIN_BEVEL    = 0x00001000,
137 	PS_JOIN_MITER    = 0x00002000,
138 	PS_GEOMETRIC     = 0x00010000
139     };
140 
141     /**
142        Stock Objects
143 
144        See [MS-EMF] Section 2.1.31
145     */
146     enum StockObject {
147 	WHITE_BRUSH	= 0x80000000,
148 	LTGRAY_BRUSH	= 0x80000001,
149 	GRAY_BRUSH	= 0x80000002,
150 	DKGRAY_BRUSH	= 0x80000003,
151 	BLACK_BRUSH	= 0x80000004,
152 	NULL_BRUSH	= 0x80000005,
153 	WHITE_PEN	= 0x80000006,
154 	BLACK_PEN	= 0x80000007,
155 	NULL_PEN	= 0x80000008,
156 	OEM_FIXED_FONT	= 0x8000000A,
157 	ANSI_FIXED_FONT	= 0x8000000B,
158 	ANSI_VAR_FONT	= 0x8000000C,
159 	SYSTEM_FONT	= 0x8000000D,
160 	DEVICE_DEFAULT_FONT = 0x8000000E,
161 	DEFAULT_PALETTE = 0x8000000F,
162 	SYSTEM_FIXED_FONT = 0x80000010,
163 	DEFAULT_GUI_FONT = 0x80000011,
164 	DC_BRUSH	= 0x80000012,
165 	DC_PEN		= 0x80000013
166     };
167 
168     /**
169        Fill mode
170 
171        See [MS-EMF] Section 2.1.27
172     */
173     enum PolygonFillMode {
174 	    ALTERNATE = 0x01, ///< Equivalent to Qt::OddEvenFill
175 	    WINDING   = 0x02  ///< Equivalent to Qt::WindingFill
176     };
177 
178     /**
179       Clipping region mode
180 
181       See [MS-EMF] Section 2.1.29
182     */
183     enum RegionMode {
184         RGN_AND = 0x01,   ///< Equivalent to Qt::IntersectClip
185         RGN_OR = 0x02,    ///< Equivalent to Qt::UniteClip
186         RGN_XOR = 0x03,
187         RGN_DIFF = 0x04,
188         RGN_COPY = 0x05   ///< Equivalent to Qt::ReplaceClip
189     };
190 
191     /**
192        Comment type as defined for the EMR_COMMENT record.
193 
194        See [MS-EMF] section 2.3.3
195      */
196     enum CommentType {
197         EMR_COMMENT_EMFSPOOL = 0x00000000,
198         EMR_COMMENT_EMFPLUS  = 0x2B464D45, // The string "EMF+"
199         EMR_COMMENT_PUBLIC   = 0x43494447,
200 
201         // The following value is not defined in [MS-EMF].pdf, but
202         // according to google it means that the file was created by
203         // Microsoft Graph.  It is present in one test file
204         // (Presentation_tips.ppt).
205         EMR_COMMENT_MSGR     = 0x5247534d // The string MSGR
206     };
207 }
208 
209 
210 #endif
211