1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef UUI_IAHNDL_HXX
30 #define UUI_IAHNDL_HXX
34 #include "osl/mutex.hxx"
35 #include "rtl/ustring.hxx"
37 #include "com/sun/star/uno/Reference.hxx"
38 #include "com/sun/star/uno/Sequence.hxx"
40 #include "com/sun/star/beans/Optional.hpp"
41 #include "com/sun/star/task/InteractionClassification.hpp"
43 #include "tools/solar.h" // sal_uInt16
44 #include "tools/errcode.hxx" // ErrCode
45 #include "tools/rc.hxx" // Resource
46 #include "tools/wintypes.hxx" // WinBits
48 namespace com
{ namespace sun
{ namespace star
{
56 class XMultiServiceFactory
;
59 struct DocumentSignatureInformation
;
62 class FutureDocumentVersionProductUpdateRequest
;
63 class XInteractionContinuation
;
64 class XInteractionHandler
;
65 class XInteractionRequest
;
68 class NameClashResolveRequest
;
72 #include <boost/unordered_map.hpp>
76 //============================================================================
77 struct InteractionHandlerData
79 /** The UNO service name to use to instanciate the content provider.
81 rtl::OUString ServiceName
;
83 InteractionHandlerData() {};
84 InteractionHandlerData(const rtl::OUString
& rService
)
85 : ServiceName( rService
){}
88 typedef std::vector
< InteractionHandlerData
> InteractionHandlerDataList
;
90 typedef ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionContinuation
> > Continuations
;
92 typedef ::boost::unordered_map
< ::rtl::OUString
, ::rtl::OUString
, ::rtl::OUStringHash
> StringHashMap
;
94 //============================================================================
95 class UUIInteractionHelper
98 mutable osl::Mutex m_aPropertyMutex
;
99 ::com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> m_xServiceFactory
;
100 ::com::sun::star::uno::Sequence
< com::sun::star::uno::Any
> m_aProperties
;
101 StringHashMap m_aTypedCustomHandlers
;
102 UUIInteractionHelper(UUIInteractionHelper
&); // not implemented
103 void operator =(UUIInteractionHelper
); // not implemented
106 UUIInteractionHelper(
107 com::sun::star::uno::Reference
<
108 com::sun::star::lang::XMultiServiceFactory
> const & rServiceFactory
,
109 com::sun::star::uno::Sequence
<
110 com::sun::star::uno::Any
> const & rArguments
)
112 UUIInteractionHelper(
113 com::sun::star::uno::Reference
<
114 com::sun::star::lang::XMultiServiceFactory
> const & rServiceFactory
)
117 ~UUIInteractionHelper() SAL_THROW(());
121 com::sun::star::uno::Reference
<
122 com::sun::star::task::XInteractionRequest
> const & rRequest
)
123 SAL_THROW((com::sun::star::uno::RuntimeException
));
125 com::sun::star::beans::Optional
< rtl::OUString
>
126 getStringFromRequest(
127 com::sun::star::uno::Reference
<
128 com::sun::star::task::XInteractionRequest
> const & rRequest
)
129 SAL_THROW((com::sun::star::uno::RuntimeException
));
132 static ::rtl::OUString
133 replaceMessageWithArguments(
134 ::rtl::OUString aMessage
,
135 std::vector
< rtl::OUString
> const & rArguments
);
140 com::sun::star::uno::Reference
<
141 com::sun::star::task::XInteractionRequest
> const & rRequest
,
142 bool bObtainErrorStringOnly
,
143 bool & bHasErrorString
,
144 rtl::OUString
& rErrorString
)
145 SAL_THROW((com::sun::star::uno::RuntimeException
));
148 handlerequest(void* pHandleData
, void* pInteractionHandler
);
150 com::sun::star::beans::Optional
< rtl::OUString
>
151 getStringFromRequest_impl(
152 com::sun::star::uno::Reference
<
153 com::sun::star::task::XInteractionRequest
> const & rRequest
)
154 SAL_THROW((com::sun::star::uno::RuntimeException
));
157 getstringfromrequest(void* pHandleData
, void* pInteractionHandler
);
163 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
>
164 getParentXWindow() const
171 com::sun::star::uno::Reference
< com::sun::star::task::XInteractionHandler
>
172 getInteractionHandler()
173 SAL_THROW((com::sun::star::uno::RuntimeException
));
175 bool handleTypedHandlerImplementations(
176 ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionRequest
> const & rRequest
180 tryOtherInteractionHandler(
181 com::sun::star::uno::Reference
<
182 com::sun::star::task::XInteractionRequest
> const & rRequest
)
183 SAL_THROW((com::sun::star::uno::RuntimeException
));
186 getInteractionHandlerList(InteractionHandlerDataList
&rdataList
)
187 SAL_THROW((com::sun::star::uno::RuntimeException
));
190 isInformationalErrorMessageRequest(
191 com::sun::star::uno::Sequence
<
192 com::sun::star::uno::Reference
<
193 com::sun::star::task::XInteractionContinuation
> > const &
196 //=====================================================================
199 handleInteractiveIOException(
200 com::sun::star::uno::Reference
<
201 com::sun::star::task::XInteractionRequest
> const & rRequest
,
202 bool bObtainErrorStringOnly
,
203 bool & bHasErrorString
,
204 rtl::OUString
& rErrorString
)
205 SAL_THROW((com::sun::star::uno::RuntimeException
));
208 handleAuthenticationRequest(
209 com::sun::star::uno::Reference
<
210 com::sun::star::task::XInteractionRequest
> const & rRequest
)
211 SAL_THROW((com::sun::star::uno::RuntimeException
));
214 handleCertificateValidationRequest(
215 com::sun::star::uno::Reference
<
216 com::sun::star::task::XInteractionRequest
> const & rRequest
)
217 SAL_THROW((com::sun::star::uno::RuntimeException
));
220 handleNameClashResolveRequest(
221 com::sun::star::ucb::NameClashResolveRequest
const & rRequest
,
222 com::sun::star::uno::Sequence
<
223 com::sun::star::uno::Reference
<
224 com::sun::star::task::XInteractionContinuation
> > const &
226 SAL_THROW((com::sun::star::uno::RuntimeException
));
229 handleMasterPasswordRequest(
230 com::sun::star::uno::Reference
<
231 com::sun::star::task::XInteractionRequest
> const & rRequest
)
232 SAL_THROW((com::sun::star::uno::RuntimeException
));
235 handlePasswordRequest(
236 com::sun::star::uno::Reference
<
237 com::sun::star::task::XInteractionRequest
> const & rRequest
)
238 SAL_THROW((com::sun::star::uno::RuntimeException
));
241 handleNoSuchFilterRequest(
242 com::sun::star::uno::Reference
<
243 com::sun::star::task::XInteractionRequest
> const & rRequest
)
244 SAL_THROW((com::sun::star::uno::RuntimeException
));
247 handleAmbigousFilterRequest(
248 com::sun::star::uno::Reference
<
249 com::sun::star::task::XInteractionRequest
> const & rRequest
)
250 SAL_THROW((com::sun::star::uno::RuntimeException
));
253 handleFilterOptionsRequest(
254 com::sun::star::uno::Reference
<
255 com::sun::star::task::XInteractionRequest
> const & rRequest
)
256 SAL_THROW((com::sun::star::uno::RuntimeException
));
259 handleErrorHandlerRequest(
260 com::sun::star::task::InteractionClassification eClassification
,
262 std::vector
< rtl::OUString
> const & rArguments
,
263 com::sun::star::uno::Sequence
<
264 com::sun::star::uno::Reference
<
265 com::sun::star::task::XInteractionContinuation
> > const &
267 bool bObtainErrorStringOnly
,
268 bool & bHasErrorString
,
269 rtl::OUString
& rErrorString
)
270 SAL_THROW((com::sun::star::uno::RuntimeException
));
273 handleGenericErrorRequest(
274 sal_Int32 nErrorCode
,
275 com::sun::star::uno::Sequence
<
276 com::sun::star::uno::Reference
<
277 com::sun::star::task::XInteractionContinuation
> > const &
279 bool bObtainErrorStringOnly
,
280 bool & bHasErrorString
,
281 rtl::OUString
& rErrorString
)
282 SAL_THROW((com::sun::star::uno::RuntimeException
));
285 handleMacroConfirmRequest(
286 const ::rtl::OUString
& aDocumentURL
,
287 const ::com::sun::star::uno::Reference
<
288 ::com::sun::star::embed::XStorage
>& xZipStorage
,
289 const ::rtl::OUString
& aDocumentVersion
,
290 const ::com::sun::star::uno::Sequence
<
291 ::com::sun::star::security::DocumentSignatureInformation
>
293 com::sun::star::uno::Sequence
<
294 com::sun::star::uno::Reference
<
295 com::sun::star::task::XInteractionContinuation
> > const &
297 SAL_THROW((com::sun::star::uno::RuntimeException
));
300 handleFutureDocumentVersionUpdateRequest(
301 const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest
&
303 com::sun::star::uno::Sequence
<
304 com::sun::star::uno::Reference
<
305 com::sun::star::task::XInteractionContinuation
> > const &
307 SAL_THROW((com::sun::star::uno::RuntimeException
));
310 handleBrokenPackageRequest(
311 std::vector
< rtl::OUString
> const & rArguments
,
312 ::com::sun::star::uno::Sequence
<
313 ::com::sun::star::uno::Reference
<
314 ::com::sun::star::task::XInteractionContinuation
> > const &
316 bool bObtainErrorStringOnly
,
317 bool & bHasErrorString
,
318 rtl::OUString
& rErrorString
)
319 SAL_THROW((::com::sun::star::uno::RuntimeException
));
321 bool handleLockedDocumentRequest(
322 com::sun::star::uno::Reference
<
323 com::sun::star::task::XInteractionRequest
> const & rRequest
)
324 SAL_THROW((::com::sun::star::uno::RuntimeException
));
326 bool handleChangedByOthersRequest(
327 com::sun::star::uno::Reference
<
328 com::sun::star::task::XInteractionRequest
> const & rRequest
)
329 SAL_THROW((::com::sun::star::uno::RuntimeException
));
331 bool handleLockFileIgnoreRequest(
332 com::sun::star::uno::Reference
<
333 com::sun::star::task::XInteractionRequest
> const & rRequest
)
334 SAL_THROW((::com::sun::star::uno::RuntimeException
));
336 bool handleCustomRequest(
337 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionRequest
>& i_rRequest
,
338 const ::rtl::OUString
& i_rServiceName
342 class ErrorResource
: private Resource
345 inline ErrorResource(ResId
& rResId
) SAL_THROW(()): Resource(rResId
) {}
347 inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
349 bool getString(ErrCode nErrorCode
, rtl::OUString
&rString
) const
353 #endif // UUI_IAHNDL_HXX
355 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */