Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / uui / source / iahndl.hxx
blobdb39affb659a8c19f7101d5ddb64f302448643f0
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>
33 #include <tools/wintypes.hxx>
35 #include <unordered_map>
36 #include <vector>
38 namespace com { namespace sun { namespace star {
39 namespace awt {
40 class XWindow;
42 namespace embed {
43 class XStorage;
45 namespace lang {
46 class XMultiServiceFactory;
48 namespace security {
49 struct DocumentSignatureInformation;
51 namespace task {
52 class XInteractionContinuation;
53 class XInteractionHandler2;
54 class XInteractionRequest;
56 namespace ucb {
57 class NameClashResolveRequest;
59 } } }
61 namespace vcl { class Window; }
63 struct InteractionHandlerData
65 /** The UNO service name to use to instantiate the content provider.
67 OUString ServiceName;
70 typedef std::vector< InteractionHandlerData > InteractionHandlerDataList;
72 typedef std::unordered_map< OUString, OUString > StringHashMap;
74 class UUIInteractionHelper
76 private:
77 css::uno::Reference< css::uno::XComponentContext > m_xContext;
78 css::uno::Reference< css::awt::XWindow > m_xWindowParam;
79 const OUString m_aContextParam;
80 StringHashMap m_aTypedCustomHandlers;
81 UUIInteractionHelper(UUIInteractionHelper const &) = delete;
82 UUIInteractionHelper& operator =(UUIInteractionHelper const &) = delete;
84 public:
85 UUIInteractionHelper(
86 css::uno::Reference< css::uno::XComponentContext > const & rxContext,
87 css::uno::Reference< css::awt::XWindow > const & rxWindow,
88 const OUString & rContextParam);
89 explicit UUIInteractionHelper(
90 css::uno::Reference< css::uno::XComponentContext > const & rxContext);
92 css::uno::Reference<css::awt::XWindow> GetParentWindow() const { return m_xWindowParam; }
93 void SetParentWindow(const css::uno::Reference<css::awt::XWindow>& rWindow) { m_xWindowParam = rWindow; }
95 ~UUIInteractionHelper();
97 bool handleRequest( css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
99 css::beans::Optional< OUString >
100 getStringFromRequest(
101 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
103 // Helper.
104 static OUString
105 replaceMessageWithArguments(
106 const OUString& aMessage,
107 std::vector< OUString > const & rArguments );
109 const css::uno::Reference< css::uno::XComponentContext >&
110 getORB() const
111 { return m_xContext; }
112 private:
113 bool
114 handleRequest_impl(
115 css::uno::Reference< css::task::XInteractionRequest > const & rRequest,
116 bool bObtainErrorStringOnly,
117 bool & bHasErrorString,
118 OUString & rErrorString);
120 static void handlerequest(void* pHandleData, void* pInteractionHandler);
122 css::beans::Optional< OUString >
123 getStringFromRequest_impl(
124 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
126 static void getstringfromrequest(void* pHandleData, void* pInteractionHandler);
128 const css::uno::Reference< css::awt::XWindow>&
129 getParentXWindow() const;
131 css::uno::Reference< css::task::XInteractionHandler2 >
132 getInteractionHandler() const;
134 bool handleTypedHandlerImplementations(
135 css::uno::Reference< css::task::XInteractionRequest > const & rRequest
138 bool
139 tryOtherInteractionHandler(
140 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
142 void
143 getInteractionHandlerList(InteractionHandlerDataList &rdataList);
145 static bool
146 isInformationalErrorMessageRequest(
147 css::uno::Sequence<
148 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
150 bool
151 handleInteractiveIOException(
152 css::uno::Reference< css::task::XInteractionRequest > const & rRequest,
153 bool bObtainErrorStringOnly,
154 bool & bHasErrorString,
155 OUString & rErrorString);
157 bool
158 handleAuthenticationRequest(
159 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
161 bool
162 handleCertificateValidationRequest(
163 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
165 void
166 handleNameClashResolveRequest(
167 css::ucb::NameClashResolveRequest const & rRequest,
168 css::uno::Sequence<
169 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
171 bool
172 handleMasterPasswordRequest(
173 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
175 bool
176 handlePasswordRequest(
177 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
179 bool
180 handleNoSuchFilterRequest(
181 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
183 bool
184 handleFilterOptionsRequest(
185 css::uno::Reference<
186 css::task::XInteractionRequest > const & rRequest);
188 void
189 handleErrorHandlerRequest(
190 css::task::InteractionClassification eClassification,
191 ErrCode nErrorCode,
192 std::vector< OUString > const & rArguments,
193 css::uno::Sequence<
194 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
195 bool bObtainErrorStringOnly,
196 bool & bHasErrorString,
197 OUString & rErrorString);
199 void
200 handleGenericErrorRequest(
201 ErrCode nErrorCode,
202 css::uno::Sequence<
203 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
204 bool bObtainErrorStringOnly,
205 bool & bHasErrorString,
206 OUString & rErrorString);
208 void
209 handleMacroConfirmRequest(
210 const OUString& aDocumentURL,
211 const css::uno::Reference< css::embed::XStorage >& xZipStorage,
212 const OUString& aDocumentVersion,
213 const css::uno::Sequence< css::security::DocumentSignatureInformation >& aSignInfo,
214 css::uno::Sequence<
215 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations);
217 void
218 handleBrokenPackageRequest(
219 std::vector< OUString > const & rArguments,
220 css::uno::Sequence<
221 css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations,
222 bool bObtainErrorStringOnly,
223 bool & bHasErrorString,
224 OUString & rErrorString);
226 bool handleLockedDocumentRequest(
227 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
229 bool handleChangedByOthersRequest(
230 css::uno::Reference<
231 css::task::XInteractionRequest > const & rRequest);
233 bool handleLockFileProblemRequest(
234 css::uno::Reference< css::task::XInteractionRequest > const & rRequest);
236 bool handleCustomRequest(
237 const css::uno::Reference< css::task::XInteractionRequest >& i_rRequest,
238 const OUString& i_rServiceName
239 ) const;
241 void
242 handleAuthFallbackRequest(
243 const OUString & instructions,
244 const OUString & url,
245 css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations );
248 class ErrorResource
250 const std::pair<const char*, ErrCode>* m_pStringArray;
251 const std::locale& m_rResLocale;
252 public:
253 explicit ErrorResource(const std::pair<const char*, ErrCode>* pStringArray, const std::locale& rResLocale)
254 : m_pStringArray(pStringArray)
255 , m_rResLocale(rResLocale)
258 bool getString(ErrCode nErrorCode, OUString &rString) const;
261 #endif // INCLUDED_UUI_SOURCE_IAHNDL_HXX
263 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */