Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / desktop / source / deployment / gui / dp_gui_extensioncmdqueue.hxx
blobff8fd73a692395a24e5fb643d3c2d43a70c26a33
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_EXTENSIONCMDQUEUE_HXX
21 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_EXTENSIONCMDQUEUE_HXX
23 #include <sal/config.h>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <rtl/ref.hxx>
28 #include <vector>
30 #include "dp_gui_updatedata.hxx"
32 /// @HTML
34 namespace com { namespace sun { namespace star {
35 namespace task { class XInteractionRequest; }
36 namespace uno { class XComponentContext; }
37 } } }
39 namespace dp_gui {
41 class DialogHelper;
42 class TheExtensionManager;
44 /**
45 Manages installing of extensions in the GUI mode. Requests for installing
46 Extensions can be asynchronous. For example, the Extension Manager is running
47 in an office process and someone uses the system integration to install an Extension.
48 That is, the user double clicks an extension symbol in a file browser, which then
49 causes an invocation of "unopkg gui ext". When at that time the Extension Manager
50 already performs a task, triggered by the user (for example, add, update, disable,
51 enable) then adding of the extension will be postponed until the user has finished
52 the task.
54 This class also ensures that the extensions are not installed in the main thread.
55 Doing so would cause a deadlock because of the progress bar which needs to be constantly
56 updated.
58 class ExtensionCmdQueue {
60 public:
61 /**
62 Create an instance.
64 ExtensionCmdQueue( DialogHelper * pDialogHelper,
65 TheExtensionManager *pManager,
66 const css::uno::Reference< css::uno::XComponentContext > & rContext);
68 ~ExtensionCmdQueue();
70 void addExtension( const OUString &rExtensionURL,
71 const OUString &rRepository,
72 const bool bWarnUser );
73 void removeExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage );
74 void enableExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage,
75 const bool bEnable );
76 void checkForUpdates(const std::vector< css::uno::Reference<
77 css::deployment::XPackage > > &vList );
78 void acceptLicense( const css::uno::Reference< css::deployment::XPackage > &rPackage );
79 static void syncRepositories( const css::uno::Reference< css::uno::XComponentContext > & xContext );
80 /**
81 This call does not block. It signals the internal thread
82 that it should install the remaining extensions and then terminate.
84 void stop();
86 bool isBusy();
87 private:
88 ExtensionCmdQueue(ExtensionCmdQueue const &) = delete;
89 ExtensionCmdQueue& operator =(ExtensionCmdQueue const &) = delete;
91 class Thread;
93 rtl::Reference< Thread > m_thread;
96 void handleInteractionRequest( const css::uno::Reference< css::uno::XComponentContext > & xContext,
97 const css::uno::Reference< css::task::XInteractionRequest > & xRequest );
101 #endif
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */