1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef INCLUDED_DP_GUI_THEEXTMGR_HXX 29*cdf0e10cSrcweir #define INCLUDED_DP_GUI_THEEXTMGR_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "comphelper/sequence.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "cppuhelper/implbase2.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include "com/sun/star/container/XNameAccess.hpp" 36*cdf0e10cSrcweir #include "com/sun/star/deployment/XExtensionManager.hpp" 37*cdf0e10cSrcweir #include "com/sun/star/deployment/ExtensionManager.hpp" 38*cdf0e10cSrcweir #include "com/sun/star/frame/XDesktop.hpp" 39*cdf0e10cSrcweir #include "com/sun/star/frame/XTerminateListener.hpp" 40*cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp" 41*cdf0e10cSrcweir #include "com/sun/star/util/XModifyListener.hpp" 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include "dp_gui.h" 44*cdf0e10cSrcweir #include "dp_gui_dialog2.hxx" 45*cdf0e10cSrcweir #include "dp_gui_updatedata.hxx" 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir //============================================================================== 48*cdf0e10cSrcweir namespace dp_gui { 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir //------------------------------------------------------------------------------ 51*cdf0e10cSrcweir class ExtensionCmdQueue; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //------------------------------------------------------------------------------ 54*cdf0e10cSrcweir class TheExtensionManager : 55*cdf0e10cSrcweir public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XTerminateListener, 56*cdf0e10cSrcweir ::com::sun::star::util::XModifyListener > 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir private: 59*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 60*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; 61*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; 62*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir Window *m_pParent; 65*cdf0e10cSrcweir ExtMgrDialog *m_pExtMgrDialog; 66*cdf0e10cSrcweir UpdateRequiredDialog *m_pUpdReqDialog; 67*cdf0e10cSrcweir ExtensionCmdQueue *m_pExecuteCmdQueue; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir ::rtl::OUString m_sGetExtensionsURL; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir void createPackageList(); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir public: 74*cdf0e10cSrcweir static ::rtl::Reference<TheExtensionManager> s_ExtMgr; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir TheExtensionManager( Window * pParent, 77*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext ); 78*cdf0e10cSrcweir ~TheExtensionManager(); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir void createDialog( const bool bCreateUpdDlg ); 81*cdf0e10cSrcweir sal_Int16 execute(); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; } 84*cdf0e10cSrcweir DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; } 85*cdf0e10cSrcweir ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue; } 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir void SetText( const ::rtl::OUString &rTitle ); 88*cdf0e10cSrcweir void Show(); 89*cdf0e10cSrcweir void ToTop( sal_uInt16 nFlags ); 90*cdf0e10cSrcweir bool Close(); 91*cdf0e10cSrcweir bool isVisible(); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir //----------------- 94*cdf0e10cSrcweir bool checkUpdates( bool showUpdateOnly, bool parentVisible ); 95*cdf0e10cSrcweir bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false ); 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir bool queryTermination(); 98*cdf0e10cSrcweir void terminateDialog(); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // Tools 101*cdf0e10cSrcweir bool supportsOptions( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 102*cdf0e10cSrcweir PackageState getPackageState( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 103*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; } 104*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const { return m_xExtensionManager; } 105*cdf0e10cSrcweir bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir //----------------- 108*cdf0e10cSrcweir static ::rtl::Reference<TheExtensionManager> get( 109*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xContext, 110*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> const & xParent = 0, 111*cdf0e10cSrcweir ::rtl::OUString const & view = ::rtl::OUString() ); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir // XEventListener 114*cdf0e10cSrcweir virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt ) 115*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir // XTerminateListener 118*cdf0e10cSrcweir virtual void SAL_CALL queryTermination( ::com::sun::star::lang::EventObject const & evt ) 119*cdf0e10cSrcweir throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException); 120*cdf0e10cSrcweir virtual void SAL_CALL notifyTermination( ::com::sun::star::lang::EventObject const & evt ) 121*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir // XModifyListener 124*cdf0e10cSrcweir virtual void SAL_CALL modified( ::com::sun::star::lang::EventObject const & evt ) 125*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 126*cdf0e10cSrcweir }; 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir } // namespace dp_gui 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir #endif 131*cdf0e10cSrcweir 132