1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
37 namespace com::sun::star
{
45 class XMultiServiceFactory
;
48 struct DocumentSignatureInformation
;
51 class XInteractionContinuation
;
52 class XInteractionHandler2
;
53 class XInteractionRequest
;
56 class NameClashResolveRequest
;
60 namespace vcl
{ class Window
; }
62 struct InteractionHandlerData
64 /** The UNO service name to use to instantiate the content provider.
69 typedef std::vector
< InteractionHandlerData
> InteractionHandlerDataList
;
71 typedef std::unordered_map
< OUString
, OUString
> StringHashMap
;
73 class UUIInteractionHelper
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;
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
>
100 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
104 replaceMessageWithArguments(
105 const OUString
& aMessage
,
106 std::vector
< OUString
> const & rArguments
);
108 const css::uno::Reference
< css::uno::XComponentContext
>&
110 { return m_xContext
; }
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
138 tryOtherInteractionHandler(
139 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
142 getInteractionHandlerList(InteractionHandlerDataList
&rdataList
);
145 isInformationalErrorMessageRequest(
147 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
150 handleInteractiveIOException(
151 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
,
152 bool bObtainErrorStringOnly
,
153 bool & bHasErrorString
,
154 OUString
& rErrorString
);
157 handleAuthenticationRequest(
158 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
161 handleCertificateValidationRequest(
162 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
165 handleNameClashResolveRequest(
166 css::ucb::NameClashResolveRequest
const & rRequest
,
168 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
171 handleMasterPasswordRequest(
172 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
175 handlePasswordRequest(
176 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
179 handleNoSuchFilterRequest(
180 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
183 handleFilterOptionsRequest(
185 css::task::XInteractionRequest
> const & rRequest
);
188 handleErrorHandlerRequest(
189 css::task::InteractionClassification eClassification
,
191 std::vector
< OUString
> const & rArguments
,
193 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
,
194 bool bObtainErrorStringOnly
,
195 bool & bHasErrorString
,
196 OUString
& rErrorString
);
199 handleGenericErrorRequest(
202 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
,
203 bool bObtainErrorStringOnly
,
204 bool & bHasErrorString
,
205 OUString
& rErrorString
);
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
,
214 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
217 handleBrokenPackageRequest(
218 std::vector
< OUString
> const & rArguments
,
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(
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
241 handleAuthFallbackRequest(
242 const OUString
& instructions
,
243 const OUString
& url
,
244 css::uno::Sequence
< css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
249 const std::pair
<const char*, ErrCode
>* m_pStringArray
;
250 const std::locale
& m_rResLocale
;
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: */