Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_DP_GUI_THEEXTMGR_HXX
21 : #define INCLUDED_DP_GUI_THEEXTMGR_HXX
22 :
23 : #include "comphelper/sequence.hxx"
24 :
25 : #include "cppuhelper/implbase2.hxx"
26 :
27 : #include "com/sun/star/container/XNameAccess.hpp"
28 : #include "com/sun/star/deployment/XExtensionManager.hpp"
29 : #include "com/sun/star/deployment/ExtensionManager.hpp"
30 : #include "com/sun/star/frame/XDesktop2.hpp"
31 : #include "com/sun/star/frame/XTerminateListener.hpp"
32 : #include "com/sun/star/uno/XComponentContext.hpp"
33 : #include "com/sun/star/util/XModifyListener.hpp"
34 :
35 : #include "dp_gui.h"
36 : #include "dp_gui_dialog2.hxx"
37 : #include "dp_gui_updatedata.hxx"
38 :
39 : //==============================================================================
40 : namespace dp_gui {
41 :
42 : //------------------------------------------------------------------------------
43 : class ExtensionCmdQueue;
44 :
45 : //------------------------------------------------------------------------------
46 : class TheExtensionManager :
47 : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XTerminateListener,
48 : ::com::sun::star::util::XModifyListener >
49 : {
50 : private:
51 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
52 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xDesktop;
53 : ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
54 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNameAccessNodes;
55 :
56 : Window *m_pParent;
57 : ExtMgrDialog *m_pExtMgrDialog;
58 : UpdateRequiredDialog *m_pUpdReqDialog;
59 : ExtensionCmdQueue *m_pExecuteCmdQueue;
60 :
61 : ::rtl::OUString m_sGetExtensionsURL;
62 :
63 : public:
64 : static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
65 :
66 : TheExtensionManager( Window * pParent,
67 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext );
68 : ~TheExtensionManager();
69 :
70 : void createDialog( const bool bCreateUpdDlg );
71 : sal_Int16 execute();
72 :
73 0 : Dialog* getDialog() { return m_pExtMgrDialog ? (Dialog*) m_pExtMgrDialog : (Dialog*) m_pUpdReqDialog; }
74 0 : DialogHelper* getDialogHelper() { return m_pExtMgrDialog ? (DialogHelper*) m_pExtMgrDialog : (DialogHelper*) m_pUpdReqDialog; }
75 0 : ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue; }
76 :
77 : void SetText( const ::rtl::OUString &rTitle );
78 : void Show();
79 : void ToTop( sal_uInt16 nFlags );
80 : bool Close();
81 : bool isVisible();
82 :
83 : //-----------------
84 : bool checkUpdates( bool showUpdateOnly, bool parentVisible );
85 : bool installPackage( const ::rtl::OUString &rPackageURL, bool bWarnUser = false );
86 : void createPackageList();
87 :
88 : bool queryTermination();
89 : void terminateDialog();
90 :
91 : // Tools
92 : bool supportsOptions( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
93 : PackageState getPackageState( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
94 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; }
95 0 : ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const { return m_xExtensionManager; }
96 : bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
97 :
98 : //-----------------
99 : static ::rtl::Reference<TheExtensionManager> get(
100 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xContext,
101 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> const & xParent = 0,
102 : ::rtl::OUString const & view = ::rtl::OUString() );
103 :
104 : // XEventListener
105 : virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
106 : throw (::com::sun::star::uno::RuntimeException);
107 :
108 : // XTerminateListener
109 : virtual void SAL_CALL queryTermination( ::com::sun::star::lang::EventObject const & evt )
110 : throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
111 : virtual void SAL_CALL notifyTermination( ::com::sun::star::lang::EventObject const & evt )
112 : throw (::com::sun::star::uno::RuntimeException);
113 :
114 : // XModifyListener
115 : virtual void SAL_CALL modified( ::com::sun::star::lang::EventObject const & evt )
116 : throw (::com::sun::star::uno::RuntimeException);
117 : };
118 :
119 : } // namespace dp_gui
120 :
121 : #endif
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|