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_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_THEEXTMGR_HXX
21 : #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_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 : css::uno::Reference<
57 : css::awt::XWindow > m_xParent;
58 : VclPtr<ExtMgrDialog> m_pExtMgrDialog;
59 : VclPtr<UpdateRequiredDialog> m_pUpdReqDialog;
60 : ExtensionCmdQueue *m_pExecuteCmdQueue;
61 :
62 : OUString m_sGetExtensionsURL;
63 :
64 : public:
65 : static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
66 :
67 : TheExtensionManager( const css::uno::Reference< css::awt::XWindow > &xParent,
68 : const css::uno::Reference< css::uno::XComponentContext > &xContext );
69 : virtual ~TheExtensionManager();
70 :
71 : void createDialog( const bool bCreateUpdDlg );
72 : sal_Int16 execute();
73 :
74 0 : Dialog* getDialog()
75 : {
76 0 : if (m_pExtMgrDialog)
77 0 : return m_pExtMgrDialog.get();
78 0 : return m_pUpdReqDialog.get();
79 : }
80 0 : DialogHelper* getDialogHelper()
81 : {
82 0 : if (m_pExtMgrDialog)
83 0 : return m_pExtMgrDialog.get();
84 0 : return m_pUpdReqDialog.get();
85 : }
86 0 : ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue; }
87 :
88 : void SetText( const OUString &rTitle );
89 : void Show();
90 : void ToTop( ToTopFlags nFlags );
91 : bool Close();
92 : bool isVisible();
93 :
94 :
95 : bool checkUpdates( bool showUpdateOnly, bool parentVisible );
96 : bool installPackage( const OUString &rPackageURL, bool bWarnUser = false );
97 : void createPackageList();
98 :
99 : static bool queryTermination();
100 : void terminateDialog();
101 :
102 : // Tools
103 : bool supportsOptions( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
104 : static PackageState getPackageState( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
105 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; }
106 0 : ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > getExtensionManager() const { return m_xExtensionManager; }
107 : bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
108 :
109 :
110 : static ::rtl::Reference<TheExtensionManager> get(
111 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xContext,
112 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> const & xParent = 0,
113 : OUString const & view = OUString() );
114 :
115 : // XEventListener
116 : virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
117 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 :
119 : // XTerminateListener
120 : virtual void SAL_CALL queryTermination( ::com::sun::star::lang::EventObject const & evt )
121 : throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual void SAL_CALL notifyTermination( ::com::sun::star::lang::EventObject const & evt )
123 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 :
125 : // XModifyListener
126 : virtual void SAL_CALL modified( ::com::sun::star::lang::EventObject const & evt )
127 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : };
129 :
130 : } // namespace dp_gui
131 :
132 : #endif
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|