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: testcomp.h,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 ************************************************************************/
30 //#include <com/sun/star/bridge/XServer.hpp>
31 //#include <com/sun/star/bridge/XClient.hpp>
34 #include <com/sun/star/bridge/XInstanceProvider.hpp>
35 //#include <com/sun/star/bridge/XConnectionAdministration.hpp>
36 #include <osl/thread.hxx>
39 void parseCommandLine( char *argv
[] ,
40 ::rtl::OUString
*pProtocol
, ::rtl::OUString
*pConnection
,
41 sal_Bool
*pbLatency
, sal_Bool
*pbReverse
);
44 Reference
< XInterface
> createComponent(
45 const ::rtl::OUString
&sServiceName
,
46 const ::rtl::OUString
&sDllName
,
47 const Reference
< XMultiServiceFactory
> & rSMgr
);
49 class OInterfaceTest
:
50 public ::cppu::OWeakObject
,
59 Any SAL_CALL
queryInterface( const com::sun::star::uno::Type
& aType
) throw ( ::com::sun::star::uno::RuntimeException
);
60 void SAL_CALL
acquire() throw() { OWeakObject::acquire(); }
61 void SAL_CALL
release() throw() { OWeakObject::release(); }
64 virtual void SAL_CALL
setIn( const ::com::sun::star::uno::Reference
< ::test::XCallMe
>& callback
) throw(::com::sun::star::uno::RuntimeException
);
65 virtual void SAL_CALL
setInOut( ::com::sun::star::uno::Reference
< ::test::XCallMe
>& callback
) throw(::com::sun::star::uno::RuntimeException
);
66 virtual void SAL_CALL
getOut( ::com::sun::star::uno::Reference
< ::test::XCallMe
>& callback
) throw(::com::sun::star::uno::RuntimeException
);
67 virtual ::com::sun::star::uno::Reference
< ::test::XCallMe
> SAL_CALL
get( ) throw(::com::sun::star::uno::RuntimeException
);
72 Reference
< XCallMe
> m_rCallMe
;
77 public ::cppu::OWeakObject
,
81 OCallMe() : m_nLastToDos(-1) {}
86 Any SAL_CALL
queryInterface( const com::sun::star::uno::Type
& aType
) throw ( ::com::sun::star::uno::RuntimeException
);
87 void SAL_CALL
acquire()throw() { OWeakObject::acquire(); }
88 void SAL_CALL
release()throw() { OWeakObject::release(); }
91 virtual void SAL_CALL
call( const ::rtl::OUString
& s
, sal_Int32 nToDo
)
92 throw(::com::sun::star::uno::RuntimeException
,
93 ::test::TestBridgeException
);
94 virtual void SAL_CALL
callOneway( const ::rtl::OUString
& s
, sal_Int32 nToDo
)
95 throw(::com::sun::star::uno::RuntimeException
);
96 virtual void SAL_CALL
drawLine( sal_Int32 x1
, sal_Int32 y1
, sal_Int32 x2
, sal_Int32 y2
)
97 throw(::com::sun::star::uno::RuntimeException
);
99 virtual ::rtl::OUString SAL_CALL
getsAttribute() throw(::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
setsAttribute( const ::rtl::OUString
& _sattribute
) throw(::com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
callAgain( const ::com::sun::star::uno::Reference
< ::test::XCallMe
>& callAgain
,
102 sal_Int32 nToCall
) throw(::com::sun::star::uno::RuntimeException
);
104 virtual ::test::TestTypes SAL_CALL
transport( const ::test::TestTypes
& types
)
105 throw(::com::sun::star::uno::RuntimeException
);
107 ::osl::Mutex m_mutex
;
108 ::rtl::OUString m_sAttribute
;
109 sal_Int32 m_nLastToDos
;
113 public ::cppu::OWeakObject
,
122 Any SAL_CALL
queryInterface( const com::sun::star::uno::Type
& aType
) throw ( ::com::sun::star::uno::RuntimeException
);
123 void SAL_CALL
acquire() throw() { OWeakObject::acquire(); }
124 void SAL_CALL
release() throw() { OWeakObject::release(); }
126 virtual ::com::sun::star::uno::Reference
< ::test::XCallMe
> SAL_CALL
createCallMe( )
127 throw(::com::sun::star::uno::RuntimeException
);
128 virtual ::com::sun::star::uno::Reference
< ::test::XInterfaceTest
> SAL_CALL
createInterfaceTest( )
129 throw(::com::sun::star::uno::RuntimeException
);
134 class OInstanceProvider
:
135 public ::cppu::OWeakObject
,
136 public XInstanceProvider
139 OInstanceProvider( ){}
140 OInstanceProvider( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> & r
) :
143 ~OInstanceProvider(){ printf( "instance provider dies\n" );}
146 Any SAL_CALL
queryInterface( const Type
& aType
)throw ( ::com::sun::star::uno::RuntimeException
);
147 void SAL_CALL
acquire()throw() { OWeakObject::acquire(); }
148 void SAL_CALL
release() throw() { OWeakObject::release(); }
151 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
152 getInstance( const ::rtl::OUString
& sObjectName
)
153 throw( ::com::sun::star::container::NoSuchElementException
,
154 ::com::sun::star::uno::RuntimeException
);
156 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_rSMgr
;
159 void testRemote( const Reference
< XInterface
> &rRemote
);