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