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 .
22 #include <com/sun/star/task/XInteractionHandler.hpp>
23 #include <com/sun/star/task/XInteractionRequest.hpp>
25 #include <cppuhelper/implbase.hxx>
30 @short handle interactions non visible
31 @descr Sometimes it's necessary to use a non visible interaction handler.
32 He can't do anything, which a visible one can handle.
33 But it can be used to intercept problems e.g. during loading of documents.
35 In current implementation we solve conflicts for following situations only:
36 - InteractiveIOException
37 - InteractiveAugmentedIOException
38 All other requests will be aborted.
40 class QuietInteraction final
: public ::cppu::WeakImplHelper
<
41 css::task::XInteractionHandler
>
46 /// in case an unknown interaction was aborted - we save it for our external user!
47 css::uno::Any m_aRequest
;
52 // XInterface, XTypeProvider
55 @interface XInteractionHandler
56 @short called from outside to handle a problem
57 @descr The only interaction we can handle here is to
58 decide which of two ambiguous filters should be really used.
59 We use the user selected one every time.
60 All other request will be aborted and can break the code,
61 which use this interaction handler.
63 But you can use another method of this class to check for
64 some special interactions too: IO Exceptions
65 May a ComponentLoader needs that to throw suitable exception
70 virtual void SAL_CALL
handle( const css::uno::Reference
< css::task::XInteractionRequest
>& xRequest
) override
;
75 @short ctor to guarantee right initialized instances of this class
76 @threadsafe not necessary
81 @short return the handled interaction request
82 @descr We saved any obtained interaction request internally.
83 Maybe the outside user of this class is interested
84 on that. Especially we got an unknown interaction
87 @return [com.sun.star.uno.Any]
88 the packed interaction request
89 Can be empty if no interaction was used!
93 css::uno::Any
getRequest() const;
96 @short returns information if interaction was used
97 @descr It can be useful to know the reason for a failed operation.
100 <TRUE/> for used interaction
105 bool wasUsed() const;
108 } // namespace framework
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */