xref: /aoo41x/main/cppu/source/helper/purpenv/Proxy.hxx (revision cdf0e10c)
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 INCLUDED_Proxy_hxx
29 #define INCLUDED_Proxy_hxx
30 
31 #include "osl/interlck.h"
32 
33 #include "uno/environment.hxx"
34 #include "uno/mapping.hxx"
35 #include "uno/dispatcher.h"
36 
37 #include "cppu/helper/purpenv/Mapping.hxx"
38 
39 
40 namespace cssu = com::sun::star::uno;
41 
42 
43 class SAL_DLLPRIVATE Proxy : public uno_Interface
44 {
45     oslInterlockedCount                 m_nRef;
46 
47 	cssu::Environment                   m_from;
48 	cssu::Environment                   m_to;
49 
50 	cssu::Mapping                       m_from_to;
51 	cssu::Mapping                       m_to_from;
52 
53     // mapping information
54     uno_Interface                    *  m_pUnoI; // wrapped interface
55     typelib_InterfaceTypeDescription *  m_pTypeDescr;
56     rtl::OUString                       m_aOId;
57 
58 	cppu::helper::purpenv::ProbeFun   * m_probeFun;
59 	void                              * m_pProbeContext;
60 
61 public:
62     explicit Proxy(cssu::Mapping                    const & to_from,
63 				   uno_Environment                        * pTo,
64 				   uno_Environment                        * pFrom,
65 				   uno_Interface                          * pUnoI,
66 				   typelib_InterfaceTypeDescription       * pTypeDescr,
67 				   rtl::OUString                    const & rOId,
68 				   cppu::helper::purpenv::ProbeFun        * probeFun,
69 				   void                                   * pProbeContext)
70 		SAL_THROW( () );
71     ~Proxy(void);
72 
73 	void acquire(void);
74 	void release(void);
75 
76     void dispatch(
77         typelib_TypeDescriptionReference  * pReturnTypeRef,
78         typelib_MethodParameter           * pParams,
79         sal_Int32                           nParams,
80         typelib_TypeDescription     const * pMemberType,
81         void                              * pReturn,
82         void                              * pArgs[],
83         uno_Any                          ** ppException );
84 
85 };
86 
87 extern "C" SAL_DLLPRIVATE void SAL_CALL Proxy_free(uno_ExtEnvironment * pEnv, void * pProxy) SAL_THROW_EXTERN_C();
88 
89 #endif
90