1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: iahndl.hxx,v $
10 * $Revision: 1.21.22.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef UUI_IAHNDL_HXX
32 #define UUI_IAHNDL_HXX
34 #ifndef INCLUDED_VECTOR
36 #define INCLUDED_VECTOR
38 #include "osl/mutex.hxx"
39 #include "com/sun/star/uno/Reference.hxx"
40 #include "com/sun/star/uno/Sequence.hxx"
42 #include "com/sun/star/beans/Optional.hpp"
43 #include "com/sun/star/embed/XStorage.hpp"
44 #include "com/sun/star/task/InteractionClassification.hpp"
45 #include "com/sun/star/task/PasswordRequestMode.hpp"
46 #include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
47 #include "com/sun/star/security/DocumentSignatureInformation.hpp"
48 #include "tools/solar.h"
49 #include "tools/errcode.hxx"
50 #include "vcl/wintypes.hxx"
52 #include <com/sun/star/security/XCertificate.hpp>
53 #ifndef _COM_SUN_STAR_XML_CRYPTO_XXSECURITYENVIRONMENT_HPP_
54 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
59 struct CntHTTPCookieRequest
;
61 #define DESCRIPTION_1 1
62 #define DESCRIPTION_2 2
65 #define UUI_DOC_LOAD_LOCK 0
66 #define UUI_DOC_OWN_LOAD_LOCK 1
67 #define UUI_DOC_SAVE_LOCK 2
68 #define UUI_DOC_OWN_SAVE_LOCK 3
70 //============================================================================
71 /** Information about a InteractionHandler
73 struct InteractionHandlerData
75 /** The UNO service name to use to instanciate the content provider.
77 rtl::OUString ServiceName
;
79 InteractionHandlerData() {};
80 InteractionHandlerData( const rtl::OUString
& rService
)
81 : ServiceName( rService
){}
84 typedef std::vector
< InteractionHandlerData
> InteractionHandlerDataList
;
86 namespace cssu
= com::sun::star::uno
;
87 namespace dcss
= ::com::sun::star
;
89 namespace com
{ namespace sun
{ namespace star
{
91 class AmbigousFilterRequest
;
92 class FilterOptionsRequest
;
93 class NoSuchFilterRequest
;
96 class XMultiServiceFactory
;
99 class XInteractionContinuation
;
100 class XInteractionHandler
;
101 class XInteractionRequest
;
102 class XPasswordContainer
;
106 class AuthenticationRequest
;
107 class HandleCookiesRequest
;
108 class NameClashResolveRequest
;
109 class CertificateValidationRequest
;
112 class RuntimeException
;
116 class UUIInteractionHelper
119 osl::Mutex m_aPropertyMutex
;
120 com::sun::star::uno::Reference
<
121 com::sun::star::lang::XMultiServiceFactory
>
123 com::sun::star::uno::Sequence
< com::sun::star::uno::Any
> m_aProperties
;
125 UUIInteractionHelper(UUIInteractionHelper
&); // not implemented
126 void operator =(UUIInteractionHelper
); // not implemented
129 UUIInteractionHelper(com::sun::star::uno::Reference
<
130 com::sun::star::lang::XMultiServiceFactory
>
131 const & rServiceFactory
,
132 com::sun::star::uno::Sequence
<
133 com::sun::star::uno::Any
> const & rArguments
)
135 UUIInteractionHelper(com::sun::star::uno::Reference
<
136 com::sun::star::lang::XMultiServiceFactory
>
137 const & rServiceFactory
)
140 ~UUIInteractionHelper() SAL_THROW(());
143 handleRequest(com::sun::star::uno::Reference
<
144 com::sun::star::task::XInteractionRequest
> const &
146 throw (com::sun::star::uno::RuntimeException
);
148 com::sun::star::beans::Optional
< rtl::OUString
>
149 getStringFromRequest(com::sun::star::uno::Reference
<
150 com::sun::star::task::XInteractionRequest
> const &
152 throw (com::sun::star::uno::RuntimeException
);
156 handle_impl(com::sun::star::uno::Reference
<
157 com::sun::star::task::XInteractionRequest
> const &
159 throw (com::sun::star::uno::RuntimeException
);
162 GetInteractionHandlerList(InteractionHandlerDataList
&rdataList
);
165 isDomainMatch( rtl::OUString hostName
, rtl::OUString certHostName
);
167 handlerequest(void* pHandleData
, void* pInteractionHandler
);
169 com::sun::star::beans::Optional
< rtl::OUString
>
170 getStringFromRequest_impl(com::sun::star::uno::Reference
<
171 com::sun::star::task::XInteractionRequest
> const &
173 throw (com::sun::star::uno::RuntimeException
);
176 getstringfromrequest(void* pHandleData
, void* pInteractionHandler
);
178 Window
* getParentProperty() SAL_THROW(());
180 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> getParentXWindow() SAL_THROW(());
182 rtl::OUString
getContextProperty() SAL_THROW(());
185 initPasswordContainer(com::sun::star::uno::Reference
<
186 com::sun::star::task::XPasswordContainer
> *
188 com::sun::star::uno::Reference
<
189 com::sun::star::task::XUrlContainer
> *
193 com::sun::star::uno::Reference
< com::sun::star::task::XInteractionHandler
>
194 getInteractionHandler() const
195 SAL_THROW((com::sun::star::uno::RuntimeException
));
197 void executeLoginDialog(LoginErrorInfo
& rInfo
,
198 rtl::OUString
const & rRealm
)
199 SAL_THROW((com::sun::star::uno::RuntimeException
));
202 executeMasterPasswordDialog(LoginErrorInfo
& rInfo
,
203 com::sun::star::task::PasswordRequestMode nMode
)
204 SAL_THROW((com::sun::star::uno::RuntimeException
));
207 executePasswordDialog(LoginErrorInfo
& rInfo
,
208 com::sun::star::task::PasswordRequestMode nMode
,
209 ::rtl::OUString aDocumentName
)
210 SAL_THROW((com::sun::star::uno::RuntimeException
));
213 executeMSPasswordDialog(LoginErrorInfo
& rInfo
,
214 com::sun::star::task::PasswordRequestMode nMode
,
215 ::rtl::OUString aDocumentName
)
216 SAL_THROW((com::sun::star::uno::RuntimeException
));
218 void executeCookieDialog(CntHTTPCookieRequest
& rRequest
)
219 SAL_THROW((com::sun::star::uno::RuntimeException
));
221 void executeFilterDialog(rtl::OUString
const & rURL
,
222 uui::FilterNameList
const & rFilters
,
223 rtl::OUString
& rFilter
)
224 SAL_THROW((com::sun::star::uno::RuntimeException
));
226 sal_Bool
executeUnknownAuthDialog( const cssu::Reference
< dcss::security::XCertificate
>& rXCert
)
227 SAL_THROW((com::sun::star::uno::RuntimeException
));
229 sal_Bool
executeSSLWarnDialog( const cssu::Reference
< dcss::security::XCertificate
>& rXCert
,
230 sal_Int32
const & failures
,
231 const rtl::OUString
& hostName
)
232 SAL_THROW((com::sun::star::uno::RuntimeException
));
235 getLocalizedDatTimeStr( ::com::sun::star::util::DateTime aDateTime
);
238 executeErrorDialog(com::sun::star::task::InteractionClassification
240 rtl::OUString
const & rContext
,
241 rtl::OUString
const & rMessage
,
242 WinBits nButtonMask
)
243 SAL_THROW((com::sun::star::uno::RuntimeException
));
246 executeMessageBox( rtl::OUString
const & rTitle
,
247 rtl::OUString
const & rMessage
,
248 WinBits nButtonMask
)
249 SAL_THROW((com::sun::star::uno::RuntimeException
));
252 handleAuthenticationRequest(
253 com::sun::star::ucb::AuthenticationRequest
const & rRequest
,
254 com::sun::star::uno::Sequence
<
255 com::sun::star::uno::Reference
<
256 com::sun::star::task::XInteractionContinuation
> > const &
258 rtl::OUString
const & rURL
)
259 SAL_THROW((com::sun::star::uno::RuntimeException
));
262 handleCertificateValidationRequest(
263 com::sun::star::ucb::CertificateValidationRequest
const & rRequest
,
264 com::sun::star::uno::Sequence
<
265 com::sun::star::uno::Reference
<
266 com::sun::star::task::XInteractionContinuation
> > const &
268 SAL_THROW((com::sun::star::uno::RuntimeException
));
271 handleNameClashResolveRequest(
272 com::sun::star::ucb::NameClashResolveRequest
const & rRequest
,
273 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
<
274 com::sun::star::task::XInteractionContinuation
> > const &
276 SAL_THROW((com::sun::star::uno::RuntimeException
));
279 handleMasterPasswordRequest(
280 com::sun::star::task::PasswordRequestMode nMode
,
281 com::sun::star::uno::Sequence
<
282 com::sun::star::uno::Reference
<
283 com::sun::star::task::XInteractionContinuation
> > const &
285 SAL_THROW((com::sun::star::uno::RuntimeException
));
289 handlePasswordRequest(
290 com::sun::star::task::PasswordRequestMode nMode
,
291 com::sun::star::uno::Sequence
<
292 com::sun::star::uno::Reference
<
293 com::sun::star::task::XInteractionContinuation
> > const &
295 ::rtl::OUString aDocumentName
= ::rtl::OUString())
296 SAL_THROW((com::sun::star::uno::RuntimeException
));
299 handleMSPasswordRequest(
300 com::sun::star::task::PasswordRequestMode nMode
,
301 com::sun::star::uno::Sequence
<
302 com::sun::star::uno::Reference
<
303 com::sun::star::task::XInteractionContinuation
> > const &
305 ::rtl::OUString aDocumentName
= ::rtl::OUString())
306 SAL_THROW((com::sun::star::uno::RuntimeException
));
309 handleCookiesRequest(
310 com::sun::star::ucb::HandleCookiesRequest
const & rRequest
,
311 com::sun::star::uno::Sequence
<
312 com::sun::star::uno::Reference
<
313 com::sun::star::task::XInteractionContinuation
> > const &
315 SAL_THROW((com::sun::star::uno::RuntimeException
));
318 handleNoSuchFilterRequest(
319 com::sun::star::document::NoSuchFilterRequest
const & rRequest
,
320 com::sun::star::uno::Sequence
<
321 com::sun::star::uno::Reference
<
322 com::sun::star::task::XInteractionContinuation
> > const &
324 SAL_THROW((com::sun::star::uno::RuntimeException
));
327 handleAmbigousFilterRequest(
328 com::sun::star::document::AmbigousFilterRequest
const & rRequest
,
329 com::sun::star::uno::Sequence
<
330 com::sun::star::uno::Reference
<
331 com::sun::star::task::XInteractionContinuation
> > const &
333 SAL_THROW((com::sun::star::uno::RuntimeException
));
336 handleFilterOptionsRequest(
337 com::sun::star::document::FilterOptionsRequest
const & rRequest
,
338 com::sun::star::uno::Sequence
<
339 com::sun::star::uno::Reference
<
340 com::sun::star::task::XInteractionContinuation
> > const &
342 SAL_THROW((com::sun::star::uno::RuntimeException
));
346 com::sun::star::task::InteractionClassification eClassification
,
348 std::vector
< rtl::OUString
> const & rArguments
,
349 com::sun::star::uno::Sequence
<
350 com::sun::star::uno::Reference
<
351 com::sun::star::task::XInteractionContinuation
> > const &
353 bool bObtainErrorStringOnly
,
354 bool & bHasErrorString
,
355 rtl::OUString
& rErrorString
)
356 SAL_THROW((com::sun::star::uno::RuntimeException
));
359 handleGenericErrorRequest(
360 sal_Int32 nErrorCode
,
361 com::sun::star::uno::Sequence
<
362 com::sun::star::uno::Reference
<
363 com::sun::star::task::XInteractionContinuation
> > const &
365 bool bObtainErrorStringOnly
,
366 bool & bHasErrorString
,
367 rtl::OUString
& rErrorString
)
368 SAL_THROW((com::sun::star::uno::RuntimeException
));
371 handleMacroConfirmRequest(
372 const ::rtl::OUString
& aDocumentURL
,
373 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xZipStorage
,
374 const ::rtl::OUString
& aDocumentVersion
,
375 const ::com::sun::star::uno::Sequence
< ::com::sun::star::security::DocumentSignatureInformation
> aSignInfo
,
376 com::sun::star::uno::Sequence
<
377 com::sun::star::uno::Reference
<
378 com::sun::star::task::XInteractionContinuation
> > const &
381 SAL_THROW((com::sun::star::uno::RuntimeException
));
384 handleFutureDocumentVersionUpdateRequest(
385 const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest
& _rRequest
,
386 com::sun::star::uno::Sequence
<
387 com::sun::star::uno::Reference
<
388 com::sun::star::task::XInteractionContinuation
> > const &
391 SAL_THROW((com::sun::star::uno::RuntimeException
));
394 handleBrokenPackageRequest(
395 std::vector
< rtl::OUString
> const & rArguments
,
396 ::com::sun::star::uno::Sequence
<
397 ::com::sun::star::uno::Reference
<
398 ::com::sun::star::task::XInteractionContinuation
> > const &
400 bool bObtainErrorStringOnly
,
401 bool & bHasErrorString
,
402 rtl::OUString
& rErrorString
)
403 SAL_THROW((::com::sun::star::uno::RuntimeException
));
405 bool handleMessageboxRequests(
406 ::com::sun::star::uno::Reference
<
407 ::com::sun::star::task::XInteractionRequest
> const &
409 bool bObtainErrorStringOnly
,
410 bool & bHasErrorString
,
411 rtl::OUString
& rErrorString
);
413 bool handleDialogRequests(
414 ::com::sun::star::uno::Reference
<
415 ::com::sun::star::task::XInteractionRequest
> const &
418 bool handleErrorHandlerRequests(
419 ::com::sun::star::uno::Reference
<
420 ::com::sun::star::task::XInteractionRequest
> const &
422 bool bObtainErrorStringOnly
,
423 bool & bHasErrorString
,
424 rtl::OUString
& rErrorString
);
426 void handleLockedDocumentRequest(
427 const ::rtl::OUString
& aDocumentURL
,
428 const ::rtl::OUString
& aInfo
,
429 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
<
430 ::com::sun::star::task::XInteractionContinuation
> > const &
433 SAL_THROW((::com::sun::star::uno::RuntimeException
));
435 void handleChangedByOthersRequest(
436 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
<
437 ::com::sun::star::task::XInteractionContinuation
> > const &
439 SAL_THROW((::com::sun::star::uno::RuntimeException
));
441 void handleLockFileIgnoreRequest(
442 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
<
443 ::com::sun::star::task::XInteractionContinuation
> > const &
445 SAL_THROW((::com::sun::star::uno::RuntimeException
));
449 #endif // UUI_IAHNDL_HXX