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 _OCONNECTIONPOINTHELPER_HXX 25 #define _OCONNECTIONPOINTHELPER_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 #include "OConnectionPointContainerHelper.hxx" 40 41 //______________________________________________________________________________________________________________ 42 // namespaces 43 //______________________________________________________________________________________________________________ 44 45 namespace unocontrols{ 46 47 #define UNO3_ANY ::com::sun::star::uno::Any 48 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence 49 #define UNO3_TYPE ::com::sun::star::uno::Type 50 #define UNO3_REFERENCE ::com::sun::star::uno::Reference 51 #define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer 52 #define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint 53 #define UNO3_MUTEX ::osl::Mutex 54 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException 55 #define UNO3_XINTERFACE ::com::sun::star::uno::XInterface 56 #define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper 57 #define UNO3_LISTENEREXISTEXCEPTION ::com::sun::star::lang::ListenerExistException 58 #define UNO3_INVALIDLISTENEREXCEPTION ::com::sun::star::lang::InvalidListenerException 59 #define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference 60 #define UNO3_OWEAKOBJECT ::cppu::OWeakObject 61 #define UNO3_OCONNECTIONPOINTCONTAINERHELPER OConnectionPointContainerHelper 62 63 //______________________________________________________________________________________________________________ 64 // defines 65 //______________________________________________________________________________________________________________ 66 67 //______________________________________________________________________________________________________________ 68 // class declaration OConnectionPointHelper 69 //______________________________________________________________________________________________________________ 70 71 class OConnectionPointHelper : public UNO3_XCONNECTIONPOINT 72 , public UNO3_OWEAKOBJECT 73 { 74 75 //______________________________________________________________________________________________________________ 76 // public methods 77 //______________________________________________________________________________________________________________ 78 79 public: 80 81 //__________________________________________________________________________________________________________ 82 // construct/destruct 83 //__________________________________________________________________________________________________________ 84 85 /**_________________________________________________________________________________________________________ 86 @short 87 @descr 88 89 @seealso 90 91 @param 92 93 @return 94 95 @onerror 96 */ 97 98 OConnectionPointHelper( UNO3_MUTEX& aMutex , 99 UNO3_OCONNECTIONPOINTCONTAINERHELPER* pContainerImplementation , 100 UNO3_TYPE aType ); 101 102 /**_________________________________________________________________________________________________________ 103 @short 104 @descr 105 106 @seealso 107 108 @param 109 110 @return 111 112 @onerror 113 */ 114 115 virtual ~OConnectionPointHelper(); 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 ); 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 // XConnectionPoint 170 //__________________________________________________________________________________________________________ 171 172 /**_________________________________________________________________________________________________________ 173 @short 174 @descr 175 176 @seealso 177 178 @param 179 180 @return 181 182 @onerror 183 */ 184 185 virtual UNO3_TYPE SAL_CALL getConnectionType(); 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_XCONNECTIONPOINTCONTAINER > SAL_CALL getConnectionPointContainer(); 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_REFERENCE< UNO3_XINTERFACE >& xListener ); 216 217 /**_________________________________________________________________________________________________________ 218 @short 219 @descr 220 221 @seealso 222 223 @param 224 225 @return 226 227 @onerror 228 */ 229 230 virtual void SAL_CALL unadvise( const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ); 231 232 /**_________________________________________________________________________________________________________ 233 @short 234 @descr 235 236 @seealso 237 238 @param 239 240 @return 241 242 @onerror 243 */ 244 245 virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XINTERFACE > > SAL_CALL getConnections(); 246 247 //______________________________________________________________________________________________________________ 248 // private methods 249 //______________________________________________________________________________________________________________ 250 251 private: 252 253 /**_________________________________________________________________________________________________________ 254 @short 255 @descr 256 257 @seealso 258 259 @param 260 261 @return 262 263 @onerror 264 */ 265 266 sal_Bool impl_LockContainer(); 267 268 /**_________________________________________________________________________________________________________ 269 @short 270 @descr 271 272 @seealso 273 274 @param 275 276 @return 277 278 @onerror 279 */ 280 281 void impl_UnlockContainer(); 282 283 //______________________________________________________________________________________________________________ 284 // private variables 285 //______________________________________________________________________________________________________________ 286 287 private: 288 289 UNO3_MUTEX& m_aSharedMutex ; 290 UNO3_WEAKREFERENCE< UNO3_XCONNECTIONPOINTCONTAINER > m_oContainerWeakReference ; // Reference to container-class!. Don't use Reference<...> 291 // It is a ring-reference => and must be a wekreference! 292 UNO3_OCONNECTIONPOINTCONTAINERHELPER* m_pContainerImplementation ; 293 UNO3_TYPE m_aInterfaceType ; 294 UNO3_REFERENCE< UNO3_XINTERFACE > m_xLock ; 295 296 }; // class OConnectionPointHelper 297 298 } // namespace unocontrols 299 300 #endif // #ifndef _OCONNECTIONPOINTHELPER_HXX 301