Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / desktop / source / deployment / manager / dp_commandenvironments.hxx
blob71759bc43337de6cc2dbb9f143681e84779847fd
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_MANAGER_DP_COMMANDENVIRONMENTS_HXX
21 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_MANAGER_DP_COMMANDENVIRONMENTS_HXX
23 #include <cppuhelper/implbase.hxx>
24 #include <ucbhelper/content.hxx>
26 namespace dp_manager {
28 /**
29 This command environment is to be used when an extension is temporarily
30 stored in the "tmp" repository. It prevents all kind of user interaction.
32 class BaseCommandEnv
33 : public ::cppu::WeakImplHelper< css::ucb::XCommandEnvironment,
34 css::task::XInteractionHandler,
35 css::ucb::XProgressHandler >
37 css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler;
38 protected:
39 void handle_(bool approve,
40 css::uno::Reference< css::task::XInteractionRequest> const & xRequest );
41 public:
42 virtual ~BaseCommandEnv() override;
43 BaseCommandEnv();
44 explicit BaseCommandEnv(
45 css::uno::Reference< css::task::XInteractionHandler> const & handler);
47 // XCommandEnvironment
48 virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL
49 getInteractionHandler() override;
50 virtual css::uno::Reference<css::ucb::XProgressHandler >
51 SAL_CALL getProgressHandler() override;
53 // XInteractionHandler
54 virtual void SAL_CALL handle(
55 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
57 // XProgressHandler
58 virtual void SAL_CALL push( css::uno::Any const & Status ) override;
59 virtual void SAL_CALL update( css::uno::Any const & Status ) override;
60 virtual void SAL_CALL pop() override;
63 class TmpRepositoryCommandEnv : public BaseCommandEnv
65 public:
66 TmpRepositoryCommandEnv();
67 explicit TmpRepositoryCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
69 // XInteractionHandler
70 virtual void SAL_CALL handle(
71 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
75 /** this class is for use in XPackageManager::synchronize.
77 It handles particular license cases.
79 class LicenseCommandEnv : public BaseCommandEnv
81 private:
82 OUString m_repository;
83 bool m_bSuppressLicense;
84 public:
85 LicenseCommandEnv(
86 css::uno::Reference< css::task::XInteractionHandler> const & handler,
87 bool bSuppressLicense,
88 OUString const & repository);
90 // XInteractionHandler
91 virtual void SAL_CALL handle(
92 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
96 /** this class is for use in XPackageManager::checkPrerequisites
98 It always prohibits a license interaction
100 class NoLicenseCommandEnv : public BaseCommandEnv
103 public:
104 explicit NoLicenseCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
106 // XInteractionHandler
107 virtual void SAL_CALL handle(
108 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
112 /* For use in XExtensionManager::addExtension in the call to
113 XPackage::checkPrerequisites
114 It prevents all user interactions. The license is always accepted.
115 It remembers if there was a platform or a dependency exception in
116 the member m_bException. if there was any other exception then m_bUnknownException
117 is set.
120 class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv
122 public:
123 SilentCheckPrerequisitesCommandEnv();
124 // XInteractionHandler
125 virtual void SAL_CALL handle(
126 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
128 // Set to true if a PlatformException or a DependencyException were handled.
129 css::uno::Any m_Exception;
130 // Set to true if an unknown exception was handled.
131 css::uno::Any m_UnknownException;
136 #endif
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */