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