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 __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
21 #define __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
24 #include <macros/xinterface.hxx>
25 #include <macros/xtypeprovider.hxx>
28 #include <com/sun/star/task/XInteractionHandler.hpp>
29 #include <com/sun/star/task/XInteractionRequest.hpp>
31 #include <cppuhelper/weak.hxx>
36 @short handle interactions non visible
37 @descr Sometimes it's neccessary to use a non visible interaction handler.
38 He can't do anything, which a visible one can handle.
39 But it can be used to intercept problems e.g. during loading of documents.
41 In current implementation we solve conflicts for following situations only:
42 - AmbigousFilterRequest
43 - InteractiveIOException
44 - InteractiveAugmentedIOException
45 All other requests will be aborted.
49 class QuietInteraction
: public css::lang::XTypeProvider
50 , public css::task::XInteractionHandler
51 , private ThreadHelpBase
52 , public ::cppu::OWeakObject
54 //_____________________________________
58 /// in case an unknown interaction was aborted - we save it for our external user!
59 css::uno::Any m_aRequest
;
61 //_____________________________________
65 // XInterface, XTypeProvider
66 FWK_DECLARE_XINTERFACE
67 FWK_DECLARE_XTYPEPROVIDER
69 //_________________________________
71 @interface XInteractionHandler
72 @short called from outside to handle a problem
73 @descr The only interaction we can handle here is to
74 decide which of two ambigous filters should be realy used.
75 We use the user selected one every time.
76 All other request will be aborted and can break the code,
77 which use this interaction handler.
79 But you can use another method of this class to check for
80 some special interactions too: IO Exceptions
81 May a ComponentLoader needs that to throw suitable exception
86 virtual void SAL_CALL
handle( const css::uno::Reference
< css::task::XInteractionRequest
>& xRequest
) throw( css::uno::RuntimeException
);
88 //_____________________________________
92 //_________________________________
94 @short ctor to guarantee right initialized instances of this class
97 @threadsafe not neccessary
101 //_________________________________
103 @short return the handled interaction request
104 @descr We saved any getted interaction request internaly.
105 May the outside user of this class is interessted
106 on that. Especialy we gotted an unknown interaction
109 @return [com.sun.star.uno.Any]
110 the packed interaction request
111 Can be empty if no interaction was used!
115 css::uno::Any
getRequest() const;
117 //_________________________________
119 @short returns information if interaction was used
120 @descr It can be useful to know the reason for a failed operation.
123 <TRUE/> for used interaction
128 sal_Bool
wasUsed() const;
131 } // namespace framework
133 #endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */