Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_FRAMEWORK_INC_INTERACTION_QUIETINTERACTION_HXX
21 : #define INCLUDED_FRAMEWORK_INC_INTERACTION_QUIETINTERACTION_HXX
22 :
23 : #include <macros/xinterface.hxx>
24 : #include <macros/xtypeprovider.hxx>
25 : #include <general.h>
26 :
27 : #include <com/sun/star/task/XInteractionHandler.hpp>
28 : #include <com/sun/star/task/XInteractionRequest.hpp>
29 :
30 : #include <cppuhelper/implbase1.hxx>
31 :
32 : namespace framework{
33 :
34 : /**
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.
39 :
40 : In current implementation we solve conflicts for following situations only:
41 : - AmbigousFilterRequest
42 : - InteractiveIOException
43 : - InteractiveAugmentedIOException
44 : All other requests will be aborted.
45 : */
46 0 : class QuietInteraction : public ::cppu::WeakImplHelper1<
47 : css::task::XInteractionHandler >
48 : {
49 : // member
50 : private:
51 :
52 : /// in case an unknown interaction was aborted - we save it for our external user!
53 : css::uno::Any m_aRequest;
54 :
55 : // uno interface
56 : public:
57 :
58 : // XInterface, XTypeProvider
59 :
60 : /**
61 : @interface XInteractionHandler
62 : @short called from outside to handle a problem
63 : @descr The only interaction we can handle here is to
64 : decide which of two ambigous filters should be really used.
65 : We use the user selected one every time.
66 : All other request will be aborted and can break the code,
67 : which use this interaction handler.
68 :
69 : But you can use another method of this class to check for
70 : some special interactions too: IO Exceptions
71 : May a ComponentLoader needs that to throw suitable exception
72 : on his own interface.
73 :
74 : @threadsafe yes
75 : */
76 : virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
77 :
78 : // c++ interface
79 : public:
80 : /**
81 : @short ctor to guarantee right initialized instances of this class
82 : @threadsafe not necessary
83 : */
84 : QuietInteraction();
85 :
86 : /**
87 : @short return the handled interaction request
88 : @descr We saved any getted interaction request internally.
89 : May the outside user of this class is interessted
90 : on that. Especialy we gotted an unknown interaction
91 : and aborted it hard.
92 :
93 : @return [com.sun.star.uno.Any]
94 : the packed interaction request
95 : Can be empty if no interaction was used!
96 :
97 : @threadsafe yes
98 : */
99 : css::uno::Any getRequest() const;
100 :
101 : /**
102 : @short returns information if interaction was used
103 : @descr It can be useful to know the reason for a failed operation.
104 :
105 : @return [boolean]
106 : <TRUE/> for used interaction
107 : <FALSE/> otherwise
108 :
109 : @threadsafe yes
110 : */
111 : bool wasUsed() const;
112 : };
113 :
114 : } // namespace framework
115 :
116 : #endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|