1c6ed87c9SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3c6ed87c9SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4c6ed87c9SAndrew Rist * or more contributor license agreements. See the NOTICE file 5c6ed87c9SAndrew Rist * distributed with this work for additional information 6c6ed87c9SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7c6ed87c9SAndrew Rist * to you under the Apache License, Version 2.0 (the 8c6ed87c9SAndrew Rist * "License"); you may not use this file except in compliance 9c6ed87c9SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11c6ed87c9SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13c6ed87c9SAndrew Rist * Unless required by applicable law or agreed to in writing, 14c6ed87c9SAndrew Rist * software distributed under the License is distributed on an 15c6ed87c9SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16c6ed87c9SAndrew Rist * KIND, either express or implied. See the License for the 17c6ed87c9SAndrew Rist * specific language governing permissions and limitations 18c6ed87c9SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20c6ed87c9SAndrew Rist *************************************************************/ 21c6ed87c9SAndrew Rist 22c6ed87c9SAndrew Rist 23cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ 24cdf0e10cSrcweir #define _COM_SUN_STAR_UNO_REFERENCE_HXX_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 27cdf0e10cSrcweir #include <com/sun/star/uno/RuntimeException.hpp> 28cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_XINTERFACE_HDL_ 29cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hdl> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir #include <com/sun/star/uno/genfunc.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir namespace com 34cdf0e10cSrcweir { 35cdf0e10cSrcweir namespace sun 36cdf0e10cSrcweir { 37cdf0e10cSrcweir namespace star 38cdf0e10cSrcweir { 39cdf0e10cSrcweir namespace uno 40cdf0e10cSrcweir { 41cdf0e10cSrcweir 42cdf0e10cSrcweir //__________________________________________________________________________________________________ 43cdf0e10cSrcweir inline XInterface * BaseReference::iquery( 44cdf0e10cSrcweir XInterface * pInterface, const Type & rType ) 45cdf0e10cSrcweir SAL_THROW( (RuntimeException) ) 46cdf0e10cSrcweir { 47cdf0e10cSrcweir if (pInterface) 48cdf0e10cSrcweir { 49cdf0e10cSrcweir Any aRet( pInterface->queryInterface( rType ) ); 50cdf0e10cSrcweir if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir XInterface * pRet = static_cast< XInterface * >( aRet.pReserved ); 53cdf0e10cSrcweir aRet.pReserved = 0; 54cdf0e10cSrcweir return pRet; 55cdf0e10cSrcweir } 56cdf0e10cSrcweir } 57cdf0e10cSrcweir return 0; 58cdf0e10cSrcweir } 59cdf0e10cSrcweir //__________________________________________________________________________________________________ 60cdf0e10cSrcweir template< class interface_type > 61cdf0e10cSrcweir inline XInterface * Reference< interface_type >::iquery( 62cdf0e10cSrcweir XInterface * pInterface ) SAL_THROW( (RuntimeException) ) 63cdf0e10cSrcweir { 64cdf0e10cSrcweir return BaseReference::iquery(pInterface, interface_type::static_type()); 65cdf0e10cSrcweir } 66cdf0e10cSrcweir #ifndef EXCEPTIONS_OFF 67cdf0e10cSrcweir extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg( 68cdf0e10cSrcweir typelib_TypeDescriptionReference * pType ) 69cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 70cdf0e10cSrcweir extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg( 71cdf0e10cSrcweir typelib_TypeDescriptionReference * pType ) 72cdf0e10cSrcweir SAL_THROW_EXTERN_C(); 73cdf0e10cSrcweir //__________________________________________________________________________________________________ 74cdf0e10cSrcweir inline XInterface * BaseReference::iquery_throw( 75cdf0e10cSrcweir XInterface * pInterface, const Type & rType ) 76cdf0e10cSrcweir SAL_THROW( (RuntimeException) ) 77cdf0e10cSrcweir { 78cdf0e10cSrcweir XInterface * pQueried = iquery( pInterface, rType ); 79cdf0e10cSrcweir if (pQueried) 80cdf0e10cSrcweir return pQueried; 81cdf0e10cSrcweir throw RuntimeException( 82cdf0e10cSrcweir ::rtl::OUString( cppu_unsatisfied_iquery_msg( rType.getTypeLibType() ), SAL_NO_ACQUIRE ), 83cdf0e10cSrcweir Reference< XInterface >( pInterface ) ); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir //__________________________________________________________________________________________________ 86cdf0e10cSrcweir template< class interface_type > 87cdf0e10cSrcweir inline XInterface * Reference< interface_type >::iquery_throw( 88cdf0e10cSrcweir XInterface * pInterface ) SAL_THROW( (RuntimeException) ) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir return BaseReference::iquery_throw( 91cdf0e10cSrcweir pInterface, interface_type::static_type()); 92cdf0e10cSrcweir } 93cdf0e10cSrcweir //__________________________________________________________________________________________________ 94cdf0e10cSrcweir template< class interface_type > 95cdf0e10cSrcweir inline interface_type * Reference< interface_type >::iset_throw( 96cdf0e10cSrcweir interface_type * pInterface ) SAL_THROW( (RuntimeException) ) 97cdf0e10cSrcweir { 98cdf0e10cSrcweir if (pInterface) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir pInterface->acquire(); 101cdf0e10cSrcweir return pInterface; 102cdf0e10cSrcweir } 103cdf0e10cSrcweir throw RuntimeException( 104cdf0e10cSrcweir ::rtl::OUString( cppu_unsatisfied_iset_msg( interface_type::static_type().getTypeLibType() ), SAL_NO_ACQUIRE ), 105cdf0e10cSrcweir NULL ); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir #endif 108cdf0e10cSrcweir 109cdf0e10cSrcweir //__________________________________________________________________________________________________ 110cdf0e10cSrcweir template< class interface_type > 111cdf0e10cSrcweir inline Reference< interface_type >::~Reference() SAL_THROW( () ) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir if (_pInterface) 114cdf0e10cSrcweir _pInterface->release(); 115cdf0e10cSrcweir } 116cdf0e10cSrcweir //__________________________________________________________________________________________________ 117cdf0e10cSrcweir template< class interface_type > 118cdf0e10cSrcweir inline Reference< interface_type >::Reference() SAL_THROW( () ) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir _pInterface = 0; 121cdf0e10cSrcweir } 122cdf0e10cSrcweir //__________________________________________________________________________________________________ 123cdf0e10cSrcweir template< class interface_type > 124cdf0e10cSrcweir inline Reference< interface_type >::Reference( const Reference< interface_type > & rRef ) SAL_THROW( () ) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir _pInterface = rRef._pInterface; 127cdf0e10cSrcweir if (_pInterface) 128cdf0e10cSrcweir _pInterface->acquire(); 129cdf0e10cSrcweir } 130cdf0e10cSrcweir //__________________________________________________________________________________________________ 131cdf0e10cSrcweir template< class interface_type > 132cdf0e10cSrcweir inline Reference< interface_type >::Reference( interface_type * pInterface ) SAL_THROW( () ) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir _pInterface = castToXInterface(pInterface); 135cdf0e10cSrcweir if (_pInterface) 136cdf0e10cSrcweir _pInterface->acquire(); 137cdf0e10cSrcweir } 138cdf0e10cSrcweir //__________________________________________________________________________________________________ 139cdf0e10cSrcweir template< class interface_type > 140cdf0e10cSrcweir inline Reference< interface_type >::Reference( interface_type * pInterface, __sal_NoAcquire ) SAL_THROW( () ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir _pInterface = castToXInterface(pInterface); 143cdf0e10cSrcweir } 144cdf0e10cSrcweir //__________________________________________________________________________________________________ 145cdf0e10cSrcweir template< class interface_type > 146cdf0e10cSrcweir inline Reference< interface_type >::Reference( interface_type * pInterface, UnoReference_NoAcquire ) SAL_THROW( () ) 147cdf0e10cSrcweir { 148cdf0e10cSrcweir _pInterface = castToXInterface(pInterface); 149cdf0e10cSrcweir } 150cdf0e10cSrcweir //__________________________________________________________________________________________________ 151cdf0e10cSrcweir template< class interface_type > 152cdf0e10cSrcweir inline Reference< interface_type >::Reference( const BaseReference & rRef, UnoReference_Query ) SAL_THROW( (RuntimeException) ) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir _pInterface = iquery( rRef.get() ); 155cdf0e10cSrcweir } 156cdf0e10cSrcweir //__________________________________________________________________________________________________ 157cdf0e10cSrcweir template< class interface_type > 158cdf0e10cSrcweir inline Reference< interface_type >::Reference( XInterface * pInterface, UnoReference_Query ) SAL_THROW( (RuntimeException) ) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir _pInterface = iquery( pInterface ); 161cdf0e10cSrcweir } 162cdf0e10cSrcweir //__________________________________________________________________________________________________ 163cdf0e10cSrcweir template< class interface_type > 164cdf0e10cSrcweir inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Query ) SAL_THROW( (RuntimeException) ) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir _pInterface = (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass 167cdf0e10cSrcweir ? iquery( static_cast< XInterface * >( rAny.pReserved ) ) : 0); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir #ifndef EXCEPTIONS_OFF 170cdf0e10cSrcweir //__________________________________________________________________________________________________ 171cdf0e10cSrcweir template< class interface_type > 172cdf0e10cSrcweir inline Reference< interface_type >::Reference( const BaseReference & rRef, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) 173cdf0e10cSrcweir { 174*a8ee967bSHerbert Dürr _pInterface = NULL; 175cdf0e10cSrcweir _pInterface = iquery_throw( rRef.get() ); 176cdf0e10cSrcweir } 177cdf0e10cSrcweir //__________________________________________________________________________________________________ 178cdf0e10cSrcweir template< class interface_type > 179cdf0e10cSrcweir inline Reference< interface_type >::Reference( XInterface * pInterface, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) 180cdf0e10cSrcweir { 181*a8ee967bSHerbert Dürr _pInterface = NULL; 182cdf0e10cSrcweir _pInterface = iquery_throw( pInterface ); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir //__________________________________________________________________________________________________ 185cdf0e10cSrcweir template< class interface_type > 186cdf0e10cSrcweir inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) 187cdf0e10cSrcweir { 188*a8ee967bSHerbert Dürr _pInterface = NULL; 189cdf0e10cSrcweir _pInterface = iquery_throw( typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass 190cdf0e10cSrcweir ? static_cast< XInterface * >( rAny.pReserved ) : 0 ); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir //__________________________________________________________________________________________________ 193cdf0e10cSrcweir template< class interface_type > 194cdf0e10cSrcweir inline Reference< interface_type >::Reference( const Reference< interface_type > & rRef, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) 195cdf0e10cSrcweir { 196*a8ee967bSHerbert Dürr _pInterface = NULL; 197cdf0e10cSrcweir _pInterface = iset_throw( rRef.get() ); 198cdf0e10cSrcweir } 199cdf0e10cSrcweir //__________________________________________________________________________________________________ 200cdf0e10cSrcweir template< class interface_type > 201cdf0e10cSrcweir inline Reference< interface_type >::Reference( interface_type * pInterface, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) 202cdf0e10cSrcweir { 203*a8ee967bSHerbert Dürr _pInterface = NULL; 204cdf0e10cSrcweir _pInterface = iset_throw( pInterface ); 205cdf0e10cSrcweir } 206cdf0e10cSrcweir #endif 207cdf0e10cSrcweir 208cdf0e10cSrcweir //__________________________________________________________________________________________________ 209cdf0e10cSrcweir template< class interface_type > 210cdf0e10cSrcweir inline void Reference< interface_type >::clear() SAL_THROW( () ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir if (_pInterface) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir XInterface * const pOld = _pInterface; 215cdf0e10cSrcweir _pInterface = 0; 216cdf0e10cSrcweir pOld->release(); 217cdf0e10cSrcweir } 218cdf0e10cSrcweir } 219cdf0e10cSrcweir //__________________________________________________________________________________________________ 220cdf0e10cSrcweir template< class interface_type > 221cdf0e10cSrcweir inline sal_Bool Reference< interface_type >::set( 222cdf0e10cSrcweir interface_type * pInterface ) SAL_THROW( () ) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir if (pInterface) 225cdf0e10cSrcweir castToXInterface(pInterface)->acquire(); 226cdf0e10cSrcweir XInterface * const pOld = _pInterface; 227cdf0e10cSrcweir _pInterface = castToXInterface(pInterface); 228cdf0e10cSrcweir if (pOld) 229cdf0e10cSrcweir pOld->release(); 230cdf0e10cSrcweir return (0 != pInterface); 231cdf0e10cSrcweir } 232cdf0e10cSrcweir //__________________________________________________________________________________________________ 233cdf0e10cSrcweir template< class interface_type > 234cdf0e10cSrcweir inline sal_Bool Reference< interface_type >::set( 235cdf0e10cSrcweir interface_type * pInterface, __sal_NoAcquire ) SAL_THROW( () ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir XInterface * const pOld = _pInterface; 238cdf0e10cSrcweir _pInterface = castToXInterface(pInterface); 239cdf0e10cSrcweir if (pOld) 240cdf0e10cSrcweir pOld->release(); 241cdf0e10cSrcweir return (0 != pInterface); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir //__________________________________________________________________________________________________ 244cdf0e10cSrcweir template< class interface_type > 245cdf0e10cSrcweir inline sal_Bool Reference< interface_type >::set( 246cdf0e10cSrcweir interface_type * pInterface, UnoReference_NoAcquire ) SAL_THROW( () ) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir return set( pInterface, SAL_NO_ACQUIRE ); 249cdf0e10cSrcweir } 250cdf0e10cSrcweir 251cdf0e10cSrcweir //__________________________________________________________________________________________________ 252cdf0e10cSrcweir template< class interface_type > 253cdf0e10cSrcweir inline sal_Bool Reference< interface_type >::set( 254cdf0e10cSrcweir const Reference< interface_type > & rRef ) SAL_THROW( () ) 255cdf0e10cSrcweir { 256cdf0e10cSrcweir return set( castFromXInterface( rRef._pInterface ) ); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir //__________________________________________________________________________________________________ 259cdf0e10cSrcweir template< class interface_type > 260cdf0e10cSrcweir inline sal_Bool Reference< interface_type >::set( 261cdf0e10cSrcweir XInterface * pInterface, UnoReference_Query ) SAL_THROW( (RuntimeException) ) 262cdf0e10cSrcweir { 263cdf0e10cSrcweir return set( castFromXInterface(iquery( pInterface )), SAL_NO_ACQUIRE ); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir //__________________________________________________________________________________________________ 266cdf0e10cSrcweir template< class interface_type > 267cdf0e10cSrcweir inline sal_Bool Reference< interface_type >::set( 268cdf0e10cSrcweir const BaseReference & rRef, UnoReference_Query ) SAL_THROW( (RuntimeException) ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir return set( castFromXInterface(iquery( rRef.get() )), SAL_NO_ACQUIRE ); 271cdf0e10cSrcweir } 272cdf0e10cSrcweir 273cdf0e10cSrcweir //______________________________________________________________________________ 274cdf0e10cSrcweir template< class interface_type > 275cdf0e10cSrcweir inline bool Reference< interface_type >::set( 276cdf0e10cSrcweir Any const & rAny, UnoReference_Query ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir return set( 279cdf0e10cSrcweir castFromXInterface( 280cdf0e10cSrcweir iquery( 281cdf0e10cSrcweir rAny.pType->eTypeClass == typelib_TypeClass_INTERFACE 282cdf0e10cSrcweir ? static_cast< XInterface * >( rAny.pReserved ) : 0 )), 283cdf0e10cSrcweir SAL_NO_ACQUIRE ); 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir #ifndef EXCEPTIONS_OFF 287cdf0e10cSrcweir //__________________________________________________________________________________________________ 288cdf0e10cSrcweir template< class interface_type > 289cdf0e10cSrcweir inline void Reference< interface_type >::set( 290cdf0e10cSrcweir XInterface * pInterface, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir set( castFromXInterface(iquery_throw( pInterface )), SAL_NO_ACQUIRE ); 293cdf0e10cSrcweir } 294cdf0e10cSrcweir //__________________________________________________________________________________________________ 295cdf0e10cSrcweir template< class interface_type > 296cdf0e10cSrcweir inline void Reference< interface_type >::set( 297cdf0e10cSrcweir const BaseReference & rRef, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) 298cdf0e10cSrcweir { 299cdf0e10cSrcweir set( castFromXInterface(iquery_throw( rRef.get() )), SAL_NO_ACQUIRE ); 300cdf0e10cSrcweir } 301cdf0e10cSrcweir 302cdf0e10cSrcweir //______________________________________________________________________________ 303cdf0e10cSrcweir template< class interface_type > 304cdf0e10cSrcweir inline void Reference< interface_type >::set( 305cdf0e10cSrcweir Any const & rAny, UnoReference_QueryThrow ) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir set( castFromXInterface( 308cdf0e10cSrcweir iquery_throw( 309cdf0e10cSrcweir rAny.pType->eTypeClass == typelib_TypeClass_INTERFACE 310cdf0e10cSrcweir ? static_cast< XInterface * >( rAny.pReserved ) : 0 )), 311cdf0e10cSrcweir SAL_NO_ACQUIRE ); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir //__________________________________________________________________________________________________ 314cdf0e10cSrcweir template< class interface_type > 315cdf0e10cSrcweir inline void Reference< interface_type >::set( 316cdf0e10cSrcweir interface_type * pInterface, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir set( iset_throw( pInterface ), SAL_NO_ACQUIRE ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir //__________________________________________________________________________________________________ 321cdf0e10cSrcweir template< class interface_type > 322cdf0e10cSrcweir inline void Reference< interface_type >::set( 323cdf0e10cSrcweir const Reference< interface_type > & rRef, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir set( rRef.get(), UNO_SET_THROW ); 326cdf0e10cSrcweir } 327cdf0e10cSrcweir 328cdf0e10cSrcweir #endif 329cdf0e10cSrcweir 330cdf0e10cSrcweir //__________________________________________________________________________________________________ 331cdf0e10cSrcweir template< class interface_type > 332cdf0e10cSrcweir inline Reference< interface_type > & Reference< interface_type >::operator = ( 333cdf0e10cSrcweir interface_type * pInterface ) SAL_THROW( () ) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir set( pInterface ); 336cdf0e10cSrcweir return *this; 337cdf0e10cSrcweir } 338cdf0e10cSrcweir //__________________________________________________________________________________________________ 339cdf0e10cSrcweir template< class interface_type > 340cdf0e10cSrcweir inline Reference< interface_type > & Reference< interface_type >::operator = ( 341cdf0e10cSrcweir const Reference< interface_type > & rRef ) SAL_THROW( () ) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir set( castFromXInterface( rRef._pInterface ) ); 344cdf0e10cSrcweir return *this; 345cdf0e10cSrcweir } 346cdf0e10cSrcweir 347cdf0e10cSrcweir //__________________________________________________________________________________________________ 348cdf0e10cSrcweir template< class interface_type > 349cdf0e10cSrcweir inline Reference< interface_type > Reference< interface_type >::query( 350cdf0e10cSrcweir const BaseReference & rRef ) SAL_THROW( (RuntimeException) ) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir return Reference< interface_type >( 353cdf0e10cSrcweir castFromXInterface(iquery( rRef.get() )), SAL_NO_ACQUIRE ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir //__________________________________________________________________________________________________ 356cdf0e10cSrcweir template< class interface_type > 357cdf0e10cSrcweir inline Reference< interface_type > Reference< interface_type >::query( 358cdf0e10cSrcweir XInterface * pInterface ) SAL_THROW( (RuntimeException) ) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir return Reference< interface_type >( 361cdf0e10cSrcweir castFromXInterface(iquery( pInterface )), SAL_NO_ACQUIRE ); 362cdf0e10cSrcweir } 363cdf0e10cSrcweir 364cdf0e10cSrcweir //################################################################################################## 365cdf0e10cSrcweir 366cdf0e10cSrcweir //__________________________________________________________________________________________________ 367cdf0e10cSrcweir inline sal_Bool BaseReference::operator == ( XInterface * pInterface ) const SAL_THROW( () ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir if (_pInterface == pInterface) 370cdf0e10cSrcweir return sal_True; 371cdf0e10cSrcweir #ifndef EXCEPTIONS_OFF 372cdf0e10cSrcweir try 373cdf0e10cSrcweir { 374cdf0e10cSrcweir #endif 375cdf0e10cSrcweir // only the query to XInterface must return the same pointer if they belong to same objects 376cdf0e10cSrcweir Reference< XInterface > x1( _pInterface, UNO_QUERY ); 377cdf0e10cSrcweir Reference< XInterface > x2( pInterface, UNO_QUERY ); 378cdf0e10cSrcweir return (x1._pInterface == x2._pInterface); 379cdf0e10cSrcweir #ifndef EXCEPTIONS_OFF 380cdf0e10cSrcweir } 381cdf0e10cSrcweir catch (RuntimeException &) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir return sal_False; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir #endif 386cdf0e10cSrcweir } 387cdf0e10cSrcweir 388cdf0e10cSrcweir //______________________________________________________________________________ 389cdf0e10cSrcweir inline sal_Bool BaseReference::operator < ( 390cdf0e10cSrcweir const BaseReference & rRef ) const SAL_THROW( () ) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir if (_pInterface == rRef._pInterface) 393cdf0e10cSrcweir return sal_False; 394cdf0e10cSrcweir #if ! defined EXCEPTIONS_OFF 395cdf0e10cSrcweir try 396cdf0e10cSrcweir { 397cdf0e10cSrcweir #endif 398cdf0e10cSrcweir // only the query to XInterface must return the same pointer: 399cdf0e10cSrcweir Reference< XInterface > x1( _pInterface, UNO_QUERY ); 400cdf0e10cSrcweir Reference< XInterface > x2( rRef, UNO_QUERY ); 401cdf0e10cSrcweir return (x1._pInterface < x2._pInterface); 402cdf0e10cSrcweir #if ! defined EXCEPTIONS_OFF 403cdf0e10cSrcweir } 404cdf0e10cSrcweir catch (RuntimeException &) 405cdf0e10cSrcweir { 406cdf0e10cSrcweir return sal_False; 407cdf0e10cSrcweir } 408cdf0e10cSrcweir #endif 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir //__________________________________________________________________________________________________ 412cdf0e10cSrcweir inline sal_Bool BaseReference::operator != ( XInterface * pInterface ) const SAL_THROW( () ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir return (! operator == ( pInterface )); 415cdf0e10cSrcweir } 416cdf0e10cSrcweir //__________________________________________________________________________________________________ 417cdf0e10cSrcweir inline sal_Bool BaseReference::operator == ( const BaseReference & rRef ) const SAL_THROW( () ) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir return operator == ( rRef._pInterface ); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir //__________________________________________________________________________________________________ 422cdf0e10cSrcweir inline sal_Bool BaseReference::operator != ( const BaseReference & rRef ) const SAL_THROW( () ) 423cdf0e10cSrcweir { 424cdf0e10cSrcweir return (! operator == ( rRef._pInterface )); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427cdf0e10cSrcweir } 428cdf0e10cSrcweir } 429cdf0e10cSrcweir } 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir #endif 433