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