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 ~UUIInteractionHelper();
94 bool handleRequest( css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
96 css::beans::Optional
< OUString
>
98 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
102 replaceMessageWithArguments(
103 const OUString
& aMessage
,
104 std::vector
< OUString
> const & rArguments
);
106 const css::uno::Reference
< css::uno::XComponentContext
>&
108 { return m_xContext
; }
112 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
,
113 bool bObtainErrorStringOnly
,
114 bool & bHasErrorString
,
115 OUString
& rErrorString
);
117 static void handlerequest(void* pHandleData
, void* pInteractionHandler
);
119 css::beans::Optional
< OUString
>
120 getStringFromRequest_impl(
121 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
123 static void getstringfromrequest(void* pHandleData
, void* pInteractionHandler
);
125 const css::uno::Reference
< css::awt::XWindow
>&
126 getParentXWindow() const;
128 css::uno::Reference
< css::task::XInteractionHandler2
>
129 getInteractionHandler();
131 bool handleTypedHandlerImplementations(
132 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
136 tryOtherInteractionHandler(
137 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
140 getInteractionHandlerList(InteractionHandlerDataList
&rdataList
);
143 isInformationalErrorMessageRequest(
145 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
148 handleInteractiveIOException(
149 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
,
150 bool bObtainErrorStringOnly
,
151 bool & bHasErrorString
,
152 OUString
& rErrorString
);
155 handleAuthenticationRequest(
156 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
159 handleCertificateValidationRequest(
160 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
163 handleNameClashResolveRequest(
164 css::ucb::NameClashResolveRequest
const & rRequest
,
166 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
169 handleMasterPasswordRequest(
170 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
173 handlePasswordRequest(
174 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
177 handleNoSuchFilterRequest(
178 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
181 handleFilterOptionsRequest(
183 css::task::XInteractionRequest
> const & rRequest
);
186 handleErrorHandlerRequest(
187 css::task::InteractionClassification eClassification
,
189 std::vector
< OUString
> const & rArguments
,
191 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
,
192 bool bObtainErrorStringOnly
,
193 bool & bHasErrorString
,
194 OUString
& rErrorString
);
197 handleGenericErrorRequest(
200 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
,
201 bool bObtainErrorStringOnly
,
202 bool & bHasErrorString
,
203 OUString
& rErrorString
);
206 handleMacroConfirmRequest(
207 const OUString
& aDocumentURL
,
208 const css::uno::Reference
< css::embed::XStorage
>& xZipStorage
,
209 const OUString
& aDocumentVersion
,
210 const css::uno::Sequence
< css::security::DocumentSignatureInformation
>& aSignInfo
,
212 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
215 handleBrokenPackageRequest(
216 std::vector
< OUString
> const & rArguments
,
218 css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
,
219 bool bObtainErrorStringOnly
,
220 bool & bHasErrorString
,
221 OUString
& rErrorString
);
223 bool handleLockedDocumentRequest(
224 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
226 bool handleChangedByOthersRequest(
228 css::task::XInteractionRequest
> const & rRequest
);
230 bool handleLockFileProblemRequest(
231 css::uno::Reference
< css::task::XInteractionRequest
> const & rRequest
);
233 bool handleCustomRequest(
234 const css::uno::Reference
< css::task::XInteractionRequest
>& i_rRequest
,
235 const OUString
& i_rServiceName
239 handleAuthFallbackRequest(
240 const OUString
& instructions
,
241 const OUString
& url
,
242 css::uno::Sequence
< css::uno::Reference
< css::task::XInteractionContinuation
> > const & rContinuations
);
247 const std::pair
<const char*, ErrCode
>* m_pStringArray
;
248 const std::locale
& m_rResLocale
;
250 explicit ErrorResource(const std::pair
<const char*, ErrCode
>* pStringArray
, const std::locale
& rResLocale
)
251 : m_pStringArray(pStringArray
)
252 , m_rResLocale(rResLocale
)
255 bool getString(ErrCode nErrorCode
, OUString
&rString
) const;
258 #endif // INCLUDED_UUI_SOURCE_IAHNDL_HXX
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */