bump product version to 4.1.6.2
[LibreOffice.git] / uui / source / iahndl.hxx
blobd1c553df1802f351972616925f49156b6bc77a9a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <vector>
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 {
41 namespace awt {
42 class XWindow;
44 namespace embed {
45 class XStorage;
47 namespace lang {
48 class XMultiServiceFactory;
50 namespace security {
51 struct DocumentSignatureInformation;
53 namespace task {
54 class FutureDocumentVersionProductUpdateRequest;
55 class XInteractionContinuation;
56 class XInteractionHandler2;
57 class XInteractionRequest;
59 namespace ucb {
60 class NameClashResolveRequest;
62 } } }
64 #include <boost/unordered_map.hpp>
66 class Window;
68 //============================================================================
69 struct InteractionHandlerData
71 /** The UNO service name to use to instanciate the content provider.
73 OUString ServiceName;
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
89 private:
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
98 public:
99 UUIInteractionHelper(
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)
105 SAL_THROW(());
106 UUIInteractionHelper(
107 com::sun::star::uno::Reference<
108 com::sun::star::uno::XComponentContext > const & rxContext)
109 SAL_THROW(());
111 ~UUIInteractionHelper() SAL_THROW(());
113 bool
114 handleRequest(
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));
125 // Helper.
126 static OUString
127 replaceMessageWithArguments(
128 OUString aMessage,
129 std::vector< OUString > const & rArguments );
131 ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
132 getORB() const
133 { return m_xContext; }
134 private:
135 bool
136 handleRequest_impl(
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));
144 static long
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));
153 static long
154 getstringfromrequest(void* pHandleData, void* pInteractionHandler);
156 Window *
157 getParentProperty()
158 SAL_THROW(());
160 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
161 getParentXWindow() const
162 SAL_THROW(());
164 OUString
165 getContextProperty()
166 SAL_THROW(());
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
176 bool
177 tryOtherInteractionHandler(
178 com::sun::star::uno::Reference<
179 com::sun::star::task::XInteractionRequest > const & rRequest)
180 SAL_THROW((com::sun::star::uno::RuntimeException));
182 void
183 getInteractionHandlerList(InteractionHandlerDataList &rdataList)
184 SAL_THROW((com::sun::star::uno::RuntimeException));
186 static bool
187 isInformationalErrorMessageRequest(
188 com::sun::star::uno::Sequence<
189 com::sun::star::uno::Reference<
190 com::sun::star::task::XInteractionContinuation > > const &
191 rContinuations);
193 //=====================================================================
195 bool
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));
204 bool
205 handleAuthenticationRequest(
206 com::sun::star::uno::Reference<
207 com::sun::star::task::XInteractionRequest > const & rRequest)
208 SAL_THROW((com::sun::star::uno::RuntimeException));
210 bool
211 handleCertificateValidationRequest(
212 com::sun::star::uno::Reference<
213 com::sun::star::task::XInteractionRequest > const & rRequest)
214 SAL_THROW((com::sun::star::uno::RuntimeException));
216 void
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 &
222 rContinuations)
223 SAL_THROW((com::sun::star::uno::RuntimeException));
225 bool
226 handleMasterPasswordRequest(
227 com::sun::star::uno::Reference<
228 com::sun::star::task::XInteractionRequest > const & rRequest)
229 SAL_THROW((com::sun::star::uno::RuntimeException));
231 bool
232 handlePasswordRequest(
233 com::sun::star::uno::Reference<
234 com::sun::star::task::XInteractionRequest > const & rRequest)
235 SAL_THROW((com::sun::star::uno::RuntimeException));
237 bool
238 handleNoSuchFilterRequest(
239 com::sun::star::uno::Reference<
240 com::sun::star::task::XInteractionRequest > const & rRequest)
241 SAL_THROW((com::sun::star::uno::RuntimeException));
243 bool
244 handleAmbigousFilterRequest(
245 com::sun::star::uno::Reference<
246 com::sun::star::task::XInteractionRequest > const & rRequest)
247 SAL_THROW((com::sun::star::uno::RuntimeException));
249 bool
250 handleFilterOptionsRequest(
251 com::sun::star::uno::Reference<
252 com::sun::star::task::XInteractionRequest > const & rRequest)
253 SAL_THROW((com::sun::star::uno::RuntimeException));
255 void
256 handleErrorHandlerRequest(
257 com::sun::star::task::InteractionClassification eClassification,
258 ErrCode nErrorCode,
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 &
263 rContinuations,
264 bool bObtainErrorStringOnly,
265 bool & bHasErrorString,
266 OUString & rErrorString)
267 SAL_THROW((com::sun::star::uno::RuntimeException));
269 void
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 &
275 rContinuations,
276 bool bObtainErrorStringOnly,
277 bool & bHasErrorString,
278 OUString & rErrorString)
279 SAL_THROW((com::sun::star::uno::RuntimeException));
281 void
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 >
289 aSignInfo,
290 com::sun::star::uno::Sequence<
291 com::sun::star::uno::Reference<
292 com::sun::star::task::XInteractionContinuation > > const &
293 rContinuations)
294 SAL_THROW((com::sun::star::uno::RuntimeException));
296 void
297 handleFutureDocumentVersionUpdateRequest(
298 const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest&
299 _rRequest,
300 com::sun::star::uno::Sequence<
301 com::sun::star::uno::Reference<
302 com::sun::star::task::XInteractionContinuation > > const &
303 rContinuations)
304 SAL_THROW((com::sun::star::uno::RuntimeException));
306 void
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 &
312 rContinuations,
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
336 ) const;
339 class ErrorResource: private Resource
341 public:
342 inline ErrorResource(ResId & rResId) SAL_THROW(()): Resource(rResId) {}
344 inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
346 bool getString(ErrCode nErrorCode, OUString &rString) const
347 SAL_THROW(());
350 #endif // UUI_IAHNDL_HXX
352 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */