1f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f8e07b45SAndrew Rist  * distributed with this work for additional information
6f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f8e07b45SAndrew Rist  *
11f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f8e07b45SAndrew Rist  *
13f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18f8e07b45SAndrew Rist  * under the License.
19f8e07b45SAndrew Rist  *
20f8e07b45SAndrew Rist  *************************************************************/
21f8e07b45SAndrew Rist 
22f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
32cdf0e10cSrcweir #include <macros/xinterface.hxx>
33cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
34cdf0e10cSrcweir #include <general.h>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir //_________________________________________________________________________________________________________________
37cdf0e10cSrcweir //	interface includes
38cdf0e10cSrcweir //_________________________________________________________________________________________________________________
39cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
40cdf0e10cSrcweir #include <com/sun/star/task/XInteractionRequest.hpp>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //_________________________________________________________________________________________________________________
43cdf0e10cSrcweir //	other includes
44cdf0e10cSrcweir //_________________________________________________________________________________________________________________
45cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //_________________________________________________________________________________________________________________
48cdf0e10cSrcweir //	namespace
49cdf0e10cSrcweir //_________________________________________________________________________________________________________________
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace framework{
52cdf0e10cSrcweir 
53cdf0e10cSrcweir //_________________________________________________________________________________________________________________
54cdf0e10cSrcweir //	exported const
55cdf0e10cSrcweir //_________________________________________________________________________________________________________________
56cdf0e10cSrcweir 
57cdf0e10cSrcweir //_________________________________________________________________________________________________________________
58cdf0e10cSrcweir //	exported definitions
59cdf0e10cSrcweir //_________________________________________________________________________________________________________________
60cdf0e10cSrcweir 
61cdf0e10cSrcweir /**
62cdf0e10cSrcweir     @short      handle interactions non visible
6307a3d7f1SPedro Giffuni     @descr      Sometimes it's necessary to use a non visible interaction handler.
64cdf0e10cSrcweir                 He can't do anything, which a visible one can handle.
65cdf0e10cSrcweir                 But it can be used to intercept problems e.g. during loading of documents.
66cdf0e10cSrcweir 
67cdf0e10cSrcweir                 In current implementation we solve conflicts for following situations only:
68cdf0e10cSrcweir                     - AmbigousFilterRequest
69cdf0e10cSrcweir                     - InteractiveIOException
70cdf0e10cSrcweir                     - InteractiveAugmentedIOException
71cdf0e10cSrcweir                 All other requests will be aborted.
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     @modified   12.07.2002 14:06
74cdf0e10cSrcweir     @by         Andreas Schl�ns
75cdf0e10cSrcweir  */
76cdf0e10cSrcweir class QuietInteraction : public  css::lang::XTypeProvider
77cdf0e10cSrcweir                        , public  css::task::XInteractionHandler
78cdf0e10cSrcweir                        , private ThreadHelpBase
79cdf0e10cSrcweir                        , public  ::cppu::OWeakObject
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     //_____________________________________
82cdf0e10cSrcweir     // member
83cdf0e10cSrcweir     private:
84cdf0e10cSrcweir 
85cdf0e10cSrcweir         /// in case an unknown interaction was aborted - we save it for our external user!
86cdf0e10cSrcweir         css::uno::Any m_aRequest;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     //_____________________________________
89cdf0e10cSrcweir     // uno interface
90cdf0e10cSrcweir     public:
91cdf0e10cSrcweir 
92cdf0e10cSrcweir         // XInterface, XTypeProvider
93cdf0e10cSrcweir         FWK_DECLARE_XINTERFACE
94cdf0e10cSrcweir         FWK_DECLARE_XTYPEPROVIDER
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         //_________________________________
97cdf0e10cSrcweir         /**
98cdf0e10cSrcweir             @interface  XInteractionHandler
99cdf0e10cSrcweir             @short      called from outside to handle a problem
100cdf0e10cSrcweir             @descr      The only interaction we can handle here is to
101*15289133Smseidel                         decide which of two ambiguous filters should be really used.
102cdf0e10cSrcweir                         We use the user selected one every time.
103cdf0e10cSrcweir                         All other request will be aborted and can break the code,
104cdf0e10cSrcweir                         which use this interaction handler.
105cdf0e10cSrcweir 
106cdf0e10cSrcweir                         But you can use another method of this class to check for
107cdf0e10cSrcweir                         some special interactions too: IO Exceptions
108cdf0e10cSrcweir                         May a ComponentLoader needs that to throw suitable exception
109cdf0e10cSrcweir                         on his own interface.
110cdf0e10cSrcweir 
111cdf0e10cSrcweir             @threadsafe yes
112cdf0e10cSrcweir         */
113cdf0e10cSrcweir         virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     //_____________________________________
116cdf0e10cSrcweir     // c++ interface
117cdf0e10cSrcweir     public:
118cdf0e10cSrcweir 
119cdf0e10cSrcweir         //_________________________________
120cdf0e10cSrcweir         /**
121cdf0e10cSrcweir             @short      ctor to guarantee right initialized instances of this class
122cdf0e10cSrcweir             @descr      -
123cdf0e10cSrcweir 
12407a3d7f1SPedro Giffuni             @threadsafe not necessary
125cdf0e10cSrcweir         */
126cdf0e10cSrcweir         QuietInteraction();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir         //_________________________________
129cdf0e10cSrcweir         /**
13006fea5ebSmseidel             @short      returns the handled interaction request
13106fea5ebSmseidel             @descr      We saved any getted interaction request internally.
13206fea5ebSmseidel                         Maybe the outside user of this class is interested
13306fea5ebSmseidel                         in that. Especially if we got an unknown interaction
134cdf0e10cSrcweir                         and aborted it hard.
135cdf0e10cSrcweir 
136cdf0e10cSrcweir             @return     [com.sun.star.uno.Any]
137cdf0e10cSrcweir                             the packed interaction request
138cdf0e10cSrcweir                             Can be empty if no interaction was used!
139cdf0e10cSrcweir 
140cdf0e10cSrcweir             @threadsafe yes
141cdf0e10cSrcweir         */
142cdf0e10cSrcweir         css::uno::Any getRequest() const;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir         //_________________________________
145cdf0e10cSrcweir         /**
146cdf0e10cSrcweir             @short      returns information if interaction was used
14706fea5ebSmseidel             @descr      It can be useful to know the reason for a failed operation.
148cdf0e10cSrcweir 
149cdf0e10cSrcweir             @return     [boolean]
150cdf0e10cSrcweir                             <TRUE/> for used interaction
151*15289133Smseidel                             <FALSE/> otherwise
152cdf0e10cSrcweir 
153cdf0e10cSrcweir             @threadsafe yes
154cdf0e10cSrcweir         */
155cdf0e10cSrcweir         sal_Bool wasUsed() const;
156cdf0e10cSrcweir };
157cdf0e10cSrcweir 
158cdf0e10cSrcweir } // namespace framework
159cdf0e10cSrcweir 
160cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_
161