Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / desktop / source / deployment / gui / dp_gui_theextmgr.hxx
blobdb862a5f388dca6ed8ebd250d70ad750346cbd72
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_THEEXTMGR_HXX
21 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_THEEXTMGR_HXX
23 #include <cppuhelper/implbase.hxx>
25 #include <com/sun/star/container/XNameAccess.hpp>
26 #include <com/sun/star/deployment/XExtensionManager.hpp>
27 #include <com/sun/star/deployment/ExtensionManager.hpp>
28 #include <com/sun/star/frame/XDesktop2.hpp>
29 #include <com/sun/star/frame/XTerminateListener.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/util/XModifyListener.hpp>
33 #include "dp_gui.h"
34 #include "dp_gui_dialog2.hxx"
35 #include "dp_gui_updatedata.hxx"
38 namespace dp_gui {
41 class ExtensionCmdQueue;
44 class TheExtensionManager :
45 public ::cppu::WeakImplHelper< css::frame::XTerminateListener,
46 css::util::XModifyListener >
48 private:
49 css::uno::Reference< css::uno::XComponentContext > m_xContext;
50 css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
51 css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
52 css::uno::Reference< css::container::XNameAccess > m_xNameAccessNodes;
53 css::uno::Reference< css::awt::XWindow > m_xParent;
54 std::shared_ptr<ExtMgrDialog> m_xExtMgrDialog;
55 std::unique_ptr<UpdateRequiredDialog> m_xUpdReqDialog;
56 std::unique_ptr<ExtensionCmdQueue> m_xExecuteCmdQueue;
58 OUString m_sGetExtensionsURL;
59 bool m_bModified;
60 bool m_bExtMgrDialogExecuting;
62 public:
63 static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
65 TheExtensionManager( const css::uno::Reference< css::awt::XWindow > &xParent,
66 const css::uno::Reference< css::uno::XComponentContext > &xContext );
67 virtual ~TheExtensionManager() override;
69 void createDialog( const bool bCreateUpdDlg );
70 sal_Int16 execute();
72 bool isModified() const { return m_bModified; }
73 void clearModified() { m_bModified = false; }
75 weld::Window* getDialog()
77 if (m_xExtMgrDialog)
78 return m_xExtMgrDialog->getDialog();
79 if (m_xUpdReqDialog)
80 return m_xUpdReqDialog->getDialog();
81 return nullptr;
83 DialogHelper* getDialogHelper()
85 if (m_xExtMgrDialog)
86 return m_xExtMgrDialog.get();
87 return m_xUpdReqDialog.get();
89 ExtensionCmdQueue* getCmdQueue() const { return m_xExecuteCmdQueue.get(); }
91 void SetText( const OUString &rTitle );
92 void Show();
93 void ToTop();
94 void Close();
95 bool isVisible();
98 void checkUpdates();
99 bool installPackage( const OUString &rPackageURL, bool bWarnUser = false );
100 void createPackageList();
102 void terminateDialog();
104 // Tools
105 bool supportsOptions( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
106 static PackageState getPackageState( const css::uno::Reference< css::deployment::XPackage > &xPackage );
107 const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return m_xContext; }
108 const css::uno::Reference< css::deployment::XExtensionManager >& getExtensionManager() const { return m_xExtensionManager; }
109 bool isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const;
112 static ::rtl::Reference<TheExtensionManager> get(
113 css::uno::Reference< css::uno::XComponentContext> const & xContext,
114 css::uno::Reference< css::awt::XWindow> const & xParent = nullptr,
115 OUString const & view = OUString() );
117 // XEventListener
118 virtual void SAL_CALL disposing( css::lang::EventObject const & evt ) override;
120 // XTerminateListener
121 virtual void SAL_CALL queryTermination( css::lang::EventObject const & evt ) override;
122 virtual void SAL_CALL notifyTermination( css::lang::EventObject const & evt ) override;
124 // XModifyListener
125 virtual void SAL_CALL modified( css::lang::EventObject const & evt ) override;
128 } // namespace dp_gui
130 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */