1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/deployment/XExtensionManager.hpp>
26 #include <com/sun/star/frame/XDesktop2.hpp>
27 #include <com/sun/star/frame/XTerminateListener.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <com/sun/star/util/XModifyListener.hpp>
32 #include "dp_gui_dialog2.hxx"
38 class ExtensionCmdQueue
;
41 class TheExtensionManager
:
42 public ::cppu::WeakImplHelper
< css::frame::XTerminateListener
,
43 css::util::XModifyListener
>
46 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
47 css::uno::Reference
< css::frame::XDesktop2
> m_xDesktop
;
48 css::uno::Reference
< css::deployment::XExtensionManager
> m_xExtensionManager
;
49 css::uno::Reference
< css::container::XNameAccess
> m_xNameAccessNodes
;
50 css::uno::Reference
< css::awt::XWindow
> m_xParent
;
51 std::shared_ptr
<ExtMgrDialog
> m_xExtMgrDialog
;
52 std::unique_ptr
<UpdateRequiredDialog
> m_xUpdReqDialog
;
53 std::unique_ptr
<ExtensionCmdQueue
> m_xExecuteCmdQueue
;
55 OUString m_sGetExtensionsURL
;
57 bool m_bExtMgrDialogExecuting
;
60 static ::rtl::Reference
<TheExtensionManager
> s_ExtMgr
;
62 TheExtensionManager( css::uno::Reference
< css::awt::XWindow
> xParent
,
63 const css::uno::Reference
< css::uno::XComponentContext
> &xContext
);
64 virtual ~TheExtensionManager() override
;
66 void createDialog( const bool bCreateUpdDlg
);
69 bool isModified() const { return m_bModified
; }
70 void clearModified() { m_bModified
= false; }
72 weld::Window
* getDialog()
75 return m_xExtMgrDialog
->getDialog();
77 return m_xUpdReqDialog
->getDialog();
80 DialogHelper
* getDialogHelper()
83 return m_xExtMgrDialog
.get();
84 return m_xUpdReqDialog
.get();
86 ExtensionCmdQueue
* getCmdQueue() const { return m_xExecuteCmdQueue
.get(); }
88 void SetText( const OUString
&rTitle
);
96 bool installPackage( const OUString
&rPackageURL
, bool bWarnUser
= false );
97 void createPackageList();
99 void terminateDialog();
102 bool supportsOptions( const css::uno::Reference
< css::deployment::XPackage
> &xPackage
) const;
103 static PackageState
getPackageState( const css::uno::Reference
< css::deployment::XPackage
> &xPackage
);
104 const css::uno::Reference
< css::uno::XComponentContext
>& getContext() const { return m_xContext
; }
105 const css::uno::Reference
< css::deployment::XExtensionManager
>& getExtensionManager() const { return m_xExtensionManager
; }
106 bool isReadOnly( const css::uno::Reference
< css::deployment::XPackage
> &xPackage
) const;
109 static ::rtl::Reference
<TheExtensionManager
> get(
110 css::uno::Reference
< css::uno::XComponentContext
> const & xContext
,
111 css::uno::Reference
< css::awt::XWindow
> const & xParent
= nullptr,
112 OUString
const & view
= OUString() );
115 virtual void SAL_CALL
disposing( css::lang::EventObject
const & evt
) override
;
117 // XTerminateListener
118 virtual void SAL_CALL
queryTermination( css::lang::EventObject
const & evt
) override
;
119 virtual void SAL_CALL
notifyTermination( css::lang::EventObject
const & evt
) override
;
122 virtual void SAL_CALL
modified( css::lang::EventObject
const & evt
) override
;
125 } // namespace dp_gui
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */