1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: stillinteraction.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
32 #define __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
34 //_________________________________________________________________________________________________________________
36 //_________________________________________________________________________________________________________________
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/xinterface.hxx>
40 #include <macros/xtypeprovider.hxx>
43 //_________________________________________________________________________________________________________________
45 //_________________________________________________________________________________________________________________
46 #include <com/sun/star/task/XInteractionHandler.hpp>
47 #include <com/sun/star/task/XInteractionRequest.hpp>
49 //_________________________________________________________________________________________________________________
51 //_________________________________________________________________________________________________________________
52 #include <cppuhelper/weak.hxx>
54 //_________________________________________________________________________________________________________________
56 //_________________________________________________________________________________________________________________
60 //_________________________________________________________________________________________________________________
62 //_________________________________________________________________________________________________________________
64 //_________________________________________________________________________________________________________________
65 // exported definitions
66 //_________________________________________________________________________________________________________________
69 @short handle interactions non visible
70 @descr Sometimes it's neccessary to use a non visible interaction handler.
71 He can't do anything, which a visible one can handle.
72 But it can be used to intercept problems e.g. during loading of documents.
74 In current implementation we solve conflicts for following situations only:
75 - AmbigousFilterRequest
76 - InteractiveIOException
77 - InteractiveAugmentedIOException
78 All other requests will be aborted.
80 @modified 12.07.2002 14:06
83 class QuietInteraction
: public css::lang::XTypeProvider
84 , public css::task::XInteractionHandler
85 , private ThreadHelpBase
86 , public ::cppu::OWeakObject
88 //_____________________________________
92 /// in case an unknown interaction was aborted - we save it for our external user!
93 css::uno::Any m_aRequest
;
95 //_____________________________________
99 // XInterface, XTypeProvider
100 FWK_DECLARE_XINTERFACE
101 FWK_DECLARE_XTYPEPROVIDER
103 //_________________________________
105 @interface XInteractionHandler
106 @short called from outside to handle a problem
107 @descr The only interaction we can handle here is to
108 decide which of two ambigous filters should be realy used.
109 We use the user selected one every time.
110 All other request will be aborted and can break the code,
111 which use this interaction handler.
113 But you can use another method of this class to check for
114 some special interactions too: IO Exceptions
115 May a ComponentLoader needs that to throw suitable exception
116 on his own interface.
120 virtual void SAL_CALL
handle( const css::uno::Reference
< css::task::XInteractionRequest
>& xRequest
) throw( css::uno::RuntimeException
);
122 //_____________________________________
126 //_________________________________
128 @short ctor to guarantee right initialized instances of this class
131 @threadsafe not neccessary
135 //_________________________________
137 @short return the handled interaction request
138 @descr We saved any getted interaction request internaly.
139 May the outside user of this class is interessted
140 on that. Especialy we gotted an unknown interaction
143 @return [com.sun.star.uno.Any]
144 the packed interaction request
145 Can be empty if no interaction was used!
149 css::uno::Any
getRequest() const;
151 //_________________________________
153 @short returns information if interaction was used
154 @descr It can be usefully to know the reason for a failed operation.
157 <TRUE/> for used interaction
162 sal_Bool
wasUsed() const;
165 } // namespace framework
167 #endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_