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