1*b3b486c3SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b3b486c3SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b3b486c3SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b3b486c3SAndrew Rist  * distributed with this work for additional information
6*b3b486c3SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b3b486c3SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b3b486c3SAndrew Rist  * "License"); you may not use this file except in compliance
9*b3b486c3SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b3b486c3SAndrew Rist  *
11*b3b486c3SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b3b486c3SAndrew Rist  *
13*b3b486c3SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b3b486c3SAndrew Rist  * software distributed under the License is distributed on an
15*b3b486c3SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3b486c3SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b3b486c3SAndrew Rist  * specific language governing permissions and limitations
18*b3b486c3SAndrew Rist  * under the License.
19*b3b486c3SAndrew Rist  *
20*b3b486c3SAndrew Rist  *************************************************************/
21*b3b486c3SAndrew Rist 
22*b3b486c3SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _UCBHELPER_COMMANDENVIRONMENTPROXY_HXX
25cdf0e10cSrcweir #define _UCBHELPER_COMMANDENVIRONMENTPROXY_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
28cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_
29cdf0e10cSrcweir #include <com/sun/star/ucb/XCommandEnvironment.hpp>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
32cdf0e10cSrcweir #include <ucbhelper/macros.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace ucbhelper
35cdf0e10cSrcweir {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir struct CommandEnvironmentProxy_Impl;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //=========================================================================
40cdf0e10cSrcweir 
41cdf0e10cSrcweir /**
42cdf0e10cSrcweir   * This class implements the interface
43cdf0e10cSrcweir   * com::sun::star::ucb::XCommandEnvironement.
44cdf0e10cSrcweir   *
45cdf0e10cSrcweir   * Instances of this class can be used to create a (local) proxy for (remote)
46cdf0e10cSrcweir   * command environment implementations. This implementation caches the
47cdf0e10cSrcweir   * (remote) interfaces supplied by the given environment in order to avoid the
48cdf0e10cSrcweir   * overhead produced by multiple (remote) calls to methods of the given
49cdf0e10cSrcweir   * (remote) command environment.
50cdf0e10cSrcweir   */
51cdf0e10cSrcweir class CommandEnvironmentProxy : public cppu::OWeakObject,
52cdf0e10cSrcweir 						   		public com::sun::star::lang::XTypeProvider,
53cdf0e10cSrcweir 						   		public com::sun::star::ucb::XCommandEnvironment
54cdf0e10cSrcweir {
55cdf0e10cSrcweir 	CommandEnvironmentProxy_Impl* m_pImpl;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir private:
58cdf0e10cSrcweir 	CommandEnvironmentProxy( const CommandEnvironmentProxy& ); 			  // n.i.
59cdf0e10cSrcweir     CommandEnvironmentProxy& operator=( const CommandEnvironmentProxy& ); // n.i.
60cdf0e10cSrcweir 
61cdf0e10cSrcweir public:
62cdf0e10cSrcweir 	/**
63cdf0e10cSrcweir 	  * Constructor.
64cdf0e10cSrcweir 	  *
65cdf0e10cSrcweir 	  * @param rxEnv is the implementation of a (remote) command environment.
66cdf0e10cSrcweir 	  */
67cdf0e10cSrcweir 	CommandEnvironmentProxy(
68cdf0e10cSrcweir 			const com::sun::star::uno::Reference<
69cdf0e10cSrcweir 				com::sun::star::ucb::XCommandEnvironment >&	rxEnv );
70cdf0e10cSrcweir 	/**
71cdf0e10cSrcweir 	  * Destructor.
72cdf0e10cSrcweir 	  */
73cdf0e10cSrcweir 	virtual ~CommandEnvironmentProxy();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	// XInterface
76cdf0e10cSrcweir 	XINTERFACE_DECL()
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	// XTypeProvider
79cdf0e10cSrcweir 	XTYPEPROVIDER_DECL()
80cdf0e10cSrcweir 
81cdf0e10cSrcweir  	// XCommandEnvironemnt
82cdf0e10cSrcweir 	virtual com::sun::star::uno::Reference<
83cdf0e10cSrcweir 				com::sun::star::task::XInteractionHandler > SAL_CALL
84cdf0e10cSrcweir 	getInteractionHandler()
85cdf0e10cSrcweir 		throw ( com::sun::star::uno::RuntimeException );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	virtual com::sun::star::uno::Reference<
88cdf0e10cSrcweir 				com::sun::star::ucb::XProgressHandler > SAL_CALL
89cdf0e10cSrcweir 	getProgressHandler()
90cdf0e10cSrcweir 		throw ( com::sun::star::uno::RuntimeException );
91cdf0e10cSrcweir };
92cdf0e10cSrcweir 
93cdf0e10cSrcweir } /* namespace ucbhelper */
94cdf0e10cSrcweir 
95cdf0e10cSrcweir #endif /* !_UCBHELPER_COMMANDENVIRONMENTPROXY_HXX */
96