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 _UCBHELPER_COMMANDENVIRONMENTPROXY_HXX
29 #define _UCBHELPER_COMMANDENVIRONMENTPROXY_HXX
30 
31 #include <com/sun/star/lang/XTypeProvider.hpp>
32 #ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_
33 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
34 #endif
35 #include <cppuhelper/weak.hxx>
36 #include <ucbhelper/macros.hxx>
37 
38 namespace ucbhelper
39 {
40 
41 struct CommandEnvironmentProxy_Impl;
42 
43 //=========================================================================
44 
45 /**
46   * This class implements the interface
47   * com::sun::star::ucb::XCommandEnvironement.
48   *
49   * Instances of this class can be used to create a (local) proxy for (remote)
50   * command environment implementations. This implementation caches the
51   * (remote) interfaces supplied by the given environment in order to avoid the
52   * overhead produced by multiple (remote) calls to methods of the given
53   * (remote) command environment.
54   */
55 class CommandEnvironmentProxy : public cppu::OWeakObject,
56 						   		public com::sun::star::lang::XTypeProvider,
57 						   		public com::sun::star::ucb::XCommandEnvironment
58 {
59 	CommandEnvironmentProxy_Impl* m_pImpl;
60 
61 private:
62 	CommandEnvironmentProxy( const CommandEnvironmentProxy& ); 			  // n.i.
63     CommandEnvironmentProxy& operator=( const CommandEnvironmentProxy& ); // n.i.
64 
65 public:
66 	/**
67 	  * Constructor.
68 	  *
69 	  * @param rxEnv is the implementation of a (remote) command environment.
70 	  */
71 	CommandEnvironmentProxy(
72 			const com::sun::star::uno::Reference<
73 				com::sun::star::ucb::XCommandEnvironment >&	rxEnv );
74 	/**
75 	  * Destructor.
76 	  */
77 	virtual ~CommandEnvironmentProxy();
78 
79 	// XInterface
80 	XINTERFACE_DECL()
81 
82 	// XTypeProvider
83 	XTYPEPROVIDER_DECL()
84 
85  	// XCommandEnvironemnt
86 	virtual com::sun::star::uno::Reference<
87 				com::sun::star::task::XInteractionHandler > SAL_CALL
88 	getInteractionHandler()
89 		throw ( com::sun::star::uno::RuntimeException );
90 
91 	virtual com::sun::star::uno::Reference<
92 				com::sun::star::ucb::XProgressHandler > SAL_CALL
93 	getProgressHandler()
94 		throw ( com::sun::star::uno::RuntimeException );
95 };
96 
97 } /* namespace ucbhelper */
98 
99 #endif /* !_UCBHELPER_COMMANDENVIRONMENTPROXY_HXX */
100