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  sal_uInt32 nSize; // size in bytes of this structure
55 #if defined(_WIN32)
56  HWND hWnd; // the window hwnd
57 #elif defined( MACOSX )
58  NSView* mpNSView; // the cocoa (NSView *) implementing this object
59  bool mbOpenGL; // use an OpenGL providing NSView
60 #elif defined( ANDROID )
61  // Nothing
62 #elif defined( IOS )
63  // Nothing
64 #elif defined( UNX )
65  void* pDisplay; // the relevant display connection
66  unsigned long aWindow; // the window of the object
67  void* pSalFrame; // contains a salframe, if object has one
68  void* pWidget; // the corresponding widget
69  void* pVisual; // the visual in use
70  int nScreen; // the current screen of the window
71  // note: this is a "long" in Xlib *but* in the protocol it's only 32-bit
72  // however, the GTK3 vclplug wants to store pointers in here!
73  sal_IntPtr aShellWindow; // the window of the frame's shell
74  const char* pToolkit; // the toolkit in use (gtk2 vs gtk3)
75  const char* pPlatformName; // the windowing system in use (xcb vs wayland)
76 #endif
77 
79  : nSize(0)
80 #if defined(_WIN32)
81  , hWnd(nullptr)
82 #elif defined( MACOSX )
83  , mpNSView(nullptr)
84  , mbOpenGL(false)
85 #elif defined( ANDROID )
86 #elif defined( IOS )
87 #elif defined( UNX )
88  , pDisplay(nullptr)
89  , aWindow(0)
90  , pSalFrame(nullptr)
91  , pWidget(nullptr)
92  , pVisual(nullptr)
93  , nScreen(0)
94  , aShellWindow(0)
95  , pToolkit(nullptr)
96  , pPlatformName(nullptr)
97 #endif
98  {
99  }
100 };
101 
103 {
104  sal_uInt32 nSize; // size in bytes of this structure
105 #if defined(_WIN32)
106  HWND hWnd; // the window hwnd
107 #elif defined( MACOSX )
108  NSView* pView; // the cocoa (NSView *) implementing this object
109 #elif defined( ANDROID )
110  // Nothing
111 #elif defined( IOS )
112  // Nothing
113 #elif defined( UNX )
114  long aWindow; // the window of the object
115  bool bXEmbedSupport:1; // decides whether the object in question
116  // should support the XEmbed protocol
117 #endif
118 };
119 
121 {
122 #if defined(_WIN32)
123  HMENU hMenu; // the menu handle of the menu bar
124 #else
125  // Nothing
126 #endif
127 };
128 
130 {
131  sal_uInt32 nSize; // size in bytes of this structure
132 #if defined(_WIN32)
133  HDC hDC; // handle to a device context
134  HWND hWnd; // optional handle to a window
135 #elif defined( MACOSX )
136  CGContextRef rCGContext; // CoreGraphics graphic context
137 #elif defined( ANDROID )
138  // Nothing
139 #elif defined( IOS )
140  CGContextRef rCGContext; // CoreGraphics graphic context
141 #elif defined( UNX )
142  void* pDisplay; // the relevant display connection
143  long hDrawable; // a drawable
144  void* pVisual; // the visual in use
145  int nScreen; // the current screen of the drawable
146  void* pXRenderFormat; // render format for drawable
147 #endif
149  : nSize( sizeof( SystemGraphicsData ) )
150 #if defined(_WIN32)
151  , hDC( nullptr )
152  , hWnd( nullptr )
153 #elif defined( MACOSX )
154  , rCGContext( nullptr )
155 #elif defined( ANDROID )
156  // Nothing
157 #elif defined( IOS )
158  , rCGContext( NULL )
159 #elif defined( UNX )
160  , pDisplay( nullptr )
161  , hDrawable( 0 )
162  , pVisual( nullptr )
163  , nScreen( 0 )
164  , pXRenderFormat( nullptr )
165 #endif
166  { }
167 };
168 
170 {
171 #if defined(_WIN32) // meaningless on Windows
172 #elif defined( MACOSX )
173  bool bOpenGL; // create an OpenGL providing NSView
174  bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true
175 #elif defined( ANDROID )
176  // Nothing
177 #elif defined( IOS )
178  // Nothing
179 #elif defined( UNX )
180  void* pVisual; // the visual to be used
181 #endif
182 };
183 
185 {
186  sal_uInt32 index;
187  double x;
188  double y;
190 };
191 
192 #if ENABLE_CAIRO_CANVAS
193 
194 struct SystemFontData
195 {
196 #if defined( UNX )
197  void* nFontId; // native font id
198  int nFontFlags; // native font flags
199 #endif
200  bool bFakeBold; // Does this font need faking the bold style
201  bool bFakeItalic; // Does this font need faking the italic style
202  bool bAntialias; // Should this font be antialiased
203  bool bVerticalCharacterType; // Is the font using vertical character type
204 
205  SystemFontData()
206  :
207 #if defined( UNX )
208  nFontId( nullptr ),
209  nFontFlags( 0 ),
210 #endif
211  bFakeBold( false ),
212  bFakeItalic( false ),
213  bAntialias( true ),
214  bVerticalCharacterType( false )
215  {
216  }
217 };
218 
219 #endif // ENABLE_CAIRO_CANVAS
220 
221 typedef std::vector<SystemGlyphData> SystemGlyphDataVector;
222 
224 {
226  int orientation; // Text orientation
227 };
228 
229 #endif // INCLUDED_VCL_SYSDATA_HXX
230 
231 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void * pXRenderFormat
Definition: sysdata.hxx:146
std::vector< SystemGlyphData > SystemGlyphDataVector
Definition: sysdata.hxx:221
const char * pPlatformName
Definition: sysdata.hxx:75
void * pDisplay
Definition: sysdata.hxx:65
void * pVisual
Definition: sysdata.hxx:69
SystemGlyphDataVector rGlyphData
Definition: sysdata.hxx:225
return NULL
unsigned long aWindow
Definition: sysdata.hxx:66
sal_uInt32 nSize
Definition: sysdata.hxx:131
void * pWidget
Definition: sysdata.hxx:68
sal_uInt32 nSize
Definition: sysdata.hxx:104
if(nullptr==pCandidateA||nullptr==pCandidateB)
sal_uInt32 index
Definition: sysdata.hxx:186
sal_uInt32 nSize
Definition: sysdata.hxx:54
const char * pToolkit
Definition: sysdata.hxx:74
sal_IntPtr aShellWindow
Definition: sysdata.hxx:73
void * pSalFrame
Definition: sysdata.hxx:67