cppu Index: inc/com/sun/star/uno/Reference.h =================================================================== RCS file: /cvs/udk/cppu/inc/com/sun/star/uno/Reference.h,v retrieving revision 1.18 diff -u -p -r1.18 Reference.h --- inc/com/sun/star/uno/Reference.h 19 Jun 2006 13:10:59 -0000 1.18 +++ inc/com/sun/star/uno/Reference.h 11 Dec 2006 13:58:21 -0000 @@ -35,6 +35,8 @@ #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ #define _COM_SUN_STAR_UNO_REFERENCE_H_ +#include // for BOOST_NO_MEMBER_TEMPLATE_FRIENDS macro + #ifndef _RTL_ALLOC_H_ #include #endif @@ -72,10 +74,6 @@ enum UnoReference_NoAcquire class BaseReference { protected: - /** the interface pointer - */ - XInterface * _pInterface; - /** Queries given interface for type rType. @param pInterface interface pointer @@ -96,6 +94,19 @@ protected: SAL_THROW( (RuntimeException) ); #endif +// if member template friends don't work, make protected _pInterface +// public, to allow template copy constructor from Reference to access +// them. +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + template friend class Reference; +#else +public: +#endif + + /** the interface pointer + */ + XInterface * _pInterface; + public: /** Gets interface pointer. This call does not acquire the interface. @@ -323,14 +334,16 @@ public: */ inline Reference( const Any & rAny, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ); #endif - - /** Cast operator to Reference< XInterface >: Reference objects are binary compatible and - any interface must be derived from com.sun.star.uno.XInterface. - This a useful direct cast possibility. - */ - inline SAL_CALL operator const Reference< XInterface > & () const SAL_THROW( () ) - { return * reinterpret_cast< const Reference< XInterface > * >( this ); } - + + /* Constructor: copy-construct from derived interface + + @param rRef + Interface reference that must be convertible to interface_type + (typically, this implies that interface_type is a basetype of + the passed type) + */ + template< class Ifc > inline Reference( const Reference& rRef ); + /** Dereference operator: Used to call interface methods. @return UNacquired interface pointer @@ -458,6 +471,18 @@ public: */ inline Reference< interface_type > & SAL_CALL operator = ( const Reference< interface_type > & rRef ) SAL_THROW( () ); + /** Assignment operator for derived interfaces: Acquires given + interface reference and sets reference. An interface already + set will be released. + + @param rRef + Interface reference that must be convertible to interface_type + (typically, this implies that interface_type is a basetype of + the passed type) + */ + template< class Ifc > + inline Reference< interface_type > & SAL_CALL operator = ( const Reference& rRef ); + /** Queries given interface reference for type interface_type. @param rRef interface reference Index: inc/com/sun/star/uno/Reference.hxx =================================================================== RCS file: /cvs/udk/cppu/inc/com/sun/star/uno/Reference.hxx,v retrieving revision 1.25 diff -u -p -r1.25 Reference.hxx --- inc/com/sun/star/uno/Reference.hxx 19 Jun 2006 13:11:13 -0000 1.25 +++ inc/com/sun/star/uno/Reference.hxx 11 Dec 2006 13:58:21 -0000 @@ -188,7 +188,16 @@ inline Reference< interface_type >::Refe ? static_cast< XInterface * >( rAny.pReserved ) : 0 ); } #endif - +//__________________________________________________________________________________________________ +template< class interface_type > +template< class Ifc > +inline Reference< interface_type >::Reference( const Reference& rRef ) +{ + interface_type* pTmp = reinterpret_cast< Ifc* >(rRef._pInterface); + _pInterface = pTmp; + if (_pInterface) + _pInterface->acquire(); +} //__________________________________________________________________________________________________ template< class interface_type > inline void Reference< interface_type >::clear() SAL_THROW( () ) @@ -311,6 +320,16 @@ inline Reference< interface_type > & Ref const Reference< interface_type > & rRef ) SAL_THROW( () ) { set( castFromXInterface( rRef._pInterface ) ); + return *this; +} +//__________________________________________________________________________________________________ +template< class interface_type > +template< class Ifc > +inline Reference< interface_type > & Reference< interface_type >::operator = ( + const Reference& rRef ) +{ + interface_type* pTmp = reinterpret_cast< Ifc* >(rRef._pInterface); + set( pTmp ); return *this; } cppuhelper Index: inc/cppuhelper/weakref.hxx =================================================================== RCS file: /cvs/udk/cppuhelper/inc/cppuhelper/weakref.hxx,v retrieving revision 1.6 diff -u -p -r1.6 weakref.hxx --- inc/cppuhelper/weakref.hxx 8 Sep 2005 09:23:30 -0000 1.6 +++ inc/cppuhelper/weakref.hxx 11 Dec 2006 13:58:27 -0000 @@ -139,7 +139,11 @@ public: @param rRef another hard ref */ inline WeakReference( const Reference< interface_type > & rRef ) SAL_THROW( () ) - : WeakReferenceHelper( rRef ) + : WeakReferenceHelper( + // Reference objects are binary compatible and any + // interface must be derived from + // com.sun.star.uno.XInterface. + reinterpret_cast< const Reference< XInterface >& >( rRef )) {} /** Gets a hard reference to the object. Index: source/component_context.cxx =================================================================== RCS file: /cvs/udk/cppuhelper/source/component_context.cxx,v retrieving revision 1.29 diff -u -p -r1.29 component_context.cxx --- source/component_context.cxx 16 Sep 2006 12:39:56 -0000 1.29 +++ source/component_context.cxx 11 Dec 2006 13:58:27 -0000 @@ -744,8 +744,8 @@ void ComponentContext::disposing() } } - // dispose service manager - try_dispose( m_xSMgr ); + // dispose service manager, disambiguate try_dispose call + try_dispose( Reference< XInterface >(m_xSMgr) ); m_xSMgr.clear(); // dispose ac try_dispose( xAC ); dbaccess Index: source/core/misc/sdbcoretools.cxx =================================================================== RCS file: /cvs/dba/dbaccess/source/core/misc/sdbcoretools.cxx,v retrieving revision 1.9 diff -u -p -r1.9 sdbcoretools.cxx --- source/core/misc/sdbcoretools.cxx 17 Sep 2006 06:42:43 -0000 1.9 +++ source/core/misc/sdbcoretools.cxx 11 Dec 2006 13:59:03 -0000 @@ -81,7 +81,9 @@ namespace dbaccess Reference< XInterface > xDs = getDataSource( _rxObject ); Reference xDocumentDataSource(xDs,UNO_QUERY); if ( xDocumentDataSource.is() ) - xDs = xDocumentDataSource->getDatabaseDocument(); + xDs.set( + static_cast( + xDocumentDataSource->getDatabaseDocument().get()) ); Reference< XModifiable > xModi( xDs, UNO_QUERY ); if ( xModi.is() ) xModi->setModified(_bModified); Index: source/ui/misc/UITools.cxx =================================================================== RCS file: /cvs/dba/dbaccess/source/ui/misc/UITools.cxx,v retrieving revision 1.66 diff -u -p -r1.66 UITools.cxx --- source/ui/misc/UITools.cxx 12 Oct 2006 13:40:04 -0000 1.66 +++ source/ui/misc/UITools.cxx 11 Dec 2006 13:59:31 -0000 @@ -479,7 +479,9 @@ Reference< XInterface > getDataSourceOrM Reference< XInterface > xRet; Reference xDocumentDataSource(_xObject,UNO_QUERY); if ( xDocumentDataSource.is() ) - xRet = xDocumentDataSource->getDatabaseDocument(); + xRet.set( + static_cast( + xDocumentDataSource->getDatabaseDocument().get()) ); if ( !xRet.is() ) { desktop Index: source/deployment/inc/dp_misc.h =================================================================== RCS file: /cvs/framework/desktop/source/deployment/inc/dp_misc.h,v retrieving revision 1.9 diff -u -p -r1.9 dp_misc.h --- source/deployment/inc/dp_misc.h 8 Sep 2005 17:18:39 -0000 1.9 +++ source/deployment/inc/dp_misc.h 11 Dec 2006 14:00:32 -0000 @@ -73,6 +73,12 @@ inline void try_dispose( css::uno::Refer xComp->dispose(); } +inline void try_dispose_comp( css::uno::Reference const & xComp ) +{ + if (xComp.is()) + xComp->dispose(); +} + //############################################################################## //============================================================================== Index: source/deployment/manager/dp_manager.cxx =================================================================== RCS file: /cvs/framework/desktop/source/deployment/manager/dp_manager.cxx,v retrieving revision 1.19 diff -u -p -r1.19 dp_manager.cxx --- source/deployment/manager/dp_manager.cxx 24 Oct 2006 13:56:57 -0000 1.19 +++ source/deployment/manager/dp_manager.cxx 11 Dec 2006 14:00:32 -0000 @@ -742,7 +742,7 @@ void PackageManagerImpl::deletePackageFr Reference const & xPackage, OUString const & destFolder) { - try_dispose( xPackage ); + try_dispose_comp( xPackage ); //we remove the package from the uno cache //no service from the package may be loaded at this time!!! @@ -769,7 +769,7 @@ void PackageManagerImpl::removePackage_( xCmdEnv ) ); if (!option.IsPresent || option.Value.IsAmbiguous || option.Value.Value) xPackage->revokePackage( xAbortChannel, xCmdEnv ); - try_dispose( xPackage ); + try_dispose_comp( xPackage ); m_activePackagesDB->erase( name ); // to be removed upon next start } Index: source/deployment/manager/dp_managerfac.cxx =================================================================== RCS file: /cvs/framework/desktop/source/deployment/manager/dp_managerfac.cxx,v retrieving revision 1.9 diff -u -p -r1.9 dp_managerfac.cxx --- source/deployment/manager/dp_managerfac.cxx 12 Oct 2006 14:09:14 -0000 1.9 +++ source/deployment/manager/dp_managerfac.cxx 11 Dec 2006 14:00:32 -0000 @@ -188,7 +188,7 @@ PackageManagerFactoryImpl::getPackageMan if (xAlreadyIn.is()) { guard.clear(); - try_dispose( xRet ); + try_dispose_comp( xRet ); xRet = xAlreadyIn; } else Index: source/deployment/registry/package/dp_package.cxx =================================================================== RCS file: /cvs/framework/desktop/source/deployment/registry/package/dp_package.cxx,v retrieving revision 1.15 diff -u -p -r1.15 dp_package.cxx --- source/deployment/registry/package/dp_package.cxx 6 Nov 2006 14:55:35 -0000 1.15 +++ source/deployment/registry/package/dp_package.cxx 11 Dec 2006 14:00:32 -0000 @@ -365,7 +365,7 @@ void BackendImpl::PackageImpl::disposing sal_Int32 len = m_bundle.getLength(); Reference const * p = m_bundle.getConstArray(); for ( sal_Int32 pos = 0; pos < len; ++pos ) - try_dispose( p[ pos ] ); + try_dispose_comp( p[ pos ] ); m_bundle.realloc( 0 ); Package::disposing(); package Index: source/xstor/xstorage.hxx =================================================================== RCS file: /cvs/xml/package/source/xstor/xstorage.hxx,v retrieving revision 1.15 diff -u -p -r1.15 xstorage.hxx --- source/xstor/xstorage.hxx 13 Oct 2006 11:51:10 -0000 1.15 +++ source/xstor/xstorage.hxx 11 Dec 2006 14:24:01 -0000 @@ -199,8 +199,7 @@ struct StorageHolder_Impl StorageHolder_Impl( OStorage* pStorage ) : m_pPointer( pStorage ) - , m_xWeakRef( ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >( - (::com::sun::star::embed::XStorage*)pStorage ) ) + , m_xWeakRef( (::com::sun::star::embed::XStorage*)pStorage ) { } sc Index: source/ui/view/gridwin.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/view/gridwin.cxx,v retrieving revision 1.79 diff -u -p -r1.79 gridwin.cxx --- source/ui/view/gridwin.cxx 14 Nov 2006 15:56:25 -0000 1.79 +++ source/ui/view/gridwin.cxx 11 Dec 2006 14:28:26 -0000 @@ -91,6 +91,7 @@ #include #include +#include #include #include #include sfx2 Index: source/view/sfxbasecontroller.cxx =================================================================== RCS file: /cvs/framework/sfx2/source/view/sfxbasecontroller.cxx,v retrieving revision 1.69 diff -u -p -r1.69 sfxbasecontroller.cxx --- source/view/sfxbasecontroller.cxx 1 Nov 2006 18:29:14 -0000 1.69 +++ source/view/sfxbasecontroller.cxx 11 Dec 2006 14:32:18 -0000 @@ -66,6 +66,10 @@ #include #endif +#ifndef _COM_SUN_STAR_AWT_XWINDOWPEER_HPP_ +#include +#endif + #ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_ #include #endif so3 Index: source/solink/lnkbase2.cxx =================================================================== RCS file: /cvs/oi/so3/source/solink/lnkbase2.cxx,v retrieving revision 1.10 diff -u -p -r1.10 lnkbase2.cxx --- source/solink/lnkbase2.cxx 12 Oct 2006 11:01:40 -0000 1.10 +++ source/solink/lnkbase2.cxx 11 Dec 2006 14:32:57 -0000 @@ -86,7 +86,7 @@ struct ImplBaseLinkData }; ImplBaseLinkData() { - ClientType.nCntntType = NULL; + ClientType.nCntntType = 0; ClientType.bIntrnlLnk = FALSE; ClientType.nUpdateMode = 0; DDEType.pItem = NULL; svx Index: source/dialog/cfg.cxx =================================================================== RCS file: /cvs/graphics/svx/source/dialog/cfg.cxx,v retrieving revision 1.36 diff -u -p -r1.36 cfg.cxx --- source/dialog/cfg.cxx 12 Oct 2006 12:06:11 -0000 1.36 +++ source/dialog/cfg.cxx 11 Dec 2006 14:35:21 -0000 @@ -3743,7 +3743,8 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySe uno::Reference< graphic::XGraphic >() ); GetSaveInData()->PersistChanges( - GetSaveInData()->GetImageManager() ); + static_cast( + GetSaveInData()->GetImageManager().get()) ); aContentsListBox->GetModel()->Remove( pActEntry ); @@ -3865,7 +3866,8 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySe aContentsListBox->MakeVisible( pNewLBEntry ); GetSaveInData()->PersistChanges( - GetSaveInData()->GetImageManager() ); + static_cast( + GetSaveInData()->GetImageManager().get()) ); } catch ( uno::Exception& ) { @@ -3929,7 +3931,8 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySe uno::Reference< graphic::XGraphic >() ); GetSaveInData()->PersistChanges( - GetSaveInData()->GetImageManager() ); + static_cast( + GetSaveInData()->GetImageManager().get()) ); } catch ( uno::Exception& ) { @@ -4469,7 +4472,9 @@ void ToolbarSaveInData::Reset() try { GetImageManager()->reset(); - PersistChanges( GetImageManager() ); + PersistChanges( + static_cast( + GetImageManager().get()) ); } catch ( uno::Exception& ) { @@ -4699,7 +4704,9 @@ void ToolbarSaveInData::RestoreToolbar( OSL_TRACE("Error restoring icon when resetting toolbar"); } } - PersistChanges( GetImageManager() ); + PersistChanges( + static_cast( + GetImageManager().get()) ); } catch ( container::NoSuchElementException& ) { Index: source/form/fmsrcimp.cxx =================================================================== RCS file: /cvs/graphics/svx/source/form/fmsrcimp.cxx,v retrieving revision 1.34 diff -u -p -r1.34 fmsrcimp.cxx --- source/form/fmsrcimp.cxx 12 Oct 2006 12:46:29 -0000 1.34 +++ source/form/fmsrcimp.cxx 11 Dec 2006 14:36:42 -0000 @@ -1250,8 +1250,8 @@ sal_Bool FmSearchEngine::SwitchToContext if (m_bSearchingCurrently) return sal_False; - m_xSearchCursor = xCursor; - m_xOriginalIterator = xCursor; + m_xSearchCursor = CursorWrapper(xCursor); + m_xOriginalIterator = CursorWrapper(xCursor); m_xClonedIterator = CursorWrapper(m_xOriginalIterator, sal_True); m_bUsingTextComponents = sal_True; Index: source/inc/fmtools.hxx =================================================================== RCS file: /cvs/graphics/svx/source/inc/fmtools.hxx,v retrieving revision 1.25 diff -u -p -r1.25 fmtools.hxx --- source/inc/fmtools.hxx 19 Jun 2006 16:07:21 -0000 1.25 +++ source/inc/fmtools.hxx 11 Dec 2006 14:36:55 -0000 @@ -290,8 +290,8 @@ private: public: // Construction/Destruction CursorWrapper() { } - CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor, sal_Bool bUseCloned = sal_False); - CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned = sal_False); + explicit CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor, sal_Bool bUseCloned = sal_False); + explicit CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned = sal_False); // bei bUseCloned == sal_True wird der Cursor ueber das XCloneable-Interface (dass er besitzen muss) gedoubled und // erst dann benutzt ucb Index: source/ucp/tdoc/tdoc_stgelems.cxx =================================================================== RCS file: /cvs/ucb/ucb/source/ucp/tdoc/tdoc_stgelems.cxx,v retrieving revision 1.7 diff -u -p -r1.7 tdoc_stgelems.cxx --- source/ucp/tdoc/tdoc_stgelems.cxx 17 Sep 2006 14:03:14 -0000 1.7 +++ source/ucp/tdoc/tdoc_stgelems.cxx 11 Dec 2006 14:40:50 -0000 @@ -115,7 +115,9 @@ Storage::Storage( const uno::Reference< uno::UNO_QUERY ); if ( xProxyFac.is() ) { - m_xAggProxy = xProxyFac->createProxy( m_xWrappedStorage ); + m_xAggProxy = xProxyFac->createProxy( + // disambiguate embed::XStorage bases + static_cast(m_xWrappedStorage.get()) ); } } catch ( uno::Exception const & ) ucbhelper Index: source/provider/simpleioerrorrequest.cxx =================================================================== RCS file: /cvs/ucb/ucbhelper/source/provider/simpleioerrorrequest.cxx,v retrieving revision 1.8 diff -u -p -r1.8 simpleioerrorrequest.cxx --- source/provider/simpleioerrorrequest.cxx 16 Sep 2006 17:24:44 -0000 1.8 +++ source/provider/simpleioerrorrequest.cxx 11 Dec 2006 14:40:55 -0000 @@ -39,6 +39,9 @@ #ifndef _COM_SUN_STAR_UCB_INTERACTIVEAUGMENTEDIOEXCEPTION_HPP_ #include #endif +#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_ +#include +#endif #ifndef _UCBHELPER_SIMPLEIOERRORREQUEST_HXX #include