1*0a1e2f0eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0a1e2f0eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0a1e2f0eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0a1e2f0eSAndrew Rist * distributed with this work for additional information 6*0a1e2f0eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0a1e2f0eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0a1e2f0eSAndrew Rist * "License"); you may not use this file except in compliance 9*0a1e2f0eSAndrew Rist * with the License. You may obtain a copy of the License at 10*0a1e2f0eSAndrew Rist * 11*0a1e2f0eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*0a1e2f0eSAndrew Rist * 13*0a1e2f0eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0a1e2f0eSAndrew Rist * software distributed under the License is distributed on an 15*0a1e2f0eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0a1e2f0eSAndrew Rist * KIND, either express or implied. See the License for the 17*0a1e2f0eSAndrew Rist * specific language governing permissions and limitations 18*0a1e2f0eSAndrew Rist * under the License. 19*0a1e2f0eSAndrew Rist * 20*0a1e2f0eSAndrew Rist *************************************************************/ 21*0a1e2f0eSAndrew Rist 22*0a1e2f0eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_DP_GUI_THEEXTMGR_HXX 25cdf0e10cSrcweir #define INCLUDED_DP_GUI_THEEXTMGR_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "comphelper/sequence.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "cppuhelper/implbase2.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "com/sun/star/container/XNameAccess.hpp" 32cdf0e10cSrcweir #include "com/sun/star/deployment/XExtensionManager.hpp" 33cdf0e10cSrcweir #include "com/sun/star/deployment/ExtensionManager.hpp" 34cdf0e10cSrcweir #include "com/sun/star/frame/XDesktop.hpp" 35cdf0e10cSrcweir #include "com/sun/star/frame/XTerminateListener.hpp" 36cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp" 37cdf0e10cSrcweir #include "com/sun/star/util/XModifyListener.hpp" 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include "dp_gui.h" 40cdf0e10cSrcweir #include "dp_gui_dialog2.hxx" 41cdf0e10cSrcweir #include "dp_gui_updatedata.hxx" 42cdf0e10cSrcweir 43cdf0e10cSrcweir //============================================================================== 44cdf0e10cSrcweir namespace dp_gui { 45cdf0e10cSrcweir 46cdf0e10cSrcweir //------------------------------------------------------------------------------ 47cdf0e10cSrcweir class ExtensionCmdQueue; 48cdf0e10cSrcweir 49cdf0e10cSrcweir //------------------------------------------------------------------------------ 50cdf0e10cSrcweir class TheExtensionManager : 51cdf0e10cSrcweir public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XTerminateListener, 52cdf0e10cSrcweir ::com::sun::star::util::XModifyListener > 53cdf0e10cSrcweir { 54cdf0e10cSrcweir private: 55cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 56cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop > m_xDesktop; 57cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; 58cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes; 59cdf0e10cSrcweir 60cdf0e10cSrcweir Window *m_pParent; 61cdf0e10cSrcweir ExtMgrDialog *m_pExtMgrDialog; 62cdf0e10cSrcweir UpdateRequiredDialog *m_pUpdReqDialog; 63cdf0e10cSrcweir ExtensionCmdQueue *m_pExecuteCmdQueue; 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::rtl::OUString m_sGetExtensionsURL; 66cdf0e10cSrcweir 67cdf0e10cSrcweir void createPackageList(); 68cdf0e10cSrcweir 69cdf0e10cSrcweir public: 70cdf0e10cSrcweir static ::rtl::Reference<TheExtensionManager> s_ExtMgr; 71cdf0e10cSrcweir 72cdf0e10cSrcweir TheExtensionManager( Window * pParent, 73cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext ); 74cdf0e10cSrcweir ~TheExtensionManager(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir void createDialog( const bool bCreateUpdDlg ); 77cdf0e10cSrcweir sal_Int16 execute(); 78cdf0e10cSrcweir getDialog()79cdf0e10cSrcweir Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; } getDialogHelper()80cdf0e10cSrcweir DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; } getCmdQueue() const81cdf0e10cSrcweir ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue; } 82cdf0e10cSrcweir 83cdf0e10cSrcweir void SetText( const ::rtl::OUString &rTitle ); 84cdf0e10cSrcweir void Show(); 85cdf0e10cSrcweir void ToTop( sal_uInt16 nFlags ); 86cdf0e10cSrcweir bool Close(); 87cdf0e10cSrcweir bool isVisible(); 88cdf0e10cSrcweir 89cdf0e10cSrcweir //----------------- 90cdf0e10cSrcweir bool checkUpdates( bool showUpdateOnly, bool parentVisible ); 91cdf0e10cSrcweir bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false ); 92cdf0e10cSrcweir 93cdf0e10cSrcweir bool queryTermination(); 94cdf0e10cSrcweir void terminateDialog(); 95cdf0e10cSrcweir 96cdf0e10cSrcweir // Tools 97cdf0e10cSrcweir bool supportsOptions( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 98cdf0e10cSrcweir PackageState getPackageState( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; getContext() const99cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; } getExtensionManager() const100cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const { return m_xExtensionManager; } 101cdf0e10cSrcweir bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 102cdf0e10cSrcweir 103cdf0e10cSrcweir //----------------- 104cdf0e10cSrcweir static ::rtl::Reference<TheExtensionManager> get( 105cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xContext, 106cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> const & xParent = 0, 107cdf0e10cSrcweir ::rtl::OUString const & view = ::rtl::OUString() ); 108cdf0e10cSrcweir 109cdf0e10cSrcweir // XEventListener 110cdf0e10cSrcweir virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt ) 111cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir 113cdf0e10cSrcweir // XTerminateListener 114cdf0e10cSrcweir virtual void SAL_CALL queryTermination( ::com::sun::star::lang::EventObject const & evt ) 115cdf0e10cSrcweir throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException); 116cdf0e10cSrcweir virtual void SAL_CALL notifyTermination( ::com::sun::star::lang::EventObject const & evt ) 117cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // XModifyListener 120cdf0e10cSrcweir virtual void SAL_CALL modified( ::com::sun::star::lang::EventObject const & evt ) 121cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 122cdf0e10cSrcweir }; 123cdf0e10cSrcweir 124cdf0e10cSrcweir } // namespace dp_gui 125cdf0e10cSrcweir 126cdf0e10cSrcweir #endif 127cdf0e10cSrcweir 128