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