1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SVTOOLS_FILEPICKER_INTERACTION_HXX
29 #define SVTOOLS_FILEPICKER_INTERACTION_HXX
30 
31 #include <cppuhelper/implbase1.hxx>
32 #include <com/sun/star/task/XInteractionHandler.hpp>
33 
34 //........................................................................
35 namespace svt
36 {
37 //........................................................................
38 
39 	//====================================================================
40 	//= OFilePickerInteractionHandler
41 	//====================================================================
42 	typedef ::cppu::WeakImplHelper1	<	::com::sun::star::task::XInteractionHandler
43 									>	OFilePickerInteractionHandler_Base;
44 
45 	/** a InteractionHandler implementation which extends another handler with some customizability
46 	*/
47 	class OFilePickerInteractionHandler : public OFilePickerInteractionHandler_Base
48 	{
49     public:
50         /** flags, which indicates special handled interactions
51             These values will be used combained as flags - so they must
52             in range [2^n]!
53          */
54         enum EInterceptedInteractions
55         {
56             E_NOINTERCEPTION = 0,
57             E_DOESNOTEXIST   = 1
58             // next values [2,4,8,16 ...]!
59         };
60 
61 	protected:
62         ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xMaster        ; // our master handler
63         ::com::sun::star::uno::Any                                                      m_aException     ; // the last handled request
64         sal_Bool                                                                        m_bUsed          ; // indicates using of this interaction handler instance
65         EInterceptedInteractions                                                        m_eInterceptions ; // enable/disable interception of some special interactions
66 
67 	public:
68         OFilePickerInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxMaster );
69 
70         // some generic functions
71         void     enableInterceptions( EInterceptedInteractions eInterceptions );
72         sal_Bool wasUsed            () const;
73         void     resetUseState      ();
74         void     forgetRequest      ();
75 
76         // functions to analyze last cached request
77         sal_Bool wasAccessDenied() const;
78 
79 	protected:
80 		// XInteractionHandler
81 		virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& _rxRequest ) throw (::com::sun::star::uno::RuntimeException);
82 
83 	private:
84 		~OFilePickerInteractionHandler();
85 	};
86 
87 //........................................................................
88 }	// namespace svt
89 //........................................................................
90 
91 #endif // SVTOOLS_FILEPICKER_INTERACTION_HXX
92 
93