1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 #ifndef __SHUTDOWNICON_HXX__
4 #define __SHUTDOWNICON_HXX__
6 #include <com/sun/star/frame/XTerminateListener.hpp>
7 #include <com/sun/star/frame/XDesktop.hpp>
8 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
9 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
10 #include <com/sun/star/lang/XComponent.hpp>
11 #include <com/sun/star/lang/XEventListener.hpp>
12 #include <com/sun/star/lang/XServiceInfo.hpp>
13 #include <com/sun/star/lang/XInitialization.hpp>
14 #include <com/sun/star/beans/XFastPropertySet.hpp>
15 #include <rtl/string.hxx>
16 #include <rtl/ustring.hxx>
17 #include <osl/mutex.hxx>
18 #include <osl/module.hxx>
19 #include <sfx2/sfxuno.hxx>
20 #include <cppuhelper/compbase4.hxx>
21 #include <sfx2/dllapi.h>
26 class FileDialogHelper
;
29 typedef ::cppu::WeakComponentImplHelper4
<
30 ::com::sun::star::lang::XInitialization
,
31 ::com::sun::star::frame::XTerminateListener
,
32 ::com::sun::star::lang::XServiceInfo
,
33 ::com::sun::star::beans::XFastPropertySet
> ShutdownIconServiceBase
;
35 #if defined(USE_APP_SHORTCUTS)
36 #define WRITER_URL "private:factory/swriter"
37 #define CALC_URL "private:factory/scalc"
38 #define IMPRESS_URL "private:factory/simpress"
39 #define IMPRESS_WIZARD_URL "private:factory/simpress?slot=6686"
40 #define DRAW_URL "private:factory/sdraw"
41 #define MATH_URL "private:factory/smath"
42 #define BASE_URL "private:factory/sdatabase?Interactive"
43 #define STARTMODULE_URL ".uno:ShowStartModule"
46 class SFX2_DLLPUBLIC ShutdownIcon
: public ShutdownIconServiceBase
48 ::osl::Mutex m_aMutex
;
50 bool m_bListenForTermination
;
51 bool m_bSystemDialogs
;
53 sfx2::FileDialogHelper
* m_pFileDlg
;
54 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xServiceManager
;
56 static ShutdownIcon
*pShutdownIcon
; // one instance
58 oslGenericFunction m_pInitSystray
;
59 oslGenericFunction m_pDeInitSystray
;
60 ::osl::Module
*m_pPlugin
;
66 static bool LoadModule( osl::Module
**pModule
,
67 oslGenericFunction
*pInit
,
68 oslGenericFunction
*pDeInit
);
69 static void EnterModalMode();
70 static void LeaveModalMode();
71 static rtl::OUString
getShortcutName();
73 friend class SfxNotificationListener_Impl
;
76 ShutdownIcon( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> aSMgr
);
78 virtual ~ShutdownIcon();
82 static ShutdownIcon
* getInstance();
83 static ShutdownIcon
* createInstance();
85 static void terminateDesktop();
86 static void addTerminateListener();
88 static void FileOpen();
89 static void OpenURL( const ::rtl::OUString
& aURL
, const ::rtl::OUString
& rTarget
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& =
90 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>( 0 ) );
91 static void FromTemplate();
93 static void SetAutostart( bool bActivate
);
94 static bool GetAutostart();
95 static bool bModalMode
;
97 void init() throw( ::com::sun::star::uno::Exception
);
99 static ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XSingleServiceFactory
>
100 GetWrapperFactory( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & xSMgr
);
101 static ::rtl::OUString
GetImplementationName_static();
103 ::rtl::OUString
GetResString( int id
);
104 ::rtl::OUString
GetUrlDescription( const ::rtl::OUString
& aUrl
);
106 void SetVeto( bool bVeto
) { m_bVeto
= bVeto
;}
107 bool GetVeto() { return m_bVeto
; }
109 void StartFileDialog();
110 sfx2::FileDialogHelper
* GetFileDialog() const { return m_pFileDlg
; }
111 static long DialogClosedHdl_Impl( ShutdownIcon
*, sfx2::FileDialogHelper
* );
113 static bool IsQuickstarterInstalled();
115 // Component Helper - force override
116 virtual void SAL_CALL
disposing();
119 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
120 throw(::com::sun::star::uno::RuntimeException
);
122 // XTerminateListener
123 virtual void SAL_CALL
queryTermination( const ::com::sun::star::lang::EventObject
& aEvent
)
124 throw(::com::sun::star::frame::TerminationVetoException
, ::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
notifyTermination( const ::com::sun::star::lang::EventObject
& aEvent
)
126 throw(::com::sun::star::uno::RuntimeException
);
129 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
130 throw( ::com::sun::star::uno::Exception
);
133 virtual void SAL_CALL
setFastPropertyValue( ::sal_Int32 nHandle
,
134 const ::com::sun::star::uno::Any
& aValue
)
135 throw (::com::sun::star::beans::UnknownPropertyException
,
136 ::com::sun::star::beans::PropertyVetoException
,
137 ::com::sun::star::lang::IllegalArgumentException
,
138 ::com::sun::star::lang::WrappedTargetException
,
139 ::com::sun::star::uno::RuntimeException
);
140 virtual ::com::sun::star::uno::Any SAL_CALL
getFastPropertyValue( ::sal_Int32 nHandle
)
141 throw (::com::sun::star::beans::UnknownPropertyException
,
142 ::com::sun::star::lang::WrappedTargetException
,
143 ::com::sun::star::uno::RuntimeException
);
145 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDesktop
> m_xDesktop
;
148 static void EnableAutostartW32( const rtl::OUString
&aShortcutName
);
149 static rtl::OUString
GetAutostartFolderNameW32();
155 // builtin win32 systray
156 void win32_init_sys_tray();
157 void win32_shutdown_sys_tray();
158 # elif defined QUARTZ
159 void aqua_init_systray();
160 void aqua_shutdown_systray();
162 // external plugin systray impl.
163 void plugin_init_sys_tray();
164 void plugin_shutdown_sys_tray();
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */