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_INC_SALFRAME_HXX
21 : #define INCLUDED_VCL_INC_SALFRAME_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <vcl/dllapi.h>
25 :
26 : #include <vcl/ptrstyle.hxx>
27 :
28 : #include <salwtype.hxx>
29 : #include <salgeom.hxx>
30 : #include <tools/gen.hxx>
31 : #include <vcl/region.hxx>
32 :
33 : #include <vcl/impdel.hxx>
34 : #include <rtl/ustring.hxx>
35 : #include <vcl/keycod.hxx>
36 : #include <vcl/window.hxx>
37 : #include <vcl/vclptr.hxx>
38 :
39 : #include <vcl/window.hxx>
40 : // complete vcl::Window for SalFrame::CallCallback under -fsanitize=function
41 :
42 : class AllSettings;
43 : class SalGraphics;
44 : class SalBitmap;
45 : class SalMenu;
46 :
47 : struct SalFrameState;
48 : struct SalInputContext;
49 : struct SystemEnvData;
50 :
51 : // SalFrame types
52 : #define SAL_FRAME_TOTOP_RESTOREWHENMIN ((sal_uInt16)0x0001)
53 : #define SAL_FRAME_TOTOP_FOREGROUNDTASK ((sal_uInt16)0x0002)
54 : #define SAL_FRAME_TOTOP_GRABFOCUS ((sal_uInt16)0x0004)
55 : #define SAL_FRAME_TOTOP_GRABFOCUS_ONLY ((sal_uInt16)0x0008)
56 :
57 : // SalFrame styles
58 : #define SAL_FRAME_STYLE_DEFAULT ((sal_uLong)0x00000001)
59 : #define SAL_FRAME_STYLE_MOVEABLE ((sal_uLong)0x00000002)
60 : #define SAL_FRAME_STYLE_SIZEABLE ((sal_uLong)0x00000004)
61 : #define SAL_FRAME_STYLE_CLOSEABLE ((sal_uLong)0x00000008)
62 :
63 : // no shadow effect on Windows XP
64 : #define SAL_FRAME_STYLE_NOSHADOW ((sal_uLong)0x00000010)
65 : // indicate tooltip windows, so they can always be topmost
66 : #define SAL_FRAME_STYLE_TOOLTIP ((sal_uLong)0x00000020)
67 : // windows without windowmanager decoration, this typically only applies to floating windows
68 : #define SAL_FRAME_STYLE_OWNERDRAWDECORATION ((sal_uLong)0x00000040)
69 : // dialogs
70 : #define SAL_FRAME_STYLE_DIALOG ((sal_uLong)0x00000080)
71 : // partial fullscreen: fullscreen on one monitor of a multimonitor display
72 : #define SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ((sal_uLong)0x00800000)
73 : // plugged system child window
74 : #define SAL_FRAME_STYLE_PLUG ((sal_uLong)0x10000000)
75 : // system child window inside another SalFrame
76 : #define SAL_FRAME_STYLE_SYSTEMCHILD ((sal_uLong)0x08000000)
77 : // floating window
78 : #define SAL_FRAME_STYLE_FLOAT ((sal_uLong)0x20000000)
79 : // floating window that needs to be focusable
80 : #define SAL_FRAME_STYLE_FLOAT_FOCUSABLE ((sal_uLong)0x04000000)
81 : // toolwindows should be painted with a smaller decoration
82 : #define SAL_FRAME_STYLE_TOOLWINDOW ((sal_uLong)0x40000000)
83 : // the window containing the intro bitmap, aka splashscreen
84 : #define SAL_FRAME_STYLE_INTRO ((sal_uLong)0x80000000)
85 :
86 : // - extended frame style -
87 : // - (sal equivalent to extended WinBits) -
88 : typedef sal_uInt64 SalExtStyle;
89 : #define SAL_FRAME_EXT_STYLE_DOCUMENT SalExtStyle(0x00000001)
90 : #define SAL_FRAME_EXT_STYLE_DOCMODIFIED SalExtStyle(0x00000002)
91 :
92 : // Flags for SetPosSize
93 : #define SAL_FRAME_POSSIZE_X ((sal_uInt16)0x0001)
94 : #define SAL_FRAME_POSSIZE_Y ((sal_uInt16)0x0002)
95 : #define SAL_FRAME_POSSIZE_WIDTH ((sal_uInt16)0x0004)
96 : #define SAL_FRAME_POSSIZE_HEIGHT ((sal_uInt16)0x0008)
97 :
98 : struct SystemParentData;
99 :
100 : class VCL_PLUGIN_PUBLIC SalFrame
101 : : public vcl::DeletionNotifier
102 : , public SalGeometryProvider
103 : {
104 : // the VCL window corresponding to this frame
105 : VclPtr<vcl::Window> m_pWindow;
106 : SALFRAMEPROC m_pProc;
107 :
108 : public:
109 : SalFrame();
110 : virtual ~SalFrame();
111 :
112 : SalFrameGeometry maGeometry;
113 :
114 : // SalGeometryProvider
115 0 : virtual long GetWidth() const SAL_OVERRIDE { return maGeometry.nWidth; }
116 0 : virtual long GetHeight() const SAL_OVERRIDE { return maGeometry.nHeight; }
117 0 : virtual bool IsOffScreen() const SAL_OVERRIDE { return false; }
118 :
119 : // SalGraphics or NULL, but two Graphics for all SalFrames
120 : // must be returned
121 : virtual SalGraphics* AcquireGraphics() = 0;
122 : virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0;
123 :
124 : // Event must be destroyed, when Frame is destroyed
125 : // When Event is called, SalInstance::Yield() must be returned
126 : virtual bool PostEvent( void* pData ) = 0;
127 :
128 : virtual void SetTitle( const OUString& rTitle ) = 0;
129 : virtual void SetIcon( sal_uInt16 nIcon ) = 0;
130 : virtual void SetRepresentedURL( const OUString& );
131 : virtual void SetMenu( SalMenu *pSalMenu ) = 0;
132 : virtual void DrawMenuBar() = 0;
133 :
134 : virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) = 0;
135 :
136 : // Before the window is visible, a resize event
137 : // must be sent with the correct size
138 : virtual void Show( bool bVisible, bool bNoActivate = false ) = 0;
139 :
140 : // Set ClientSize and Center the Window to the desktop
141 : // and send/post a resize message
142 : virtual void SetMinClientSize( long nWidth, long nHeight ) = 0;
143 : virtual void SetMaxClientSize( long nWidth, long nHeight ) = 0;
144 : virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) = 0;
145 : virtual void GetClientSize( long& rWidth, long& rHeight ) = 0;
146 : virtual void GetWorkArea( Rectangle& rRect ) = 0;
147 : virtual SalFrame* GetParent() const = 0;
148 : // Note: x will be mirrored at parent if UI mirroring is active
149 : SalFrameGeometry GetGeometry();
150 0 : const SalFrameGeometry& GetUnmirroredGeometry() const { return maGeometry; }
151 :
152 : virtual void SetWindowState( const SalFrameState* pState ) = 0;
153 : virtual bool GetWindowState( SalFrameState* pState ) = 0;
154 : virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) = 0;
155 :
156 : // Enable/Disable ScreenSaver, SystemAgents, ...
157 : virtual void StartPresentation( bool bStart ) = 0;
158 : // Show Window over all other Windows
159 : virtual void SetAlwaysOnTop( bool bOnTop ) = 0;
160 :
161 : // Window to top and grab focus
162 : virtual void ToTop( sal_uInt16 nFlags ) = 0;
163 :
164 : // this function can call with the same
165 : // pointer style
166 : virtual void SetPointer( PointerStyle ePointerStyle ) = 0;
167 : virtual void CaptureMouse( bool bMouse ) = 0;
168 : virtual void SetPointerPos( long nX, long nY ) = 0;
169 :
170 : // flush output buffer
171 : virtual void Flush() = 0;
172 : virtual void Flush( const Rectangle& );
173 : // flush output buffer, wait till outstanding operations are done
174 : virtual void Sync() = 0;
175 :
176 : virtual void SetInputContext( SalInputContext* pContext ) = 0;
177 : virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) = 0;
178 :
179 : virtual OUString GetKeyName( sal_uInt16 nKeyCode ) = 0;
180 :
181 : // returns in 'rKeyCode' the single keycode that translates to the given unicode when using a keyboard layout of language 'aLangType'
182 : // returns false if no mapping exists or function not supported
183 : // this is required for advanced menu support
184 : virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) = 0;
185 :
186 : // returns the input language used for the last key stroke
187 : // may be LANGUAGE_DONTKNOW if not supported by the OS
188 : virtual LanguageType GetInputLanguage() = 0;
189 :
190 : virtual void UpdateSettings( AllSettings& rSettings ) = 0;
191 :
192 : virtual void Beep() = 0;
193 :
194 : // returns system data (most prominent: window handle)
195 : virtual const SystemEnvData*
196 : GetSystemData() const = 0;
197 :
198 : // get current modifier, button mask and mouse position
199 498 : struct SalPointerState
200 : {
201 : sal_uLong mnState;
202 : Point maPos; // in frame coordinates
203 : };
204 :
205 : virtual SalPointerState GetPointerState() = 0;
206 :
207 : virtual KeyIndicatorState GetIndicatorState() = 0;
208 :
209 : virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) = 0;
210 :
211 : // set new parent window
212 : virtual void SetParent( SalFrame* pNewParent ) = 0;
213 : // reparent window to act as a plugin; implementation
214 : // may choose to use a new system window internally
215 : // return false to indicate failure
216 : virtual bool SetPluginParent( SystemParentData* pNewParent ) = 0;
217 :
218 : // move the frame to a new screen
219 : virtual void SetScreenNumber( unsigned int nScreen ) = 0;
220 :
221 : virtual void SetApplicationID( const OUString &rApplicationID) = 0;
222 :
223 : // shaped system windows
224 : // set clip region to none (-> rectangular windows, normal state)
225 : virtual void ResetClipRegion() = 0;
226 : // start setting the clipregion consisting of nRects rectangles
227 : virtual void BeginSetClipRegion( sal_uLong nRects ) = 0;
228 : // add a rectangle to the clip region
229 : virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0;
230 : // done setting up the clipregion
231 : virtual void EndSetClipRegion() = 0;
232 :
233 : // Callbacks (indepent part in vcl/source/window/winproc.cxx)
234 : // for default message handling return 0
235 : void SetCallback( vcl::Window* pWindow, SALFRAMEPROC pProc );
236 :
237 : // returns the instance set
238 0 : vcl::Window* GetWindow() const { return m_pWindow; }
239 :
240 : // Call the callback set; this sometimes necessary for implementation classes
241 : // that should not know more than necessary about the SalFrame implementation
242 : // (e.g. input methods, printer update handlers).
243 102962 : long CallCallback( sal_uInt16 nEvent, const void* pEvent ) const
244 102962 : { return m_pProc ? long(m_pProc( m_pWindow, const_cast<SalFrame*>(this), nEvent, pEvent )) : 0; }
245 : };
246 :
247 : #endif // INCLUDED_VCL_INC_SALFRAME_HXX
248 :
249 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|