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