2 #ifndef __SHUTDOWNICON_HXX__
3 #define __SHUTDOWNICON_HXX__
5 #include <com/sun/star/frame/XTerminateListener.hpp>
6 #include <com/sun/star/frame/XDesktop.hpp>
7 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
8 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
9 #include <com/sun/star/lang/XComponent.hpp>
10 #include <com/sun/star/lang/XEventListener.hpp>
11 #include <com/sun/star/lang/XServiceInfo.hpp>
12 #include <com/sun/star/lang/XInitialization.hpp>
13 #include <com/sun/star/lang/XInitialization.hpp>
14 #include <com/sun/star/beans/XFastPropertySet.hpp>
15 #ifndef _RTL_STRING_HXX
16 #include <rtl/string.hxx>
18 #ifndef _RTL_USTRING_HXX
19 #include <rtl/ustring.hxx>
21 #include <osl/mutex.hxx>
22 #include <osl/module.hxx>
23 #include <sfx2/sfxuno.hxx>
24 #include <cppuhelper/compbase4.hxx>
25 #include <sfx2/dllapi.h>
30 class FileDialogHelper
;
33 typedef ::cppu::WeakComponentImplHelper4
<
34 ::com::sun::star::lang::XInitialization
,
35 ::com::sun::star::frame::XTerminateListener
,
36 ::com::sun::star::lang::XServiceInfo
,
37 ::com::sun::star::beans::XFastPropertySet
> ShutdownIconServiceBase
;
39 #if defined(USE_APP_SHORTCUTS)
40 #define WRITER_URL "private:factory/swriter"
41 #define CALC_URL "private:factory/scalc"
42 #define IMPRESS_URL "private:factory/simpress"
43 #define IMPRESS_WIZARD_URL "private:factory/simpress?slot=6686"
44 #define DRAW_URL "private:factory/sdraw"
45 #define MATH_URL "private:factory/smath"
46 #define BASE_URL "private:factory/sdatabase?Interactive"
47 #define STARTMODULE_URL ".uno:ShowStartModule"
50 class SFX2_DLLPUBLIC ShutdownIcon
: public ShutdownIconServiceBase
52 ::osl::Mutex m_aMutex
;
54 bool m_bListenForTermination
;
56 sfx2::FileDialogHelper
* m_pFileDlg
;
57 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xServiceManager
;
59 static ShutdownIcon
*pShutdownIcon
; // one instance
61 oslGenericFunction m_pInitSystray
;
62 oslGenericFunction m_pDeInitSystray
;
63 ::osl::Module
*m_pPlugin
;
69 static bool LoadModule( osl::Module
**pModule
,
70 oslGenericFunction
*pInit
,
71 oslGenericFunction
*pDeInit
);
72 static void EnterModalMode();
73 static void LeaveModalMode();
74 static rtl::OUString
getShortcutName();
76 friend class SfxNotificationListener_Impl
;
79 ShutdownIcon( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> aSMgr
);
81 virtual ~ShutdownIcon();
85 static ShutdownIcon
* getInstance();
86 static ShutdownIcon
* createInstance();
88 static void terminateDesktop();
89 static void addTerminateListener();
91 static void FileOpen();
92 static void OpenURL( const ::rtl::OUString
& aURL
, const ::rtl::OUString
& rTarget
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& =
93 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>( 0 ) );
94 static void FromTemplate();
96 static void SetAutostart( bool bActivate
);
97 static bool GetAutostart();
98 static bool bModalMode
;
100 void init() throw( ::com::sun::star::uno::Exception
);
102 static ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XSingleServiceFactory
>
103 GetWrapperFactory( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & xSMgr
);
104 static ::rtl::OUString
GetImplementationName_static();
106 ::rtl::OUString
GetResString( int id
);
107 ::rtl::OUString
GetUrlDescription( const ::rtl::OUString
& aUrl
);
109 void SetVeto( bool bVeto
) { m_bVeto
= bVeto
;}
110 bool GetVeto() { return m_bVeto
; }
112 void StartFileDialog();
113 sfx2::FileDialogHelper
* GetFileDialog() const { return m_pFileDlg
; }
114 static long DialogClosedHdl_Impl( ShutdownIcon
*, sfx2::FileDialogHelper
* );
116 static bool IsQuickstarterInstalled();
118 // Component Helper - force override
119 virtual void SAL_CALL
disposing();
122 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
123 throw(::com::sun::star::uno::RuntimeException
);
125 // XTerminateListener
126 virtual void SAL_CALL
queryTermination( const ::com::sun::star::lang::EventObject
& aEvent
)
127 throw(::com::sun::star::frame::TerminationVetoException
, ::com::sun::star::uno::RuntimeException
);
128 virtual void SAL_CALL
notifyTermination( const ::com::sun::star::lang::EventObject
& aEvent
)
129 throw(::com::sun::star::uno::RuntimeException
);
132 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
133 throw( ::com::sun::star::uno::Exception
);
136 virtual void SAL_CALL
setFastPropertyValue( ::sal_Int32 nHandle
,
137 const ::com::sun::star::uno::Any
& aValue
)
138 throw (::com::sun::star::beans::UnknownPropertyException
,
139 ::com::sun::star::beans::PropertyVetoException
,
140 ::com::sun::star::lang::IllegalArgumentException
,
141 ::com::sun::star::lang::WrappedTargetException
,
142 ::com::sun::star::uno::RuntimeException
);
143 virtual ::com::sun::star::uno::Any SAL_CALL
getFastPropertyValue( ::sal_Int32 nHandle
)
144 throw (::com::sun::star::beans::UnknownPropertyException
,
145 ::com::sun::star::lang::WrappedTargetException
,
146 ::com::sun::star::uno::RuntimeException
);
148 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDesktop
> m_xDesktop
;
151 static void EnableAutostartW32( const rtl::OUString
&aShortcutName
);
152 static rtl::OUString
GetAutostartFolderNameW32();
155 static void SetAutostartOs2( bool bActivate
);
156 static bool GetAutostartOs2( );
162 // builtin win32 systray
163 void win32_init_sys_tray();
164 void win32_shutdown_sys_tray();
165 # elif defined QUARTZ
166 void aqua_init_systray();
167 void aqua_shutdown_systray();
169 // external plugin systray impl.
170 void plugin_init_sys_tray();
171 void plugin_shutdown_sys_tray();