Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / uui / source / iahndl.hxx
blob3306e272ad29e225d1d4fad1ab2bab2f4fe4fbd8
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
32 #include <vector>
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 {
49 namespace awt {
50 class XWindow;
52 namespace embed {
53 class XStorage;
55 namespace lang {
56 class XMultiServiceFactory;
58 namespace security {
59 struct DocumentSignatureInformation;
61 namespace task {
62 class FutureDocumentVersionProductUpdateRequest;
63 class XInteractionContinuation;
64 class XInteractionHandler;
65 class XInteractionRequest;
67 namespace ucb {
68 class NameClashResolveRequest;
70 } } }
72 #include <boost/unordered_map.hpp>
74 class Window;
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
97 private:
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
105 public:
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)
111 SAL_THROW(());
112 UUIInteractionHelper(
113 com::sun::star::uno::Reference<
114 com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory)
115 SAL_THROW(());
117 ~UUIInteractionHelper() SAL_THROW(());
119 bool
120 handleRequest(
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));
131 // Helper.
132 static ::rtl::OUString
133 replaceMessageWithArguments(
134 ::rtl::OUString aMessage,
135 std::vector< rtl::OUString > const & rArguments );
137 private:
138 bool
139 handleRequest_impl(
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));
147 static long
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));
156 static long
157 getstringfromrequest(void* pHandleData, void* pInteractionHandler);
159 Window *
160 getParentProperty()
161 SAL_THROW(());
163 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
164 getParentXWindow() const
165 SAL_THROW(());
167 rtl::OUString
168 getContextProperty()
169 SAL_THROW(());
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
179 bool
180 tryOtherInteractionHandler(
181 com::sun::star::uno::Reference<
182 com::sun::star::task::XInteractionRequest > const & rRequest)
183 SAL_THROW((com::sun::star::uno::RuntimeException));
185 void
186 getInteractionHandlerList(InteractionHandlerDataList &rdataList)
187 SAL_THROW((com::sun::star::uno::RuntimeException));
189 static bool
190 isInformationalErrorMessageRequest(
191 com::sun::star::uno::Sequence<
192 com::sun::star::uno::Reference<
193 com::sun::star::task::XInteractionContinuation > > const &
194 rContinuations);
196 //=====================================================================
198 bool
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));
207 bool
208 handleAuthenticationRequest(
209 com::sun::star::uno::Reference<
210 com::sun::star::task::XInteractionRequest > const & rRequest)
211 SAL_THROW((com::sun::star::uno::RuntimeException));
213 bool
214 handleCertificateValidationRequest(
215 com::sun::star::uno::Reference<
216 com::sun::star::task::XInteractionRequest > const & rRequest)
217 SAL_THROW((com::sun::star::uno::RuntimeException));
219 void
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 &
225 rContinuations)
226 SAL_THROW((com::sun::star::uno::RuntimeException));
228 bool
229 handleMasterPasswordRequest(
230 com::sun::star::uno::Reference<
231 com::sun::star::task::XInteractionRequest > const & rRequest)
232 SAL_THROW((com::sun::star::uno::RuntimeException));
234 bool
235 handlePasswordRequest(
236 com::sun::star::uno::Reference<
237 com::sun::star::task::XInteractionRequest > const & rRequest)
238 SAL_THROW((com::sun::star::uno::RuntimeException));
240 bool
241 handleNoSuchFilterRequest(
242 com::sun::star::uno::Reference<
243 com::sun::star::task::XInteractionRequest > const & rRequest)
244 SAL_THROW((com::sun::star::uno::RuntimeException));
246 bool
247 handleAmbigousFilterRequest(
248 com::sun::star::uno::Reference<
249 com::sun::star::task::XInteractionRequest > const & rRequest)
250 SAL_THROW((com::sun::star::uno::RuntimeException));
252 bool
253 handleFilterOptionsRequest(
254 com::sun::star::uno::Reference<
255 com::sun::star::task::XInteractionRequest > const & rRequest)
256 SAL_THROW((com::sun::star::uno::RuntimeException));
258 void
259 handleErrorHandlerRequest(
260 com::sun::star::task::InteractionClassification eClassification,
261 ErrCode nErrorCode,
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 &
266 rContinuations,
267 bool bObtainErrorStringOnly,
268 bool & bHasErrorString,
269 rtl::OUString & rErrorString)
270 SAL_THROW((com::sun::star::uno::RuntimeException));
272 void
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 &
278 rContinuations,
279 bool bObtainErrorStringOnly,
280 bool & bHasErrorString,
281 rtl::OUString & rErrorString)
282 SAL_THROW((com::sun::star::uno::RuntimeException));
284 void
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 >
292 aSignInfo,
293 com::sun::star::uno::Sequence<
294 com::sun::star::uno::Reference<
295 com::sun::star::task::XInteractionContinuation > > const &
296 rContinuations)
297 SAL_THROW((com::sun::star::uno::RuntimeException));
299 void
300 handleFutureDocumentVersionUpdateRequest(
301 const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest&
302 _rRequest,
303 com::sun::star::uno::Sequence<
304 com::sun::star::uno::Reference<
305 com::sun::star::task::XInteractionContinuation > > const &
306 rContinuations)
307 SAL_THROW((com::sun::star::uno::RuntimeException));
309 void
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 &
315 rContinuations,
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
339 ) const;
342 class ErrorResource: private Resource
344 public:
345 inline ErrorResource(ResId & rResId) SAL_THROW(()): Resource(rResId) {}
347 inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
349 bool getString(ErrCode nErrorCode, rtl::OUString &rString) const
350 SAL_THROW(());
353 #endif // UUI_IAHNDL_HXX
355 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */