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/beans/Optional.hpp"
40 #include "com/sun/star/uno/Reference.hxx"
41 #include "com/sun/star/uno/Sequence.hxx"
42 #include "com/sun/star/task/InteractionClassification.hpp"
43 #include "com/sun/star/task/PasswordRequestMode.hpp"
44 #include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp"
45 #include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
46 #include "tools/solar.h"
47 #include "tools/errcode.hxx"
48 #include "vcl/wintypes.hxx"
50 #include <com/sun/star/security/XCertificate.hpp>
51 #ifndef _COM_SUN_STAR_XML_CRYPTO_XXSECURITYENVIRONMENT_HPP_
52 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
57 struct CntHTTPCookieRequest
;
59 #define DESCRIPTION_1 1
60 #define DESCRIPTION_2 2
63 #define UUI_DOC_LOAD_LOCK 0
64 #define UUI_DOC_OWN_LOAD_LOCK 1
65 #define UUI_DOC_SAVE_LOCK 2
66 #define UUI_DOC_OWN_SAVE_LOCK 3
68 //============================================================================
69 /** Information about a InteractionHandler
71 struct InteractionHandlerData
73 /** The UNO service name to use to instanciate the content provider.
75 rtl::OUString ServiceName
;
77 InteractionHandlerData() {};
78 InteractionHandlerData( const rtl::OUString
& rService
)
79 : ServiceName( rService
){}
82 typedef std::vector
< InteractionHandlerData
> InteractionHandlerDataList
;
84 namespace cssu
= com::sun::star::uno
;
85 namespace dcss
= ::com::sun::star
;
87 namespace com
{ namespace sun
{ namespace star
{
89 class AmbigousFilterRequest
;
90 class FilterOptionsRequest
;
91 class NoSuchFilterRequest
;
94 class XMultiServiceFactory
;
97 class XInteractionContinuation
;
98 class XInteractionHandler
;
99 class XInteractionRequest
;
100 class XPasswordContainer
;
103 class AuthenticationRequest
;
104 class HandleCookiesRequest
;
105 class NameClashResolveRequest
;
106 class CertificateValidationRequest
;
109 class RuntimeException
;
113 class UUIInteractionHelper
116 osl::Mutex m_aPropertyMutex
;
117 com::sun::star::uno::Reference
<
118 com::sun::star::lang::XMultiServiceFactory
>
120 com::sun::star::uno::Sequence
< com::sun::star::uno::Any
> m_aProperties
;
122 UUIInteractionHelper(UUIInteractionHelper
&); // not implemented
123 void operator =(UUIInteractionHelper
); // not implemented
126 UUIInteractionHelper(com::sun::star::uno::Reference
<
127 com::sun::star::lang::XMultiServiceFactory
>
128 const & rServiceFactory
,
129 com::sun::star::uno::Sequence
<
130 com::sun::star::uno::Any
> const & rArguments
)
132 UUIInteractionHelper(com::sun::star::uno::Reference
<
133 com::sun::star::lang::XMultiServiceFactory
>
134 const & rServiceFactory
)
137 ~UUIInteractionHelper() SAL_THROW(());
140 handleRequest(com::sun::star::uno::Reference
<
141 com::sun::star::task::XInteractionRequest
> const &
143 throw (com::sun::star::uno::RuntimeException
);
145 com::sun::star::beans::Optional
< rtl::OUString
>
146 getStringFromRequest(com::sun::star::uno::Reference
<
147 com::sun::star::task::XInteractionRequest
> const &
149 throw (com::sun::star::uno::RuntimeException
);
153 handle_impl(com::sun::star::uno::Reference
<
154 com::sun::star::task::XInteractionRequest
> const &
156 throw (com::sun::star::uno::RuntimeException
);
159 GetInteractionHandlerList(InteractionHandlerDataList
&rdataList
);
162 isDomainMatch( rtl::OUString hostName
, rtl::OUString certHostName
);
164 handlerequest(void* pHandleData
, void* pInteractionHandler
);
166 com::sun::star::beans::Optional
< rtl::OUString
>
167 getStringFromRequest_impl(com::sun::star::uno::Reference
<
168 com::sun::star::task::XInteractionRequest
> const &
170 throw (com::sun::star::uno::RuntimeException
);
173 getstringfromrequest(void* pHandleData
, void* pInteractionHandler
);
175 Window
* getParentProperty() SAL_THROW(());
177 rtl::OUString
getContextProperty() SAL_THROW(());
180 initPasswordContainer(com::sun::star::uno::Reference
<
181 com::sun::star::task::XPasswordContainer
> *
185 com::sun::star::uno::Reference
< com::sun::star::task::XInteractionHandler
>
186 getInteractionHandler() const
187 SAL_THROW((com::sun::star::uno::RuntimeException
));
189 void executeLoginDialog(LoginErrorInfo
& rInfo
,
190 rtl::OUString
const & rRealm
)
191 SAL_THROW((com::sun::star::uno::RuntimeException
));
194 executeMasterPasswordDialog(LoginErrorInfo
& rInfo
,
195 com::sun::star::task::PasswordRequestMode nMode
)
196 SAL_THROW((com::sun::star::uno::RuntimeException
));
199 executePasswordDialog(LoginErrorInfo
& rInfo
,
200 com::sun::star::task::PasswordRequestMode nMode
,
201 ::rtl::OUString aDocumentName
)
202 SAL_THROW((com::sun::star::uno::RuntimeException
));
205 executeMSPasswordDialog(LoginErrorInfo
& rInfo
,
206 com::sun::star::task::PasswordRequestMode nMode
,
207 ::rtl::OUString aDocumentName
)
208 SAL_THROW((com::sun::star::uno::RuntimeException
));
210 void executeCookieDialog(CntHTTPCookieRequest
& rRequest
)
211 SAL_THROW((com::sun::star::uno::RuntimeException
));
213 void executeFilterDialog(rtl::OUString
const & rURL
,
214 uui::FilterNameList
const & rFilters
,
215 rtl::OUString
& rFilter
)
216 SAL_THROW((com::sun::star::uno::RuntimeException
));
218 sal_Bool
executeUnknownAuthDialog( const cssu::Reference
< dcss::security::XCertificate
>& rXCert
)
219 SAL_THROW((com::sun::star::uno::RuntimeException
));
221 sal_Bool
executeSSLWarnDialog( const cssu::Reference
< dcss::security::XCertificate
>& rXCert
,
222 sal_Int32
const & failures
,
223 const rtl::OUString
& hostName
)
224 SAL_THROW((com::sun::star::uno::RuntimeException
));
227 getLocalizedDatTimeStr( ::com::sun::star::util::DateTime aDateTime
);
230 executeErrorDialog(com::sun::star::task::InteractionClassification
232 rtl::OUString
const & rContext
,
233 rtl::OUString
const & rMessage
,
234 WinBits nButtonMask
)
235 SAL_THROW((com::sun::star::uno::RuntimeException
));
238 executeMessageBox( rtl::OUString
const & rTitle
,
239 rtl::OUString
const & rMessage
,
240 WinBits nButtonMask
)
241 SAL_THROW((com::sun::star::uno::RuntimeException
));
244 handleAuthenticationRequest(
245 com::sun::star::ucb::AuthenticationRequest
const & rRequest
,
246 com::sun::star::uno::Sequence
<
247 com::sun::star::uno::Reference
<
248 com::sun::star::task::XInteractionContinuation
> > const &
250 SAL_THROW((com::sun::star::uno::RuntimeException
));
253 handleCertificateValidationRequest(
254 com::sun::star::ucb::CertificateValidationRequest
const & rRequest
,
255 com::sun::star::uno::Sequence
<
256 com::sun::star::uno::Reference
<
257 com::sun::star::task::XInteractionContinuation
> > const &
259 SAL_THROW((com::sun::star::uno::RuntimeException
));
262 handleNameClashResolveRequest(
263 com::sun::star::ucb::NameClashResolveRequest
const & rRequest
,
264 com::sun::star::uno::Sequence
< com::sun::star::uno::Reference
<
265 com::sun::star::task::XInteractionContinuation
> > const &
267 SAL_THROW((com::sun::star::uno::RuntimeException
));
270 handleMasterPasswordRequest(
271 com::sun::star::task::PasswordRequestMode nMode
,
272 com::sun::star::uno::Sequence
<
273 com::sun::star::uno::Reference
<
274 com::sun::star::task::XInteractionContinuation
> > const &
276 SAL_THROW((com::sun::star::uno::RuntimeException
));
280 handlePasswordRequest(
281 com::sun::star::task::PasswordRequestMode nMode
,
282 com::sun::star::uno::Sequence
<
283 com::sun::star::uno::Reference
<
284 com::sun::star::task::XInteractionContinuation
> > const &
286 ::rtl::OUString aDocumentName
= ::rtl::OUString())
287 SAL_THROW((com::sun::star::uno::RuntimeException
));
290 handleMSPasswordRequest(
291 com::sun::star::task::PasswordRequestMode nMode
,
292 com::sun::star::uno::Sequence
<
293 com::sun::star::uno::Reference
<
294 com::sun::star::task::XInteractionContinuation
> > const &
296 ::rtl::OUString aDocumentName
= ::rtl::OUString())
297 SAL_THROW((com::sun::star::uno::RuntimeException
));
300 handleCookiesRequest(
301 com::sun::star::ucb::HandleCookiesRequest
const & rRequest
,
302 com::sun::star::uno::Sequence
<
303 com::sun::star::uno::Reference
<
304 com::sun::star::task::XInteractionContinuation
> > const &
306 SAL_THROW((com::sun::star::uno::RuntimeException
));
309 handleNoSuchFilterRequest(
310 com::sun::star::document::NoSuchFilterRequest
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 handleAmbigousFilterRequest(
319 com::sun::star::document::AmbigousFilterRequest
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 handleFilterOptionsRequest(
328 com::sun::star::document::FilterOptionsRequest
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
));
337 com::sun::star::task::InteractionClassification eClassification
,
339 std::vector
< rtl::OUString
> const & rArguments
,
340 com::sun::star::uno::Sequence
<
341 com::sun::star::uno::Reference
<
342 com::sun::star::task::XInteractionContinuation
> > const &
344 bool bObtainErrorStringOnly
,
345 bool & bHasErrorString
,
346 rtl::OUString
& rErrorString
)
347 SAL_THROW((com::sun::star::uno::RuntimeException
));
350 handleGenericErrorRequest(
351 sal_Int32 nErrorCode
,
352 com::sun::star::uno::Sequence
<
353 com::sun::star::uno::Reference
<
354 com::sun::star::task::XInteractionContinuation
> > const &
356 bool bObtainErrorStringOnly
,
357 bool & bHasErrorString
,
358 rtl::OUString
& rErrorString
)
359 SAL_THROW((com::sun::star::uno::RuntimeException
));
362 handleMacroConfirmRequest(
363 const ::com::sun::star::task::DocumentMacroConfirmationRequest
& _rRequest
,
364 com::sun::star::uno::Sequence
<
365 com::sun::star::uno::Reference
<
366 com::sun::star::task::XInteractionContinuation
> > const &
369 SAL_THROW((com::sun::star::uno::RuntimeException
));
372 handleFutureDocumentVersionUpdateRequest(
373 const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest
& _rRequest
,
374 com::sun::star::uno::Sequence
<
375 com::sun::star::uno::Reference
<
376 com::sun::star::task::XInteractionContinuation
> > const &
379 SAL_THROW((com::sun::star::uno::RuntimeException
));
382 handleBrokenPackageRequest(
383 std::vector
< rtl::OUString
> const & rArguments
,
384 ::com::sun::star::uno::Sequence
<
385 ::com::sun::star::uno::Reference
<
386 ::com::sun::star::task::XInteractionContinuation
> > const &
388 bool bObtainErrorStringOnly
,
389 bool & bHasErrorString
,
390 rtl::OUString
& rErrorString
)
391 SAL_THROW((::com::sun::star::uno::RuntimeException
));
393 bool handleMessageboxRequests(
394 ::com::sun::star::uno::Reference
<
395 ::com::sun::star::task::XInteractionRequest
> const &
397 bool bObtainErrorStringOnly
,
398 bool & bHasErrorString
,
399 rtl::OUString
& rErrorString
);
401 bool handleDialogRequests(
402 ::com::sun::star::uno::Reference
<
403 ::com::sun::star::task::XInteractionRequest
> const &
406 bool handleErrorHandlerRequests(
407 ::com::sun::star::uno::Reference
<
408 ::com::sun::star::task::XInteractionRequest
> const &
410 bool bObtainErrorStringOnly
,
411 bool & bHasErrorString
,
412 rtl::OUString
& rErrorString
);
414 void handleLockedDocumentRequest(
415 const ::rtl::OUString
& aDocumentURL
,
416 const ::rtl::OUString
& aInfo
,
417 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
<
418 ::com::sun::star::task::XInteractionContinuation
> > const &
421 SAL_THROW((::com::sun::star::uno::RuntimeException
));
423 void handleChangedByOthersRequest(
424 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
<
425 ::com::sun::star::task::XInteractionContinuation
> > const &
427 SAL_THROW((::com::sun::star::uno::RuntimeException
));
429 void handleLockFileIgnoreRequest(
430 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
<
431 ::com::sun::star::task::XInteractionContinuation
> > const &
433 SAL_THROW((::com::sun::star::uno::RuntimeException
));
437 #endif // UUI_IAHNDL_HXX