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