1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OConnectionPointHelper.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _OCONNECTIONPOINTHELPER_HXX
32 #define _OCONNECTIONPOINTHELPER_HXX
34 //______________________________________________________________________________________________________________
35 // includes of other projects
36 //______________________________________________________________________________________________________________
38 #include <com/sun/star/lang/XConnectionPointContainer.hpp>
39 #include <com/sun/star/lang/XConnectionPoint.hpp>
40 #include <cppuhelper/weak.hxx>
41 #include <cppuhelper/propshlp.hxx>
43 //______________________________________________________________________________________________________________
44 // includes of my own project
45 //______________________________________________________________________________________________________________
46 #include "OConnectionPointContainerHelper.hxx"
48 //______________________________________________________________________________________________________________
50 //______________________________________________________________________________________________________________
52 namespace unocontrols
{
54 #define UNO3_ANY ::com::sun::star::uno::Any
55 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
56 #define UNO3_TYPE ::com::sun::star::uno::Type
57 #define UNO3_REFERENCE ::com::sun::star::uno::Reference
58 #define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
59 #define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
60 #define UNO3_MUTEX ::osl::Mutex
61 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
62 #define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
63 #define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
64 #define UNO3_LISTENEREXISTEXCEPTION ::com::sun::star::lang::ListenerExistException
65 #define UNO3_INVALIDLISTENEREXCEPTION ::com::sun::star::lang::InvalidListenerException
66 #define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference
67 #define UNO3_OWEAKOBJECT ::cppu::OWeakObject
68 #define UNO3_OCONNECTIONPOINTCONTAINERHELPER OConnectionPointContainerHelper
70 //______________________________________________________________________________________________________________
72 //______________________________________________________________________________________________________________
74 //______________________________________________________________________________________________________________
75 // class declaration OConnectionPointHelper
76 //______________________________________________________________________________________________________________
78 class OConnectionPointHelper
: public UNO3_XCONNECTIONPOINT
79 , public UNO3_OWEAKOBJECT
82 //______________________________________________________________________________________________________________
84 //______________________________________________________________________________________________________________
88 //__________________________________________________________________________________________________________
90 //__________________________________________________________________________________________________________
92 /**_________________________________________________________________________________________________________
105 OConnectionPointHelper( UNO3_MUTEX
& aMutex
,
106 UNO3_OCONNECTIONPOINTCONTAINERHELPER
* pContainerImplementation
,
109 /**_________________________________________________________________________________________________________
122 virtual ~OConnectionPointHelper();
124 //________________________________________________________________________________________________________
126 //________________________________________________________________________________________________________
128 /**_______________________________________________________________________________________________________
129 @short give answer, if interface is supported
130 @descr The interfaces are searched by type.
134 @param "rType" is the type of searched interface.
136 @return Any information about found interface
138 @onerror A RuntimeException is thrown.
141 virtual UNO3_ANY SAL_CALL
queryInterface( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
143 /**_______________________________________________________________________________________________________
144 @short increment refcount
154 @onerror A RuntimeException is thrown.
157 virtual void SAL_CALL
acquire() throw();
159 /**_______________________________________________________________________________________________________
160 @short decrement refcount
170 @onerror A RuntimeException is thrown.
173 virtual void SAL_CALL
release() throw();
175 //__________________________________________________________________________________________________________
177 //__________________________________________________________________________________________________________
179 /**_________________________________________________________________________________________________________
192 virtual UNO3_TYPE SAL_CALL
getConnectionType() throw( UNO3_RUNTIMEEXCEPTION
);
194 /**_________________________________________________________________________________________________________
207 virtual UNO3_REFERENCE
< UNO3_XCONNECTIONPOINTCONTAINER
> SAL_CALL
getConnectionPointContainer() throw( UNO3_RUNTIMEEXCEPTION
);
209 /**_________________________________________________________________________________________________________
222 virtual void SAL_CALL
advise( const UNO3_REFERENCE
< UNO3_XINTERFACE
>& xListener
) throw( UNO3_LISTENEREXISTEXCEPTION
,
223 UNO3_INVALIDLISTENEREXCEPTION
,
224 UNO3_RUNTIMEEXCEPTION
);
226 /**_________________________________________________________________________________________________________
239 virtual void SAL_CALL
unadvise( const UNO3_REFERENCE
< UNO3_XINTERFACE
>& xListener
) throw( UNO3_RUNTIMEEXCEPTION
);
241 /**_________________________________________________________________________________________________________
254 virtual UNO3_SEQUENCE
< UNO3_REFERENCE
< UNO3_XINTERFACE
> > SAL_CALL
getConnections() throw( UNO3_RUNTIMEEXCEPTION
);
256 //______________________________________________________________________________________________________________
258 //______________________________________________________________________________________________________________
262 /**_________________________________________________________________________________________________________
275 sal_Bool
impl_LockContainer();
277 /**_________________________________________________________________________________________________________
290 void impl_UnlockContainer();
292 //______________________________________________________________________________________________________________
294 //______________________________________________________________________________________________________________
298 UNO3_MUTEX
& m_aSharedMutex
;
299 UNO3_WEAKREFERENCE
< UNO3_XCONNECTIONPOINTCONTAINER
> m_oContainerWeakReference
; // Reference to container-class!. Don't use Reference<...>
300 // It is a ring-reference => and must be a wekreference!
301 UNO3_OCONNECTIONPOINTCONTAINERHELPER
* m_pContainerImplementation
;
302 UNO3_TYPE m_aInterfaceType
;
303 UNO3_REFERENCE
< UNO3_XINTERFACE
> m_xLock
;
305 }; // class OConnectionPointHelper
307 } // namespace unocontrols
309 #endif // #ifndef _OCONNECTIONPOINTHELPER_HXX