1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_FRAMEWORK_INC_INTERACTION_QUIETINTERACTION_HXX
21 #define INCLUDED_FRAMEWORK_INC_INTERACTION_QUIETINTERACTION_HXX
23 #include <macros/xinterface.hxx>
24 #include <macros/xtypeprovider.hxx>
27 #include <com/sun/star/task/XInteractionHandler.hpp>
28 #include <com/sun/star/task/XInteractionRequest.hpp>
30 #include <cppuhelper/implbase1.hxx>
35 @short handle interactions non visible
36 @descr Sometimes it's necessary to use a non visible interaction handler.
37 He can't do anything, which a visible one can handle.
38 But it can be used to intercept problems e.g. during loading of documents.
40 In current implementation we solve conflicts for following situations only:
41 - InteractiveIOException
42 - InteractiveAugmentedIOException
43 All other requests will be aborted.
45 class QuietInteraction
: public ::cppu::WeakImplHelper1
<
46 css::task::XInteractionHandler
>
51 /// in case an unknown interaction was aborted - we save it for our external user!
52 css::uno::Any m_aRequest
;
57 // XInterface, XTypeProvider
60 @interface XInteractionHandler
61 @short called from outside to handle a problem
62 @descr The only interaction we can handle here is to
63 decide which of two ambigous filters should be really used.
64 We use the user selected one every time.
65 All other request will be aborted and can break the code,
66 which use this interaction handler.
68 But you can use another method of this class to check for
69 some special interactions too: IO Exceptions
70 May a ComponentLoader needs that to throw suitable exception
75 virtual void SAL_CALL
handle( const css::uno::Reference
< css::task::XInteractionRequest
>& xRequest
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 @short ctor to guarantee right initialized instances of this class
81 @threadsafe not necessary
86 @short return the handled interaction request
87 @descr We saved any getted interaction request internally.
88 May the outside user of this class is interessted
89 on that. Especially we gotted an unknown interaction
92 @return [com.sun.star.uno.Any]
93 the packed interaction request
94 Can be empty if no interaction was used!
98 css::uno::Any
getRequest() const;
101 @short returns information if interaction was used
102 @descr It can be useful to know the reason for a failed operation.
105 <TRUE/> for used interaction
110 bool wasUsed() const;
113 } // namespace framework
115 #endif // INCLUDED_FRAMEWORK_INC_INTERACTION_QUIETINTERACTION_HXX
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */