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 UUI_IAHNDL_HXX
21 #define UUI_IAHNDL_HXX
25 #include "osl/mutex.hxx"
26 #include "rtl/ustring.hxx"
28 #include "com/sun/star/uno/Reference.hxx"
29 #include "com/sun/star/uno/Sequence.hxx"
30 #include "com/sun/star/uno/XComponentContext.hpp"
32 #include "com/sun/star/beans/Optional.hpp"
33 #include "com/sun/star/task/InteractionClassification.hpp"
35 #include "tools/solar.h" // sal_uInt16
36 #include "tools/errcode.hxx" // ErrCode
37 #include "tools/rc.hxx" // Resource
38 #include "tools/wintypes.hxx" // WinBits
40 namespace com
{ namespace sun
{ namespace star
{
48 class XMultiServiceFactory
;
51 struct DocumentSignatureInformation
;
54 class FutureDocumentVersionProductUpdateRequest
;
55 class XInteractionContinuation
;
56 class XInteractionHandler2
;
57 class XInteractionRequest
;
60 class NameClashResolveRequest
;
64 #include <boost/unordered_map.hpp>
68 //============================================================================
69 struct InteractionHandlerData
71 /** The UNO service name to use to instanciate the content provider.
75 InteractionHandlerData() {};
76 InteractionHandlerData(const OUString
& rService
)
77 : ServiceName( rService
){}
80 typedef std::vector
< InteractionHandlerData
> InteractionHandlerDataList
;
82 typedef ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionContinuation
> > Continuations
;
84 typedef ::boost::unordered_map
< OUString
, OUString
, OUStringHash
> StringHashMap
;
86 //============================================================================
87 class UUIInteractionHelper
90 mutable osl::Mutex m_aPropertyMutex
;
91 ::com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> m_xContext
;
92 ::com::sun::star::uno::Reference
< com::sun::star::awt::XWindow
> m_xWindowParam
;
93 const OUString m_aContextParam
;
94 StringHashMap m_aTypedCustomHandlers
;
95 UUIInteractionHelper(UUIInteractionHelper
&); // not implemented
96 void operator =(UUIInteractionHelper
); // not implemented
100 com::sun::star::uno::Reference
<
101 com::sun::star::uno::XComponentContext
> const & rxContext
,
102 com::sun::star::uno::Reference
<
103 com::sun::star::awt::XWindow
> const & rxWindow
,
104 const OUString
& rContextParam
)
106 UUIInteractionHelper(
107 com::sun::star::uno::Reference
<
108 com::sun::star::uno::XComponentContext
> const & rxContext
)
111 ~UUIInteractionHelper() SAL_THROW(());
115 com::sun::star::uno::Reference
<
116 com::sun::star::task::XInteractionRequest
> const & rRequest
)
117 SAL_THROW((com::sun::star::uno::RuntimeException
));
119 com::sun::star::beans::Optional
< OUString
>
120 getStringFromRequest(
121 com::sun::star::uno::Reference
<
122 com::sun::star::task::XInteractionRequest
> const & rRequest
)
123 SAL_THROW((com::sun::star::uno::RuntimeException
));
127 replaceMessageWithArguments(
129 std::vector
< OUString
> const & rArguments
);
131 ::com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>
133 { return m_xContext
; }
137 com::sun::star::uno::Reference
<
138 com::sun::star::task::XInteractionRequest
> const & rRequest
,
139 bool bObtainErrorStringOnly
,
140 bool & bHasErrorString
,
141 OUString
& rErrorString
)
142 SAL_THROW((com::sun::star::uno::RuntimeException
));
145 handlerequest(void* pHandleData
, void* pInteractionHandler
);
147 com::sun::star::beans::Optional
< OUString
>
148 getStringFromRequest_impl(
149 com::sun::star::uno::Reference
<
150 com::sun::star::task::XInteractionRequest
> const & rRequest
)
151 SAL_THROW((com::sun::star::uno::RuntimeException
));
154 getstringfromrequest(void* pHandleData
, void* pInteractionHandler
);
160 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
>
161 getParentXWindow() const
168 com::sun::star::uno::Reference
< com::sun::star::task::XInteractionHandler2
>
169 getInteractionHandler()
170 SAL_THROW((com::sun::star::uno::RuntimeException
));
172 bool handleTypedHandlerImplementations(
173 ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionRequest
> const & rRequest
177 tryOtherInteractionHandler(
178 com::sun::star::uno::Reference
<
179 com::sun::star::task::XInteractionRequest
> const & rRequest
)
180 SAL_THROW((com::sun::star::uno::RuntimeException
));
183 getInteractionHandlerList(InteractionHandlerDataList
&rdataList
)
184 SAL_THROW((com::sun::star::uno::RuntimeException
));
187 isInformationalErrorMessageRequest(
188 com::sun::star::uno::Sequence
<
189 com::sun::star::uno::Reference
<
190 com::sun::star::task::XInteractionContinuation
> > const &
193 //=====================================================================
196 handleInteractiveIOException(
197 com::sun::star::uno::Reference
<
198 com::sun::star::task::XInteractionRequest
> const & rRequest
,
199 bool bObtainErrorStringOnly
,
200 bool & bHasErrorString
,
201 OUString
& rErrorString
)
202 SAL_THROW((com::sun::star::uno::RuntimeException
));
205 handleAuthenticationRequest(
206 com::sun::star::uno::Reference
<
207 com::sun::star::task::XInteractionRequest
> const & rRequest
)
208 SAL_THROW((com::sun::star::uno::RuntimeException
));
211 handleCertificateValidationRequest(
212 com::sun::star::uno::Reference
<
213 com::sun::star::task::XInteractionRequest
> const & rRequest
)
214 SAL_THROW((com::sun::star::uno::RuntimeException
));
217 handleNameClashResolveRequest(
218 com::sun::star::ucb::NameClashResolveRequest
const & rRequest
,
219 com::sun::star::uno::Sequence
<
220 com::sun::star::uno::Reference
<
221 com::sun::star::task::XInteractionContinuation
> > const &
223 SAL_THROW((com::sun::star::uno::RuntimeException
));
226 handleMasterPasswordRequest(
227 com::sun::star::uno::Reference
<
228 com::sun::star::task::XInteractionRequest
> const & rRequest
)
229 SAL_THROW((com::sun::star::uno::RuntimeException
));
232 handlePasswordRequest(
233 com::sun::star::uno::Reference
<
234 com::sun::star::task::XInteractionRequest
> const & rRequest
)
235 SAL_THROW((com::sun::star::uno::RuntimeException
));
238 handleNoSuchFilterRequest(
239 com::sun::star::uno::Reference
<
240 com::sun::star::task::XInteractionRequest
> const & rRequest
)
241 SAL_THROW((com::sun::star::uno::RuntimeException
));
244 handleAmbigousFilterRequest(
245 com::sun::star::uno::Reference
<
246 com::sun::star::task::XInteractionRequest
> const & rRequest
)
247 SAL_THROW((com::sun::star::uno::RuntimeException
));
250 handleFilterOptionsRequest(
251 com::sun::star::uno::Reference
<
252 com::sun::star::task::XInteractionRequest
> const & rRequest
)
253 SAL_THROW((com::sun::star::uno::RuntimeException
));
256 handleErrorHandlerRequest(
257 com::sun::star::task::InteractionClassification eClassification
,
259 std::vector
< OUString
> const & rArguments
,
260 com::sun::star::uno::Sequence
<
261 com::sun::star::uno::Reference
<
262 com::sun::star::task::XInteractionContinuation
> > const &
264 bool bObtainErrorStringOnly
,
265 bool & bHasErrorString
,
266 OUString
& rErrorString
)
267 SAL_THROW((com::sun::star::uno::RuntimeException
));
270 handleGenericErrorRequest(
271 sal_Int32 nErrorCode
,
272 com::sun::star::uno::Sequence
<
273 com::sun::star::uno::Reference
<
274 com::sun::star::task::XInteractionContinuation
> > const &
276 bool bObtainErrorStringOnly
,
277 bool & bHasErrorString
,
278 OUString
& rErrorString
)
279 SAL_THROW((com::sun::star::uno::RuntimeException
));
282 handleMacroConfirmRequest(
283 const OUString
& aDocumentURL
,
284 const ::com::sun::star::uno::Reference
<
285 ::com::sun::star::embed::XStorage
>& xZipStorage
,
286 const OUString
& aDocumentVersion
,
287 const ::com::sun::star::uno::Sequence
<
288 ::com::sun::star::security::DocumentSignatureInformation
>
290 com::sun::star::uno::Sequence
<
291 com::sun::star::uno::Reference
<
292 com::sun::star::task::XInteractionContinuation
> > const &
294 SAL_THROW((com::sun::star::uno::RuntimeException
));
297 handleFutureDocumentVersionUpdateRequest(
298 const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest
&
300 com::sun::star::uno::Sequence
<
301 com::sun::star::uno::Reference
<
302 com::sun::star::task::XInteractionContinuation
> > const &
304 SAL_THROW((com::sun::star::uno::RuntimeException
));
307 handleBrokenPackageRequest(
308 std::vector
< OUString
> const & rArguments
,
309 ::com::sun::star::uno::Sequence
<
310 ::com::sun::star::uno::Reference
<
311 ::com::sun::star::task::XInteractionContinuation
> > const &
313 bool bObtainErrorStringOnly
,
314 bool & bHasErrorString
,
315 OUString
& rErrorString
)
316 SAL_THROW((::com::sun::star::uno::RuntimeException
));
318 bool handleLockedDocumentRequest(
319 com::sun::star::uno::Reference
<
320 com::sun::star::task::XInteractionRequest
> const & rRequest
)
321 SAL_THROW((::com::sun::star::uno::RuntimeException
));
323 bool handleChangedByOthersRequest(
324 com::sun::star::uno::Reference
<
325 com::sun::star::task::XInteractionRequest
> const & rRequest
)
326 SAL_THROW((::com::sun::star::uno::RuntimeException
));
328 bool handleLockFileIgnoreRequest(
329 com::sun::star::uno::Reference
<
330 com::sun::star::task::XInteractionRequest
> const & rRequest
)
331 SAL_THROW((::com::sun::star::uno::RuntimeException
));
333 bool handleCustomRequest(
334 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionRequest
>& i_rRequest
,
335 const OUString
& i_rServiceName
339 class ErrorResource
: private Resource
342 inline ErrorResource(ResId
& rResId
) SAL_THROW(()): Resource(rResId
) {}
344 inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
346 bool getString(ErrCode nErrorCode
, OUString
&rString
) const
350 #endif // UUI_IAHNDL_HXX
352 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */