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>
33 #include <tools/wintypes.hxx>
35 #include <unordered_map>
38 namespace com
{ namespace sun
{ namespace star
{
46 class XMultiServiceFactory
;
49 struct DocumentSignatureInformation
;
52 class XInteractionContinuation
;
53 class XInteractionHandler2
;
54 class XInteractionRequest
;
57 class NameClashResolveRequest
;
61 namespace vcl
{ class Window
; }
63 struct InteractionHandlerData
65 /** The UNO service name to use to instantiate the content provider.
70 typedef std::vector
< InteractionHandlerData
> InteractionHandlerDataList
;
72 typedef std::unordered_map
< OUString
, OUString
> StringHashMap
;
74 class UUIInteractionHelper
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;
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
);
105 replaceMessageWithArguments(
106 const OUString
& aMessage
,
107 std::vector
< OUString
> const & rArguments
);
109 const css::uno::Reference
< css::uno::XComponentContext
>&
111 { return m_xContext
; }
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
139 tryOtherInteractionHandler(
140 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
143 getInteractionHandlerList(InteractionHandlerDataList
&rdataList
);
146 isInformationalErrorMessageRequest(
148 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
151 handleInteractiveIOException(
152 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
,
153 bool bObtainErrorStringOnly
,
154 bool & bHasErrorString
,
155 OUString
& rErrorString
);
158 handleAuthenticationRequest(
159 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
162 handleCertificateValidationRequest(
163 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
166 handleNameClashResolveRequest(
167 css::ucb::NameClashResolveRequest
const & rRequest
,
169 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
172 handleMasterPasswordRequest(
173 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
176 handlePasswordRequest(
177 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
180 handleNoSuchFilterRequest(
181 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
184 handleFilterOptionsRequest(
186 css::task::XInteractionRequest
> const & rRequest
);
189 handleErrorHandlerRequest(
190 css::task::InteractionClassification eClassification
,
192 std::vector
< OUString
> const & rArguments
,
194 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
,
195 bool bObtainErrorStringOnly
,
196 bool & bHasErrorString
,
197 OUString
& rErrorString
);
200 handleGenericErrorRequest(
203 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
,
204 bool bObtainErrorStringOnly
,
205 bool & bHasErrorString
,
206 OUString
& rErrorString
);
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
,
215 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
218 handleBrokenPackageRequest(
219 std::vector
< OUString
> const & rArguments
,
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(
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
242 handleAuthFallbackRequest(
243 const OUString
& instructions
,
244 const OUString
& url
,
245 css::uno::Sequence
< css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
250 const std::pair
<const char*, ErrCode
>* m_pStringArray
;
251 const std::locale
& m_rResLocale
;
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: */