1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
29*cdf0e10cSrcweir #define __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
32*cdf0e10cSrcweir //	my own includes
33*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
36*cdf0e10cSrcweir #include <macros/xinterface.hxx>
37*cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
38*cdf0e10cSrcweir #include <general.h>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
41*cdf0e10cSrcweir //	interface includes
42*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
43*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionRequest.hpp>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
47*cdf0e10cSrcweir //	other includes
48*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
49*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
52*cdf0e10cSrcweir //	namespace
53*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir namespace framework{
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
58*cdf0e10cSrcweir //	exported const
59*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
62*cdf0e10cSrcweir //	exported definitions
63*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir /**
66*cdf0e10cSrcweir     @short      handle interactions non visible
67*cdf0e10cSrcweir     @descr      Sometimes it's neccessary to use a non visible interaction handler.
68*cdf0e10cSrcweir                 He can't do anything, which a visible one can handle.
69*cdf0e10cSrcweir                 But it can be used to intercept problems e.g. during loading of documents.
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir                 In current implementation we solve conflicts for following situations only:
72*cdf0e10cSrcweir                     - AmbigousFilterRequest
73*cdf0e10cSrcweir                     - InteractiveIOException
74*cdf0e10cSrcweir                     - InteractiveAugmentedIOException
75*cdf0e10cSrcweir                 All other requests will be aborted.
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir     @modified   12.07.2002 14:06
78*cdf0e10cSrcweir     @by         Andreas Schl�ns
79*cdf0e10cSrcweir  */
80*cdf0e10cSrcweir class QuietInteraction : public  css::lang::XTypeProvider
81*cdf0e10cSrcweir                        , public  css::task::XInteractionHandler
82*cdf0e10cSrcweir                        , private ThreadHelpBase
83*cdf0e10cSrcweir                        , public  ::cppu::OWeakObject
84*cdf0e10cSrcweir {
85*cdf0e10cSrcweir     //_____________________________________
86*cdf0e10cSrcweir     // member
87*cdf0e10cSrcweir     private:
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir         /// in case an unknown interaction was aborted - we save it for our external user!
90*cdf0e10cSrcweir         css::uno::Any m_aRequest;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     //_____________________________________
93*cdf0e10cSrcweir     // uno interface
94*cdf0e10cSrcweir     public:
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir         // XInterface, XTypeProvider
97*cdf0e10cSrcweir         FWK_DECLARE_XINTERFACE
98*cdf0e10cSrcweir         FWK_DECLARE_XTYPEPROVIDER
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir         //_________________________________
101*cdf0e10cSrcweir         /**
102*cdf0e10cSrcweir             @interface  XInteractionHandler
103*cdf0e10cSrcweir             @short      called from outside to handle a problem
104*cdf0e10cSrcweir             @descr      The only interaction we can handle here is to
105*cdf0e10cSrcweir                         decide which of two ambigous filters should be realy used.
106*cdf0e10cSrcweir                         We use the user selected one every time.
107*cdf0e10cSrcweir                         All other request will be aborted and can break the code,
108*cdf0e10cSrcweir                         which use this interaction handler.
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir                         But you can use another method of this class to check for
111*cdf0e10cSrcweir                         some special interactions too: IO Exceptions
112*cdf0e10cSrcweir                         May a ComponentLoader needs that to throw suitable exception
113*cdf0e10cSrcweir                         on his own interface.
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir             @threadsafe yes
116*cdf0e10cSrcweir         */
117*cdf0e10cSrcweir         virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     //_____________________________________
120*cdf0e10cSrcweir     // c++ interface
121*cdf0e10cSrcweir     public:
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir         //_________________________________
124*cdf0e10cSrcweir         /**
125*cdf0e10cSrcweir             @short      ctor to guarantee right initialized instances of this class
126*cdf0e10cSrcweir             @descr      -
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir             @threadsafe not neccessary
129*cdf0e10cSrcweir         */
130*cdf0e10cSrcweir         QuietInteraction();
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir         //_________________________________
133*cdf0e10cSrcweir         /**
134*cdf0e10cSrcweir             @short      return the handled interaction request
135*cdf0e10cSrcweir             @descr      We saved any getted interaction request internaly.
136*cdf0e10cSrcweir                         May the outside user of this class is interessted
137*cdf0e10cSrcweir                         on that. Especialy we gotted an unknown interaction
138*cdf0e10cSrcweir                         and aborted it hard.
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir             @return     [com.sun.star.uno.Any]
141*cdf0e10cSrcweir                             the packed interaction request
142*cdf0e10cSrcweir                             Can be empty if no interaction was used!
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir             @threadsafe yes
145*cdf0e10cSrcweir         */
146*cdf0e10cSrcweir         css::uno::Any getRequest() const;
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir         //_________________________________
149*cdf0e10cSrcweir         /**
150*cdf0e10cSrcweir             @short      returns information if interaction was used
151*cdf0e10cSrcweir             @descr      It can be usefully to know the reason for a failed operation.
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir             @return     [boolean]
154*cdf0e10cSrcweir                             <TRUE/> for used interaction
155*cdf0e10cSrcweir                             <FALSE/> otherwhise
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir             @threadsafe yes
158*cdf0e10cSrcweir         */
159*cdf0e10cSrcweir         sal_Bool wasUsed() const;
160*cdf0e10cSrcweir };
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir } // namespace framework
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_
165