xref: /aoo4110/main/vcl/inc/salframe.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_SALFRAME_HXX
25 #define _SV_SALFRAME_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 
30 #ifdef __cplusplus
31 
32 #ifndef _SV_PTRSTYLE_HXX
33 #include <vcl/ptrstyle.hxx>
34 #endif
35 #include <vcl/sndstyle.hxx>
36 
37 #endif // __cplusplus
38 #include <salwtype.hxx>
39 #include <salgeom.hxx>
40 #include <tools/gen.hxx>
41 #include <vcl/region.hxx>
42 
43 #ifndef _VCL_IMPDEL_HXX
44 #include <vcl/impdel.hxx>
45 #endif
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 #define SAL_FRAME_STYLE_MINABLE             ((sal_uLong)0x00000008)
107 #define SAL_FRAME_STYLE_MAXABLE             ((sal_uLong)0x00000010)
108 #define SAL_FRAME_STYLE_BORDER              ((sal_uLong)0x00000040)
109 #define SAL_FRAME_STYLE_DOC                 ((sal_uLong)0x00004000)
110 #define SAL_FRAME_STYLE_DIALOG              ((sal_uLong)0x00008000)
111 #define SAL_FRAME_STYLE_TOOL                ((sal_uLong)0x00010000)
112 #define SAL_FRAME_STYLE_FULLSIZE            ((sal_uLong)0x00020000)
113 */
114 
115 // ----------------------------------------
116 // - extended frame style                 -
117 // - (sal equivalent to extended WinBits) -
118 // ----------------------------------------
119 typedef sal_uInt64 SalExtStyle;
120 #define SAL_FRAME_EXT_STYLE_DOCUMENT        SalExtStyle(0x00000001)
121 #define SAL_FRAME_EXT_STYLE_DOCMODIFIED     SalExtStyle(0x00000002)
122 
123 // ------------------------
124 // - Flags for SetPosSize -
125 // ------------------------
126 
127 #define SAL_FRAME_POSSIZE_X                 ((sal_uInt16)0x0001)
128 #define SAL_FRAME_POSSIZE_Y                 ((sal_uInt16)0x0002)
129 #define SAL_FRAME_POSSIZE_WIDTH             ((sal_uInt16)0x0004)
130 #define SAL_FRAME_POSSIZE_HEIGHT            ((sal_uInt16)0x0008)
131 
132 #ifdef __cplusplus
133 
134 using namespace rtl;
135 
136 // ------------
137 // - SalFrame -
138 // ------------
139 
140 struct SystemParentData;
141 
142 class VCL_PLUGIN_PUBLIC SalFrame : public vcl::DeletionNotifier
143 {
144     // the VCL window corresponding to this frame
145     Window*					m_pWindow;
146     SALFRAMEPROC			m_pProc;
147 public:                     // public for Sal Implementation
SalFrame()148     SalFrame() : m_pWindow( NULL ), m_pProc( NULL ) {}
149     virtual ~SalFrame();
150 
151 public:                     // public for Sal Implementation
152     SalFrameGeometry		maGeometry;
153 
154 public:
155     // SalGraphics or NULL, but two Graphics for all SalFrames
156     // must be returned
157     virtual SalGraphics*		GetGraphics() = 0;
158     virtual void				ReleaseGraphics( SalGraphics* pGraphics ) = 0;
159 
160     // Event must be destroyed, when Frame is destroyed
161     // When Event is called, SalInstance::Yield() must be returned
162     virtual sal_Bool				PostEvent( void* pData ) = 0;
163 
164     virtual void				SetTitle( const XubString& rTitle ) = 0;
165     virtual void				SetIcon( sal_uInt16 nIcon ) = 0;
166     virtual void                SetRepresentedURL( const rtl::OUString& );
167     virtual void                    SetMenu( SalMenu *pSalMenu ) = 0;
168     virtual void                    DrawMenuBar() = 0;
169 
170     virtual void                SetExtendedFrameStyle( SalExtStyle nExtStyle ) = 0;
171 
172     // Before the window is visible, a resize event
173     // must be sent with the correct size
174     virtual void				Show( sal_Bool bVisible, sal_Bool bNoActivate = sal_False ) = 0;
175     virtual void				Enable( sal_Bool bEnable ) = 0;
176     // Set ClientSize and Center the Window to the desktop
177     // and send/post a resize message
178     virtual void                SetMinClientSize( long nWidth, long nHeight ) = 0;
179     virtual void                SetMaxClientSize( long nWidth, long nHeight ) = 0;
180     virtual void				SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) = 0;
181     virtual void				GetClientSize( long& rWidth, long& rHeight ) = 0;
182     virtual void				GetWorkArea( Rectangle& rRect ) = 0;
183     virtual SalFrame*			GetParent() const = 0;
184     // Note: x will be mirrored at parent if UI mirroring is active
185     SalFrameGeometry			GetGeometry();
GetUnmirroredGeometry() const186     const SalFrameGeometry&		GetUnmirroredGeometry() const { return maGeometry; }
187     virtual void				SetWindowState( const SalFrameState* pState ) = 0;
188     virtual sal_Bool				GetWindowState( SalFrameState* pState ) = 0;
189     virtual void				ShowFullScreen( sal_Bool bFullScreen, sal_Int32 nDisplay ) = 0;
190     // Enable/Disable ScreenSaver, SystemAgents, ...
191     virtual void				StartPresentation( sal_Bool bStart ) = 0;
192     // Show Window over all other Windows
193     virtual void				SetAlwaysOnTop( sal_Bool bOnTop ) = 0;
194 
195     // Window to top and grab focus
196     virtual void				ToTop( sal_uInt16 nFlags ) = 0;
197 
198     // this function can call with the same
199     // pointer style
200     virtual void				SetPointer( PointerStyle ePointerStyle ) = 0;
201     virtual void				CaptureMouse( sal_Bool bMouse ) = 0;
202     virtual void				SetPointerPos( long nX, long nY ) = 0;
203 
204     // flush output buffer
205     virtual void				Flush( void) = 0;
206     virtual void                Flush( const Rectangle& );
207     // flush output buffer, wait till outstanding operations are done
208     virtual void				Sync() = 0;
209 
210     virtual void				SetInputContext( SalInputContext* pContext ) = 0;
211     virtual void				EndExtTextInput( sal_uInt16 nFlags ) = 0;
212 
213     virtual String				GetKeyName( sal_uInt16 nKeyCode ) = 0;
214     virtual String				GetSymbolKeyName( const XubString& rFontName, sal_uInt16 nKeyCode ) = 0;
215 
216     // returns in 'rKeyCode' the single keycode that translates to the given unicode when using a keyboard layout of language 'aLangType'
217     // returns sal_False if no mapping exists or function not supported
218     // this is required for advanced menu support
219     virtual sal_Bool                MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ) = 0;
220 
221     // returns the input language used for the last key stroke
222     // may be LANGUAGE_DONTKNOW if not supported by the OS
223     virtual LanguageType		GetInputLanguage() = 0;
224 
225     virtual SalBitmap*			SnapShot() = 0;
226 
227     virtual void				UpdateSettings( AllSettings& rSettings ) = 0;
228 
229     virtual void				Beep( SoundType eSoundType ) = 0;
230 
231     // returns system data (most prominent: window handle)
232     virtual const SystemEnvData*	GetSystemData() const = 0;
233 
234     // sets a background bitmap on the frame; the implementation
235     // must not make assumptions about the lifetime of the passed SalBitmap
236     // but should copy its contents to an own buffer
237     virtual void                SetBackgroundBitmap( SalBitmap* ) = 0;
238 
239 
240     // get current modifier, button mask and mouse position
241     struct SalPointerState
242     {
243         sal_uLong   mnState;
244         Point   maPos;      // in frame coordinates
245     };
246 
247     virtual SalPointerState		GetPointerState() = 0;
248 
249     // set new parent window
250     virtual void				SetParent( SalFrame* pNewParent ) = 0;
251     // reparent window to act as a plugin; implementation
252     // may choose to use a new system window inetrnally
253     // return false to indicate failure
254     virtual bool				SetPluginParent( SystemParentData* pNewParent ) = 0;
255 
256     // move the frame to a new screen
257     virtual void                SetScreenNumber( unsigned int nScreen ) = 0;
258 
259     // shaped system windows
260     // set clip region to none (-> rectangular windows, normal state)
261 	virtual void					ResetClipRegion() = 0;
262     // start setting the clipregion consisting of nRects rectangles
263 	virtual void					BeginSetClipRegion( sal_uLong nRects ) = 0;
264     // add a rectangle to the clip region
265 	virtual void					UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) = 0;
266     // done setting up the clipregion
267 	virtual void					EndSetClipRegion() = 0;
268 
269     // Callbacks (indepent part in vcl/source/window/winproc.cxx)
270     // for default message handling return 0
SetCallback(Window * pWindow,SALFRAMEPROC pProc)271     void						SetCallback( Window* pWindow, SALFRAMEPROC pProc )
272     { m_pWindow = pWindow; m_pProc = pProc; }
273 
274     // returns the instance set
GetWindow() const275     Window*                       GetWindow() const { return m_pWindow; }
276 
277     // Call the callback set; this sometimes necessary for implementation classes
278     // that should not now more than necessary about the SalFrame implementation
279     // (e.g. input methods, printer update handlers).
CallCallback(sal_uInt16 nEvent,const void * pEvent) const280     long						CallCallback( sal_uInt16 nEvent, const void* pEvent ) const
281     { return m_pProc ? m_pProc( m_pWindow, const_cast<SalFrame*>(this), nEvent, pEvent ) : 0; }
282 };
283 
284 
285 
286 #endif // __cplusplus
287 
288 #endif // _SV_SALFRAME_HXX
289