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 _UCBHELPER_COMMANDENVIRONMENT_HXX
25 #define _UCBHELPER_COMMANDENVIRONMENT_HXX
26 
27 #include <com/sun/star/lang/XTypeProvider.hpp>
28 #ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_
29 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
30 #endif
31 #include <cppuhelper/weak.hxx>
32 #include <ucbhelper/macros.hxx>
33 #include "ucbhelper/ucbhelperdllapi.h"
34 
35 namespace ucbhelper
36 {
37 
38 struct CommandEnvironment_Impl;
39 
40 //=========================================================================
41 
42 /**
43   * This class implements the interface
44   * com::sun::star::ucb::XCommandEnvironement. Instances of this class can
45   * be used to supply environments to commands executed by UCB contents.
46   */
47 class UCBHELPER_DLLPUBLIC CommandEnvironment : public cppu::OWeakObject,
48 						   public com::sun::star::lang::XTypeProvider,
49 						   public com::sun::star::ucb::XCommandEnvironment
50 {
51 	CommandEnvironment_Impl* m_pImpl;
52 
53 private:
54 	UCBHELPER_DLLPRIVATE CommandEnvironment( const CommandEnvironment& ); 				// n.i.
55     UCBHELPER_DLLPRIVATE CommandEnvironment& operator=( const CommandEnvironment& ); 	// n.i.
56 
57 public:
58 	/**
59 	  * Constructor.
60 	  *
61 	  * @param rxInteractionHandler is the implementation of an Interaction
62 	  *        Handler or an empty reference.
63 	  * @param rxProgressHandler is the implementation of a Progress
64 	  *        Handler or an empty reference.
65 	  */
66 	CommandEnvironment(
67 			const com::sun::star::uno::Reference<
68 				com::sun::star::task::XInteractionHandler >&
69 					rxInteractionHandler,
70 			const com::sun::star::uno::Reference<
71 				com::sun::star::ucb::XProgressHandler >&
72 					rxProgressHandler );
73 	/**
74 	  * Destructor.
75 	  */
76 	virtual ~CommandEnvironment();
77 
78 	// XInterface
79 	XINTERFACE_DECL()
80 
81 	// XTypeProvider
82 	XTYPEPROVIDER_DECL()
83 
84  	// XCommandEnvironemnt
85 	virtual com::sun::star::uno::Reference<
86 				com::sun::star::task::XInteractionHandler > SAL_CALL
87 	getInteractionHandler()
88 		throw ( com::sun::star::uno::RuntimeException );
89 
90 	virtual com::sun::star::uno::Reference<
91 				com::sun::star::ucb::XProgressHandler > SAL_CALL
92 	getProgressHandler()
93 		throw ( com::sun::star::uno::RuntimeException );
94 };
95 
96 } /* namespace ucbhelper */
97 
98 #endif /* !_UCBHELPER_COMMANDENVIRONMENT_HXX */
99