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