diff options
-rw-r--r-- | extensions/test/ole/cpnt/cpnt.cxx | 47 | ||||
-rw-r--r-- | extensions/test/ole/cpnt/makefile.mk | 5 | ||||
-rw-r--r-- | extensions/test/ole/idl/oletest.idl | 12 |
3 files changed, 54 insertions, 10 deletions
diff --git a/extensions/test/ole/cpnt/cpnt.cxx b/extensions/test/ole/cpnt/cpnt.cxx index b36709ae8..c50c15f64 100644 --- a/extensions/test/ole/cpnt/cpnt.cxx +++ b/extensions/test/ole/cpnt/cpnt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cpnt.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jl $ $Date: 2002-09-04 15:59:47 $ + * last change: $Author: jl $ $Date: 2002-09-13 06:37:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,7 +72,7 @@ #include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#include <cppuhelper/implbase7.hxx> +#include <cppuhelper/implbase8.hxx> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/uno/Reference.h> #include <rtl/ustring> @@ -86,6 +86,7 @@ #include <oletest/XSimple3.hpp> #include <oletest/XTestInParameters.hpp> #include <oletest/XTestOutParameters.hpp> +#include <oletest/XIdentity.hpp> #include <com/sun/star/beans/Property.hpp> using namespace cppu; using namespace osl; @@ -103,10 +104,11 @@ using namespace com::sun::star::reflection; #define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES" #define KEY2 L"oletest.OleTest" -class OComponent : public WeakImplHelper7< +class OComponent : public WeakImplHelper8< XTestSequence, XTestStruct, XTestOther, XTestInterfaces, - XSimple, XTestOutParameters, XTestInParameters > + XSimple, XTestOutParameters, XTestInParameters, XIdentity > { + Reference<XInterface> m_xIntIdentity; sal_Int32 m_arrayConstructor; Reference<XMultiServiceFactory> m_rFactory; @@ -273,6 +275,10 @@ public: // XTestSequence void SAL_CALL func( const OUString &message) throw(::com::sun::star::uno::RuntimeException); OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + // XIdentity + virtual void SAL_CALL setObject( const Reference< XInterface >& val ) throw (RuntimeException); + virtual sal_Bool SAL_CALL isSame( const Reference< XInterface >& val ) throw (RuntimeException); + virtual Reference< XInterface > SAL_CALL getThis( ) throw (RuntimeException); }; class EventListener: public WeakImplHelper1<XEventListener> @@ -295,7 +301,9 @@ OComponent::~OComponent() Reference<XInterface> SAL_CALL OComponent_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr ) throw(RuntimeException) { - Reference<XInterface> xService = *new OComponent( rSMgr ); +// Reference<XInterface> xService(static_cast<XWeak*>(new OComponent( rSMgr )), UNO_QUERY); + OComponent* o= new OComponent( rSMgr ); + Reference<XInterface> xService(static_cast<XIdentity*>(o), UNO_QUERY); return xService; } @@ -458,6 +466,13 @@ Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) thro // throw (RuntimeException) Sequence< Reference< XInterface > > SAL_CALL OComponent::methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) { + for( sal_Int32 i= 0; i < aSeq.getLength(); i++) + { + Reference<XInterface> xInt= aSeq[i]; + Reference<XEventListener> xList( xInt, UNO_QUERY); + if( xList.is()) + xList->disposing( EventObject()); + } return aSeq; } @@ -1710,6 +1725,26 @@ void SAL_CALL OComponent::testInterface( const Reference< XCallback >& xCallbac } +void SAL_CALL OComponent::setObject( const Reference< XInterface >& val ) throw (RuntimeException) +{ + m_xIntIdentity= val; +} + +sal_Bool SAL_CALL OComponent::isSame( const Reference< XInterface >& val ) throw (RuntimeException) +{ + if( m_xIntIdentity == val) + return sal_True; + else + return sal_False; +} + +Reference< XInterface > SAL_CALL OComponent::getThis( ) throw (RuntimeException) +{ +// return Reference<XInterface>(static_cast<XIdentity*>(this), UNO_QUERY); + Reference<XInterface> ret(static_cast<XIdentity*>(this), UNO_QUERY); + return ret; +} + void SAL_CALL EventListener::disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException) { bCalled= sal_True; diff --git a/extensions/test/ole/cpnt/makefile.mk b/extensions/test/ole/cpnt/makefile.mk index 5782ee146..ed353a8e3 100644 --- a/extensions/test/ole/cpnt/makefile.mk +++ b/extensions/test/ole/cpnt/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.4 $ # -# last change: $Author: jl $ $Date: 2001-12-03 13:57:38 $ +# last change: $Author: jl $ $Date: 2002-09-13 06:37:46 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -95,6 +95,7 @@ UNOTYPES= oletest.XTestSequence oletest.XTestStruct \ oletest.XSimple3 \ oletest.XTestOutParameters \ oletest.XTestInParameters \ + oletest.XIdentity \ com.sun.star.beans.PropertyAttribute \ com.sun.star.uno.XAggregation \ com.sun.star.lang.XTypeProvider \ diff --git a/extensions/test/ole/idl/oletest.idl b/extensions/test/ole/idl/oletest.idl index 202ebe795..ab9eb45d8 100644 --- a/extensions/test/ole/idl/oletest.idl +++ b/extensions/test/ole/idl/oletest.idl @@ -2,9 +2,9 @@ * * $RCSfile: oletest.idl,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jl $ $Date: 2002-09-04 16:01:00 $ + * last change: $Author: jl $ $Date: 2002-09-13 06:39:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -320,5 +320,13 @@ interface XTestInterfaces: com::sun::star::uno::XInterface void testInterface2( [in] oletest::XSimple xSimple, [in] long mode); }; +interface XIdentity: com::sun::star::uno::XInterface +{ + void setObject([in] com::sun::star::uno::XInterface val); + boolean isSame( [in] com::sun::star::uno::XInterface val); + + com::sun::star::uno::XInterface getThis(); +}; + }; // oletest |