LibreOffice Module vcl (master)  1
sysdata.hxx
Go to the documentation of this file.
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 <sal/types.h>
24 
25 #include <vector>
26 
27 #include <config_cairo_canvas.h>
28 
29 #ifdef MACOSX
30 // predeclare the native classes to avoid header/include problems
31 typedef struct CGContext *CGContextRef;
32 typedef struct CGLayer *CGLayerRef;
33 typedef const struct __CTFont * CTFontRef;
34 #ifdef __OBJC__
35 @class NSView;
36 #else
37 class NSView;
38 #endif
39 #endif
40 
41 #ifdef IOS
42 typedef const struct __CTFont * CTFontRef;
43 typedef struct CGContext *CGContextRef;
44 #endif
45 
46 #if defined(_WIN32)
47 #include <prewin.h>
48 #include <windef.h>
49 #include <postwin.h>
50 #endif
51 
53 {
54 #if defined(_WIN32)
55  HWND hWnd; // the window hwnd
56 #elif defined( MACOSX )
57  NSView* mpNSView; // the cocoa (NSView *) implementing this object
58  bool mbOpenGL; // use an OpenGL providing NSView
59 #elif defined( ANDROID )
60  // Nothing
61 #elif defined( IOS )
62  // Nothing
63 #elif defined( UNX )
64  enum class Toolkit { Gtk3, Qt5 };
65  enum class Platform { Wayland, Xcb };
66 
67  void* pDisplay; // the relevant display connection
68  unsigned long aWindow; // the window of the object
69  void* pSalFrame; // contains a salframe, if object has one
70  void* pWidget; // the corresponding widget
71  void* pVisual; // the visual in use
72  int nScreen; // the current screen of the window
73  // note: this is a "long" in Xlib *but* in the protocol it's only 32-bit
74  // however, the GTK3 vclplug wants to store pointers in here!
75  sal_IntPtr aShellWindow; // the window of the frame's shell
76  Toolkit toolkit; // the toolkit in use
77  Platform platform; // the windowing system in use
78 #endif
79 
81 #if defined(_WIN32)
82  : hWnd(nullptr)
83 #elif defined( MACOSX )
84  : mpNSView(nullptr)
85  , mbOpenGL(false)
86 #elif defined( ANDROID )
87 #elif defined( IOS )
88 #elif defined( UNX )
89  : pDisplay(nullptr)
90  , aWindow(0)
91  , pSalFrame(nullptr)
92  , pWidget(nullptr)
93  , pVisual(nullptr)
94  , nScreen(0)
95  , aShellWindow(0)
96  , toolkit(Toolkit())
97  , platform(Platform())
98 #endif
99  {
100  }
101 };
102 
104 {
105  sal_uInt32 nSize; // size in bytes of this structure
106 #if defined(_WIN32)
107  HWND hWnd; // the window hwnd
108 #elif defined( MACOSX )
109  NSView* pView; // the cocoa (NSView *) implementing this object
110 #elif defined( ANDROID )
111  // Nothing
112 #elif defined( IOS )
113  // Nothing
114 #elif defined( UNX )
115  long aWindow; // the window of the object
116  bool bXEmbedSupport:1; // decides whether the object in question
117  // should support the XEmbed protocol
118 #endif
119 };
120 
122 {
123 #if defined(_WIN32)
124  HMENU hMenu; // the menu handle of the menu bar
125 #else
126  // Nothing
127 #endif
128 };
129 
131 {
132  sal_uInt32 nSize; // size in bytes of this structure
133 #if defined(_WIN32)
134  HDC hDC; // handle to a device context
135  HWND hWnd; // optional handle to a window
136 #elif defined( MACOSX )
137  CGContextRef rCGContext; // CoreGraphics graphic context
138 #elif defined( ANDROID )
139  // Nothing
140 #elif defined( IOS )
141  CGContextRef rCGContext; // CoreGraphics graphic context
142 #elif defined( UNX )
143  void* pDisplay; // the relevant display connection
144  long hDrawable; // a drawable
145  void* pVisual; // the visual in use
146  int nScreen; // the current screen of the drawable
147  void* pXRenderFormat; // render format for drawable
148  void* pSurface; // the cairo surface when using svp-based backends
149 #endif
151  : nSize( sizeof( SystemGraphicsData ) )
152 #if defined(_WIN32)
153  , hDC( nullptr )
154  , hWnd( nullptr )
155 #elif defined( MACOSX )
156  , rCGContext( nullptr )
157 #elif defined( ANDROID )
158  // Nothing
159 #elif defined( IOS )
160  , rCGContext( NULL )
161 #elif defined( UNX )
162  , pDisplay( nullptr )
163  , hDrawable( 0 )
164  , pVisual( nullptr )
165  , nScreen( 0 )
166  , pXRenderFormat( nullptr )
167  , pSurface( nullptr )
168 #endif
169  { }
170 };
171 
173 {
174 #if defined(_WIN32) // meaningless on Windows
175 #elif defined( MACOSX )
176  bool bOpenGL; // create an OpenGL providing NSView
177  bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true
178 #elif defined( ANDROID )
179  // Nothing
180 #elif defined( IOS )
181  // Nothing
182 #elif defined( UNX )
183  void* pVisual; // the visual to be used
184 #endif
185 };
186 
188 {
189  sal_uInt32 index;
190  double x;
191  double y;
193 };
194 
195 #if ENABLE_CAIRO_CANVAS
196 
197 struct SystemFontData
198 {
199 #if defined( UNX )
200  void* nFontId; // native font id
201  int nFontFlags; // native font flags
202 #endif
203  bool bFakeBold; // Does this font need faking the bold style
204  bool bFakeItalic; // Does this font need faking the italic style
205  bool bAntialias; // Should this font be antialiased
206  bool bVerticalCharacterType; // Is the font using vertical character type
207 
208  SystemFontData()
209  :
210 #if defined( UNX )
211  nFontId( nullptr ),
212  nFontFlags( 0 ),
213 #endif
214  bFakeBold( false ),
215  bFakeItalic( false ),
216  bAntialias( true ),
217  bVerticalCharacterType( false )
218  {
219  }
220 };
221 
222 #endif // ENABLE_CAIRO_CANVAS
223 
224 typedef std::vector<SystemGlyphData> SystemGlyphDataVector;
225 
227 {
228  SystemGlyphDataVector rGlyphData; // glyph data
229  int orientation; // Text orientation
230 };
231 
232 #endif // INCLUDED_VCL_SYSDATA_HXX
233 
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void * pXRenderFormat
Definition: sysdata.hxx:147
std::vector< SystemGlyphData > SystemGlyphDataVector
Definition: sysdata.hxx:224
void * pDisplay
Definition: sysdata.hxx:67
void * pVisual
Definition: sysdata.hxx:71
SystemGlyphDataVector rGlyphData
Definition: sysdata.hxx:228
return NULL
unsigned long aWindow
Definition: sysdata.hxx:68
sal_uInt32 nSize
Definition: sysdata.hxx:132
void * pWidget
Definition: sysdata.hxx:70
Toolkit toolkit
Definition: sysdata.hxx:76
sal_uInt32 nSize
Definition: sysdata.hxx:105
if(nullptr==pCandidateA||nullptr==pCandidateB)
Platform platform
Definition: sysdata.hxx:77
sal_uInt32 index
Definition: sysdata.hxx:189
sal_IntPtr aShellWindow
Definition: sysdata.hxx:75
void * pSalFrame
Definition: sysdata.hxx:69