update credits
[LibreOffice.git] / framework / inc / interaction / quietinteraction.hxx
blob01183013f3241eff6f96b7adc5406a161147b77f
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 __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>
26 #include <general.h>
28 #include <com/sun/star/task/XInteractionHandler.hpp>
29 #include <com/sun/star/task/XInteractionRequest.hpp>
31 #include <cppuhelper/weak.hxx>
33 namespace framework{
35 /**
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.
47 @by Andreas Schlüns
49 class QuietInteraction : public css::lang::XTypeProvider
50 , public css::task::XInteractionHandler
51 , private ThreadHelpBase
52 , public ::cppu::OWeakObject
54 //_____________________________________
55 // member
56 private:
58 /// in case an unknown interaction was aborted - we save it for our external user!
59 css::uno::Any m_aRequest;
61 //_____________________________________
62 // uno interface
63 public:
65 // XInterface, XTypeProvider
66 FWK_DECLARE_XINTERFACE
67 FWK_DECLARE_XTYPEPROVIDER
69 //_________________________________
70 /**
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
82 on his own interface.
84 @threadsafe yes
86 virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException );
88 //_____________________________________
89 // c++ interface
90 public:
92 //_________________________________
93 /**
94 @short ctor to guarantee right initialized instances of this class
95 @descr -
97 @threadsafe not neccessary
99 QuietInteraction();
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
107 and aborted it hard.
109 @return [com.sun.star.uno.Any]
110 the packed interaction request
111 Can be empty if no interaction was used!
113 @threadsafe yes
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.
122 @return [boolean]
123 <TRUE/> for used interaction
124 <FALSE/> otherwise
126 @threadsafe yes
128 sal_Bool wasUsed() const;
131 } // namespace framework
133 #endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */