1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SVTOOLS_FILEPICKER_INTERACTION_HXX
25 #define SVTOOLS_FILEPICKER_INTERACTION_HXX
26 
27 #include <cppuhelper/implbase1.hxx>
28 #include <com/sun/star/task/XInteractionHandler.hpp>
29 
30 //........................................................................
31 namespace svt
32 {
33 //........................................................................
34 
35 	//====================================================================
36 	//= OFilePickerInteractionHandler
37 	//====================================================================
38 	typedef ::cppu::WeakImplHelper1	<	::com::sun::star::task::XInteractionHandler
39 									>	OFilePickerInteractionHandler_Base;
40 
41 	/** a InteractionHandler implementation which extends another handler with some customizability
42 	*/
43 	class OFilePickerInteractionHandler : public OFilePickerInteractionHandler_Base
44 	{
45     public:
46         /** flags, which indicates special handled interactions
47             These values will be used combained as flags - so they must
48             in range [2^n]!
49          */
50         enum EInterceptedInteractions
51         {
52             E_NOINTERCEPTION = 0,
53             E_DOESNOTEXIST   = 1
54             // next values [2,4,8,16 ...]!
55         };
56 
57 	protected:
58         ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xMaster        ; // our master handler
59         ::com::sun::star::uno::Any                                                      m_aException     ; // the last handled request
60         sal_Bool                                                                        m_bUsed          ; // indicates using of this interaction handler instance
61         EInterceptedInteractions                                                        m_eInterceptions ; // enable/disable interception of some special interactions
62 
63 	public:
64         OFilePickerInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxMaster );
65 
66         // some generic functions
67         void     enableInterceptions( EInterceptedInteractions eInterceptions );
68         sal_Bool wasUsed            () const;
69         void     resetUseState      ();
70         void     forgetRequest      ();
71 
72         // functions to analyze last cached request
73         sal_Bool wasAccessDenied() const;
74 
75 	protected:
76 		// XInteractionHandler
77 		virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& _rxRequest ) throw (::com::sun::star::uno::RuntimeException);
78 
79 	private:
80 		~OFilePickerInteractionHandler();
81 	};
82 
83 //........................................................................
84 }	// namespace svt
85 //........................................................................
86 
87 #endif // SVTOOLS_FILEPICKER_INTERACTION_HXX
88 
89