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