Line data Source code
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 _SV_SYSDATA_HXX
21 : #define _SV_SYSDATA_HXX
22 :
23 : #include <vector>
24 : #include <cstddef>
25 :
26 : #ifdef MACOSX
27 : // predeclare the native classes to avoid header/include problems
28 : typedef struct CGContext *CGContextRef;
29 : typedef struct CGLayer *CGLayerRef;
30 : #ifdef ENABLE_CORETEXT
31 : typedef const struct __CTFont * CTFontRef;
32 : #endif
33 : #ifdef __OBJC__
34 : @class NSView;
35 : #else
36 : class NSView;
37 : #endif
38 : #endif
39 :
40 : #ifdef IOS
41 : typedef const struct __CTFont * CTFontRef;
42 : typedef struct CGContext *CGContextRef;
43 : #endif
44 :
45 : #if defined( WNT )
46 : #ifdef _MSC_VER
47 : #pragma warning(push)
48 : #pragma warning(disable:4201)
49 : #endif
50 : #include <windef.h>
51 : #ifdef _MSC_VER
52 : #pragma warning(pop)
53 : #endif
54 : #endif
55 :
56 : // -----------------
57 : // - SystemEnvData -
58 : // -----------------
59 :
60 : struct SystemEnvData
61 : {
62 : unsigned long nSize; // size in bytes of this structure
63 : #if defined( WNT )
64 : HWND hWnd; // the window hwnd
65 : #elif defined( MACOSX )
66 : NSView* pView; // the cocoa (NSView *) implementing this object
67 : #elif defined( ANDROID )
68 : // Nothing
69 : #elif defined( IOS )
70 : // Nothing
71 : #elif defined( UNX )
72 : void* pDisplay; // the relevant display connection
73 : long aWindow; // the window of the object
74 : void* pSalFrame; // contains a salframe, if object has one
75 : void* pWidget; // the corresponding widget
76 : void* pVisual; // the visual in use
77 : int nScreen; // the current screen of the window
78 : int nDepth; // depth of said visual
79 : long aColormap; // the colormap being used
80 : void* pAppContext; // the application context in use
81 : long aShellWindow; // the window of the frame's shell
82 : void* pShellWidget; // the frame's shell widget
83 : #endif
84 : };
85 :
86 : #define SystemChildData SystemEnvData
87 :
88 : // --------------------
89 : // - SystemParentData -
90 : // --------------------
91 :
92 : struct SystemParentData
93 : {
94 : unsigned long nSize; // size in bytes of this structure
95 : #if defined( WNT )
96 : HWND hWnd; // the window hwnd
97 : #elif defined( MACOSX )
98 : NSView* pView; // the cocoa (NSView *) implementing this object
99 : #elif defined( ANDROID )
100 : // Nothing
101 : #elif defined( IOS )
102 : // Nothing
103 : #elif defined( UNX )
104 : long aWindow; // the window of the object
105 : bool bXEmbedSupport:1; // decides whether the object in question
106 : // should support the XEmbed protocol
107 : #endif
108 : };
109 :
110 : // --------------------
111 : // - SystemMenuData -
112 : // --------------------
113 :
114 : struct SystemMenuData
115 : {
116 : unsigned long nSize; // size in bytes of this structure
117 : #if defined( WNT )
118 : HMENU hMenu; // the menu handle of the menu bar
119 : #elif defined( MACOSX )
120 : // Nothing
121 : #elif defined( ANDROID )
122 : // Nothing
123 : #elif defined( IOS )
124 : // Nothing
125 : #elif defined( UNX )
126 : long aMenu; // ???
127 : #endif
128 : };
129 :
130 : // --------------------
131 : // - SystemGraphicsData -
132 : // --------------------
133 :
134 : struct SystemGraphicsData
135 : {
136 : unsigned long nSize; // size in bytes of this structure
137 : #if defined( WNT )
138 : HDC hDC; // handle to a device context
139 : #elif defined( MACOSX )
140 : CGContextRef rCGContext; // CoreGraphics graphic context
141 : #elif defined( ANDROID )
142 : // Nothing
143 : #elif defined( IOS )
144 : // Nothing
145 : #elif defined( UNX )
146 : void* pDisplay; // the relevant display connection
147 : long hDrawable; // a drawable
148 : void* pVisual; // the visual in use
149 : int nScreen; // the current screen of the drawable
150 : int nDepth; // depth of said visual
151 : long aColormap; // the colormap being used
152 : void* pXRenderFormat; // render format for drawable
153 : #endif
154 2 : SystemGraphicsData()
155 : : nSize( sizeof( SystemGraphicsData ) )
156 : #if defined( WNT )
157 : , hDC( 0 )
158 : #elif defined( MACOSX )
159 : // Nothing
160 : #elif defined( ANDROID )
161 : // Nothing
162 : #elif defined( IOS )
163 : // Nothing
164 : #elif defined( UNX )
165 : , pDisplay( NULL )
166 : , hDrawable( 0 )
167 : , pVisual( NULL )
168 : , nScreen( 0 )
169 : , nDepth( 0 )
170 : , aColormap( 0 )
171 2 : , pXRenderFormat( NULL )
172 : #endif
173 2 : { }
174 : };
175 :
176 :
177 : // --------------------
178 : // - SystemWindowData -
179 : // --------------------
180 :
181 : struct SystemWindowData
182 : {
183 : unsigned long nSize; // size in bytes of this structure
184 : #if defined( WNT ) // meaningless on Windows
185 : #elif defined( MACOSX ) // meaningless on Mac OS X
186 : // Nothing
187 : #elif defined( ANDROID )
188 : // Nothing
189 : #elif defined( IOS )
190 : // Nothing
191 : #elif defined( UNX )
192 : void* pVisual; // the visual to be used
193 : #endif
194 : };
195 :
196 :
197 : // --------------------
198 : // - SystemGlyphData -
199 : // --------------------
200 :
201 : struct SystemGlyphData
202 : {
203 : unsigned long index;
204 : double x;
205 : double y;
206 : int fallbacklevel;
207 : };
208 :
209 :
210 : // --------------------
211 : // - SystemFontData -
212 : // --------------------
213 : struct SystemFontData
214 : {
215 : unsigned long nSize; // size in bytes of this structure
216 : #if defined( WNT )
217 : HFONT hFont; // native font object
218 : #elif defined( MACOSX )
219 : #ifndef ENABLE_CORETEXT
220 : void* aATSUFontID; // native font object
221 : #endif
222 : #elif defined( UNX )
223 : void* nFontId; // native font id
224 : int nFontFlags; // native font flags
225 : #endif
226 : bool bFakeBold; // Does this font need faking the bold style
227 : bool bFakeItalic; // Does this font need faking the italic style
228 : bool bAntialias; // Should this font be antialiased
229 : bool bVerticalCharacterType; // Is the font using vertical character type
230 :
231 0 : SystemFontData()
232 : : nSize( sizeof( SystemFontData ) )
233 : #if defined( WNT )
234 : , hFont( 0 )
235 : #elif defined( MACOSX )
236 : #ifndef ENABLE_CORETEXT
237 : , aATSUFontID( NULL )
238 : #endif
239 : #elif defined( UNX )
240 : , nFontId( NULL )
241 : , nFontFlags( 0 )
242 : #endif
243 : , bFakeBold( false )
244 : , bFakeItalic( false )
245 : , bAntialias( true )
246 0 : , bVerticalCharacterType( false )
247 : {
248 0 : }
249 : };
250 :
251 : // --------------------
252 : // - SystemTextLayoutData -
253 : // --------------------
254 :
255 : typedef std::vector<SystemGlyphData> SystemGlyphDataVector;
256 :
257 0 : struct SystemTextLayoutData
258 : {
259 : unsigned long nSize; // size in bytes of this structure
260 : SystemGlyphDataVector rGlyphData; // glyph data
261 : int orientation; // Text orientation
262 : };
263 :
264 : #endif // _SV_SYSDATA_HXX
265 :
266 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|