nss: upgrade to release 3.73
[LibreOffice.git] / uui / source / iahndl.hxx
blob872bc13ac469486a4d812c55769728ae844ae871
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_UUI_SOURCE_IAHNDL_HXX
21 #define INCLUDED_UUI_SOURCE_IAHNDL_HXX
23 #include <rtl/ustring.hxx>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <com/sun/star/beans/Optional.hpp>
30 #include <com/sun/star/task/InteractionClassification.hpp>
32 #include <vcl/errcode.hxx>
34 #include <unordered_map>
35 #include <vector>
37 namespace com::sun::star {
38 namespace awt {
39 class XWindow;
41 namespace embed {
42 class XStorage;
44 namespace lang {
45 class XMultiServiceFactory;
47 namespace security {
48 struct DocumentSignatureInformation;
50 namespace task {
51 class XInteractionContinuation;
52 class XInteractionHandler2;
53 class XInteractionRequest;
55 namespace ucb {
56 class NameClashResolveRequest;
60 namespace vcl { class Window; }
62 struct InteractionHandlerData
64 /** The UNO service name to use to instantiate the content provider.
66 OUString ServiceName;
69 typedef std::vector< InteractionHandlerData > InteractionHandlerDataList;
71 typedef std::unordered_map< OUString, OUString > StringHashMap;
73 class UUIInteractionHelper
75 private:
76 css::uno::Reference< css::uno::XComponentContext > m_xContext;
77 css::uno::Reference< css::awt::XWindow > m_xWindowParam;
78 const OUString m_aContextParam;
79 StringHashMap m_aTypedCustomHandlers;
80 UUIInteractionHelper(UUIInteractionHelper const &) = delete;
81 UUIInteractionHelper& operator =(UUIInteractionHelper const &) = delete;
83 public:
84 UUIInteractionHelper(
85 css::uno::Reference< css::uno::XComponentContext > const & rxContext,
86 css::uno::Reference< css::awt::XWindow > const & rxWindow,
87 const OUString & rContextParam);
88 explicit UUIInteractionHelper(
89 css::uno::Reference< css::uno::XComponentContext > const & rxContext);
91 css::uno::Reference<css::awt::XWindow> GetParentWindow() const { return m_xWindowParam; }
92 void SetParentWindow(const css::uno::Reference<css::awt::XWindow>& rWindow) { m_xWindowParam = rWindow; }
94 ~UUIInteractionHelper();
96 bool handleRequest( css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
98 css::beans::Optional< OUString >
99 getStringFromRequest(
100 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
102 // Helper.
103 static OUString
104 replaceMessageWithArguments(
105 const OUString& aMessage,
106 std::vector< OUString > const & rArguments );
108 const css::uno::Reference< css::uno::XComponentContext >&
109 getORB() const
110 { return m_xContext; }
111 private:
112 bool
113 handleRequest_impl(
114 css::uno::Reference< css::task::XInteractionRequest > const & rRequest,
115 bool bObtainErrorStringOnly,
116 bool & bHasErrorString,
117 OUString & rErrorString);
119 static void handlerequest(void* pHandleData, void* pInteractionHandler);
121 css::beans::Optional< OUString >
122 getStringFromRequest_impl(
123 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
125 static void getstringfromrequest(void* pHandleData, void* pInteractionHandler);
127 const css::uno::Reference< css::awt::XWindow>&
128 getParentXWindow() const;
130 css::uno::Reference< css::task::XInteractionHandler2 >
131 getInteractionHandler() const;
133 bool handleTypedHandlerImplementations(
134 css::uno::Reference< css::task::XInteractionRequest > const & rRequest
137 bool
138 tryOtherInteractionHandler(
139 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
141 void
142 getInteractionHandlerList(InteractionHandlerDataList &rdataList);
144 static bool
145 isInformationalErrorMessageRequest(
146 css::uno::Sequence<
147 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
149 bool
150 handleInteractiveIOException(
151 css::uno::Reference< css::task::XInteractionRequest > const & rRequest,
152 bool bObtainErrorStringOnly,
153 bool & bHasErrorString,
154 OUString & rErrorString);
156 bool
157 handleAuthenticationRequest(
158 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
160 bool
161 handleCertificateValidationRequest(
162 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
164 void
165 handleNameClashResolveRequest(
166 css::ucb::NameClashResolveRequest const & rRequest,
167 css::uno::Sequence<
168 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
170 bool
171 handleMasterPasswordRequest(
172 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
174 bool
175 handlePasswordRequest(
176 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
178 bool
179 handleNoSuchFilterRequest(
180 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
182 bool
183 handleFilterOptionsRequest(
184 css::uno::Reference<
185 css::task::XInteractionRequest > const & rRequest);
187 void
188 handleErrorHandlerRequest(
189 css::task::InteractionClassification eClassification,
190 ErrCode nErrorCode,
191 std::vector< OUString > const & rArguments,
192 css::uno::Sequence<
193 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
194 bool bObtainErrorStringOnly,
195 bool & bHasErrorString,
196 OUString & rErrorString);
198 void
199 handleGenericErrorRequest(
200 ErrCode nErrorCode,
201 css::uno::Sequence<
202 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
203 bool bObtainErrorStringOnly,
204 bool & bHasErrorString,
205 OUString & rErrorString);
207 void
208 handleMacroConfirmRequest(
209 const OUString& aDocumentURL,
210 const css::uno::Reference< css::embed::XStorage >& xZipStorage,
211 const OUString& aDocumentVersion,
212 const css::uno::Sequence< css::security::DocumentSignatureInformation >& aSignInfo,
213 css::uno::Sequence<
214 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
216 void
217 handleBrokenPackageRequest(
218 std::vector< OUString > const & rArguments,
219 css::uno::Sequence<
220 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
221 bool bObtainErrorStringOnly,
222 bool & bHasErrorString,
223 OUString & rErrorString);
225 bool handleLockedDocumentRequest(
226 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
228 bool handleChangedByOthersRequest(
229 css::uno::Reference<
230 css::task::XInteractionRequest > const & rRequest);
232 bool handleLockFileProblemRequest(
233 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
235 bool handleCustomRequest(
236 const css::uno::Reference< css::task::XInteractionRequest >& i_rRequest,
237 const OUString& i_rServiceName
238 ) const;
240 void
241 handleAuthFallbackRequest(
242 const OUString & instructions,
243 const OUString & url,
244 css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations );
247 class ErrorResource
249 const std::pair<const char*, ErrCode>* m_pStringArray;
250 const std::locale& m_rResLocale;
251 public:
252 explicit ErrorResource(const std::pair<const char*, ErrCode>* pStringArray, const std::locale& rResLocale)
253 : m_pStringArray(pStringArray)
254 , m_rResLocale(rResLocale)
257 bool getString(ErrCode nErrorCode, OUString &rString) const;
260 #endif // INCLUDED_UUI_SOURCE_IAHNDL_HXX
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */