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