tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / desktop / source / deployment / manager / dp_commandenvironments.hxx
blob6533d45b4fc362a4db44015fcfd81effb4b148fe
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 #pragma once
22 #include <cppuhelper/implbase.hxx>
23 #include <com/sun/star/task/XInteractionHandler.hpp>
24 #include <com/sun/star/task/XInteractionRequest.hpp>
25 #include <com/sun/star/ucb/XProgressHandler.hpp>
26 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
29 namespace dp_manager {
31 /**
32 This command environment is to be used when an extension is temporarily
33 stored in the "tmp" repository. It prevents all kind of user interaction.
35 class BaseCommandEnv
36 : public ::cppu::WeakImplHelper< css::ucb::XCommandEnvironment,
37 css::task::XInteractionHandler,
38 css::ucb::XProgressHandler >
40 css::uno::Reference< css::task::XInteractionHandler> m_forwardHandler;
41 protected:
42 void handle_(bool approve,
43 css::uno::Reference< css::task::XInteractionRequest> const & xRequest );
44 public:
45 virtual ~BaseCommandEnv() override;
46 BaseCommandEnv();
47 explicit BaseCommandEnv(
48 css::uno::Reference< css::task::XInteractionHandler> const & handler);
50 // XCommandEnvironment
51 virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL
52 getInteractionHandler() override;
53 virtual css::uno::Reference<css::ucb::XProgressHandler >
54 SAL_CALL getProgressHandler() override;
56 // XInteractionHandler
57 virtual void SAL_CALL handle(
58 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
60 // XProgressHandler
61 virtual void SAL_CALL push( css::uno::Any const & Status ) override;
62 virtual void SAL_CALL update( css::uno::Any const & Status ) override;
63 virtual void SAL_CALL pop() override;
66 class TmpRepositoryCommandEnv : public BaseCommandEnv
68 public:
69 TmpRepositoryCommandEnv();
70 explicit TmpRepositoryCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
72 // XInteractionHandler
73 virtual void SAL_CALL handle(
74 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
78 /** this class is for use in XPackageManager::synchronize.
80 It handles particular license cases.
82 class LicenseCommandEnv : public BaseCommandEnv
84 private:
85 OUString m_repository;
86 bool m_bSuppressLicense;
87 public:
88 LicenseCommandEnv(
89 css::uno::Reference< css::task::XInteractionHandler> const & handler,
90 bool bSuppressLicense,
91 OUString repository);
93 // XInteractionHandler
94 virtual void SAL_CALL handle(
95 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
99 /** this class is for use in XPackageManager::checkPrerequisites
101 It always prohibits a license interaction
103 class NoLicenseCommandEnv : public BaseCommandEnv
106 public:
107 explicit NoLicenseCommandEnv(css::uno::Reference< css::task::XInteractionHandler> const & handler);
109 // XInteractionHandler
110 virtual void SAL_CALL handle(
111 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
115 /* For use in XExtensionManager::addExtension in the call to
116 XPackage::checkPrerequisites
117 It prevents all user interactions. The license is always accepted.
118 It remembers if there was a platform or a dependency exception in
119 the member m_bException. if there was any other exception then m_bUnknownException
120 is set.
123 class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv
125 public:
126 SilentCheckPrerequisitesCommandEnv();
127 // XInteractionHandler
128 virtual void SAL_CALL handle(
129 css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override;
131 // Set to true if a PlatformException or a DependencyException were handled.
132 css::uno::Any m_Exception;
133 // Set to true if an unknown exception was handled.
134 css::uno::Any m_UnknownException;
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */