xref: /aoo41x/main/vcl/inc/vcl/svapp.hxx (revision 4d7c9de0)
10d63794cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
30d63794cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
40d63794cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
50d63794cSAndrew Rist  * distributed with this work for additional information
60d63794cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
70d63794cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
80d63794cSAndrew Rist  * "License"); you may not use this file except in compliance
90d63794cSAndrew Rist  * with the License.  You may obtain a copy of the License at
100d63794cSAndrew Rist  *
110d63794cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
120d63794cSAndrew Rist  *
130d63794cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
140d63794cSAndrew Rist  * software distributed under the License is distributed on an
150d63794cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
160d63794cSAndrew Rist  * KIND, either express or implied.  See the License for the
170d63794cSAndrew Rist  * specific language governing permissions and limitations
180d63794cSAndrew Rist  * under the License.
190d63794cSAndrew Rist  *
200d63794cSAndrew Rist  *************************************************************/
210d63794cSAndrew Rist 
220d63794cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX
25cdf0e10cSrcweir #define _SV_SVAPP_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _VOS_THREAD_HXX
28cdf0e10cSrcweir #include <vos/thread.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #include <tools/string.hxx>
31cdf0e10cSrcweir #include <tools/link.hxx>
32cdf0e10cSrcweir #include <tools/unqid.hxx>
33cdf0e10cSrcweir #include <vcl/sv.h>
34cdf0e10cSrcweir #include <vcl/dllapi.h>
35cdf0e10cSrcweir #include <vcl/apptypes.hxx>
36cdf0e10cSrcweir #ifndef _VCL_SETTINGS_HXX
37cdf0e10cSrcweir #include <vcl/settings.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <vcl/vclevent.hxx>
40cdf0e10cSrcweir class Link;
41cdf0e10cSrcweir class AllSettings;
42cdf0e10cSrcweir class DataChangedEvent;
43cdf0e10cSrcweir class Accelerator;
44cdf0e10cSrcweir class Help;
45cdf0e10cSrcweir class OutputDevice;
46cdf0e10cSrcweir class Window;
47cdf0e10cSrcweir class WorkWindow;
48cdf0e10cSrcweir class MenuBar;
49cdf0e10cSrcweir class UnoWrapperBase;
50cdf0e10cSrcweir class Reflection;
51cdf0e10cSrcweir class KeyCode;
52cdf0e10cSrcweir class NotifyEvent;
53cdf0e10cSrcweir class KeyEvent;
54cdf0e10cSrcweir class MouseEvent;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir namespace vos { class IMutex; }
57cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
58cdf0e10cSrcweir #include <com/sun/star/connection/XConnection.hpp>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir namespace com {
61cdf0e10cSrcweir namespace sun {
62cdf0e10cSrcweir namespace star {
63cdf0e10cSrcweir namespace lang {
64cdf0e10cSrcweir     class XMultiServiceFactory;
65cdf0e10cSrcweir }
66cdf0e10cSrcweir namespace awt {
67cdf0e10cSrcweir     class XToolkit;
68cdf0e10cSrcweir     class XDisplayConnection;
69cdf0e10cSrcweir }
70cdf0e10cSrcweir } } }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir // helper needed by SalLayout implementations as well as svx/source/dialog/svxbmpnumbalueset.cxx
73cdf0e10cSrcweir VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir // --------------------
76cdf0e10cSrcweir // - SystemWindowMode -
77cdf0e10cSrcweir // --------------------
78cdf0e10cSrcweir 
79cdf0e10cSrcweir #define SYSTEMWINDOW_MODE_NOAUTOMODE    ((sal_uInt16)0x0001)
80cdf0e10cSrcweir #define SYSTEMWINDOW_MODE_DIALOG        ((sal_uInt16)0x0002)
81cdf0e10cSrcweir 
82cdf0e10cSrcweir // -------------
83cdf0e10cSrcweir // - EventHook -
84cdf0e10cSrcweir // -------------
85cdf0e10cSrcweir 
86cdf0e10cSrcweir typedef long (*VCLEventHookProc)( NotifyEvent& rEvt, void* pData );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir // --------------------
89cdf0e10cSrcweir // - ApplicationEvent -
90cdf0e10cSrcweir // --------------------
91cdf0e10cSrcweir 
92cdf0e10cSrcweir // Erstmal wieder eingebaut, damit AppEvents auf dem MAC funktionieren
93cdf0e10cSrcweir #ifdef UNX
94cdf0e10cSrcweir // enum Doppelt in daemon.cxx unter unix Achtung !!!
95cdf0e10cSrcweir enum Service { SERVICE_OLE, SERVICE_APPEVENT, SERVICE_IPC };
96cdf0e10cSrcweir #endif
97cdf0e10cSrcweir 
98cdf0e10cSrcweir class VCL_DLLPUBLIC ApplicationAddress
99cdf0e10cSrcweir {
100cdf0e10cSrcweir friend class Application;
101cdf0e10cSrcweir protected:
102cdf0e10cSrcweir     UniString           aHostName;
103cdf0e10cSrcweir     UniString           aDisplayName;
104cdf0e10cSrcweir     UniString           aDomainName;
105cdf0e10cSrcweir     int                 nPID;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir public:
108cdf0e10cSrcweir                         ApplicationAddress();
109cdf0e10cSrcweir                         ApplicationAddress( const UniString& rDomain );
110cdf0e10cSrcweir                         ApplicationAddress( const UniString& rHost,
111cdf0e10cSrcweir                                             const UniString& rDisp,
112cdf0e10cSrcweir                                             const UniString& rDomain );
113cdf0e10cSrcweir                         ApplicationAddress( const UniString& rHost, int nPID );
114cdf0e10cSrcweir 
GetHost() const115cdf0e10cSrcweir     const UniString&    GetHost() const     { return aHostName; }
GetDisplay() const116cdf0e10cSrcweir     const UniString&    GetDisplay() const  { return aDisplayName; }
GetDomain() const117cdf0e10cSrcweir     const UniString&    GetDomain() const   { return aDomainName; }
GetPID() const118cdf0e10cSrcweir     int                 GetPID() const      { return nPID; }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     sal_Bool                IsConnectToSame( const ApplicationAddress& rAdr ) const;
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
ApplicationAddress()123cdf0e10cSrcweir inline ApplicationAddress::ApplicationAddress()
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     nPID = 0;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
ApplicationAddress(const UniString & rDomain)128cdf0e10cSrcweir inline ApplicationAddress::ApplicationAddress( const UniString& rDomain )
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     aDomainName     = rDomain;
131cdf0e10cSrcweir     nPID            = 0;
132cdf0e10cSrcweir }
133cdf0e10cSrcweir 
ApplicationAddress(const UniString & rHost,const UniString & rDisp,const UniString & rDomain)134cdf0e10cSrcweir inline ApplicationAddress::ApplicationAddress( const UniString& rHost,
135cdf0e10cSrcweir                                                const UniString& rDisp,
136cdf0e10cSrcweir                                                const UniString& rDomain )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir     aHostName       = rHost;
139cdf0e10cSrcweir     aDisplayName    = rDisp;
140cdf0e10cSrcweir     aDomainName     = rDomain;
141cdf0e10cSrcweir     nPID            = 0;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir 
ApplicationAddress(const UniString & rHost,int nPIDPar)144cdf0e10cSrcweir inline ApplicationAddress::ApplicationAddress( const UniString& rHost, int nPIDPar )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir     aHostName       = rHost;
147cdf0e10cSrcweir     nPID            = nPIDPar;
148cdf0e10cSrcweir }
149cdf0e10cSrcweir 
IsConnectToSame(const ApplicationAddress & rAdr) const150cdf0e10cSrcweir inline sal_Bool ApplicationAddress::IsConnectToSame( const ApplicationAddress& rAdr ) const
151cdf0e10cSrcweir {
152cdf0e10cSrcweir     if ( nPID && ((nPID == rAdr.nPID) && (aHostName.Equals( rAdr.aHostName))) )
153cdf0e10cSrcweir         return sal_True;
154cdf0e10cSrcweir     else
155cdf0e10cSrcweir         return sal_False;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir 
158cdf0e10cSrcweir #define APPEVENT_PARAM_DELIMITER    	'\n'
159cdf0e10cSrcweir 
160cdf0e10cSrcweir #define APPEVENT_OPEN_STRING        	"Open"
161cdf0e10cSrcweir #define APPEVENT_PRINT_STRING       	"Print"
162cdf0e10cSrcweir #define APPEVENT_DISKINSERT_STRING  	"DiskInsert"
163cdf0e10cSrcweir #define APPEVENT_SAVEDOCUMENTS_STRING	"SaveDocuments"
164cdf0e10cSrcweir 
165cdf0e10cSrcweir class VCL_DLLPUBLIC ApplicationEvent
166cdf0e10cSrcweir {
167cdf0e10cSrcweir private:
168cdf0e10cSrcweir     UniString           aSenderAppName; // Absender Applikationsname
169cdf0e10cSrcweir     ByteString          aEvent;         // Event
170cdf0e10cSrcweir     UniString           aData;          // Uebertragene Daten
171cdf0e10cSrcweir     ApplicationAddress  aAppAddr;       // Absender Addresse
172cdf0e10cSrcweir 
173cdf0e10cSrcweir public:
ApplicationEvent()174cdf0e10cSrcweir                         ApplicationEvent() {}
175cdf0e10cSrcweir                         ApplicationEvent( const UniString& rSenderAppName,
176cdf0e10cSrcweir                                           const ApplicationAddress& rAppAddr,
177cdf0e10cSrcweir                                           const ByteString& rEvent,
178cdf0e10cSrcweir                                           const UniString& rData );
179cdf0e10cSrcweir 
GetSenderAppName() const180cdf0e10cSrcweir     const UniString&    GetSenderAppName() const { return aSenderAppName; }
GetEvent() const181cdf0e10cSrcweir     const ByteString&   GetEvent() const { return aEvent; }
GetData() const182cdf0e10cSrcweir     const UniString&    GetData() const { return aData; }
GetAppAddress() const183cdf0e10cSrcweir     const ApplicationAddress& GetAppAddress() const { return aAppAddr; }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     sal_Bool                IsOpenEvent() const;
186cdf0e10cSrcweir     sal_Bool                IsPrintEvent() const;
187cdf0e10cSrcweir     sal_Bool                IsDiskInsertEvent() const;
188cdf0e10cSrcweir 
GetParamCount() const189cdf0e10cSrcweir     sal_uInt16              GetParamCount() const { return aData.GetTokenCount( APPEVENT_PARAM_DELIMITER ); }
GetParam(sal_uInt16 nParam) const190cdf0e10cSrcweir     UniString           GetParam( sal_uInt16 nParam ) const { return aData.GetToken( nParam, APPEVENT_PARAM_DELIMITER ); }
191cdf0e10cSrcweir };
192cdf0e10cSrcweir 
ApplicationEvent(const UniString & rSenderAppName,const ApplicationAddress & rAppAddr,const ByteString & rEvent,const UniString & rData)193cdf0e10cSrcweir inline ApplicationEvent::ApplicationEvent( const UniString& rSenderAppName,
194cdf0e10cSrcweir                                            const ApplicationAddress& rAppAddr,
195cdf0e10cSrcweir                                            const ByteString& rEvent,
196cdf0e10cSrcweir                                            const UniString& rData ) :
197cdf0e10cSrcweir     aSenderAppName( rSenderAppName ),
198cdf0e10cSrcweir     aEvent( rEvent ),
199cdf0e10cSrcweir     aData( rData ),
200cdf0e10cSrcweir     aAppAddr( rAppAddr )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
IsOpenEvent() const204cdf0e10cSrcweir inline sal_Bool ApplicationEvent::IsOpenEvent() const
205cdf0e10cSrcweir {
206cdf0e10cSrcweir     if ( aEvent.Equals( APPEVENT_OPEN_STRING ))
207cdf0e10cSrcweir         return sal_True;
208cdf0e10cSrcweir     else
209cdf0e10cSrcweir         return sal_False;
210cdf0e10cSrcweir }
211cdf0e10cSrcweir 
IsPrintEvent() const212cdf0e10cSrcweir inline sal_Bool ApplicationEvent::IsPrintEvent() const
213cdf0e10cSrcweir {
214cdf0e10cSrcweir     if ( aEvent.Equals( APPEVENT_PRINT_STRING ))
215cdf0e10cSrcweir         return sal_True;
216cdf0e10cSrcweir     else
217cdf0e10cSrcweir         return sal_False;
218cdf0e10cSrcweir }
219cdf0e10cSrcweir 
IsDiskInsertEvent() const220cdf0e10cSrcweir inline sal_Bool ApplicationEvent::IsDiskInsertEvent() const
221cdf0e10cSrcweir {
222cdf0e10cSrcweir     if ( aEvent.Equals( APPEVENT_DISKINSERT_STRING ))
223cdf0e10cSrcweir         return sal_True;
224cdf0e10cSrcweir     else
225cdf0e10cSrcweir         return sal_False;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir class VCL_DLLPUBLIC PropertyHandler
229cdf0e10cSrcweir {
230cdf0e10cSrcweir public:
231cdf0e10cSrcweir     virtual void                Property( ApplicationProperty& ) = 0;
232cdf0e10cSrcweir };
233cdf0e10cSrcweir 
234cdf0e10cSrcweir // ---------------
235cdf0e10cSrcweir // - Application -
236cdf0e10cSrcweir // ---------------
237cdf0e10cSrcweir 
238cdf0e10cSrcweir class VCL_DLLPUBLIC Application
239cdf0e10cSrcweir {
240cdf0e10cSrcweir public:
241cdf0e10cSrcweir                                 Application();
242cdf0e10cSrcweir     virtual                     ~Application();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     virtual void                Main() = 0;
245cdf0e10cSrcweir 
24685c309d6SJürgen Schmidt     virtual sal_Bool            QueryExit();
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     virtual void                UserEvent( sal_uLong nEvent, void* pEventData );
249cdf0e10cSrcweir 
250cdf0e10cSrcweir     virtual void                ActivateExtHelp();
251cdf0e10cSrcweir     virtual void                DeactivateExtHelp();
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     virtual void                ShowStatusText( const XubString& rText );
254cdf0e10cSrcweir     virtual void                HideStatusText();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     virtual void                ShowHelpStatusText( const XubString& rText );
257cdf0e10cSrcweir     virtual void                HideHelpStatusText();
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     virtual void                FocusChanged();
260cdf0e10cSrcweir     virtual void                DataChanged( const DataChangedEvent& rDCEvt );
261cdf0e10cSrcweir 
262cdf0e10cSrcweir     virtual void                Init();
263cdf0e10cSrcweir     virtual void                DeInit();
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     static void                 InitAppRes( const ResId& rResId );
266cdf0e10cSrcweir 
26785c309d6SJürgen Schmidt     static sal_uInt16           GetCommandLineParamCount();
268cdf0e10cSrcweir     static XubString            GetCommandLineParam( sal_uInt16 nParam );
269cdf0e10cSrcweir     static const XubString&     GetAppFileName();
270cdf0e10cSrcweir 
27185c309d6SJürgen Schmidt     virtual sal_uInt16          Exception( sal_uInt16 nError );
272cdf0e10cSrcweir     static void                 Abort( const XubString& rErrorText );
273cdf0e10cSrcweir 
274cdf0e10cSrcweir     static void                 Execute();
275cdf0e10cSrcweir     static void                 Quit();
276cdf0e10cSrcweir     static void                 Reschedule( bool bAllEvents = false );
277cdf0e10cSrcweir     static void                 Yield( bool bAllEvents = false );
278cdf0e10cSrcweir     static void                 EndYield();
279cdf0e10cSrcweir     static vos::IMutex&                     GetSolarMutex();
280cdf0e10cSrcweir     static vos::OThread::TThreadIdentifier  GetMainThreadIdentifier();
28185c309d6SJürgen Schmidt     static sal_uLong            ReleaseSolarMutex();
282cdf0e10cSrcweir     static void                 AcquireSolarMutex( sal_uLong nCount );
283cdf0e10cSrcweir     static void                 EnableNoYieldMode( bool i_bNoYield );
284cdf0e10cSrcweir     static void                 AddPostYieldListener( const Link& i_rListener );
285cdf0e10cSrcweir     static void                 RemovePostYieldListener( const Link& i_rListener );
286cdf0e10cSrcweir 
28785c309d6SJürgen Schmidt     static sal_Bool             IsInMain();
28885c309d6SJürgen Schmidt     static sal_Bool             IsInExecute();
28985c309d6SJürgen Schmidt     static sal_Bool             IsShutDown();
29085c309d6SJürgen Schmidt     static sal_Bool             IsInModalMode();
29185c309d6SJürgen Schmidt     static sal_uInt16           GetModalModeCount();
292cdf0e10cSrcweir 
29385c309d6SJürgen Schmidt     static sal_uInt16           GetDispatchLevel();
29485c309d6SJürgen Schmidt     static sal_Bool             AnyInput( sal_uInt16 nType = INPUT_ANY );
29585c309d6SJürgen Schmidt     static sal_uLong            GetLastInputInterval();
29685c309d6SJürgen Schmidt     static sal_Bool             IsUICaptured();
29785c309d6SJürgen Schmidt     static sal_Bool             IsUserActive( sal_uInt16 nTest = USERACTIVE_ALL );
298cdf0e10cSrcweir 
299cdf0e10cSrcweir     virtual void                SystemSettingsChanging( AllSettings& rSettings,
300cdf0e10cSrcweir                                                         Window* pFrame );
301cdf0e10cSrcweir     static void                 MergeSystemSettings( AllSettings& rSettings );
302cdf0e10cSrcweir     /** validate that the currently selected system UI font is suitable
303cdf0e10cSrcweir         to display the application's UI.
304cdf0e10cSrcweir 
305cdf0e10cSrcweir         A localized test string will be checked if it can be displayed
306cdf0e10cSrcweir         in the currently selected system UI font. If no glyphs are
307cdf0e10cSrcweir         missing it can be assumed that the font is proper for display
308cdf0e10cSrcweir         of the application's UI.
309cdf0e10cSrcweir 
310cdf0e10cSrcweir         @returns
311cdf0e10cSrcweir         <TRUE/> if the system font is suitable for our UI
312cdf0e10cSrcweir         <FALSE/> if the test string could not be displayed with the system font
313cdf0e10cSrcweir      */
314cdf0e10cSrcweir     static bool					ValidateSystemFont();
315cdf0e10cSrcweir 
316cdf0e10cSrcweir     static void                 SetSettings( const AllSettings& rSettings );
317cdf0e10cSrcweir     static const AllSettings&   GetSettings();
318cdf0e10cSrcweir     static void                 NotifyAllWindows( DataChangedEvent& rDCEvt );
319cdf0e10cSrcweir 
320cdf0e10cSrcweir     static void                 AddEventListener( const Link& rEventListener );
321cdf0e10cSrcweir     static void                 RemoveEventListener( const Link& rEventListener );
322cdf0e10cSrcweir     static void                 AddKeyListener( const Link& rKeyListener );
323cdf0e10cSrcweir     static void                 RemoveKeyListener( const Link& rKeyListener );
324cdf0e10cSrcweir     static void                 ImplCallEventListeners( sal_uLong nEvent, Window* pWin, void* pData );
325cdf0e10cSrcweir     static void                 ImplCallEventListeners( VclSimpleEvent* pEvent );
32685c309d6SJürgen Schmidt     static sal_Bool             HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent );
327cdf0e10cSrcweir 
32885c309d6SJürgen Schmidt 	static sal_uLong            PostKeyEvent( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent );
32985c309d6SJürgen Schmidt     static sal_uLong            PostMouseEvent( sal_uLong nEvent, Window *pWin, MouseEvent* pMouseEvent );
330cdf0e10cSrcweir 	static void					RemoveMouseAndKeyEvents( Window *pWin );
33185c309d6SJürgen Schmidt     static sal_Bool				IsProcessedMouseOrKeyEvent( sal_uLong nEventId );
332cdf0e10cSrcweir 
33385c309d6SJürgen Schmidt     static sal_uLong            PostUserEvent( sal_uLong nEvent, void* pEventData = NULL );
33485c309d6SJürgen Schmidt     static sal_uLong            PostUserEvent( const Link& rLink, void* pCaller = NULL );
33585c309d6SJürgen Schmidt     static sal_Bool             PostUserEvent( sal_uLong& rEventId, sal_uLong nEvent, void* pEventData = NULL );
33685c309d6SJürgen Schmidt     static sal_Bool             PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller = NULL );
337cdf0e10cSrcweir     static void                 RemoveUserEvent( sal_uLong nUserEvent );
338cdf0e10cSrcweir 
33985c309d6SJürgen Schmidt     static sal_Bool             InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority );
340cdf0e10cSrcweir     static void                 RemoveIdleHdl( const Link& rLink );
341cdf0e10cSrcweir 
342cdf0e10cSrcweir     virtual void                AppEvent( const ApplicationEvent& rAppEvent );
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     virtual void                Property( ApplicationProperty& );
345cdf0e10cSrcweir     void                        SetPropertyHandler( PropertyHandler* pHandler );
346cdf0e10cSrcweir 
347cdf0e10cSrcweir #ifndef NO_GETAPPWINDOW
348cdf0e10cSrcweir     static WorkWindow*          GetAppWindow();
349cdf0e10cSrcweir #endif
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 	static Window*              GetFocusWindow();
352cdf0e10cSrcweir     static OutputDevice*        GetDefaultDevice();
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     static Window*              GetFirstTopLevelWindow();
355cdf0e10cSrcweir     static Window*              GetNextTopLevelWindow( Window* pWindow );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     static long                 GetTopWindowCount();
358cdf0e10cSrcweir     static Window*              GetTopWindow( long nIndex );
359cdf0e10cSrcweir     static Window*              GetActiveTopWindow();
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     static void                 SetAppName( const String& rUniqueName );
362cdf0e10cSrcweir     static String               GetAppName();
363cdf0e10cSrcweir 
364cdf0e10cSrcweir     static void                 SetDisplayName( const UniString& rDisplayName );
365cdf0e10cSrcweir     static UniString            GetDisplayName();
366cdf0e10cSrcweir 
367cdf0e10cSrcweir     static unsigned int         GetScreenCount();
368cdf0e10cSrcweir     // IsMultiDisplay returns:
369cdf0e10cSrcweir     //        true:  different screens are separate and windows cannot be moved
370cdf0e10cSrcweir     //               between them (e.g. Xserver with multiple screens)
371cdf0e10cSrcweir     //        false: screens form up one large display area
372cdf0e10cSrcweir     //               windows can be moved between single screens
373cdf0e10cSrcweir     //               (e.g. Xserver with Xinerama, Windows)
374cdf0e10cSrcweir     static bool                 IsMultiDisplay();
375cdf0e10cSrcweir     static Rectangle            GetScreenPosSizePixel( unsigned int nScreen );
376cdf0e10cSrcweir     static Rectangle            GetWorkAreaPosSizePixel( unsigned int nScreen );
377cdf0e10cSrcweir 	static rtl::OUString		GetScreenName( unsigned int nScreen );
378cdf0e10cSrcweir     static unsigned int         GetDefaultDisplayNumber();
379cdf0e10cSrcweir     // if IsMultiDisplay() == false the return value will be
380cdf0e10cSrcweir     // nearest screen of the target rectangle
381cdf0e10cSrcweir     // in case of IsMultiDisplay() == true the return value
382cdf0e10cSrcweir     // will always be GetDefaultDisplayNumber()
383cdf0e10cSrcweir     static unsigned int         GetBestScreen( const Rectangle& );
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 	static const LocaleDataWrapper& GetAppLocaleDataWrapper();
386cdf0e10cSrcweir 
38785c309d6SJürgen Schmidt     static sal_Bool             InsertAccel( Accelerator* pAccel );
388cdf0e10cSrcweir     static void                 RemoveAccel( Accelerator* pAccel );
389cdf0e10cSrcweir     static void                 FlushAccel();
39085c309d6SJürgen Schmidt     static sal_Bool             CallAccel( const KeyCode& rKeyCode, sal_uInt16 nRepeat = 0 );
391cdf0e10cSrcweir 
39285c309d6SJürgen Schmidt     static sal_uLong            AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData = NULL );
393cdf0e10cSrcweir     static void                 RemoveHotKey( sal_uLong nId );
39485c309d6SJürgen Schmidt     static sal_uLong            AddEventHook( VCLEventHookProc pProc, void* pData = NULL );
395cdf0e10cSrcweir     static void                 RemoveEventHook( sal_uLong nId );
396cdf0e10cSrcweir     static long                 CallEventHooks( NotifyEvent& rEvt );
397cdf0e10cSrcweir     static long                 CallPreNotify( NotifyEvent& rEvt );
398cdf0e10cSrcweir     static long                 CallEvent( NotifyEvent& rEvt );
399cdf0e10cSrcweir 
400cdf0e10cSrcweir     static void                 SetHelp( Help* pHelp = NULL );
401cdf0e10cSrcweir     static Help*                GetHelp();
402cdf0e10cSrcweir 
403cdf0e10cSrcweir     static void                 EnableAutoHelpId( sal_Bool bEnabled = sal_True );
40485c309d6SJürgen Schmidt     static sal_Bool             IsAutoHelpIdEnabled();
405cdf0e10cSrcweir 
406cdf0e10cSrcweir     static void                 EnableAutoMnemonic( sal_Bool bEnabled = sal_True );
40785c309d6SJürgen Schmidt     static sal_Bool             IsAutoMnemonicEnabled();
408cdf0e10cSrcweir 
40985c309d6SJürgen Schmidt     static sal_uLong            GetReservedKeyCodeCount();
410cdf0e10cSrcweir     static const KeyCode*       GetReservedKeyCode( sal_uLong i );
411cdf0e10cSrcweir     static String               GetReservedKeyCodeDescription( sal_uLong i );
412cdf0e10cSrcweir 
413cdf0e10cSrcweir     static void                 SetDefDialogParent( Window* pWindow );
414cdf0e10cSrcweir     static Window*              GetDefDialogParent();
415cdf0e10cSrcweir 
416cdf0e10cSrcweir     static void                 EnableDialogCancel( sal_Bool bDialogCancel = sal_True );
41785c309d6SJürgen Schmidt     static sal_Bool             IsDialogCancelEnabled();
418cdf0e10cSrcweir 
419cdf0e10cSrcweir     static void                 SetSystemWindowMode( sal_uInt16 nMode );
42085c309d6SJürgen Schmidt     static sal_uInt16           GetSystemWindowMode();
421cdf0e10cSrcweir 
422cdf0e10cSrcweir     static void                 SetDialogScaleX( short nScale );
423cdf0e10cSrcweir     static short                GetDialogScaleX();
424cdf0e10cSrcweir 
425cdf0e10cSrcweir     static void                 SetFontPath( const String& rPath );
426cdf0e10cSrcweir     static const String&        GetFontPath();
427cdf0e10cSrcweir 
428cdf0e10cSrcweir     static UniqueItemId         CreateUniqueId();
429cdf0e10cSrcweir 
430cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayConnection > GetDisplayConnection();
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 	// The global service manager has to be created before!
433cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > GetVCLToolkit();
434cdf0e10cSrcweir     static UnoWrapperBase*      GetUnoWrapper( sal_Bool bCreateIfNotExists = sal_True );
435cdf0e10cSrcweir     static void                 SetUnoWrapper( UnoWrapperBase* pWrapper );
436cdf0e10cSrcweir 
437cdf0e10cSrcweir     static void                 SetFilterHdl( const Link& rLink );
438cdf0e10cSrcweir     static const Link&          GetFilterHdl();
439cdf0e10cSrcweir 
44085c309d6SJürgen Schmidt     static sal_Bool             IsAccessibilityEnabled();
441cdf0e10cSrcweir 
442cdf0e10cSrcweir     static void                 EnableHeadlessMode( sal_Bool bEnable = sal_True );
44385c309d6SJürgen Schmidt     static sal_Bool             IsHeadlessModeEnabled();
44485c309d6SJürgen Schmidt 
44585c309d6SJürgen Schmidt     static void                 EnableConversionMode( bool bEnableConv = true );
44685c309d6SJürgen Schmidt     static bool                 IsConversionModeEnabled();
44785c309d6SJürgen Schmidt 
448cdf0e10cSrcweir 
449cdf0e10cSrcweir     static void                 ShowNativeErrorBox(const String& sTitle  ,
450cdf0e10cSrcweir                                                    const String& sMessage);
451df906e24SSteve Yin 	static bool					EnableAccessInterface(bool bEnable);
452df906e24SSteve Yin 	static bool					IsEnableAccessInterface();
453cdf0e10cSrcweir 
454cdf0e10cSrcweir     // IME Status Window Control:
455cdf0e10cSrcweir 
456cdf0e10cSrcweir     /** Return true if any IME status window can be toggled on and off
457cdf0e10cSrcweir         externally.
458cdf0e10cSrcweir 
459cdf0e10cSrcweir         Must only be called with the Solar mutex locked.
460cdf0e10cSrcweir      */
461cdf0e10cSrcweir     static bool CanToggleImeStatusWindow();
462cdf0e10cSrcweir 
463cdf0e10cSrcweir     /** Toggle any IME status window on and off.
464cdf0e10cSrcweir 
465cdf0e10cSrcweir         This only works if CanToggleImeStatusWinodw returns true (otherwise,
466cdf0e10cSrcweir         any calls of this method are ignored).
467cdf0e10cSrcweir 
468cdf0e10cSrcweir         Must only be called with the Solar mutex locked.
469cdf0e10cSrcweir      */
470cdf0e10cSrcweir     static void ShowImeStatusWindow(bool bShow);
471cdf0e10cSrcweir 
472cdf0e10cSrcweir     /** Return true if any IME status window should be turned on by default
473cdf0e10cSrcweir         (this decision can be locale dependent, for example).
474cdf0e10cSrcweir 
475cdf0e10cSrcweir         Can be called without the Solar mutex locked.
476cdf0e10cSrcweir      */
477cdf0e10cSrcweir     static bool GetShowImeStatusWindowDefault();
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     /** Returns a string representing the desktop environment
480cdf0e10cSrcweir         the process is currently running in.
481cdf0e10cSrcweir      */
482cdf0e10cSrcweir     static const ::rtl::OUString& GetDesktopEnvironment();
483cdf0e10cSrcweir 
484cdf0e10cSrcweir     /** Add a file to the system shells recent document list if there is any.
485cdf0e10cSrcweir           This function may have no effect under Unix because there is no
486cdf0e10cSrcweir           standard API among the different desktop managers.
487cdf0e10cSrcweir 
488cdf0e10cSrcweir           @param rFileUrl
489cdf0e10cSrcweir                     The file url of the document.
490cdf0e10cSrcweir 
491cdf0e10cSrcweir           @param rMimeType
492cdf0e10cSrcweir           The mime content type of the document specified by aFileUrl.
493cdf0e10cSrcweir           If an empty string will be provided "application/octet-stream"
494cdf0e10cSrcweir           will be used.
495cdf0e10cSrcweir     */
496cdf0e10cSrcweir     static void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
497cdf0e10cSrcweir 
498cdf0e10cSrcweir private:
499cdf0e10cSrcweir 
500cdf0e10cSrcweir     DECL_STATIC_LINK( Application, PostEventHandler, void* );
501cdf0e10cSrcweir };
502cdf0e10cSrcweir 
503cdf0e10cSrcweir VCL_DLLPUBLIC Application* GetpApp();
504cdf0e10cSrcweir 
505cdf0e10cSrcweir VCL_DLLPUBLIC sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
506cdf0e10cSrcweir VCL_DLLPUBLIC void DeInitVCL();
507cdf0e10cSrcweir 
508cdf0e10cSrcweir VCL_DLLPUBLIC sal_Bool InitAccessBridge( sal_Bool bAllowCancel, sal_Bool &rCancelled );
509cdf0e10cSrcweir 
510cdf0e10cSrcweir // only allowed to call, if no thread is running. You must call JoinMainLoopThread to free all memory.
511cdf0e10cSrcweir VCL_DLLPUBLIC void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData );
512cdf0e10cSrcweir VCL_DLLPUBLIC void JoinMainLoopThread();
513cdf0e10cSrcweir 
EndYield()514cdf0e10cSrcweir inline void Application::EndYield()
515cdf0e10cSrcweir {
516cdf0e10cSrcweir     PostUserEvent( Link() );
517cdf0e10cSrcweir }
518cdf0e10cSrcweir 
519df906e24SSteve Yin #ifdef WNT
520*ad3a95a3SSteve Yin VCL_DLLPUBLIC sal_Bool HasAtHook();
521df906e24SSteve Yin VCL_DLLPUBLIC bool IsWNTInitAccessBridge();
522df906e24SSteve Yin bool WNTEnableAccessInterface(bool bEnable);
523*ad3a95a3SSteve Yin 
524*ad3a95a3SSteve Yin class VCL_DLLPUBLIC CEnableAccessInterface
525*ad3a95a3SSteve Yin {
526*ad3a95a3SSteve Yin public:
CEnableAccessInterface(bool bEnable=false)527*ad3a95a3SSteve Yin 	CEnableAccessInterface(bool bEnable = false)
528*ad3a95a3SSteve Yin 	{
529*ad3a95a3SSteve Yin 		m_bIsEnableAccessInterface = Application::IsEnableAccessInterface();
530*ad3a95a3SSteve Yin 		Application::EnableAccessInterface(bEnable);
531*ad3a95a3SSteve Yin 	}
~CEnableAccessInterface()532*ad3a95a3SSteve Yin 	~CEnableAccessInterface()
533*ad3a95a3SSteve Yin 	{
534*ad3a95a3SSteve Yin 		Application::EnableAccessInterface(m_bIsEnableAccessInterface);
535*ad3a95a3SSteve Yin 	}
536*ad3a95a3SSteve Yin private:
537*ad3a95a3SSteve Yin 	bool m_bIsEnableAccessInterface;
538*ad3a95a3SSteve Yin };
539df906e24SSteve Yin #endif
540cdf0e10cSrcweir #endif // _APP_HXX
541