xref: /trunk/main/UnoControls/source/inc/OConnectionPointContainerHelper.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 _OCONNECTIONPOINTCONTAINERHELPER_HXX
29 #define _OCONNECTIONPOINTCONTAINERHELPER_HXX
30 
31 //______________________________________________________________________________________________________________
32 //  includes of other projects
33 //______________________________________________________________________________________________________________
34 
35 #include <com/sun/star/lang/XConnectionPointContainer.hpp>
36 #include <com/sun/star/lang/XConnectionPoint.hpp>
37 #include <cppuhelper/weak.hxx>
38 #include <cppuhelper/propshlp.hxx>
39 
40 //______________________________________________________________________________________________________________
41 //  includes of my own project
42 //______________________________________________________________________________________________________________
43 
44 //______________________________________________________________________________________________________________
45 //  namespaces
46 //______________________________________________________________________________________________________________
47 
48 namespace unocontrols{
49 
50 #define UNO3_ANY                                        ::com::sun::star::uno::Any
51 #define UNO3_SEQUENCE                                   ::com::sun::star::uno::Sequence
52 #define UNO3_TYPE                                       ::com::sun::star::uno::Type
53 #define UNO3_REFERENCE                                  ::com::sun::star::uno::Reference
54 #define UNO3_XCONNECTIONPOINTCONTAINER                  ::com::sun::star::lang::XConnectionPointContainer
55 #define UNO3_XCONNECTIONPOINT                           ::com::sun::star::lang::XConnectionPoint
56 #define UNO3_MUTEX                                      ::osl::Mutex
57 #define UNO3_RUNTIMEEXCEPTION                           ::com::sun::star::uno::RuntimeException
58 #define UNO3_XINTERFACE                                 ::com::sun::star::uno::XInterface
59 #define UNO3_OMULTITYPEINTERFACECONTAINERHELPER         ::cppu::OMultiTypeInterfaceContainerHelper
60 #define UNO3_LISTENEREXISTEXCEPTION                     ::com::sun::star::lang::ListenerExistException
61 #define UNO3_INVALIDLISTENEREXCEPTION                   ::com::sun::star::lang::InvalidListenerException
62 #define UNO3_WEAKREFERENCE                              ::com::sun::star::uno::WeakReference
63 #define UNO3_OWEAKOBJECT                                ::cppu::OWeakObject
64 
65 //______________________________________________________________________________________________________________
66 //  defines
67 //______________________________________________________________________________________________________________
68 
69 //______________________________________________________________________________________________________________
70 //  class declaration OConnectionPointContainerHelper
71 //______________________________________________________________________________________________________________
72 
73 class OConnectionPointContainerHelper   :   public  UNO3_XCONNECTIONPOINTCONTAINER
74                                         ,   public  UNO3_OWEAKOBJECT
75 {
76 
77 //______________________________________________________________________________________________________________
78 //  public methods
79 //______________________________________________________________________________________________________________
80 
81 public:
82 
83     //__________________________________________________________________________________________________________
84     //  construct/destruct
85     //__________________________________________________________________________________________________________
86 
87     /**_________________________________________________________________________________________________________
88         @short
89         @descr
90 
91         @seealso
92 
93         @param
94 
95         @return
96 
97         @onerror
98     */
99 
100     OConnectionPointContainerHelper( UNO3_MUTEX& aMutex );
101 
102     /**_________________________________________________________________________________________________________
103         @short
104         @descr
105 
106         @seealso
107 
108         @param
109 
110         @return
111 
112         @onerror
113     */
114 
115     virtual ~OConnectionPointContainerHelper();
116 
117     //________________________________________________________________________________________________________
118     //  XInterface
119     //________________________________________________________________________________________________________
120 
121     /**_______________________________________________________________________________________________________
122         @short      give answer, if interface is supported
123         @descr      The interfaces are searched by type.
124 
125         @seealso    XInterface
126 
127         @param      "rType" is the type of searched interface.
128 
129         @return     Any     information about found interface
130 
131         @onerror    A RuntimeException is thrown.
132     */
133 
134     virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
135 
136     /**_______________________________________________________________________________________________________
137         @short      increment refcount
138         @descr      -
139 
140         @seealso    XInterface
141         @seealso    release()
142 
143         @param      -
144 
145         @return     -
146 
147         @onerror    A RuntimeException is thrown.
148     */
149 
150     virtual void SAL_CALL acquire() throw();
151 
152     /**_______________________________________________________________________________________________________
153         @short      decrement refcount
154         @descr      -
155 
156         @seealso    XInterface
157         @seealso    acquire()
158 
159         @param      -
160 
161         @return     -
162 
163         @onerror    A RuntimeException is thrown.
164     */
165 
166     virtual void SAL_CALL release() throw();
167 
168     //__________________________________________________________________________________________________________
169     //  XConnectionPointContainer
170     //__________________________________________________________________________________________________________
171 
172     /**_________________________________________________________________________________________________________
173         @short
174         @descr
175 
176         @seealso
177 
178         @param
179 
180         @return
181 
182         @onerror
183     */
184 
185     virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getConnectionPointTypes() throw( UNO3_RUNTIMEEXCEPTION );
186 
187     /**_________________________________________________________________________________________________________
188         @short
189         @descr
190 
191         @seealso
192 
193         @param
194 
195         @return
196 
197         @onerror
198     */
199 
200     virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINT > SAL_CALL queryConnectionPoint( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
201 
202     /**_________________________________________________________________________________________________________
203         @short
204         @descr
205 
206         @seealso
207 
208         @param
209 
210         @return
211 
212         @onerror
213     */
214 
215     virtual void SAL_CALL advise(   const   UNO3_TYPE&                          aType       ,
216                                     const   UNO3_REFERENCE< UNO3_XINTERFACE >&  xListener   ) throw( UNO3_RUNTIMEEXCEPTION );
217 
218     /**_________________________________________________________________________________________________________
219         @short
220         @descr
221 
222         @seealso
223 
224         @param
225 
226         @return
227 
228         @onerror
229     */
230 
231     virtual void SAL_CALL unadvise( const   UNO3_TYPE&                          aType       ,
232                                     const   UNO3_REFERENCE< UNO3_XINTERFACE >&  xListener   ) throw( UNO3_RUNTIMEEXCEPTION );
233 
234     /**_________________________________________________________________________________________________________
235         @short
236         @descr
237 
238         @seealso
239 
240         @param
241 
242         @return
243 
244         @onerror
245     */
246 
247     UNO3_OMULTITYPEINTERFACECONTAINERHELPER& impl_getMultiTypeContainer();
248 
249 //______________________________________________________________________________________________________________
250 //  private variables
251 //______________________________________________________________________________________________________________
252 
253 private:
254 
255     UNO3_MUTEX&                                 m_aSharedMutex          ;
256     UNO3_OMULTITYPEINTERFACECONTAINERHELPER     m_aMultiTypeContainer   ;   // Container to hold listener
257 
258 };  // class OConnectionPointContainerHelper
259 
260 }   // namespace unocontrols
261 
262 #endif  // #ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
263