LibreOffice Module desktop (master) 1
dp_gui_theextmgr.hxx
Go to the documentation of this file.
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#pragma once
21
23
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>
30
31#include "dp_gui.h"
32#include "dp_gui_dialog2.hxx"
33
34
35namespace dp_gui {
36
37
38class ExtensionCmdQueue;
39
40
42 public ::cppu::WeakImplHelper< css::frame::XTerminateListener,
43 css::util::XModifyListener >
44{
45private:
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;
54
58
59public:
60 static ::rtl::Reference<TheExtensionManager> s_ExtMgr;
61
62 TheExtensionManager( css::uno::Reference< css::awt::XWindow > xParent,
63 const css::uno::Reference< css::uno::XComponentContext > &xContext );
64 virtual ~TheExtensionManager() override;
65
66 void createDialog( const bool bCreateUpdDlg );
67 sal_Int16 execute();
68
69 bool isModified() const { return m_bModified; }
70 void clearModified() { m_bModified = false; }
71
73 {
75 return m_xExtMgrDialog->getDialog();
77 return m_xUpdReqDialog->getDialog();
78 return nullptr;
79 }
81 {
83 return m_xExtMgrDialog.get();
84 return m_xUpdReqDialog.get();
85 }
87
88 void SetText( const OUString &rTitle );
89 void Show();
90 void ToTop();
91 void Close();
92 bool isVisible();
93
94
95 void checkUpdates();
96 bool installPackage( const OUString &rPackageURL, bool bWarnUser = false );
97 void createPackageList();
98
99 void terminateDialog();
100
101 // Tools
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;
107
108
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() );
113
114 // XEventListener
115 virtual void SAL_CALL disposing( css::lang::EventObject const & evt ) override;
116
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;
120
121 // XModifyListener
122 virtual void SAL_CALL modified( css::lang::EventObject const & evt ) override;
123};
124
125} // namespace dp_gui
126
127/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Manages installing of extensions in the GUI mode.
css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager
void SetText(const OUString &rTitle)
static ::rtl::Reference< TheExtensionManager > get(css::uno::Reference< css::uno::XComponentContext > const &xContext, css::uno::Reference< css::awt::XWindow > const &xParent=nullptr, OUString const &view=OUString())
ExtensionCmdQueue * getCmdQueue() const
css::uno::Reference< css::container::XNameAccess > m_xNameAccessNodes
bool installPackage(const OUString &rPackageURL, bool bWarnUser=false)
virtual void SAL_CALL notifyTermination(css::lang::EventObject const &evt) override
std::shared_ptr< ExtMgrDialog > m_xExtMgrDialog
const css::uno::Reference< css::deployment::XExtensionManager > & getExtensionManager() const
static PackageState getPackageState(const css::uno::Reference< css::deployment::XPackage > &xPackage)
css::uno::Reference< css::awt::XWindow > m_xParent
static ::rtl::Reference< TheExtensionManager > s_ExtMgr
const css::uno::Reference< css::uno::XComponentContext > & getContext() const
virtual void SAL_CALL queryTermination(css::lang::EventObject const &evt) override
std::unique_ptr< ExtensionCmdQueue > m_xExecuteCmdQueue
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool isReadOnly(const css::uno::Reference< css::deployment::XPackage > &xPackage) const
std::unique_ptr< UpdateRequiredDialog > m_xUpdReqDialog
TheExtensionManager(css::uno::Reference< css::awt::XWindow > xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual void SAL_CALL disposing(css::lang::EventObject const &evt) override
bool supportsOptions(const css::uno::Reference< css::deployment::XPackage > &xPackage) const
virtual ~TheExtensionManager() override
void createDialog(const bool bCreateUpdDlg)
virtual void SAL_CALL modified(css::lang::EventObject const &evt) override
css::uno::Reference< css::frame::XDesktop2 > m_xDesktop
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:2642
Definition: dp_gui.h:22
PackageState
Definition: dp_gui.h:24