summaryrefslogtreecommitdiff
path: root/stoc/test
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 14:29:57 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 14:29:57 +0000
commitb525a3115f54576017a576ff842dede5e2e3545d (patch)
treec534b95a9e572b63896467624293a5ca1887d3a3 /stoc/test
parent9399c662f36c385b0c705eb34e636a9aec450282 (diff)
initial import
Diffstat (limited to 'stoc/test')
-rw-r--r--stoc/test/excomp/example/ExampleComponent1.idl77
-rw-r--r--stoc/test/excomp/example/ExampleComponent2.idl77
-rw-r--r--stoc/test/excomp/example/XTest.idl84
-rw-r--r--stoc/test/excomp/excomp.cxx182
-rw-r--r--stoc/test/excomp/excomp1.cxx259
-rw-r--r--stoc/test/excomp/excomp1.xml45
-rw-r--r--stoc/test/excomp/excomp2.cxx334
-rw-r--r--stoc/test/excomp/excomp2.xml45
-rw-r--r--stoc/test/excomp/exports.dxp4
-rw-r--r--stoc/test/excomp/makefile.mk167
-rw-r--r--stoc/test/javavm/makefile.mk124
-rw-r--r--stoc/test/javavm/testjavavm.cxx224
-rw-r--r--stoc/test/javavm/testjavavm.java73
-rw-r--r--stoc/test/language_binding.idl213
-rw-r--r--stoc/test/makefile.mk239
-rw-r--r--stoc/test/testconv.cxx736
-rw-r--r--stoc/test/testcorefl.cxx439
-rw-r--r--stoc/test/testcorefl.idl140
-rw-r--r--stoc/test/testiadapter.cxx1029
-rw-r--r--stoc/test/testintrosp.cxx1645
-rw-r--r--stoc/test/testintrosp.idl255
-rw-r--r--stoc/test/testloader.cxx162
-rw-r--r--stoc/test/testproxyfac.cxx243
-rw-r--r--stoc/test/testregistry.cxx671
-rw-r--r--stoc/test/testsmgr.cxx162
25 files changed, 7629 insertions, 0 deletions
diff --git a/stoc/test/excomp/example/ExampleComponent1.idl b/stoc/test/excomp/example/ExampleComponent1.idl
new file mode 100644
index 000000000000..3cfe772fa548
--- /dev/null
+++ b/stoc/test/excomp/example/ExampleComponent1.idl
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: ExampleComponent1.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _EXCOMP_EXAMPLECOMPONENT1_IDL_
+#define _EXCOMP_EXAMPLECOMPONENT1_IDL_
+
+#include <example/XTest.idl>
+
+module example
+{
+
+service ExampleComponent1
+{
+ interface XTest;
+};
+
+}; // test
+
+
+#endif
diff --git a/stoc/test/excomp/example/ExampleComponent2.idl b/stoc/test/excomp/example/ExampleComponent2.idl
new file mode 100644
index 000000000000..ad0e2237511f
--- /dev/null
+++ b/stoc/test/excomp/example/ExampleComponent2.idl
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: ExampleComponent2.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _EXCOMP_EXAMPLECOMPONENT2_IDL_
+#define _EXCOMP_EXAMPLECOMPONENT2_IDL_
+
+#include <example/XTest.idl>
+
+module example
+{
+
+service ExampleComponent2
+{
+ interface XTest;
+};
+
+}; // test
+
+
+#endif
diff --git a/stoc/test/excomp/example/XTest.idl b/stoc/test/excomp/example/XTest.idl
new file mode 100644
index 000000000000..01d1e4bb44ef
--- /dev/null
+++ b/stoc/test/excomp/example/XTest.idl
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * $RCSfile: XTest.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _EXCOMP_XTEST_IDL_
+#define _EXCOMP_XTEST_IDL_
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module example
+{
+/**
+ * Simple test interface.
+ *
+ * @author Juergen Schmidt
+ */
+[ uik(46833373-3462-11d3-87A50070-24594732), ident("XTest", 1.0) ]
+interface XTest : com::sun::star::uno::XInterface
+{
+ /**
+ * in parameter test, tests by calls reference also (complex types)
+ */
+ string getMessage( );
+};
+
+}; // test
+
+#endif
diff --git a/stoc/test/excomp/excomp.cxx b/stoc/test/excomp/excomp.cxx
new file mode 100644
index 000000000000..27d9954aff2b
--- /dev/null
+++ b/stoc/test/excomp/excomp.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: excomp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _VOS_PROCESS_HXX_
+#include <vos/process.hxx>
+#endif
+
+#include <example/XTest.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
+#include <cppuhelper/servicefactory.hxx>
+#endif
+
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::lang;
+using namespace example;
+using namespace cppu;
+using namespace vos;
+using namespace rtl;
+
+#ifdef _DEBUG
+#define TEST_ENSHURE(c, m) VOS_ENSHURE(c, m)
+#else
+#define TEST_ENSHURE(c, m) VOS_VERIFY(c)
+#endif
+
+OUString getExePath()
+{
+ OStartupInfo startupInfo;
+ OUString exe;
+
+ VOS_VERIFY(startupInfo.getExecutableFile(exe) == OStartupInfo::E_None);
+
+#if defined(WIN32) || defined(__OS2__) || defined(WNT)
+ exe = exe.copy(0, exe.getLength() - 10);
+#else
+ exe = exe.copy(0, exe.getLength() - 6);
+#endif
+ return exe;
+}
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+#ifdef UNX
+ OUString compName1(RTL_CONSTASCII_USTRINGPARAM("libexcomp1.so"));
+ OUString compName2(RTL_CONSTASCII_USTRINGPARAM("libexcomp2.so"));
+#else
+ OUString compName1(RTL_CONSTASCII_USTRINGPARAM("excomp1"));
+ OUString compName2(RTL_CONSTASCII_USTRINGPARAM("excomp2"));
+#endif
+
+ OUString exePath( getExePath() );
+ OUString excompRdb(exePath);
+
+ excompRdb += OUString::createFromAscii("excomp.rdb");
+
+ Reference< XMultiServiceFactory > xSMgr = ::cppu::createRegistryServiceFactory( excompRdb );
+ TEST_ENSHURE( xSMgr.is(), "excomp error 0" );
+
+ typelib_TypeDescription* pTypeDesc = NULL;
+ OUString sType = OUString::createFromAscii("com.sun.star.text.XTextDocument");
+ typelib_typedescription_getByName( &pTypeDesc, sType.pData);
+ typelib_InterfaceTypeDescription* pInterDesc = (typelib_InterfaceTypeDescription*)pTypeDesc;
+
+ Reference< XInterface > xIFace = xSMgr->createInstance(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration"));
+ Reference< XImplementationRegistration > xImpReg( xIFace, UNO_QUERY);
+ TEST_ENSHURE( xImpReg.is(), "excomp error 1" );
+ try
+ {
+ xImpReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
+ compName1,
+ Reference< XSimpleRegistry >() );
+ xImpReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
+ compName2,
+ Reference< XSimpleRegistry >() );
+ }
+ catch( CannotRegisterImplementationException& e)
+ {
+ TEST_ENSHURE( e.Message.getLength(), OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr() );
+ }
+
+ Reference< XTest > xTest1( xSMgr->createInstance(OUString::createFromAscii("example.ExampleComponent1")),
+ UNO_QUERY);
+ TEST_ENSHURE( xTest1.is(), "excomp error 2" );
+ Reference< XTest > xTest2( xSMgr->createInstance(OUString::createFromAscii("example.ExampleComponent2")),
+ UNO_QUERY);
+ TEST_ENSHURE( xTest2.is(), "excomp error 3" );
+
+ OUString m1 = xTest1->getMessage();
+ OUString m2 = xTest2->getMessage();
+
+ fprintf(stdout, "ExampleComponent1, Message = \"%s\"\n", OUStringToOString(m1, RTL_TEXTENCODING_ASCII_US).getStr());
+ fprintf(stdout, "ExampleComponent2, Message = \"%s\"\n", OUStringToOString(m2, RTL_TEXTENCODING_ASCII_US).getStr());
+
+ xImpReg->revokeImplementation(compName1, Reference< XSimpleRegistry >() );
+ xImpReg->revokeImplementation(compName2, Reference< XSimpleRegistry >() );
+
+ Reference< XComponent >( xSMgr, UNO_QUERY )->dispose();
+
+ return(0);
+}
+
+
diff --git a/stoc/test/excomp/excomp1.cxx b/stoc/test/excomp/excomp1.cxx
new file mode 100644
index 000000000000..fc5f3577df80
--- /dev/null
+++ b/stoc/test/excomp/excomp1.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * $RCSfile: excomp1.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+#include <example/XTest.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+using namespace example;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+using namespace cppu;
+using namespace osl;
+using namespace rtl;
+
+#define SERVICENAME1 "example.ExampleComponent1"
+#define IMPLNAME1 "example.ExampleComponent1.Impl"
+
+namespace excomp_impl {
+
+//*************************************************************************
+// ExampleComponent1Impl
+//*************************************************************************
+class ExampleComponent1Impl : public WeakImplHelper2< XTest, XServiceInfo >
+{
+public:
+ ExampleComponent1Impl( const Reference<XMultiServiceFactory> & rXSMgr );
+
+ ~ExampleComponent1Impl();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
+ static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( );
+
+ // XSimpleRegistry
+ virtual OUString SAL_CALL getMessage() throw(RuntimeException);
+
+protected:
+ Mutex m_mutex;
+
+ Reference<XMultiServiceFactory> m_xSMgr;
+};
+
+//*************************************************************************
+ExampleComponent1Impl::ExampleComponent1Impl( const Reference<XMultiServiceFactory> & rXSMgr )
+ : m_xSMgr(rXSMgr)
+{
+}
+
+//*************************************************************************
+ExampleComponent1Impl::~ExampleComponent1Impl()
+{
+}
+
+//*************************************************************************
+OUString SAL_CALL ExampleComponent1Impl::getImplementationName( )
+ throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME1) );
+}
+
+//*************************************************************************
+sal_Bool SAL_CALL ExampleComponent1Impl::supportsService( const OUString& ServiceName )
+ throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString * pArray = aSNL.getArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+//*************************************************************************
+Sequence<OUString> SAL_CALL ExampleComponent1Impl::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ return getSupportedServiceNames_Static();
+}
+
+//*************************************************************************
+Sequence<OUString> SAL_CALL ExampleComponent1Impl::getSupportedServiceNames_Static( )
+{
+ OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME1) );
+ return Sequence< OUString >( &aName, 1 );
+}
+
+//*************************************************************************
+OUString SAL_CALL ExampleComponent1Impl::getMessage() throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ return OUString::createFromAscii("Lalelu nur der Mann im Mond schaut zu ...");
+}
+
+
+//*************************************************************************
+Reference<XInterface> SAL_CALL ExampleComponent1_CreateInstance( const Reference<XMultiServiceFactory>& rSMgr )
+{
+ Reference<XInterface> xRet;
+
+ XTest *pXTest = (XTest*) new ExampleComponent1Impl(rSMgr);
+
+ if (pXTest)
+ {
+ xRet = Reference< XInterface >::query(pXTest);
+ }
+
+ return xRet;
+}
+
+} // excomp_impl
+
+
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ // ExampleComponent1
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME1 "/UNO/SERVICES") ) ) );
+
+ Sequence< OUString > & rSNL =
+ ::excomp_impl::ExampleComponent1Impl::getSupportedServiceNames_Static();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pRet = 0;
+
+ if (rtl_str_compare( pImplName, IMPLNAME1 ) == 0)
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME1) ),
+ ::excomp_impl::ExampleComponent1_CreateInstance,
+ ::excomp_impl::ExampleComponent1Impl::getSupportedServiceNames_Static() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+}
+
+
+
diff --git a/stoc/test/excomp/excomp1.xml b/stoc/test/excomp/excomp1.xml
new file mode 100644
index 000000000000..0246dd4f88ca
--- /dev/null
+++ b/stoc/test/excomp/excomp1.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "componentdescription.dtd">
+
+<COMPONENTDESCRIPTION
+ xmlns:xlink="http://www.w3.org/1999/xlink/Namespace" >
+
+<Author> Juergen Schmidt </Author>
+
+<Name> example.ExampleComponent1.Impl </Name>
+
+<Description>
+ This component provides a simple demo component.
+</Description>
+
+<ModuleName> excomp1 </ModuleName>
+
+<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName>
+
+<Language> c++ </Language>
+
+<Status StatusValue="final"/>
+
+<SupportedService> example.ExampleComponent1 </SupportedService>
+
+<ProjectBuildDependency> cppuhelper </ProjectBuildDependency>
+<ProjectBuildDependency> cppu </ProjectBuildDependency>
+<ProjectBuildDependency> vos </ProjectBuildDependency>
+<ProjectBuildDependency> sal </ProjectBuildDependency>
+
+<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency>
+<RuntimeModuleDependency> cppu </RuntimeModuleDependency>
+<RuntimeModuleDependency> vos </RuntimeModuleDependency>
+<RuntimeModuleDependency> sal </RuntimeModuleDependency>
+
+<Type> com.sun.star.lang.XTypeProvider </Type>
+<Type> com.sun.star.lang.XServiceInfo </Type>
+<Type> com.sun.star.lang.XSingleServiceFactory </Type>
+<Type> com.sun.star.lang.XMultiServiceFactory </Type>
+<Type> com.sun.star.registry.XRegistryKey </Type>
+<Type> com.sun.star.uno.XAggregation </Type>
+<Type> com.sun.star.uno.XWeak </Type>
+<Type> com.sun.star.uno.TypeClass </Type>
+<Type> example.XTest </Type>
+
+</COMPONENTDESCRIPTION>
diff --git a/stoc/test/excomp/excomp2.cxx b/stoc/test/excomp/excomp2.cxx
new file mode 100644
index 000000000000..ccedc6dbf907
--- /dev/null
+++ b/stoc/test/excomp/excomp2.cxx
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * $RCSfile: excomp2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#include <example/XTest.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+using namespace example;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+using namespace cppu;
+using namespace osl;
+using namespace rtl;
+
+#define SERVICENAME2 "example.ExampleComponent2"
+#define IMPLNAME2 "example.ExampleComponent2.Impl"
+
+namespace excomp2_impl {
+
+//*************************************************************************
+// ExampleComponent2Impl
+//*************************************************************************
+class ExampleComponent2Impl : public OWeakObject
+ , public XTypeProvider
+ , public XServiceInfo
+ , public XTest
+{
+public:
+ ExampleComponent2Impl( const Reference<XMultiServiceFactory> & rXSMgr );
+
+ ~ExampleComponent2Impl();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw()
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw()
+ { OWeakObject::release(); }
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
+ static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( );
+
+ // XTest
+ virtual OUString SAL_CALL getMessage() throw(RuntimeException);
+
+protected:
+ Mutex m_mutex;
+
+ Reference<XMultiServiceFactory> m_xSMgr;
+};
+
+//*************************************************************************
+ExampleComponent2Impl::ExampleComponent2Impl( const Reference<XMultiServiceFactory> & rXSMgr )
+ : m_xSMgr(rXSMgr)
+{
+}
+
+//*************************************************************************
+ExampleComponent2Impl::~ExampleComponent2Impl()
+{
+}
+
+//*************************************************************************
+Any SAL_CALL ExampleComponent2Impl::queryInterface( const ::com::sun::star::uno::Type & rType )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ Any aRet = ::cppu::queryInterface(rType,
+ static_cast< XTypeProvider * >( this ),
+ static_cast< XServiceInfo * >( this ),
+ static_cast< XTest * >( this ) );
+ if ( aRet.hasValue() )
+ return aRet;
+
+ return OWeakObject::queryInterface( rType );
+}
+
+//*************************************************************************
+Sequence< Type > SAL_CALL ExampleComponent2Impl::getTypes()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ static OTypeCollection * pTypes = 0;
+ if (! pTypes)
+ {
+ MutexGuard aGuard( m_mutex );
+ if (! pTypes)
+ {
+ static OTypeCollection aTypes(
+ ::getCppuType( (const Reference< XInterface > *)0 ),
+ ::getCppuType( (const Reference< XWeak > *)0 ),
+ ::getCppuType( (const Reference< XTypeProvider > *)0 ),
+ ::getCppuType( (const Reference< XServiceInfo > *)0 ),
+ ::getCppuType( (const Reference< XTest > *)0 ) );
+ pTypes = &aTypes;
+ }
+ }
+ return pTypes->getTypes();
+}
+
+//*************************************************************************
+Sequence< sal_Int8 > SAL_CALL ExampleComponent2Impl::getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ static OImplementationId * pId = 0;
+ if (! pId)
+ {
+ MutexGuard aGuard( m_mutex );
+ if (! pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+//*************************************************************************
+OUString SAL_CALL ExampleComponent2Impl::getImplementationName( )
+ throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME2) );
+}
+
+//*************************************************************************
+sal_Bool SAL_CALL ExampleComponent2Impl::supportsService( const OUString& ServiceName )
+ throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString * pArray = aSNL.getConstArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+//*************************************************************************
+Sequence<OUString> SAL_CALL ExampleComponent2Impl::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ return getSupportedServiceNames_Static();
+}
+
+//*************************************************************************
+Sequence<OUString> SAL_CALL ExampleComponent2Impl::getSupportedServiceNames_Static( )
+{
+ OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME2) );
+ return Sequence< OUString >( &aName, 1 );
+}
+
+//*************************************************************************
+OUString SAL_CALL ExampleComponent2Impl::getMessage() throw(RuntimeException)
+{
+ Guard< Mutex > aGuard( m_mutex );
+ return OUString::createFromAscii("Alle meine Entchen schwimmen auf dem See, schwimmen auf dem See ...");
+}
+
+
+//*************************************************************************
+Reference<XInterface> SAL_CALL ExampleComponent2_CreateInstance( const Reference<XMultiServiceFactory>& rSMgr )
+{
+ Reference<XInterface> xRet;
+
+ XTest *pXTest = (XTest*) new ExampleComponent2Impl(rSMgr);
+
+ if (pXTest)
+ {
+ xRet = Reference< XInterface >::query(pXTest);
+ }
+
+ return xRet;
+}
+
+
+} // excomp_impl
+
+
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ // ExampleComponent2
+ Reference< XRegistryKey > xNewKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME2 "/UNO/SERVICES") ) ) );
+
+ Sequence< OUString > & rSNL =
+ ::excomp2_impl::ExampleComponent2Impl::getSupportedServiceNames_Static();
+ const OUString * pArray = rSNL.getConstArray();
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+ xNewKey->createKey( pArray[nPos] );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pRet = 0;
+
+ if (rtl_str_compare( pImplName, IMPLNAME2 ) == 0)
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME2) ),
+ ::excomp2_impl::ExampleComponent2_CreateInstance,
+ ::excomp2_impl::ExampleComponent2Impl::getSupportedServiceNames_Static() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+}
+
+
+
diff --git a/stoc/test/excomp/excomp2.xml b/stoc/test/excomp/excomp2.xml
new file mode 100644
index 000000000000..4fa4db28eb2d
--- /dev/null
+++ b/stoc/test/excomp/excomp2.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "componentdescription.dtd">
+
+<COMPONENTDESCRIPTION
+ xmlns:xlink="http://www.w3.org/1999/xlink/Namespace" >
+
+<Author> Juergen Schmidt </Author>
+
+<Name> example.ExampleComponent2.Impl </Name>
+
+<Description>
+ This component provides a simple demo component.
+</Description>
+
+<ModuleName> excomp2 </ModuleName>
+
+<LoaderName> com.sun.star.loader.SharedLibrary </LoaderName>
+
+<Language> c++ </Language>
+
+<Status StatusValue="final"/>
+
+<SupportedService> example.ExampleComponent2 </SupportedService>
+
+<ProjectBuildDependency> cppuhelper </ProjectBuildDependency>
+<ProjectBuildDependency> cppu </ProjectBuildDependency>
+<ProjectBuildDependency> vos </ProjectBuildDependency>
+<ProjectBuildDependency> sal </ProjectBuildDependency>
+
+<RuntimeModuleDependency> cppuhelper </RuntimeModuleDependency>
+<RuntimeModuleDependency> cppu </RuntimeModuleDependency>
+<RuntimeModuleDependency> vos </RuntimeModuleDependency>
+<RuntimeModuleDependency> sal </RuntimeModuleDependency>
+
+<Type> com.sun.star.lang.XTypeProvider </Type>
+<Type> com.sun.star.lang.XServiceInfo </Type>
+<Type> com.sun.star.lang.XSingleServiceFactory </Type>
+<Type> com.sun.star.lang.XMultiServiceFactory </Type>
+<Type> com.sun.star.registry.XRegistryKey </Type>
+<Type> com.sun.star.uno.XAggregation </Type>
+<Type> com.sun.star.uno.XWeak </Type>
+<Type> com.sun.star.uno.TypeClass </Type>
+<Type> example.XTest </Type>
+
+</COMPONENTDESCRIPTION>
diff --git a/stoc/test/excomp/exports.dxp b/stoc/test/excomp/exports.dxp
new file mode 100644
index 000000000000..2513a15ad5d5
--- /dev/null
+++ b/stoc/test/excomp/exports.dxp
@@ -0,0 +1,4 @@
+component_getDescriptionFunc
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/stoc/test/excomp/makefile.mk b/stoc/test/excomp/makefile.mk
new file mode 100644
index 000000000000..578a1880cff3
--- /dev/null
+++ b/stoc/test/excomp/makefile.mk
@@ -0,0 +1,167 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME= stoc
+TARGET= excomp
+TARGET1= excomp1
+TARGET2= excomp2
+TARGETTYPE=CUI
+#LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE= TRUE
+NO_BSYMBOLIC= TRUE
+COMP1TYPELIST=$(TARGET1)
+COMP2TYPELIST=$(TARGET2)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# ------------------------------------------------------------------
+
+UNOUCRDEP= $(BIN)$/excomp.rdb
+UNOUCRRDB= $(BIN)$/excomp.rdb
+UNOUCROUT= $(OUT)$/inc
+INCPRE+= $(OUT)$/inc
+
+UNOTYPES=$($(TARGET1)_XML2CMPTYPES)
+UNOTYPES+=$($(TARGET2)_XML2CMPTYPES)
+UNOTYPES+= com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.lang.XComponent
+
+# --- Application excomp ------------------------------------------------
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJ)$/excomp.obj
+
+APP1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+# ---- objects ----
+SLOFILES= \
+ $(SLO)$/excomp1.obj \
+ $(SLO)$/$(COMP1TYPELIST)_description.obj \
+ $(SLO)$/excomp2.obj \
+ $(SLO)$/$(COMP2TYPELIST)_description.obj
+
+# ---- excomp1 ------
+SHL1TARGET= $(TARGET1)
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+SHL1DEPN=
+SHL1LIBS=
+SHL1OBJS= $(SLO)$/excomp1.obj \
+ $(SLO)$/$(COMP1TYPELIST)_description.obj
+SHL1IMPLIB= i$(TARGET1)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+# ---- excomp2 ------
+SHL2TARGET= $(TARGET2)
+
+SHL2STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+SHL2DEPN=
+SHL2LIBS=
+SHL2OBJS= $(SLO)$/excomp2.obj \
+ $(SLO)$/$(COMP2TYPELIST)_description.obj
+SHL2IMPLIB= i$(TARGET2)
+SHL2DEF= $(MISC)$/$(SHL2TARGET).def
+
+DEF2NAME= $(SHL2TARGET)
+DEF2EXPORTFILE= exports.dxp
+
+ALLIDLFILES:= example$/XTest.idl example$/ExampleComponent1.idl example$/ExampleComponent2.idl
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : $(BIN)$/excomp.rdb \
+ ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+$(BIN)$/excomp.rdb: $(ALLIDLFILES)
+ +unoidl -I$(PRJ) -I$(SOLARIDLDIR) -Burd -OH$(MISC)$/excomp $?
+ +regmerge $@ /UCR $(MISC)$/excomp$/{$(?:f:s/.idl/.urd/)}
+ +regmerge $@ / $(SOLARBINDIR)$/applicat.rdb
+ touch $@
+
diff --git a/stoc/test/javavm/makefile.mk b/stoc/test/javavm/makefile.mk
new file mode 100644
index 000000000000..4784d96882c6
--- /dev/null
+++ b/stoc/test/javavm/makefile.mk
@@ -0,0 +1,124 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME= stoc
+TARGET6= testjavavm
+TARGETTYPE= CUI
+LIBTARGET= NO
+ENABLE_EXCEPTIONS=TRUE
+NO_BSYMBOLIC= TRUE
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+#UNOUCROUT= $(OUT)$/inc$/test
+UNOUCROUT= $(OUT)$/inc$
+#INCPRE+= $(OUT)$/inc$/test
+INCPRE+= $(OUT)$/inc$
+
+#asdf:
+# echo $(OUT)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Application 6 - testjavavm ------------------------------------
+APP6TARGET= $(TARGET6)
+APP6OBJS = $(OBJ)$/testjavavm.obj
+APP6STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(UNOLIB)
+
+.IF "$(GUI)"=="WNT"
+APP6STDLIBS+= $(LIBCIMT)
+.ENDIF
+
+#ALLIDLFILES:=
+
+# --- Target ------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : unoheader \
+ ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+TESTJAVAVM:=com.sun.star.uno.XWeak;com.sun.star.java.XJavaVM;com.sun.star.java.XJavaThreadRegister.XJavaThreadRegister_11;com.sun.star.registry.XSimpleRegistry;com.sun.star.lang.XComponent;com.sun.star.registry.XImplementationRegistration;com.sun.star.lang.XSingleServiceFactory;com.sun.star.uno.TypeClass;com.sun.star.lang.XMultiServiceFactory
+
+#$(BIN)$/stoctest.rdb: $(ALLIDLFILES)
+# +unoidl -I$(PRJ) -I$(SOLARIDLDIR) -Burd -OH$(BIN) $?
+# +regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+# +regmerge $@ / $(UNOUCRRDB)
+# touch $@
+
+unoheader: $(UNOUCRRDB)
+ +cppumaker -BUCR -O$(UNOUCROUT) -T"$(TESTJAVAVM)" $(UNOUCRRDB)
+
diff --git a/stoc/test/javavm/testjavavm.cxx b/stoc/test/javavm/testjavavm.cxx
new file mode 100644
index 000000000000..34c883f2168e
--- /dev/null
+++ b/stoc/test/javavm/testjavavm.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * $RCSfile: testjavavm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <jni.h>
+
+//#include <iostream>
+#include <stdio.h>
+#include <uno/api.h>
+
+#include <vos/diagnose.hxx>
+#include <vos/dynload.hxx>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/java/XJavaVM.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/java/XJavaThreadRegister/XJavaThreadRegister_11.hpp>
+
+//#include <cppuhelper/implbase1.hxx>
+
+using namespace std;
+using namespace rtl;
+using namespace cppu;
+using namespace vos;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+//using namespace com::sun::star::reflection;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::java;
+using namespace com::sun::star::java::XJavaThreadRegister;
+
+
+sal_Bool testJavaVM(const Reference< XMultiServiceFactory > & xMgr )
+{
+
+ Reference<XInterface> xXInt= xMgr->createInstance(L"com.sun.star.java.JavaVirtualMachine");
+ if( ! xXInt.is())
+ return sal_False;
+ Reference<XJavaVM> xVM( xXInt, UNO_QUERY);
+ if( ! xVM.is())
+ return sal_False;
+ Reference<XJavaThreadRegister_11> xreg11(xVM, UNO_QUERY);
+ if( ! xreg11.is())
+ return sal_False;
+
+ sal_Bool b= xreg11->isThreadAttached();
+ xreg11->registerThread();
+ b= xreg11->isThreadAttached();
+ xreg11->revokeThread();
+ b= xreg11->isThreadAttached();
+
+ Uik aMachineId;
+ aMachineId.m_Data1= 0;
+ aMachineId.m_Data2= 0;
+ aMachineId.m_Data3= 0;
+ aMachineId.m_Data4= 0;
+ aMachineId.m_Data5= 0;
+
+ b= xVM->isVMEnabled();
+ b= xVM->isVMStarted();
+
+ Any anyVM = xVM->getJavaVM( aMachineId, UNO_getProcessIdentifier());
+
+ b= xVM->isVMEnabled();
+ b= xVM->isVMStarted();
+
+
+ JavaVM* _jvm= *(JavaVM**) anyVM.getValue();
+ JNIEnv *p_env;
+ if( _jvm->AttachCurrentThread( &p_env, 0))
+ return sal_False;
+
+// jclass aJProg = p_env->FindClass("TestJavaVM");
+// if( p_env->ExceptionOccurred()){
+// p_env->ExceptionDescribe();
+// p_env->ExceptionClear();
+// }
+//
+// jmethodID mid= p_env->GetStaticMethodID( aJProg,"main", "([Ljava/lang/String;)V");
+
+ jclass cls = p_env->FindClass( "TestJavaVM");
+ if (cls == 0) {
+ VOS_TRACE( "Can't find Prog class\n");
+ exit(1);
+ }
+
+// jmethodID methid = p_env->GetStaticMethodID( cls, "main", "([Ljava/lang/String;)V");
+// if (methid == 0) {
+// VOS_TRACE("Can't find Prog.main\n");
+// exit(1);
+// }
+
+// jstring jstr = p_env->NewStringUTF(" from C!");
+// if (jstr == 0) {
+// VOS_TRACE("Out of memory\n");
+// exit(1);
+// }
+// jobjectArray args = p_env->NewObjectArray( 1,
+// p_env->FindClass("java/lang/String"), jstr);
+// if (args == 0) {
+// VOS_TRACE( "Out of memory\n");
+// exit(1);
+// }
+// p_env->CallStaticVoidMethod( cls, methid, args);
+
+
+ jmethodID id = p_env->GetStaticMethodID( cls, "getInt", "()I");
+ if( id)
+ {
+ jint _i= p_env->CallStaticIntMethod(cls, id);
+ }
+
+ if( p_env->ExceptionOccurred()){
+ p_env->ExceptionDescribe();
+ p_env->ExceptionClear();
+ }
+
+
+ _jvm->DetachCurrentThread();
+ return sal_True;
+}
+
+extern
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int __cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( "applicat.rdb" ) );
+
+ sal_Bool bSucc = sal_False;
+ try
+ {
+ Reference<com::sun::star::registry::XImplementationRegistration> xImplReg(
+ xMgr->createInstance( L"com.sun.star.registry.ImplementationRegistration" ), UNO_QUERY );
+ VOS_ENSHURE( xImplReg.is(), "### no impl reg!" );
+
+ sal_Char pLibName[256];
+ ORealDynamicLoader::computeLibraryName("je558mi", pLibName, 255);
+ xImplReg->registerImplementation(
+ L"com.sun.star.loader.SharedLibrary", OWString::createFromAscii(pLibName), Reference< XSimpleRegistry >() );
+
+ bSucc = testJavaVM( xMgr );
+ }
+ catch (Exception & rExc)
+ {
+ VOS_ENSHURE( sal_False, "### exception occured!" );
+ OString aMsg( OWStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ VOS_TRACE( "### exception occured: " );
+ VOS_TRACE( aMsg.getStr() );
+ VOS_TRACE( "\n" );
+ }
+
+ Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+ printf("javavm %s", bSucc ? "succeeded" : "failed");
+// cout << "javavm " << (bSucc ? "succeeded" : "failed") << " !" << endl;
+ return (bSucc ? 0 : -1);
+}
+
+
diff --git a/stoc/test/javavm/testjavavm.java b/stoc/test/javavm/testjavavm.java
new file mode 100644
index 000000000000..3acef1ae7801
--- /dev/null
+++ b/stoc/test/javavm/testjavavm.java
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: testjavavm.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+class TestJavaVM
+{
+ public static int getInt()
+ {
+ return 100;
+ }
+
+ public static void main( String args[])
+ {
+ System.out.println("Hello World");
+ }
+}
diff --git a/stoc/test/language_binding.idl b/stoc/test/language_binding.idl
new file mode 100644
index 000000000000..cc93e8a32197
--- /dev/null
+++ b/stoc/test/language_binding.idl
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * $RCSfile: language_binding.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TEST_LANGUAGE_BINDING_IDL_
+#define _TEST_LANGUAGE_BINDING_IDL_
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+
+module test
+{
+
+enum TestEnum
+{
+ TEST,
+ ONE,
+ TWO,
+ CHECK,
+ LOLA,
+ PALOO,
+ ZA
+};
+
+/**
+ * simple c++ types
+ */
+struct TestSimple
+{
+ boolean Bool;
+ char Char;
+ byte Byte;
+ short Short;
+ unsigned short UShort;
+ long Long;
+ unsigned long ULong;
+ hyper Hyper;
+ unsigned hyper UHyper;
+ float Float;
+ double Double;
+ test::TestEnum Enum;
+};
+/**
+ * complex c++ types
+ */
+struct TestElement : test::TestSimple
+{
+ string String;
+ com::sun::star::uno::XInterface Interface;
+ any Any;
+};
+struct TestDataElements : test::TestElement
+{
+ sequence<test::TestElement > Sequence;
+};
+
+typedef TestDataElements TestData;
+
+/**
+ * Monster test interface to test language binding calls.
+ *
+ * @author Daniel Boelzle
+ */
+[ uik(46833373-3462-11d3-87A400A0-24494732), ident("XLBTest", 1.0) ]
+interface XLBTestBase : com::sun::star::uno::XInterface
+{
+ /**
+ * in parameter test, tests by calls reference also (complex types)
+ */
+ [oneway] void setValues( [in] boolean bBool, [in] char cChar, [in] byte nByte,
+ [in] short nShort, [in] unsigned short nUShort,
+ [in] long nLong, [in] unsigned long nULong,
+ [in] hyper nHyper, [in] unsigned hyper nUHyper,
+ [in] float fFloat, [in] double fDouble,
+ [in] test::TestEnum eEnum, [in] string aString,
+ [in] com::sun::star::uno::XInterface xInterface, [in] any aAny,
+ [in] sequence<test::TestElement > aSequence,
+ [in] test::TestData aStruct );
+ /**
+ * inout parameter test
+ */
+ test::TestData setValues2( [inout] boolean bBool, [inout] char cChar, [inout] byte nByte,
+ [inout] short nShort, [inout] unsigned short nUShort,
+ [inout] long nLong, [inout] unsigned long nULong,
+ [inout] hyper nHyper, [inout] unsigned hyper nUHyper,
+ [inout] float fFloat, [inout] double fDouble,
+ [inout] test::TestEnum eEnum, [inout] string aString,
+ [inout] com::sun::star::uno::XInterface xInterface, [inout] any aAny,
+ [inout] sequence<test::TestElement > aSequence,
+ [inout] test::TestData aStruct );
+
+ /**
+ * out parameter test
+ */
+ test::TestData getValues( [out] boolean bBool, [out] char cChar, [out] byte nByte,
+ [out] short nShort, [out] unsigned short nUShort,
+ [out] long nLong, [out] unsigned long nULong,
+ [out] hyper nHyper, [out] unsigned hyper nUHyper,
+ [out] float fFloat, [out] double fDouble,
+ [out] test::TestEnum eEnum, [out] string aString,
+ [out] com::sun::star::uno::XInterface xInterface, [out] any aAny,
+ [out] sequence<test::TestElement > aSequence,
+ [out] test::TestData aStruct );
+
+ [attribute] boolean Bool;
+ [attribute] byte Byte;
+ [attribute] char Char;
+ [attribute] short Short;
+ [attribute] unsigned short UShort;
+ [attribute] long Long;
+ [attribute] unsigned long ULong;
+ [attribute] hyper Hyper;
+ [attribute] unsigned hyper UHyper;
+ [attribute] float Float;
+ [attribute] double Double;
+ [attribute] test::TestEnum Enum;
+ [attribute] string String;
+ [attribute] com::sun::star::uno::XInterface Interface;
+ [attribute] any Any;
+ [attribute] sequence<test::TestElement > Sequence;
+ [attribute] test::TestData Struct;
+};
+
+
+/**
+ * Inherting from monster; adds raiseException().
+ *
+ * @author Daniel Boelzle
+ */
+[ uik(44C34C20-3478-11d3-87A400A0-24494732), ident("XLanguageBindingTest", 1.0) ]
+interface XLanguageBindingTest : test::XLBTestBase
+{
+ /**
+ * params are there only for dummy, to test if all temp out params will be released.
+ */
+ test::TestData raiseException( [out] boolean bBool, [out] char cChar, [out] byte nByte,
+ [out] short nShort, [out] unsigned short nUShort,
+ [out] long nLong, [out] unsigned long nULong,
+ [out] hyper nHyper, [out] unsigned hyper nUHyper,
+ [out] float fFloat, [out] double fDouble,
+ [out] test::TestEnum eEnum, [out] string aString,
+ [out] com::sun::star::uno::XInterface xInterface, [out] any aAny,
+ [out] sequence<test::TestElement > aSequence,
+ [out] test::TestData aStruct )
+ raises( com::sun::star::lang::IllegalArgumentException );
+
+ /**
+ * raises runtime exception
+ */
+ [attribute] long RuntimeException;
+};
+
+}; // test
+
+
+#endif
diff --git a/stoc/test/makefile.mk b/stoc/test/makefile.mk
new file mode 100644
index 000000000000..0c3c3b12b0d6
--- /dev/null
+++ b/stoc/test/makefile.mk
@@ -0,0 +1,239 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:29:35 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=stoc
+TARGET=stoc
+TARGET1=testloader
+TARGET2=testregistry
+TARGET3=testsmgr
+TARGET4=testcorefl
+TARGET5=testiadapter
+TARGET6=testintrosp
+TARGET7=testconv
+TARGET8=testproxyfac
+TARGETTYPE=CUI
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+NO_BSYMBOLIC=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= testloader.cxx \
+ testregistry.cxx \
+ testsmgr.cxx
+
+# --- Application 1 ------------------------------------------------
+APP1TARGET= $(TARGET1)
+APP1OBJS= $(OBJ)$/testloader.obj
+
+APP1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)"=="WNT"
+APP1STDLIBS+=
+# $(LIBCIMT) $(LIBCMT)
+.ENDIF
+
+# --- Application 2 ------------------------------------------------
+APP2TARGET= $(TARGET2)
+APP2OBJS= $(OBJ)$/testregistry.obj
+
+APP2STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(UNOTOOLSLIB)
+
+.IF "$(GUI)"=="WNT"
+APP2STDLIBS+=
+# $(LIBCIMT) $(LIBCMT)
+.ENDIF
+
+
+# --- Application 3 - testsmgr main ------------------------------------
+APP3TARGET= $(TARGET3)
+APP3OBJS = $(OBJ)$/testsmgr.obj
+APP3STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)"=="UNX"
+APP3STDLIBS+= -lat
+.ENDIF
+.IF "$(GUI)"=="WNT"
+APP3STDLIBS+= $(LIBCIMT) \
+ iat.lib
+.ENDIF
+
+# --- Application 4 - testcorefl main ------------------------------------
+APP4TARGET= $(TARGET4)
+APP4OBJS = $(OBJ)$/testcorefl.obj
+APP4STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)"=="WNT"
+APP4STDLIBS+= $(LIBCIMT)
+.ENDIF
+
+# --- Application 5 - testiadapter main ------------------------------------
+APP5TARGET= $(TARGET5)
+APP5OBJS = $(OBJ)$/testiadapter.obj
+APP5STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)"=="WNT"
+APP5STDLIBS+= $(LIBCIMT)
+.ENDIF
+
+# --- Application 6 - testiadapter main ------------------------------------
+APP6TARGET= $(TARGET6)
+APP6OBJS = $(OBJ)$/testintrosp.obj
+APP6STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)"=="WNT"
+APP6STDLIBS+= $(LIBCIMT)
+.ENDIF
+
+# --- Application 7 - testiadapter main ------------------------------------
+APP7TARGET= $(TARGET7)
+APP7OBJS = $(OBJ)$/testconv.obj
+APP7STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)"=="WNT"
+APP7STDLIBS+= $(LIBCIMT)
+.ENDIF
+
+# --- Application 8 - testproxyfac main ------------------------------------
+APP8TARGET= $(TARGET8)
+APP8OBJS = $(OBJ)$/testproxyfac.obj
+APP8STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB)
+
+.IF "$(GUI)"=="WNT"
+APP8STDLIBS+= $(LIBCIMT)
+.ENDIF
+
+ALLIDLFILES:= testcorefl.idl language_binding.idl testintrosp.idl
+
+
+# --- Target ------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : unoheader \
+ ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+CPPUMAKERFLAGS =
+.IF "$(COM)" == "MSC"
+CPPUMAKERFLAGS = -L
+.ENDIF
+
+FACTORYTYPES:=com.sun.star.container.XEnumeration;com.sun.star.lang.XComponent;com.sun.star.registry.XSimpleRegistry;com.sun.star.lang.XInitialization;com.sun.star.lang.XMultiServiceFactory;com.sun.star.loader.XImplementationLoader;com.sun.star.registry.XImplementationRegistration;com.sun.star.container.XSet;com.sun.star.lang.XSingleServiceFactory
+TESTCOREFL:=ModuleC;ModuleC.XInterfaceA;ModuleC.XInterfaceB;ModuleA.XInterface1;com.sun.star.reflection.XIdlReflection;com.sun.star.reflection.XIdlField;com.sun.star.reflection.XIdlArray;com.sun.star.reflection.XIdlMethod;com.sun.star.reflection.XIdlClass;com.sun.star.beans.XPropertySet;com.sun.star.lang.XComponent;com.sun.star.container.XHierarchicalNameAccess
+TESTIADAPTER:=com.sun.star.beans.XIntrospection;com.sun.star.beans.MethodConcept;com.sun.star.beans.XExactName;com.sun.star.lang.XTypeProvider;com.sun.star.uno.XAggregation;com.sun.star.script.XInvocationAdapterFactory;com.sun.star.script.XInvocation;com.sun.star.lang.XMultiServiceFactory;com.sun.star.registry.XSimpleRegistry;com.sun.star.lang.XInitialization;test.XLanguageBindingTest
+TESTINTROSP:=ModuleA;ModuleA.XIntroTest;com.sun.star.beans.XPropertySet;com.sun.star.container.XIndexAccess;com.sun.star.container.XNameAccess;com.sun.star.beans.PropertyAttribute;com.sun.star.beans.PropertyConcept
+TESTCONV:=com.sun.star.script.XTypeConverter
+TESTPROXYFAC:=com.sun.star.util.XProxyFactory
+
+$(BIN)$/stoctest.rdb: $(ALLIDLFILES)
+ +unoidl -I$(PRJ) -I$(SOLARIDLDIR) -Burd -OH$(BIN) $?
+ +regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+ +regmerge $@ / $(SOLARBINDIR)$/applicat.rdb
+ touch $@
+
+unoheader: $(BIN)$/stoctest.rdb
+ +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTIADAPTER);$(FACTORYTYPES)" $(BIN)$/stoctest.rdb
+ +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTCOREFL)" $(BIN)$/stoctest.rdb
+ +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTINTROSP)" $(BIN)$/stoctest.rdb
+ +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTCONV)" $(BIN)$/stoctest.rdb
+ +cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TESTPROXYFAC)" $(BIN)$/stoctest.rdb
+
diff --git a/stoc/test/testconv.cxx b/stoc/test/testconv.cxx
new file mode 100644
index 000000000000..5bacf288d1fe
--- /dev/null
+++ b/stoc/test/testconv.cxx
@@ -0,0 +1,736 @@
+/*************************************************************************
+ *
+ * $RCSfile: testconv.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
+#include <cppuhelper/servicefactory.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/reflection/FieldAccessMode.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+
+#include <float.h>
+#include <stdio.h>
+
+
+using namespace rtl;
+using namespace cppu;
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::script;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::registry;
+
+const double MIN_DOUBLE = -DBL_MAX;
+const double MAX_DOUBLE = DBL_MAX;
+const double MIN_FLOAT = -FLT_MAX;
+const double MAX_FLOAT = FLT_MAX;
+
+//==================================================================================================
+static void printValue( const Any & rVal )
+{
+ // print value
+ OString aStr( OUStringToOString( rVal.getValueType().getTypeName(), RTL_TEXTENCODING_ISO_8859_1 ) );
+ printf( "(%s)", aStr.getStr() );
+
+ switch (rVal.getValueTypeClass())
+ {
+ case TypeClass_VOID:
+ printf( "void" );
+ break;
+ case TypeClass_ANY:
+ if (rVal.hasValue())
+ printValue( *(Any *)rVal.getValue() );
+ break;
+ case TypeClass_BOOLEAN:
+ printf( "%s", (*(sal_Bool *)rVal.getValue() ? "true" : "false") );
+ break;
+ case TypeClass_CHAR:
+ {
+ char ar[2];
+ ar[0] = (char)(sal_Unicode)rVal.getValue();
+ ar[1] = 0;
+ printf( ar );
+ break;
+ }
+ case TypeClass_BYTE:
+ printf( "%x", (int)*(sal_Int8 *)rVal.getValue() );
+ break;
+ case TypeClass_SHORT:
+ printf( "%x", *(sal_Int16 *)rVal.getValue() );
+ break;
+ case TypeClass_UNSIGNED_SHORT:
+ printf( "%x", *(sal_uInt16 *)rVal.getValue() );
+ break;
+ case TypeClass_LONG:
+ printf( "%x", *(sal_Int32 *)rVal.getValue() );
+ break;
+ case TypeClass_UNSIGNED_LONG:
+ printf( "%x", *(sal_uInt32 *)rVal.getValue() );
+ break;
+ case TypeClass_HYPER:
+ printf( "%x", (long)*(sal_Int64 *)rVal.getValue() );
+ break;
+ case TypeClass_UNSIGNED_HYPER:
+ printf( "%x", (unsigned long)*(sal_uInt64 *)rVal.getValue() );
+ break;
+ case TypeClass_FLOAT:
+ printf( "%f", *(float *)rVal.getValue() );
+ break;
+ case TypeClass_DOUBLE:
+ printf( "%g", *(double *)rVal.getValue() );
+ break;
+ case TypeClass_STRING:
+ {
+ OString aStr( OUStringToOString( *(OUString *)rVal.getValue(), RTL_TEXTENCODING_ISO_8859_1 ) );
+ printf( aStr.getStr() );
+ break;
+ }
+ case TypeClass_ENUM:
+ {
+ typelib_EnumTypeDescription * pEnumTD = 0;
+ TYPELIB_DANGER_GET( (typelib_TypeDescription **)&pEnumTD, rVal.getValueTypeRef() );
+
+ for ( sal_Int32 nPos = pEnumTD->nEnumValues; nPos--; )
+ {
+ if (pEnumTD->pEnumValues[nPos] == *(int *)rVal.getValue())
+ {
+ printf( OUStringToOString(pEnumTD->ppEnumNames[nPos]->buffer, RTL_TEXTENCODING_ASCII_US).getStr() );
+ TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *)pEnumTD );
+ return;
+ }
+ }
+ TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *)pEnumTD );
+ printf( ">ENUM not found!<" );
+ break;
+ }
+ case TypeClass_SEQUENCE:
+ {
+ uno_Sequence * pSeq = *(uno_Sequence **)rVal.getValue();
+ typelib_TypeDescription * pSeqTD = 0;
+ TYPELIB_DANGER_GET( &pSeqTD, rVal.getValueTypeRef() );
+ typelib_TypeDescription * pElemTD = 0;
+ TYPELIB_DANGER_GET( &pElemTD, ((typelib_IndirectTypeDescription *)pSeqTD)->pType );
+
+ sal_Int32 nLen = pSeq->nElements;
+ if (nLen)
+ {
+ printf( "{ " );
+ for ( sal_Int32 nPos = 0; nPos < nLen; ++nPos )
+ {
+ printValue( Any( ((char *)pSeq->elements) + (nPos * pElemTD->nSize), pElemTD ) );
+ if (nPos < (nLen-1))
+ printf( ", " );
+ }
+ printf( " }" );
+ }
+
+ TYPELIB_DANGER_RELEASE( pElemTD );
+ TYPELIB_DANGER_RELEASE( pSeqTD );
+ break;
+ }
+
+ default:
+ printf( ">not printable<" );
+ break;
+ }
+}
+
+static Reference< XTypeConverter > s_xConverter;
+
+//==================================================================================================
+static sal_Bool convertTo( const Type & rDestType, const Any & rVal, sal_Bool bExpectSuccess )
+{
+ sal_Bool bCanConvert = sal_False;
+ Any aRet;
+
+ OString aExcMsg;
+
+ try
+ {
+ aRet = s_xConverter->convertTo( rVal, rDestType );
+ bCanConvert = sal_True;
+ }
+ catch (Exception & rExc)
+ {
+ aExcMsg = OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US );
+ }
+
+ if (bExpectSuccess && !bCanConvert)
+ {
+ printf( "# conversion of " );
+ printValue( rVal );
+ printf( " to " );
+ printf( OUStringToOString(rDestType.getTypeName(), RTL_TEXTENCODING_ASCII_US).getStr() );
+ printf( " failed, but success was expected! [" );
+ printf( aExcMsg.getStr() );
+ printf( "]\n" );
+ return sal_False;
+ }
+ if (!bExpectSuccess && bCanConvert)
+ {
+ printf( "# conversion of " );
+ printValue( rVal );
+ printf( " to " );
+ printValue( aRet );
+ printf( " was successful, but was not expected to be!\n" );
+ return sal_False;
+ }
+
+#ifdef __MAG_MARKUS_NICHT___EXTRA_AUSGABEN__
+//= re-conversion output =
+ if (bCanConvert)
+ {
+ // re convert to original type
+ sal_Bool bReConvert = sal_False;
+ Any aRet2;
+
+ try
+ {
+ aRet2 = s_xConverter->convertTo( aRet, rVal.getValueType() );
+ bReConvert = sal_True;
+ }
+ catch (Exception & rExc)
+ {
+ aExcMsg = OUStringToOString( rExc.Message, RTL_TEXTENCODING_ISO_8859_1 );
+ }
+
+ if (bReConvert)
+ {
+ if (rVal != aRet2)
+ {
+ printf( "# re-conversion of " );
+ printValue( rVal );
+ printf( " to " );
+ printValue( aRet );
+ printf( " to " );
+ printValue( aRet2 );
+ printf( ": first and last do not match!\n" );
+ }
+ }
+ else
+ {
+ printf( "# re-conversion of " );
+ printValue( aRet );
+ printf( " to " );
+ printf( rVal.getValueType().getTypeName().getStr() );
+ printf( " failed! [" );
+ printf( aExcMsg.getStr() );
+ printf( "]\n" );
+ }
+ }
+#endif
+
+ return sal_True;
+}
+
+
+//==================================================================================================
+typedef struct _ConvBlock
+{
+ Any _value;
+ sal_Bool _toString, _toDouble, _toFloat;
+ sal_Bool _toUINT32, _toINT32, _toUINT16, _toINT16, _toBYTE, _toBOOL, _toChar;
+ sal_Bool _toTypeClass, _toSeqINT16, _toSeqAny;
+
+ _ConvBlock()
+ {
+ }
+ _ConvBlock( const Any & rValue_,
+ sal_Bool toString_, sal_Bool toDouble_, sal_Bool toFloat_,
+ sal_Bool toUINT32_, sal_Bool toINT32_, sal_Bool toUINT16_, sal_Bool toINT16_,
+ sal_Bool toBYTE_, sal_Bool toBOOL_, sal_Bool toChar_,
+ sal_Bool toTypeClass_, sal_Bool toSeqINT16_, sal_Bool toSeqAny_ )
+ : _value( rValue_ )
+ , _toString( toString_ ), _toDouble( toDouble_ ), _toFloat( toFloat_ )
+ , _toUINT32( toUINT32_ ), _toINT32( toINT32_ ), _toUINT16( toUINT16_ ), _toINT16( toINT16_ )
+ , _toBYTE( toBYTE_ ), _toBOOL( toBOOL_ ), _toChar( toChar_ )
+ , _toTypeClass( toTypeClass_ ), _toSeqINT16( toSeqINT16_ ), _toSeqAny( toSeqAny_ )
+ {
+ }
+} ConvBlock;
+
+
+//==================================================================================================
+static sal_Int32 initBlocks( ConvBlock * pTestBlocks )
+{
+ Any aVal;
+
+ sal_uInt32 nElems = 0;
+
+ // ==BYTE==
+ aVal <<= OUString::createFromAscii( "0xff" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "255" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_Int8)0xff;
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "0x80" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "128" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_Int8)( 0x80 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "0x7f" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "127" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_Int8)( 0x7f );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "5" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "+5" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_Int8)( 5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "-5" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int8)( -5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "256" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==UINT16==
+ aVal <<= OUString::createFromAscii( "65535" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "0xffff" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt16)( 0xffff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "32768" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt16)( 0x8000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "32767" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "0x7fff" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt16)( 0x7fff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "256" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "0x100" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt16)( 0x100 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_uInt16)( 5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_uInt16)( -5 ); // is 0xfffb
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==INT16==
+ aVal <<= (sal_Int16)( -1 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int16)( -0x8000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int16)( 0x7fff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int16)( 0x100 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int16)( 5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int16)( -5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==UINT32==
+ aVal <<= OUString::createFromAscii( "+4294967295" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "4294967295" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "0xffffffff" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt32)( 0xffffffff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "-2147483648" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "-0x80000000" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_uInt32)( 0x80000000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "2147483647" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "0x7fffffff" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt32)( 0x7fffffff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "65536" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= OUString::createFromAscii( "0x10000" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt32)( 0x10000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_uInt32)( 0x8000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_uInt32)( 5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "0xfffffffb" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (sal_uInt32)( -5 ); // is 0xfffffffb
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==INT32==
+ aVal <<= (sal_Int32)( 0xffffffff ); // is -1
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int32)( -0x80000000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int32)( 0x7fffffff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int32)( 0x10000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int32)( -0x8001 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int32)( 5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (sal_Int32)( -5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==FLOAT==
+ aVal <<= OUString::createFromAscii( "-3.4e+38" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (float)( MIN_FLOAT );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "+3.4e+38" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (float)( MAX_FLOAT );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "9e-20" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ aVal <<= (float)( 9e-20 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "+.7071067811865" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ aVal <<= (float)( .7071067811865 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "3.14159265359" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ aVal <<= (float)( 3.14159265359 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (float)( 5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==DOUBLE==
+ aVal <<= OUString::createFromAscii( "-1.7976931348623158e+308" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (double)( MIN_DOUBLE );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "1.7976931348623158e+308" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+ aVal <<= (double)( MAX_DOUBLE );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( MIN_FLOAT );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( MAX_FLOAT );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( -((double)0x80000000) );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( -((double)0x80000001) );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( 0x7fffffff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( 0x80000000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( 0xffffffff );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "0x100000000" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
+#ifndef OS2
+ aVal <<= (double)( 0x100000000 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+#endif
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= (double)( 5 );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==CHAR==
+ sal_Unicode c = 'A';
+ aVal.setValue( &c, ::getCharCppuType() );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "A" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==BOOL==
+ aVal <<= OUString::createFromAscii( "0" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "1" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "False" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "true" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+
+ sal_Bool bTmp = sal_True;
+ aVal.setValue( &bTmp, getBooleanCppuType() );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==ZERO STRINGS==
+ aVal <<= OUString();
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "-" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "-0" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==TYPECLASS ENUM==
+ aVal <<= OUString::createFromAscii( "eNuM" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal <<= OUString::createFromAscii( "DOUBLE" );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ int e = 1;
+ aVal.setValue( &e, ::getCppuType( (const TypeClass *)0 ) );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ aVal.setValue( &e, ::getCppuType( (const FieldAccessMode *)0 ) );
+ pTestBlocks[nElems++] = ConvBlock( aVal, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==SEQ of INT==
+ Sequence< sal_Int32 > aINT32Seq( 3 ), aINT32Seq2( 3 );
+ sal_Int32 * pINT32Seq = aINT32Seq.getArray();
+ pINT32Seq[0] = -32768;
+ pINT32Seq[1] = 0;
+ pINT32Seq[2] = 32767;
+ aVal <<= aINT32Seq;
+ pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ pINT32Seq = aINT32Seq2.getArray();
+ pINT32Seq[0] = -32768;
+ pINT32Seq[1] = -32769;
+ pINT32Seq[2] = 32767;
+ aVal <<= aINT32Seq2;
+ pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ // ==SEQ of ANY==
+ Sequence< Any > aAnySeq( 2 ), aAnySeq2( 2 ), aAnySeq3( 2 );
+ Any * pAnySeq = aAnySeq.getArray();
+ pAnySeq[0] = makeAny( aINT32Seq );
+ pAnySeq[1] = makeAny( OUString::createFromAscii("lala") );
+ aVal <<= aAnySeq;
+ pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ pAnySeq = aAnySeq2.getArray();
+ pAnySeq[0] <<= (sal_Int32)4711;
+ pAnySeq[1] <<= OUString::createFromAscii("0815");
+ aVal <<= aAnySeq2;
+ pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ pAnySeq = aAnySeq3.getArray();
+ pAnySeq[0] <<= OUString::createFromAscii("TypeClass_UNION");
+ pAnySeq[1] <<= OUString::createFromAscii("TypeClass_ENUM");
+ aVal <<= aAnySeq3;
+ pTestBlocks[nElems++] = ConvBlock( aVal, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 );
+ // st,do,fl,u3,i3,u1,i1,by,bo,ch,tc,si,sa
+ return nElems;
+}
+
+//==================================================================================================
+static void test_Conversion( const Reference< XMultiServiceFactory > & xMgr )
+{
+ printf( "test_Conversion(): start...\n" );
+
+ Reference< XTypeConverter > xConverter( xMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.script.Converter" ) ), UNO_QUERY );
+
+ ConvBlock * pTestBlocks = new ConvBlock[256];
+ sal_Int32 nPos = initBlocks( pTestBlocks );
+
+ s_xConverter = xConverter;
+ while (nPos--)
+ {
+ const ConvBlock& rBlock = pTestBlocks[nPos];
+ const Any & rVal = rBlock._value;
+
+ convertTo( ::getCppuType( (const OUString *)0 ), rVal, rBlock._toString );
+ convertTo( ::getCppuType( (const float *)0 ), rVal, rBlock._toFloat );
+ convertTo( ::getCppuType( (const double *)0 ), rVal, rBlock._toDouble );
+ convertTo( ::getCppuType( (const sal_uInt32 *)0 ), rVal, rBlock._toUINT32 );
+ convertTo( ::getCppuType( (const sal_Int32 *)0 ), rVal, rBlock._toINT32 );
+ convertTo( ::getCppuType( (const sal_uInt16 *)0 ), rVal, rBlock._toUINT16 );
+ convertTo( ::getCppuType( (const sal_Int16 *)0 ), rVal, rBlock._toINT16 );
+ convertTo( ::getCppuType( (const sal_Int8 *)0 ), rVal, rBlock._toBYTE );
+ convertTo( ::getBooleanCppuType(), rVal, rBlock._toBOOL );
+ convertTo( ::getCharCppuType(), rVal, rBlock._toChar );
+ convertTo( ::getCppuType( (const TypeClass *)0 ), rVal, rBlock._toTypeClass );
+ convertTo( ::getCppuType( (const Sequence< sal_Int16 > *)0 ), rVal, rBlock._toSeqINT16 );
+ convertTo( ::getCppuType( (const Sequence< Any > *)0 ), rVal, rBlock._toSeqAny );
+
+ convertTo( ::getVoidCppuType(), rVal, sal_True ); // anything converts to void
+ }
+ s_xConverter.clear();
+
+ delete [] pTestBlocks;
+
+ Any aRet;
+ aRet = xConverter->convertTo( Any( &xMgr, ::getCppuType( (const Reference< XMultiServiceFactory > *)0 ) ),
+ ::getCppuType( (const Reference< XServiceInfo > *)0 ) );
+ aRet = xConverter->convertTo( aRet, ::getCppuType( (const Reference< XMultiServiceFactory > *)0 ) );
+ aRet = xConverter->convertTo( aRet, ::getCppuType( (const Reference< XServiceInfo > *)0 ) );
+ aRet <<= (sal_Int64)0x7fffffffffffffff;
+ aRet = xConverter->convertTo( aRet, ::getCppuType( (const sal_uInt64 *)0 ) );
+ OSL_ASSERT( *(const sal_uInt64 *)aRet.getValue() == (sal_uInt64)0x7fffffffffffffff );
+ aRet <<= (sal_uInt64)0xffffffffffffffff;
+ aRet = xConverter->convertTo( aRet, ::getCppuType( (const sal_uInt64 *)0 ) );
+ OSL_ASSERT( *(const sal_uInt64 *)aRet.getValue() == (sal_uInt64)0xffffffffffffffff );
+ aRet <<= (sal_Int64)0xffffffffffffffff;
+ aRet = xConverter->convertTo( aRet, ::getCppuType( (const sal_Int8 *)0 ) );
+ OSL_ASSERT( *(const sal_Int8 *)aRet.getValue() == (-1) );
+ printf( "test_Conversion(): end.\n" );
+}
+
+
+#ifdef UNX
+#define REG_PREFIX "lib"
+#define DLL_POSTFIX ".so"
+#else
+#define REG_PREFIX ""
+#define DLL_POSTFIX ".dll"
+#endif
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int __cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( OUString::createFromAscii("stoctest.rdb") ) );
+
+ try
+ {
+ Reference< XImplementationRegistration > xImplReg(
+ xMgr->createInstance( OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration") ), UNO_QUERY );
+ OSL_ENSHURE( xImplReg.is(), "### no impl reg!" );
+
+ OUString aLibName( OUString::createFromAscii( REG_PREFIX ) );
+ aLibName += OUString::createFromAscii("tcv");
+#ifndef OS2
+ aLibName += OUString::createFromAscii( DLL_POSTFIX );
+#endif
+ xImplReg->registerImplementation(
+ OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
+ aLibName, Reference< XSimpleRegistry >() );
+
+ test_Conversion( xMgr );
+ }
+ catch (Exception & rExc)
+ {
+ OSL_ENSHURE( sal_False, "### exception occured!" );
+ OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "### exception occured: " );
+ OSL_TRACE( aMsg.getStr() );
+ OSL_TRACE( "\n" );
+ }
+
+ Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+ return 0;
+}
diff --git a/stoc/test/testcorefl.cxx b/stoc/test/testcorefl.cxx
new file mode 100644
index 000000000000..d5d4287a2270
--- /dev/null
+++ b/stoc/test/testcorefl.cxx
@@ -0,0 +1,439 @@
+/*************************************************************************
+ *
+ * $RCSfile: testcorefl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#ifdef _DEBUG
+#define TEST_ENSHURE(c, m) OSL_ENSHURE(c, m)
+#else
+#define TEST_ENSHURE(c, m) OSL_VERIFY(c)
+#endif
+
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <ModuleA/XInterface1.hpp>
+#include <ModuleC/XInterfaceA.hpp>
+#include <ModuleC/XInterfaceB.hpp>
+#include <ModuleC/ModuleC.hpp>
+
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/reflection/XIdlReflection.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <stdio.h>
+
+
+using namespace rtl;
+using namespace cppu;
+using namespace osl;
+using namespace ModuleA;
+using namespace ModuleB;
+using namespace ModuleC;
+using namespace ModuleA::ModuleB;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::container;
+
+
+//==================================================================================================
+class OInterfaceA : public WeakImplHelper1< XInterfaceA >
+{
+public:
+
+ virtual void SAL_CALL methodA(void)
+ {}
+
+ virtual void SAL_CALL methodB(sal_Int16 aShort)
+ {}
+ virtual Sequence< StructB > SAL_CALL methodC(const StructC& aStructC, StructA& aStructA)
+ { return Sequence< StructB >(); }
+};
+
+//==================================================================================================
+static inline uik_equals( const Uik & rUik1, const Uik & rUik2 )
+{
+ return (rUik1.m_Data1 == rUik2.m_Data1 &&
+ rUik1.m_Data2 == rUik2.m_Data2 &&
+ rUik1.m_Data3 == rUik2.m_Data3 &&
+ rUik1.m_Data4 == rUik2.m_Data4 &&
+ rUik1.m_Data5 == rUik2.m_Data5);
+}
+//==================================================================================================
+static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl )
+{
+ Reference< XIdlClass > xClass;
+ Reference< XHierarchicalNameAccess > xHNameAccess( xRefl, UNO_QUERY );
+ TEST_ENSHURE(xHNameAccess.is(), "### cannot get XHierarchicalNameAccess!" );
+
+ TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.StructA"))->getName() == OUString::createFromAscii("ModuleA.StructA"), "test_RegCoreReflection(): error 2b");
+ TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.ExceptionB"))->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 2c");
+ TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.ModuleB.EnumA")).is(), "test_RegCoreReflection(): error 2e");
+ // const
+
+ TEST_ENSHURE(*(const sal_Bool *)xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstBoolean")).getValue() == aConstBoolean, "test_RegCoreReflection(): error 4c");
+ TEST_ENSHURE(*(const sal_Int8 *)xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstByte")).getValue() == aConstByte, "test_RegCoreReflection(): error 4e");
+ TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstShort")) == aConstShort, "test_RegCoreReflection(): error 4g");
+ TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstUShort")) == aConstUShort, "test_RegCoreReflection(): error 4i");
+ TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstLong")) == aConstLong, "test_RegCoreReflection(): error 4k");
+ TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstULong")) == aConstULong, "test_RegCoreReflection(): error 4m");
+ TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstFloat")) == aConstFloat, "test_RegCoreReflection(): error 4o");
+ TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstDouble")) == aConstDouble, "test_RegCoreReflection(): error 4q");
+ TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString::createFromAscii("ModuleC.aConstString")) == aConstString, "test_RegCoreReflection(): error 4s");
+
+ // Enums
+
+ xClass = xRefl->forName(OUString::createFromAscii("ModuleA.ModuleB.EnumA"));
+
+ TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 5");
+
+ Sequence<Reference< XIdlField > > fields = xClass->getFields();
+
+ TEST_ENSHURE(
+ (fields.getLength() == 3) &&
+ (fields.getArray()[0]->getName() == OUString( RTL_CONSTASCII_USTRINGPARAM("VAL_1") )) &&
+ (*(EnumA*)fields.getArray()[0]->get(Any()).getValue() == EnumA_VAL_1) &&
+ (fields.getArray()[1]->getName() == OUString( RTL_CONSTASCII_USTRINGPARAM("VAL_2") )) &&
+ (*(EnumA*)fields.getArray()[1]->get(Any()).getValue() == EnumA_VAL_2) &&
+ (fields.getArray()[2]->getName() == OUString( RTL_CONSTASCII_USTRINGPARAM("VAL_3") )) &&
+ (*(EnumA*)fields.getArray()[2]->get(Any()).getValue() == EnumA_VAL_3),
+ "test_RegCoreReflection(): error 6");
+
+
+ // Interface
+
+ Reference< XIdlClass > xA = xRefl->forName( OUString::createFromAscii("ModuleC.XInterfaceB") );
+
+ xClass = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceB"));
+
+ TEST_ENSHURE(xClass == xA, "test_RegCoreReflection(): error 7");
+ TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 7a");
+
+ typelib_TypeDescription * pTD = 0;
+ OUString aModuleName( RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceB") );
+ typelib_typedescription_getByName( &pTD, aModuleName.pData );
+ TEST_ENSHURE( pTD, "### cannot get typedescription for ModuleC.XInterfaceB!" );
+
+ TEST_ENSHURE( uik_equals( *(Uik *)&((typelib_InterfaceTypeDescription *)pTD)->aUik,
+ xClass->getUik() ),
+ "test_RegCoreReflection(): error 8" );
+ typelib_typedescription_release( pTD );
+
+ TEST_ENSHURE(xClass->getSuperclasses().getLength() == 1, "test_RegCoreReflection(): error 9");
+ TEST_ENSHURE(xClass->getSuperclasses().getArray()[0]->getName() == OUString::createFromAscii("ModuleC.XInterfaceA"), "test_RegCoreReflection(): error 10");
+ TEST_ENSHURE(xClass->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11");
+ TEST_ENSHURE(xA->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11a");
+ TEST_ENSHURE(xClass->getMethods().getArray()[3]->getName() == OUString::createFromAscii("methodA"), "test_RegCoreReflection(): 12");
+ TEST_ENSHURE(xClass->getMethods().getArray()[3]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 13");
+ TEST_ENSHURE(xClass->getMethods().getArray()[3]->getParameterTypes().getLength() == 0, "test_RegCoreReflection(): error 14");
+ TEST_ENSHURE(xClass->getMethods().getArray()[3]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 15");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getName() == OUString( RTL_CONSTASCII_USTRINGPARAM("methodB") ), "test_RegCoreReflection(): error 16");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getMode() == MethodMode_ONEWAY, "test_RegCoreReflection(): error 16a");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 16");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterTypes().getLength() == 1, "test_RegCoreReflection(): error 17");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_SHORT, "test_RegCoreReflection(): error 18");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aName == OUString( RTL_CONSTASCII_USTRINGPARAM("aShort") ), "test_RegCoreReflection(): error 18a");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aType == xRefl->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("short") ) ), "test_RegCoreReflection(): error 18b");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aMode == ParamMode_IN, "test_RegCoreReflection(): error 18c");
+ TEST_ENSHURE(xClass->getMethods().getArray()[4]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 19");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getName() == OUString::createFromAscii("methodC"), "test_RegCoreReflection(): error 20");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getMode() == MethodMode_TWOWAY, "test_RegCoreReflection(): error 20a");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 21");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 22");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getName() == OUString::createFromAscii("ModuleA.StructB"), "test_RegCoreReflection(): error 23");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getLength() == 2, "test_RegCoreReflection(): error 24");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 25");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getName() == OUString::createFromAscii("ModuleA.StructC"), "test_RegCoreReflection(): error 26");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 27");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getName() == OUString::createFromAscii("ModuleA.StructA"), "test_RegCoreReflection(): error 28");
+ TEST_ENSHURE(xClass->getMethods().getArray()[5]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 29");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getName() == OUString::createFromAscii("methodD"), "test_RegCoreReflection(): error 30");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getReturnType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 31");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getReturnType()->getName() == OUString::createFromAscii("ModuleC.XInterfaceA"), "test_RegCoreReflection(): error 32");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getLength() == 1, "test_RegCoreReflection(): error 33");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_ENUM, "test_RegCoreReflection(): error 34");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getName() == OUString::createFromAscii("ModuleA.ModuleB.EnumA"), "test_RegCoreReflection(): error 35");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getLength() == 3, "test_RegCoreReflection(): error 36");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 37");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getName() == OUString::createFromAscii("ModuleA.ExceptionA"), "test_RegCoreReflection(): error 38");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 38");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getName() == OUString::createFromAscii("ModuleA.ExceptionB"), "test_RegCoreReflection(): error 39");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 40");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getName() == OUString::createFromAscii("ModuleA.ExceptionC"), "test_RegCoreReflection(): error 41");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getLength() == 3, "test_RegCoreReflection(): error 42");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getTypeClass() == TypeClass_BOOLEAN, "test_RegCoreReflection(): error 43");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getName() == OUString::createFromAscii("boolean"), "test_RegCoreReflection(): error 43a");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 44");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getName() == OUString::createFromAscii("ModuleA.StructC"), "test_RegCoreReflection(): error 45");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 46");
+ TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getName() == OUString::createFromAscii("ModuleA.XInterface1"), "test_RegCoreReflection(): error 47");
+
+ // SequenceReflections
+
+ TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[]ModuleA.StructA") )->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 48");
+ TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[]ModuleA.StructA") )->getComponentType().is(), "test_RegCoreReflection(): error 49");
+ TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[][]ModuleA.StructA") )->getComponentType()->getComponentType()->getName() == OUString::createFromAscii("ModuleA.StructA"), "test_RegCoreReflection(): error 50");
+ TEST_ENSHURE(xRefl->forName( OUString::createFromAscii("[]com.sun.star.uno.XInterface") ) == xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString::createFromAscii("aInterfaceSeq"))->getType(), "test_RegCoreReflection(): error 51");
+
+ StructC aStructC;
+ aStructC.aLong = aConstLong;
+ aStructC.aShort = aConstShort;
+ aStructC.aFloat = aConstFloat;
+ aStructC.aDouble = aConstDouble;
+ aStructC.aString = aConstString;
+ aStructC.aInterfaceSeq = Sequence<Reference<XInterface > >();
+
+ Any aAny;
+
+ xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aInterfaceSeq"))->getType()->createObject(aAny);
+
+ TEST_ENSHURE(aAny.getValueType() == ::getCppuType( (const Sequence<Reference< XInterface > > *)0 ), "test_RegCoreReflection(): error 51a");
+
+ Any aStructAny(&aStructC, ::getCppuType( (const StructC *) 0 ));
+
+ sal_Int32 nLong = aConstLong * 2;
+ aAny.setValue( &nLong, ::getCppuType( (const sal_Int32 *)0 ) );
+
+ TEST_ENSHURE(*(sal_Int32*)xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA") ))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get(
+ Any(&aStructC, ::getCppuType( (const StructC *)0 ))).getValue() == aConstLong, "test_RegCoreReflection(): error 52");
+ TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleA.StructA"))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->getAccessMode() == FieldAccessMode_READWRITE, "test_RegCoreReflection(): error 52a");
+ xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->set(aStructAny, aAny);
+ TEST_ENSHURE(*(sal_Int32*)xRefl->forName(OUString::createFromAscii("ModuleA.StructB"))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get(aStructAny).getValue() == *(sal_Int32*)aAny.getValue(), "test_RegCoreReflection(): error 53");
+
+ xRefl->forName( OUString::createFromAscii("[]ModuleA.StructA") )->createObject(aAny);
+
+ TEST_ENSHURE(aAny.getValueTypeName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("[]ModuleA.StructA")), "test_RegCoreReflection(): error 54");
+ xRefl->forName(OUString::createFromAscii("[][]ModuleA.StructA"))->createObject(aAny);
+
+ TEST_ENSHURE(aAny.getValueTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("[][]ModuleA.StructA") ), "test_RegCoreReflection(): error 56");
+
+// xClass = xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.XIntroTest") ));
+
+// TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 58");
+// TEST_ENSHURE(xClass->getMethod(OUString::createFromAscii("getStrings"))->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 59");
+// TEST_ENSHURE(xClass->getMethod(OUString::createFromAscii("getStrings"))->getReturnType()->getComponentType()->getName() == OUString::createFromAscii("string"), "test_RegCoreReflection(): error 60");
+
+// xClass->getMethod(OUString::createFromAscii("getStrings"))->getReturnType()->createObject(aAny);
+// TEST_ENSHURE(aAny.getValueTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("[]string") ), "test_RegCoreReflection(): error 61");
+
+ TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("[][][]unsigned long"))->getComponentType()->getComponentType()->getComponentType()->getTypeClass() == TypeClass_UNSIGNED_LONG, "test_RegCoreReflection(): error 62");
+
+ try
+ {
+ Any bla = xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->get(Any());
+ TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 63");
+ return sal_False;
+ }
+ catch (IllegalArgumentException &)
+ {
+ }
+
+ try
+ {
+ Any blup;
+ blup <<= aStructC;
+ Any gulp;
+ xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->set(blup, gulp);
+ TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 64");
+ return sal_False;
+ }
+ catch (IllegalArgumentException &)
+ {
+ }
+
+ try
+ {
+ Any gulp;
+ gulp <<= 3.14f;
+ Any blup;
+ blup <<= aStructC;
+ xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->set(blup, gulp);
+ TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 65");
+ return sal_False;
+ }
+ catch (IllegalArgumentException &)
+ {
+ }
+
+ Any gulp;
+ gulp <<= OUString(OUString::createFromAscii("Test"));
+ Any blup;
+ blup <<= aStructC;
+ xRefl->forName(OUString::createFromAscii("ModuleA.StructC"))->getField(OUString::createFromAscii("aString"))->set(blup, gulp);
+
+ Reference< XInterfaceA > xAI = new OInterfaceA();
+
+ try
+ {
+ Sequence< Any > params;
+
+ Any a;
+ a <<= xAI;
+ Any bla = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params);
+ TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 66");
+ return sal_False;
+ }
+ catch (IllegalArgumentException &)
+ {
+ }
+
+ StructA aStructA;
+
+ {
+ Sequence< Any > params(2);
+
+ params.getArray()[0].setValue(&aStructC, ::getCppuType( (const StructC *)0 ));
+ params.getArray()[1].setValue(&aStructC, ::getCppuType( (const StructC *)0 ));
+
+ Any a;
+ a <<= xAI;
+ Any bla = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params);
+ }
+ try
+ {
+ Sequence< Any > params(2);
+
+ params.getArray()[0].setValue(&aStructA, ::getCppuType( (const StructA *)0 ));
+ params.getArray()[1].setValue(&aStructA, ::getCppuType( (const StructA *)0 ));
+
+ Any a;
+ a <<= xAI;
+ Any bla = xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params);
+ TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 67");
+ return sal_False;
+ }
+ catch (IllegalArgumentException &)
+ {
+ }
+
+ Sequence< Any > params(2);
+
+ params.getArray()[0].setValue(&aStructC, ::getCppuType( (const StructC *)0 ));
+ params.getArray()[1].setValue(&aStructA, ::getCppuType( (const StructA *)0 ));
+
+ Any a;
+ a <<= xAI;
+ TEST_ENSHURE(xRefl->forName(OUString::createFromAscii("ModuleC.XInterfaceA"))->getMethod(OUString::createFromAscii("methodC"))->invoke(a, params).getValueType()
+ == ::getCppuType( (const Sequence<StructB> *)0 ), "test_RegCoreReflection(): error 68");
+
+ return sal_True;
+}
+
+#ifdef UNX
+#define REG_PREFIX "lib"
+#define DLL_POSTFIX ".so"
+#else
+#define REG_PREFIX ""
+#define DLL_POSTFIX ".dll"
+#endif
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int __cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb") ) ) );
+
+ sal_Bool bSucc = sal_False;
+ try
+ {
+ Reference< XImplementationRegistration > xImplReg(
+ xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration") ) ), UNO_QUERY );
+ OSL_ENSHURE( xImplReg.is(), "### no impl reg!" );
+
+ OUString aLibName( OUString::createFromAscii(REG_PREFIX) );
+ aLibName += OUString::createFromAscii("corefl");
+#ifndef OS2
+ aLibName += OUString::createFromAscii(DLL_POSTFIX);
+#endif
+ xImplReg->registerImplementation(
+ OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), aLibName, Reference< XSimpleRegistry >() );
+
+ Reference< XIdlReflection > xRefl( xMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY );
+ OSL_ENSHURE( xRefl.is(), "### no corereflection!" );
+
+ bSucc = test_corefl( xRefl );
+ }
+ catch (Exception & rExc)
+ {
+ OSL_ENSHURE( sal_False, "### exception occured!" );
+ OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "### exception occured: " );
+ OSL_TRACE( aMsg.getStr() );
+ OSL_TRACE( "\n" );
+ }
+
+ Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+
+ printf( "testcorefl %s !\n", (bSucc ? "succeeded" : "failed") );
+ return (bSucc ? 0 : -1);
+}
diff --git a/stoc/test/testcorefl.idl b/stoc/test/testcorefl.idl
new file mode 100644
index 000000000000..317a39b1743d
--- /dev/null
+++ b/stoc/test/testcorefl.idl
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * $RCSfile: testcorefl.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <com/sun/star/uno/XInterface.idl>
+
+module ModuleA
+{
+ exception ExceptionA
+ {
+ boolean aBoolean;
+ };
+
+ struct StructA
+ {
+ long aLong;
+ short aShort;
+ };
+
+ struct StructB : StructA
+ {
+ double aDouble;
+ float aFloat;
+ };
+
+ struct StructC : StructB
+ {
+ string aString;
+ sequence<com::sun::star::uno::XInterface> aInterfaceSeq;
+ };
+
+ exception ExceptionB : ExceptionA
+ {
+ StructC aStructC;
+ };
+
+ [ uik(e227a3A1-33d6-12d1-aabe02a0-249d5590), ident("InterfaceB", 1.0) ]
+ interface XInterface1 : com::sun::star::uno::XInterface
+ {
+ };
+
+ exception ExceptionC : ExceptionB
+ {
+ XInterface1 aInterface1;
+ };
+
+ module ModuleB
+ {
+ enum EnumA { VAL_1, VAL_2, VAL_3 = 17};
+ };
+
+};
+
+module ModuleC
+{
+ const boolean aConstBoolean = True;
+ const byte aConstByte = 0;
+ const short aConstShort = -1;
+ const unsigned short aConstUShort = 1;
+ const long aConstLong = -2;
+ const unsigned long aConstULong = 2;
+// const hyper aConstHyper = -3;
+// const unsigned hyper aConstUHyper = 3;
+ const float aConstFloat = 3.14;
+ const double aConstDouble = 3.14e-10;
+ const string aConstString = "test";
+
+
+ [ uik(e227a3A0-33d6-11d1-aabe02a0-249d5590), ident("InterfaceA", 1.0) ]
+ interface XInterfaceA : com::sun::star::uno::XInterface
+ {
+ void methodA();
+ [oneway] void methodB([in] short aShort);
+ sequence<ModuleA::StructB> methodC([in] ModuleA::StructC aStructC, [inout] ModuleA::StructA aStructA);
+ };
+
+ [ uik(e227a3A1-33d6-11d1-aabe02a0-12345678), ident("InterfaceB", 1.0) ]
+ interface XInterfaceB : XInterfaceA
+ {
+ [attribute] string aString;
+
+ XInterfaceA methodD([in] ModuleA::ModuleB::EnumA aEnumA) raises (ModuleA::ExceptionA, ModuleA::ExceptionB, ModuleA::ExceptionC);
+ };
+};
diff --git a/stoc/test/testiadapter.cxx b/stoc/test/testiadapter.cxx
new file mode 100644
index 000000000000..40101cacac3b
--- /dev/null
+++ b/stoc/test/testiadapter.cxx
@@ -0,0 +1,1029 @@
+/*************************************************************************
+ *
+ * $RCSfile: testiadapter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#include <osl/diagnose.h>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <test/XLanguageBindingTest.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+
+using namespace test;
+using namespace rtl;
+using namespace cppu;
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::script;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+
+
+//==================================================================================================
+sal_Bool equals( const test::TestElement & rData1, const test::TestElement & rData2 )
+{
+ OSL_ENSHURE( rData1.Bool == rData2.Bool, "### bool does not match!" );
+ OSL_ENSHURE( rData1.Char == rData2.Char, "### char does not match!" );
+ OSL_ENSHURE( rData1.Byte == rData2.Byte, "### byte does not match!" );
+ OSL_ENSHURE( rData1.Short == rData2.Short, "### short does not match!" );
+ OSL_ENSHURE( rData1.UShort == rData2.UShort, "### unsigned short does not match!" );
+ OSL_ENSHURE( rData1.Long == rData2.Long, "### long does not match!" );
+ OSL_ENSHURE( rData1.ULong == rData2.ULong, "### unsigned long does not match!" );
+ OSL_ENSHURE( rData1.Hyper == rData2.Hyper, "### hyper does not match!" );
+ OSL_ENSHURE( rData1.UHyper == rData2.UHyper, "### unsigned hyper does not match!" );
+ OSL_ENSHURE( rData1.Float == rData2.Float, "### float does not match!" );
+ OSL_ENSHURE( rData1.Double == rData2.Double, "### double does not match!" );
+ OSL_ENSHURE( rData1.Enum == rData2.Enum, "### enum does not match!" );
+ OSL_ENSHURE( rData1.String == rData2.String, "### string does not match!" );
+ OSL_ENSHURE( rData1.Interface == rData2.Interface, "### interface does not match!" );
+ OSL_ENSHURE( rData1.Any == rData2.Any, "### any does not match!" );
+
+ return (rData1.Bool == rData2.Bool &&
+ rData1.Char == rData2.Char &&
+ rData1.Byte == rData2.Byte &&
+ rData1.Short == rData2.Short &&
+ rData1.UShort == rData2.UShort &&
+ rData1.Long == rData2.Long &&
+ rData1.ULong == rData2.ULong &&
+ rData1.Hyper == rData2.Hyper &&
+ rData1.UHyper == rData2.UHyper &&
+ rData1.Float == rData2.Float &&
+ rData1.Double == rData2.Double &&
+ rData1.Enum == rData2.Enum &&
+ rData1.String == rData2.String &&
+ rData1.Interface == rData2.Interface &&
+ rData1.Any == rData2.Any);
+}
+//==================================================================================================
+sal_Bool equals( const test::TestData & rData1, const test::TestData & rData2 )
+{
+ sal_Int32 nLen;
+
+ if ((rData1.Sequence == rData2.Sequence) &&
+ equals( (const test::TestElement &)rData1, (const test::TestElement &)rData2 ) &&
+ (nLen = rData1.Sequence.getLength()) == rData2.Sequence.getLength())
+ {
+ // once again by hand sequence ==
+ const test::TestElement * pElements1 = rData1.Sequence.getConstArray();
+ const test::TestElement * pElements2 = rData2.Sequence.getConstArray();
+ for ( ; nLen--; )
+ {
+ if (! equals( pElements1[nLen], pElements2[nLen] ))
+ {
+ OSL_ENSHURE( sal_False, "### sequence element did not match!" );
+ return sal_False;
+ }
+ }
+ return sal_True;
+ }
+ return sal_False;
+}
+//==================================================================================================
+void assign( test::TestElement & rData,
+ sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
+ sal_Int16 nShort, sal_uInt16 nUShort,
+ sal_Int32 nLong, sal_uInt32 nULong,
+ sal_Int64 nHyper, sal_uInt64 nUHyper,
+ float fFloat, double fDouble,
+ test::TestEnum eEnum, const ::rtl::OUString& rStr,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ const ::com::sun::star::uno::Any& rAny )
+{
+ rData.Bool = bBool;
+ rData.Char = cChar;
+ rData.Byte = nByte;
+ rData.Short = nShort;
+ rData.UShort = nUShort;
+ rData.Long = nLong;
+ rData.ULong = nULong;
+ rData.Hyper = nHyper;
+ rData.UHyper = nUHyper;
+ rData.Float = fFloat;
+ rData.Double = fDouble;
+ rData.Enum = eEnum;
+ rData.String = rStr;
+ rData.Interface = xTest;
+ rData.Any = rAny;
+}
+//==================================================================================================
+void assign( test::TestData & rData,
+ sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
+ sal_Int16 nShort, sal_uInt16 nUShort,
+ sal_Int32 nLong, sal_uInt32 nULong,
+ sal_Int64 nHyper, sal_uInt64 nUHyper,
+ float fFloat, double fDouble,
+ test::TestEnum eEnum, const ::rtl::OUString& rStr,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ const ::com::sun::star::uno::Any& rAny,
+ const com::sun::star::uno::Sequence< test::TestElement >& rSequence )
+{
+ assign( (test::TestElement &)rData,
+ bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
+ eEnum, rStr, xTest, rAny );
+ rData.Sequence = rSequence;
+}
+
+//==================================================================================================
+class Test_Impl : public WeakImplHelper1< XLanguageBindingTest >
+{
+ test::TestData _aData, _aStructData;
+
+public:
+ virtual ~Test_Impl()
+ { OSL_TRACE( "> scalar Test_Impl dtor <\n" ); }
+
+ // XLBTestBase
+ virtual void SAL_CALL setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
+ sal_Int16 nShort, sal_uInt16 nUShort,
+ sal_Int32 nLong, sal_uInt32 nULong,
+ sal_Int64 nHyper, sal_uInt64 nUHyper,
+ float fFloat, double fDouble,
+ test::TestEnum eEnum, const ::rtl::OUString& rStr,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ const ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Sequence<test::TestElement >& rSequence,
+ const test::TestData& rStruct )
+ throw(com::sun::star::uno::RuntimeException);
+
+ virtual test::TestData SAL_CALL setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
+ sal_Int16& nShort, sal_uInt16& nUShort,
+ sal_Int32& nLong, sal_uInt32& nULong,
+ sal_Int64& nHyper, sal_uInt64& nUHyper,
+ float& fFloat, double& fDouble,
+ test::TestEnum& eEnum, rtl::OUString& rStr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ ::com::sun::star::uno::Any& rAny,
+ ::com::sun::star::uno::Sequence<test::TestElement >& rSequence,
+ test::TestData& rStruct )
+ throw(com::sun::star::uno::RuntimeException);
+
+ virtual test::TestData SAL_CALL getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
+ sal_Int16& nShort, sal_uInt16& nUShort,
+ sal_Int32& nLong, sal_uInt32& nULong,
+ sal_Int64& nHyper, sal_uInt64& nUHyper,
+ float& fFloat, double& fDouble,
+ test::TestEnum& eEnum, rtl::OUString& rStr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ ::com::sun::star::uno::Any& rAny,
+ ::com::sun::star::uno::Sequence< test::TestElement >& rSequence,
+ test::TestData& rStruct )
+ throw(com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL getBool() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Bool; }
+ virtual sal_Int8 SAL_CALL getByte() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Byte; }
+ virtual sal_Unicode SAL_CALL getChar() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Char; }
+ virtual sal_Int16 SAL_CALL getShort() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Short; }
+ virtual sal_uInt16 SAL_CALL getUShort() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.UShort; }
+ virtual sal_Int32 SAL_CALL getLong() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Long; }
+ virtual sal_uInt32 SAL_CALL getULong() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.ULong; }
+ virtual sal_Int64 SAL_CALL getHyper() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Hyper; }
+ virtual sal_uInt64 SAL_CALL getUHyper() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.UHyper; }
+ virtual float SAL_CALL getFloat() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Float; }
+ virtual double SAL_CALL getDouble() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Double; }
+ virtual test::TestEnum SAL_CALL getEnum() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Enum; }
+ virtual rtl::OUString SAL_CALL getString() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.String; }
+ virtual com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getInterface( ) throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Interface; }
+ virtual com::sun::star::uno::Any SAL_CALL getAny() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Any; }
+ virtual com::sun::star::uno::Sequence< test::TestElement > SAL_CALL getSequence() throw(com::sun::star::uno::RuntimeException)
+ { return _aData.Sequence; }
+ virtual test::TestData SAL_CALL getStruct() throw(com::sun::star::uno::RuntimeException)
+ { return _aStructData; }
+
+ virtual void SAL_CALL setBool( sal_Bool _bool ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Bool = _bool; }
+ virtual void SAL_CALL setByte( sal_Int8 _byte ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Byte = _byte; }
+ virtual void SAL_CALL setChar( sal_Unicode _char ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Char = _char; }
+ virtual void SAL_CALL setShort( sal_Int16 _short ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Short = _short; }
+ virtual void SAL_CALL setUShort( sal_uInt16 _ushort ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.UShort = _ushort; }
+ virtual void SAL_CALL setLong( sal_Int32 _long ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Long = _long; }
+ virtual void SAL_CALL setULong( sal_uInt32 _ulong ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.ULong = _ulong; }
+ virtual void SAL_CALL setHyper( sal_Int64 _hyper ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Hyper = _hyper; }
+ virtual void SAL_CALL setUHyper( sal_uInt64 _uhyper ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.UHyper = _uhyper; }
+ virtual void SAL_CALL setFloat( float _float ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Float = _float; }
+ virtual void SAL_CALL setDouble( double _double ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Double = _double; }
+ virtual void SAL_CALL setEnum( test::TestEnum _enum ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Enum = _enum; }
+ virtual void SAL_CALL setString( const ::rtl::OUString& _string ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.String = _string; }
+ virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _interface ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Interface = _interface; }
+ virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& _any ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Any = _any; }
+ virtual void SAL_CALL setSequence( const ::com::sun::star::uno::Sequence<test::TestElement >& _sequence ) throw(::com::sun::star::uno::RuntimeException)
+ { _aData.Sequence = _sequence; }
+ virtual void SAL_CALL setStruct( const test::TestData& _struct ) throw(::com::sun::star::uno::RuntimeException)
+ { _aStructData = _struct; }
+
+ // XLanguageBindingTest
+ virtual test::TestData SAL_CALL raiseException( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte, sal_Int16& nShort, sal_uInt16& nUShort, sal_Int32& nLong, sal_uInt32& nULong, sal_Int64& nHyper, sal_uInt64& nUHyper, float& fFloat, double& fDouble, test::TestEnum& eEnum, ::rtl::OUString& aString, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInterface, ::com::sun::star::uno::Any& aAny, ::com::sun::star::uno::Sequence<test::TestElement >& aSequence,test::TestData& aStruct )
+ throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getRuntimeException() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRuntimeException( sal_Int32 _runtimeexception ) throw(::com::sun::star::uno::RuntimeException);
+};
+//==================================================================================================
+class XLB_Invocation : public WeakImplHelper1< XInvocation >
+{
+ Reference< XLanguageBindingTest > _xLBT;
+
+public:
+ XLB_Invocation( const Reference< XMultiServiceFactory > & xMgr,
+ const Reference< XLanguageBindingTest > & xLBT )
+ : _xLBT( xLBT )
+ {}
+
+ // XInvocation
+ virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection() throw(::com::sun::star::uno::RuntimeException)
+ { return Reference< XIntrospectionAccess >(); }
+ virtual Any SAL_CALL invoke( const OUString & rFunctionName,
+ const Sequence< Any > & rParams,
+ Sequence< sal_Int16 > & rOutParamIndex,
+ Sequence< Any > & rOutParam ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValue( const OUString & rPropertyName, const Any & rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual Any SAL_CALL getValue( const OUString & rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasMethod( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasProperty( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException);
+};
+//__________________________________________________________________________________________________
+Any XLB_Invocation::invoke( const OUString & rFunctionName,
+ const Sequence< Any > & rParams,
+ Sequence< sal_Int16 > & rOutParamIndex,
+ Sequence< Any > & rOutParam )
+ throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ Any aRet;
+
+ OSL_ASSERT( rOutParam.getLength() == 0 );
+ OSL_ASSERT( rOutParamIndex.getLength() == 0 );
+
+ try
+ {
+ sal_Bool aBool;
+ sal_Unicode aChar;
+ sal_Int8 nByte;
+ sal_Int16 nShort;
+ sal_uInt16 nUShort;
+ sal_Int32 nLong;
+ sal_uInt32 nULong;
+ sal_Int64 nHyper;
+ sal_uInt64 nUHyper;
+ float fFloat;
+ double fDouble;
+ TestEnum eEnum;
+ OUString aString;
+ Reference< XInterface > xInterface;
+ Any aAny;
+ Sequence< TestElement > aSeq;
+ TestData aData;
+
+ if (rFunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("setValues") ))
+ {
+ OSL_ASSERT( rParams.getLength() == 17 );
+ aBool = *(sal_Bool *)rParams[0].getValue();
+ aChar = *(sal_Unicode *)rParams[1].getValue();
+ rParams[2] >>= nByte;
+ rParams[3] >>= nShort;
+ rParams[4] >>= nUShort;
+ rParams[5] >>= nLong;
+ rParams[6] >>= nULong;
+ rParams[7] >>= nHyper;
+ rParams[8] >>= nUHyper;
+ rParams[9] >>= fFloat;
+ rParams[10] >>= fDouble;
+ rParams[11] >>= eEnum;
+ rParams[12] >>= aString;
+ rParams[13] >>= xInterface;
+ rParams[14] >>= aAny;
+ rParams[15] >>= aSeq;
+ rParams[16] >>= aData;
+
+ _xLBT->setValues( aBool, aChar, nByte, nShort, nUShort, nLong, nULong,
+ nHyper, nUHyper, fFloat, fDouble, eEnum, aString, xInterface,
+ aAny, aSeq, aData );
+
+ rOutParamIndex.realloc( 0 );
+ rOutParam.realloc( 0 );
+ }
+ else if (rFunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("setValues2") ))
+ {
+ aBool = *(sal_Bool *)rParams[0].getValue();
+ aChar = *(sal_Unicode *)rParams[1].getValue();
+ rParams[2] >>= nByte;
+ rParams[3] >>= nShort;
+ rParams[4] >>= nUShort;
+ rParams[5] >>= nLong;
+ rParams[6] >>= nULong;
+ rParams[7] >>= nHyper;
+ rParams[8] >>= nUHyper;
+ rParams[9] >>= fFloat;
+ rParams[10] >>= fDouble;
+ rParams[11] >>= eEnum;
+ rParams[12] >>= aString;
+ rParams[13] >>= xInterface;
+ rParams[14] >>= aAny;
+ rParams[15] >>= aSeq;
+ rParams[16] >>= aData;
+
+ aRet <<= _xLBT->setValues2( aBool, aChar, nByte, nShort, nUShort, nLong, nULong,
+ nHyper, nUHyper, fFloat, fDouble, eEnum, aString, xInterface,
+ aAny, aSeq, aData );
+
+ rOutParamIndex.realloc( 17 );
+ rOutParamIndex[0] = 0;
+ rOutParamIndex[1] = 1;
+ rOutParamIndex[2] = 2;
+ rOutParamIndex[3] = 3;
+ rOutParamIndex[4] = 4;
+ rOutParamIndex[5] = 5;
+ rOutParamIndex[6] = 6;
+ rOutParamIndex[7] = 7;
+ rOutParamIndex[8] = 8;
+ rOutParamIndex[9] = 9;
+ rOutParamIndex[10] = 10;
+ rOutParamIndex[11] = 11;
+ rOutParamIndex[12] = 12;
+ rOutParamIndex[13] = 13;
+ rOutParamIndex[14] = 14;
+ rOutParamIndex[15] = 15;
+ rOutParamIndex[16] = 16;
+
+ rOutParam.realloc( 17 );
+ rOutParam[0].setValue( &aBool, ::getCppuBooleanType() );
+ rOutParam[1].setValue( &aChar, ::getCppuCharType() );
+ rOutParam[2] <<= nByte;
+ rOutParam[3] <<= nShort;
+ rOutParam[4] <<= nUShort;
+ rOutParam[5] <<= nLong;
+ rOutParam[6] <<= nULong;
+ rOutParam[7] <<= nHyper;
+ rOutParam[8] <<= nUHyper;
+ rOutParam[9] <<= fFloat;
+ rOutParam[10] <<= fDouble;
+ rOutParam[11] <<= eEnum;
+ rOutParam[12] <<= aString;
+ rOutParam[13] <<= xInterface;
+ rOutParam[14] <<= aAny;
+ rOutParam[15] <<= aSeq;
+ rOutParam[16] <<= aData;
+ }
+ else if (rFunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("getValues") ))
+ {
+ aRet <<= _xLBT->getValues( aBool, aChar, nByte, nShort, nUShort, nLong, nULong,
+ nHyper, nUHyper, fFloat, fDouble, eEnum, aString, xInterface,
+ aAny, aSeq, aData );
+
+ rOutParamIndex.realloc( 17 );
+ rOutParamIndex[0] = 0;
+ rOutParamIndex[1] = 1;
+ rOutParamIndex[2] = 2;
+ rOutParamIndex[3] = 3;
+ rOutParamIndex[4] = 4;
+ rOutParamIndex[5] = 5;
+ rOutParamIndex[6] = 6;
+ rOutParamIndex[7] = 7;
+ rOutParamIndex[8] = 8;
+ rOutParamIndex[9] = 9;
+ rOutParamIndex[10] = 10;
+ rOutParamIndex[11] = 11;
+ rOutParamIndex[12] = 12;
+ rOutParamIndex[13] = 13;
+ rOutParamIndex[14] = 14;
+ rOutParamIndex[15] = 15;
+ rOutParamIndex[16] = 16;
+
+ rOutParam.realloc( 17 );
+ rOutParam[0].setValue( &aBool, ::getCppuBooleanType() );
+ rOutParam[1].setValue( &aChar, ::getCppuCharType() );
+ rOutParam[2] <<= nByte;
+ rOutParam[3] <<= nShort;
+ rOutParam[4] <<= nUShort;
+ rOutParam[5] <<= nLong;
+ rOutParam[6] <<= nULong;
+ rOutParam[7] <<= nHyper;
+ rOutParam[8] <<= nUHyper;
+ rOutParam[9] <<= fFloat;
+ rOutParam[10] <<= fDouble;
+ rOutParam[11] <<= eEnum;
+ rOutParam[12] <<= aString;
+ rOutParam[13] <<= xInterface;
+ rOutParam[14] <<= aAny;
+ rOutParam[15] <<= aSeq;
+ rOutParam[16] <<= aData;
+ }
+ else if (rFunctionName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("raiseException") ))
+ {
+ aRet <<= _xLBT->raiseException( aBool, aChar, nByte, nShort, nUShort, nLong, nULong,
+ nHyper, nUHyper, fFloat, fDouble, eEnum, aString, xInterface,
+ aAny, aSeq, aData );
+
+ rOutParamIndex.realloc( 17 );
+ rOutParamIndex[0] = 0;
+ rOutParamIndex[1] = 1;
+ rOutParamIndex[2] = 2;
+ rOutParamIndex[3] = 3;
+ rOutParamIndex[4] = 4;
+ rOutParamIndex[5] = 5;
+ rOutParamIndex[6] = 6;
+ rOutParamIndex[7] = 7;
+ rOutParamIndex[8] = 8;
+ rOutParamIndex[9] = 9;
+ rOutParamIndex[10] = 10;
+ rOutParamIndex[11] = 11;
+ rOutParamIndex[12] = 12;
+ rOutParamIndex[13] = 13;
+ rOutParamIndex[14] = 14;
+ rOutParamIndex[15] = 15;
+ rOutParamIndex[16] = 16;
+
+ rOutParam.realloc( 17 );
+ rOutParam[0].setValue( &aBool, ::getCppuBooleanType() );
+ rOutParam[1].setValue( &aChar, ::getCppuCharType() );
+ rOutParam[2] <<= nByte;
+ rOutParam[3] <<= nShort;
+ rOutParam[4] <<= nUShort;
+ rOutParam[5] <<= nLong;
+ rOutParam[6] <<= nULong;
+ rOutParam[7] <<= nHyper;
+ rOutParam[8] <<= nUHyper;
+ rOutParam[9] <<= fFloat;
+ rOutParam[10] <<= fDouble;
+ rOutParam[11] <<= eEnum;
+ rOutParam[12] <<= aString;
+ rOutParam[13] <<= xInterface;
+ rOutParam[14] <<= aAny;
+ rOutParam[15] <<= aSeq;
+ rOutParam[16] <<= aData;
+ }
+ else
+ {
+ OSL_ENSHURE( sal_False, "no XLanguageBindingTest call received on invocation!" );
+ }
+ }
+ catch (IllegalArgumentException & rExc)
+ {
+ // thrown by raiseException() call
+ InvocationTargetException aExc;
+ aExc.TargetException <<= rExc;
+ throw aExc;
+ }
+ catch (Exception &)
+ {
+ OSL_ENSHURE( sal_False, "### unexpected exception caught!" );
+ throw;
+ }
+
+ return aRet;
+}
+//__________________________________________________________________________________________________
+void XLB_Invocation::setValue( const OUString & rName, const Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Bool") ))
+ _xLBT->setBool( *(const sal_Bool *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Byte") ))
+ _xLBT->setByte( *(const sal_Int8 *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Char") ))
+ _xLBT->setChar( *(const sal_Unicode *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Short") ))
+ _xLBT->setShort( *(const sal_Int16 *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UShort") ))
+ _xLBT->setUShort( *(const sal_uInt16 *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Long") ))
+ _xLBT->setLong( *(const sal_Int32 *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ULong") ))
+ _xLBT->setULong( *(const sal_uInt32 *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Hyper") ))
+ _xLBT->setHyper( *(const sal_Int64 *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UHyper") ))
+ _xLBT->setUHyper( *(const sal_uInt64 *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Float") ))
+ _xLBT->setFloat( *(const float *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Double") ))
+ _xLBT->setDouble( *(const double *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Enum") ))
+ _xLBT->setEnum( *(const TestEnum *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("String") ))
+ _xLBT->setString( *(const OUString *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Interface") ))
+ _xLBT->setInterface( *(const Reference< XInterface > *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Any") ))
+ _xLBT->setAny( rValue );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Sequence") ))
+ _xLBT->setSequence( *(const Sequence< TestElement > *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Struct") ))
+ _xLBT->setStruct( *(const TestData *)rValue.getValue() );
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("RuntimeException") ))
+ _xLBT->setRuntimeException( *(const sal_Int32 *)rValue.getValue() );
+}
+//__________________________________________________________________________________________________
+Any XLB_Invocation::getValue( const OUString & rName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ Any aRet;
+ if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Bool") ))
+ {
+ sal_Bool aBool = _xLBT->getBool();
+ aRet.setValue( &aBool, ::getCppuBooleanType() );
+ }
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Byte") ))
+ aRet <<= _xLBT->getByte();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Char") ))
+ {
+ sal_Unicode aChar = _xLBT->getChar();
+ aRet.setValue( &aChar, ::getCppuCharType() );
+ }
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Short") ))
+ aRet <<= _xLBT->getShort();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UShort") ))
+ aRet <<= _xLBT->getUShort();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Long") ))
+ aRet <<= _xLBT->getLong();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ULong") ))
+ aRet <<= _xLBT->getULong();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Hyper") ))
+ aRet <<= _xLBT->getHyper();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UHyper") ))
+ aRet <<= _xLBT->getUHyper();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Float") ))
+ aRet <<= _xLBT->getFloat();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Double") ))
+ aRet <<= _xLBT->getDouble();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Enum") ))
+ aRet <<= _xLBT->getEnum();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("String") ))
+ aRet <<= _xLBT->getString();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Interface") ))
+ aRet <<= _xLBT->getInterface();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Any") ))
+ aRet <<= _xLBT->getAny();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Sequence") ))
+ aRet <<= _xLBT->getSequence();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Struct") ))
+ aRet <<= _xLBT->getStruct();
+ else if (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("RuntimeException") ))
+ aRet <<= _xLBT->getRuntimeException();
+ return aRet;
+}
+//__________________________________________________________________________________________________
+sal_Bool XLB_Invocation::hasMethod( const OUString & rName )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("raiseException") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("getValues") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("setValues2") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("setValues") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("acquire") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("release") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("queryInterface") ));
+}
+//__________________________________________________________________________________________________
+sal_Bool XLB_Invocation::hasProperty( const OUString & rName )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return (rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Bool") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Byte") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Char") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Short") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UShort") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Long") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ULong") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Hyper") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("UHyper") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Float") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Double") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Enum") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("String") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Interface") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Any") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Sequence") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Struct") ) ||
+ rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("RuntimeException") ) );
+}
+
+//##################################################################################################
+
+//__________________________________________________________________________________________________
+void Test_Impl::setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
+ sal_Int16 nShort, sal_uInt16 nUShort,
+ sal_Int32 nLong, sal_uInt32 nULong,
+ sal_Int64 nHyper, sal_uInt64 nUHyper,
+ float fFloat, double fDouble,
+ test::TestEnum eEnum, const ::rtl::OUString& rStr,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ const ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Sequence<test::TestElement >& rSequence,
+ const test::TestData& rStruct )
+ throw(com::sun::star::uno::RuntimeException)
+{
+ assign( _aData,
+ bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
+ eEnum, rStr, xTest, rAny, rSequence );
+ _aStructData = rStruct;
+}
+//__________________________________________________________________________________________________
+test::TestData Test_Impl::setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
+ sal_Int16& nShort, sal_uInt16& nUShort,
+ sal_Int32& nLong, sal_uInt32& nULong,
+ sal_Int64& nHyper, sal_uInt64& nUHyper,
+ float& fFloat, double& fDouble,
+ test::TestEnum& eEnum, rtl::OUString& rStr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ ::com::sun::star::uno::Any& rAny,
+ ::com::sun::star::uno::Sequence<test::TestElement >& rSequence,
+ test::TestData& rStruct )
+ throw(com::sun::star::uno::RuntimeException)
+{
+ assign( _aData,
+ bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
+ eEnum, rStr, xTest, rAny, rSequence );
+ _aStructData = rStruct;
+ return _aStructData;
+}
+//__________________________________________________________________________________________________
+test::TestData Test_Impl::getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
+ sal_Int16& nShort, sal_uInt16& nUShort,
+ sal_Int32& nLong, sal_uInt32& nULong,
+ sal_Int64& nHyper, sal_uInt64& nUHyper,
+ float& fFloat, double& fDouble,
+ test::TestEnum& eEnum, rtl::OUString& rStr,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
+ ::com::sun::star::uno::Any& rAny,
+ ::com::sun::star::uno::Sequence<test::TestElement >& rSequence,
+ test::TestData& rStruct )
+ throw(com::sun::star::uno::RuntimeException)
+{
+ bBool = _aData.Bool;
+ cChar = _aData.Char;
+ nByte = _aData.Byte;
+ nShort = _aData.Short;
+ nUShort = _aData.UShort;
+ nLong = _aData.Long;
+ nULong = _aData.ULong;
+ nHyper = _aData.Hyper;
+ nUHyper = _aData.UHyper;
+ fFloat = _aData.Float;
+ fDouble = _aData.Double;
+ eEnum = _aData.Enum;
+ rStr = _aData.String;
+ xTest = _aData.Interface;
+ rAny = _aData.Any;
+ rSequence = _aData.Sequence;
+ rStruct = _aStructData;
+ return _aStructData;
+}
+
+//==================================================================================================
+sal_Bool performTest( const Reference<XLanguageBindingTest > & xLBT )
+{
+ OSL_ENSHURE( xLBT.is(), "### no test interface!" );
+ if (xLBT.is())
+ {
+ // this data is never ever granted access to by calls other than equals(), assign()!
+ test::TestData aData; // test against this data
+
+ Reference<XInterface > xI( *new OWeakObject() );
+
+ assign( (test::TestElement &)aData,
+ sal_True, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98,
+ 0x123456789abcdef0, 0xfedcba9876543210,
+ (float)17.0815, 3.1415926359, TestEnum_LOLA, OUString::createFromAscii("dumdidum"), xI,
+ Any( &xI, ::getCppuType( (const Reference<XInterface > *)0 ) ) );
+
+ OSL_ENSHURE( aData.Any == xI, "### unexpected any!" );
+ OSL_ENSHURE( !(aData.Any != xI), "### unexpected any!" );
+
+ aData.Sequence = Sequence<test::TestElement >( (const test::TestElement *)&aData, 1 );
+ // aData complete
+ //================================================================================
+
+ // this is a manually copy of aData for first setting...
+ test::TestData aSetData;
+
+ assign( (test::TestElement &)aSetData,
+ aData.Bool, aData.Char, aData.Byte, aData.Short, aData.UShort,
+ aData.Long, aData.ULong, aData.Hyper, aData.UHyper, aData.Float, aData.Double,
+ aData.Enum, aData.String, xI,
+ Any( &xI, ::getCppuType( (const Reference<XInterface > *)0 ) ) );
+
+ aSetData.Sequence = Sequence<test::TestElement >( (const test::TestElement *)&aSetData, 1 );
+
+ xLBT->setValues(
+ aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, aSetData.UShort,
+ aSetData.Long, aSetData.ULong, aSetData.Hyper, aSetData.UHyper, aSetData.Float, aSetData.Double,
+ aSetData.Enum, aSetData.String, aSetData.Interface, aSetData.Any, aSetData.Sequence, aSetData );
+
+ {
+ test::TestData aRet, aRet2;
+ xLBT->getValues(
+ aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort,
+ aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double,
+ aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 );
+
+ OSL_ASSERT( equals( aData, aRet ) && equals( aData, aRet2 ) );
+
+ // set last retrieved values
+ test::TestData aSV2ret = xLBT->setValues2(
+ aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort,
+ aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double,
+ aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 );
+
+ OSL_ASSERT( equals( aData, aSV2ret ) && equals( aData, aRet2 ) );
+ }
+ {
+ test::TestData aRet, aRet2;
+ test::TestData aGVret = xLBT->getValues(
+ aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort,
+ aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double,
+ aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 );
+
+ OSL_ASSERT( equals( aData, aRet ) && equals( aData, aRet2 ) && equals( aData, aGVret ) );
+
+ // set last retrieved values
+ xLBT->setBool( aRet.Bool );
+ xLBT->setChar( aRet.Char );
+ xLBT->setByte( aRet.Byte );
+ xLBT->setShort( aRet.Short );
+ xLBT->setUShort( aRet.UShort );
+ xLBT->setLong( aRet.Long );
+ xLBT->setULong( aRet.ULong );
+ xLBT->setHyper( aRet.Hyper );
+ xLBT->setUHyper( aRet.UHyper );
+ xLBT->setFloat( aRet.Float );
+ xLBT->setDouble( aRet.Double );
+ xLBT->setEnum( aRet.Enum );
+ xLBT->setString( aRet.String );
+ xLBT->setInterface( aRet.Interface );
+ xLBT->setAny( aRet.Any );
+ xLBT->setSequence( aRet.Sequence );
+ xLBT->setStruct( aRet2 );
+ }
+ {
+ test::TestData aRet, aRet2;
+ aRet.Hyper = xLBT->getHyper();
+ aRet.UHyper = xLBT->getUHyper();
+ aRet.Float = xLBT->getFloat();
+ aRet.Double = xLBT->getDouble();
+ aRet.Byte = xLBT->getByte();
+ aRet.Char = xLBT->getChar();
+ aRet.Bool = xLBT->getBool();
+ aRet.Short = xLBT->getShort();
+ aRet.UShort = xLBT->getUShort();
+ aRet.Long = xLBT->getLong();
+ aRet.ULong = xLBT->getULong();
+ aRet.Enum = xLBT->getEnum();
+ aRet.String = xLBT->getString();
+ aRet.Interface = xLBT->getInterface();
+ aRet.Any = xLBT->getAny();
+ aRet.Sequence = xLBT->getSequence();
+ aRet2 = xLBT->getStruct();
+
+ return (equals( aData, aRet ) && equals( aData, aRet2 ));
+ }
+ }
+ return sal_False;
+}
+
+//__________________________________________________________________________________________________
+test::TestData Test_Impl::raiseException( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte, sal_Int16& nShort, sal_uInt16& nUShort, sal_Int32& nLong, sal_uInt32& nULong, sal_Int64& nHyper, sal_uInt64& nUHyper, float& fFloat, double& fDouble, test::TestEnum& eEnum, ::rtl::OUString& aString, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInterface, ::com::sun::star::uno::Any& aAny, ::com::sun::star::uno::Sequence< test::TestElement >& aSequence, test::TestData& aStruct )
+ throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ IllegalArgumentException aExc;
+ aExc.ArgumentPosition = 5;
+ aExc.Message = OUString::createFromAscii("dum dum dum ich tanz im kreis herum...");
+ aExc.Context = *this;
+ throw aExc;
+ return test::TestData();
+}
+//__________________________________________________________________________________________________
+sal_Int32 Test_Impl::getRuntimeException() throw(::com::sun::star::uno::RuntimeException)
+{
+ RuntimeException aExc;
+ aExc.Message = OUString::createFromAscii("dum dum dum ich tanz im kreis herum...");
+ aExc.Context = *this;
+ throw aExc;
+ return 0;
+}
+//__________________________________________________________________________________________________
+void Test_Impl::setRuntimeException( sal_Int32 _runtimeexception ) throw(::com::sun::star::uno::RuntimeException)
+{
+ RuntimeException aExc;
+ aExc.Message = OUString::createFromAscii("dum dum dum ich tanz im kreis herum...");
+ aExc.Context = *this;
+ throw aExc;
+}
+
+//==================================================================================================
+sal_Bool raiseException( const Reference<XLanguageBindingTest > & xLBT )
+{
+ try
+ {
+ try
+ {
+ try
+ {
+ test::TestData aRet, aRet2;
+ xLBT->raiseException(
+ aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort,
+ aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double,
+ aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 );
+ return sal_False;
+ }
+ catch (IllegalArgumentException aExc)
+ {
+ OSL_ENSHURE( aExc.ArgumentPosition == 5 &&
+// aExc.Context == xLBT &&
+ aExc.Message.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...")),
+ "### unexpected exception content!" );
+
+ Reference<XLanguageBindingTest > xLBT(
+ Reference<XLanguageBindingTest >::query( aExc.Context ) );
+
+ OSL_ENSHURE( xLBT.is(), "### unexpected source of exception!" );
+ if (xLBT.is())
+ xLBT->getRuntimeException();
+ else
+ return sal_False;
+ }
+ }
+ catch (const RuntimeException & rExc)
+ {
+ OSL_ENSHURE(//rExc.Context == xLBT &&
+ rExc.Message.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...")),
+ "### unexpected exception content!" );
+
+ Reference<XLanguageBindingTest > xLBT(
+ Reference<XLanguageBindingTest >::query( rExc.Context ) );
+
+ OSL_ENSHURE( xLBT.is(), "### unexpected source of exception!" );
+ if (xLBT.is())
+ xLBT->setRuntimeException( 0xcafebabe );
+ else
+ return sal_False;
+ }
+ }
+ catch (Exception & aExc)
+ {
+ OSL_ENSHURE( //aExc.Context == xLBT &&
+ aExc.Message.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...")),
+ "### unexpected exception content!" );
+ return (//aExc.Context == xLBT &&
+ aExc.Message.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...")));
+ }
+ return sal_False;
+}
+
+//==================================================================================================
+static sal_Bool test_adapter( const Reference< XMultiServiceFactory > & xMgr )
+{
+ Reference< XInvocationAdapterFactory > xAdapFac(
+ xMgr->createInstance( OUString::createFromAscii("com.sun.star.script.InvocationAdapterFactory") ), UNO_QUERY );
+
+ Reference< XLanguageBindingTest > xOriginal( (XLanguageBindingTest *)new Test_Impl() );
+ Reference< XInvocation > xInvok( new XLB_Invocation( xMgr, xOriginal ) );
+ Reference< XLanguageBindingTest > xLBT( xAdapFac->createAdapter(
+ xInvok, ::getCppuType( (const Reference< XLanguageBindingTest > *)0 ) ), UNO_QUERY );
+
+ return (performTest( xLBT ) && raiseException( xLBT ));
+}
+
+#ifdef UNX
+#define REG_PREFIX "lib"
+#define DLL_POSTFIX ".so"
+#else
+#define REG_PREFIX ""
+#define DLL_POSTFIX ".dll"
+#endif
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int __cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb") ) ) );
+
+ sal_Bool bSucc = sal_False;
+ try
+ {
+ Reference< XImplementationRegistration > xImplReg(
+ xMgr->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration") ) ),
+ UNO_QUERY );
+ OSL_ENSHURE( xImplReg.is(), "### no impl reg!" );
+
+ OUString aLibName( OUString::createFromAscii(REG_PREFIX "invadp" DLL_POSTFIX) );
+ xImplReg->registerImplementation(
+ OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), aLibName, Reference< XSimpleRegistry >() );
+
+ bSucc = test_adapter( xMgr );
+ }
+ catch (Exception & rExc)
+ {
+ OSL_ENSHURE( sal_False, "### exception occured!" );
+ OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "### exception occured: " );
+ OSL_TRACE( aMsg.getStr() );
+ OSL_TRACE( "\n" );
+ }
+
+ Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+
+ printf( "testiadapter %s !\n", (bSucc ? "succeeded" : "failed") );
+ return (bSucc ? 0 : -1);
+}
diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx
new file mode 100644
index 000000000000..2e917fcbc008
--- /dev/null
+++ b/stoc/test/testintrosp.cxx
@@ -0,0 +1,1645 @@
+/*************************************************************************
+ *
+ * $RCSfile: testintrosp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/servicefactory.hxx>
+
+#include <vos/diagnose.hxx>
+#include <vos/dynload.hxx>
+
+#include <ModuleA/XIntroTest.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XIntrospection.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/PropertyConcept.hpp>
+#include <com/sun/star/beans/MethodConcept.hpp>
+#include <com/sun/star/beans/XExactName.hpp>
+#include <com/sun/star/container/XElementAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/reflection/XIdlReflection.hpp>
+//#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <stdio.h>
+#include <string.h>
+
+
+using namespace rtl;
+using namespace cppu;
+using namespace vos;
+using namespace ModuleA;
+//using namespace ModuleB;
+//using namespace ModuleC;
+//using namespace ModuleA::ModuleB;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans::PropertyAttribute;
+
+
+typedef WeakImplHelper4< XIntroTest, XPropertySet, XNameAccess, XIndexAccess > ImplIntroTestHelper;
+typedef WeakImplHelper1< XPropertySetInfo > ImplPropertySetInfoHelper;
+
+
+#define DEFAULT_INDEX_ACCESS_COUNT 10
+#define DEFAULT_NAME_ACCESS_COUNT 5
+
+#ifdef _DEBUG
+#define TEST_ENSHURE(c, m) VOS_ENSHURE(c, m)
+#else
+#define TEST_ENSHURE(c, m) VOS_VERIFY(c)
+#endif
+
+//class IntroTestWritelnOutput;
+
+
+
+//**************************************************************
+//*** Hilfs-Funktion, um vom Type eine XIdlClass zu bekommen ***
+//**************************************************************
+Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< XMultiServiceFactory > & xMgr )
+{
+ static Reference< XIdlReflection > xRefl;
+
+ // void als Default-Klasse eintragen
+ Reference<XIdlClass> xRetClass;
+ typelib_TypeDescription * pTD = 0;
+ rType.getDescription( &pTD );
+ if( pTD )
+ {
+ OUString sOWName( pTD->pTypeName );
+ if( !xRefl.is() )
+ {
+ xRefl = Reference< XIdlReflection >( xMgr->createInstance(
+ OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY );
+ VOS_ENSHURE( xRefl.is(), "### no corereflection!" );
+ }
+ xRetClass = xRefl->forName( sOWName );
+ }
+ return xRetClass;
+}
+
+
+//****************************************************
+//*** Hilfs-Funktion, um Any als UString auszugeben ***
+//****************************************************
+// ACHTUNG: Kann mal an eine zentrale Stelle uebernommen werden
+// Wird zunaechst nur fuer einfache Datentypen ausgefuehrt
+
+OUString AnyToString( const Any& aValue, sal_Bool bIncludeType, const Reference< XMultiServiceFactory > & xMgr )
+{
+ Type aValType = aValue.getValueType();
+ TypeClass eType = aValType.getTypeClass();
+ char pBuffer[50];
+
+ OUString aRetStr;
+ switch( eType )
+ {
+ case TypeClass_TYPE: aRetStr = OUString::createFromAscii("TYPE TYPE"); break;
+ case TypeClass_INTERFACE: aRetStr = OUString::createFromAscii("TYPE INTERFACE"); break;
+ case TypeClass_SERVICE: aRetStr = OUString::createFromAscii("TYPE SERVICE"); break;
+ case TypeClass_STRUCT: aRetStr = OUString::createFromAscii("TYPE STRUCT"); break;
+ case TypeClass_TYPEDEF: aRetStr = OUString::createFromAscii("TYPE TYPEDEF"); break;
+ case TypeClass_UNION: aRetStr = OUString::createFromAscii("TYPE UNION"); break;
+ case TypeClass_ENUM: aRetStr = OUString::createFromAscii("TYPE ENUM"); break;
+ case TypeClass_EXCEPTION: aRetStr = OUString::createFromAscii("TYPE EXCEPTION"); break;
+ case TypeClass_ARRAY: aRetStr = OUString::createFromAscii("TYPE ARRAY"); break;
+ case TypeClass_SEQUENCE: aRetStr = OUString::createFromAscii("TYPE SEQUENCE"); break;
+ case TypeClass_VOID: aRetStr = OUString::createFromAscii("TYPE void"); break;
+ case TypeClass_ANY: aRetStr = OUString::createFromAscii("TYPE any"); break;
+ case TypeClass_UNKNOWN: aRetStr = OUString::createFromAscii("TYPE unknown"); break;
+ case TypeClass_BOOLEAN:
+ {
+ sal_Bool b = *(sal_Bool*)aValue.getValue();
+ //aRet.setValue( &b, getCppuBooleanType() );
+ //aValue >>= b;
+ aRetStr = OUString::valueOf( b );
+ break;
+ }
+ case TypeClass_CHAR:
+ {
+ sal_Unicode c = *(sal_Unicode*)aValue.getValue();
+ //aValue >>= c;
+ //getCppuCharType()
+ aRetStr = OUString::valueOf( c );
+ break;
+ }
+ case TypeClass_STRING:
+ {
+ aValue >>= aRetStr;
+ break;
+ }
+ case TypeClass_FLOAT:
+ {
+ float f;
+ aValue >>= f;
+ sprintf( pBuffer, "%f", f );
+ aRetStr = OUString( pBuffer, strlen( pBuffer ), RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ case TypeClass_DOUBLE:
+ {
+ double d;
+ aValue >>= d;
+ sprintf( pBuffer, "%f", d );
+ aRetStr = OUString( pBuffer, strlen( pBuffer ), RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ case TypeClass_BYTE:
+ {
+ sal_Int8 n;
+ aValue >>= n;
+ aRetStr = OUString::valueOf( (sal_Int32) n );
+ break;
+ }
+ case TypeClass_SHORT:
+ {
+ sal_Int16 n;
+ aValue >>= n;
+ aRetStr = OUString::valueOf( (sal_Int32) n );
+ break;
+ }
+ case TypeClass_LONG:
+ {
+ sal_Int32 n;
+ aValue >>= n;
+ aRetStr = OUString::valueOf( n );
+ break;
+ }
+ /*
+ case TypeClass_HYPER:
+ {
+ aRetStr = L"TYPE HYPER";
+ break;
+ }
+ case TypeClass_UNSIGNED_SHORT:
+ {
+ aRetStr = StringToUString(WSString(aValue.getUINT16()), CHARSET_SYSTEM);
+ break;
+ }
+ case TypeClass_UNSIGNED_LONG:
+ {
+ aRetStr = StringToUString(WSString(aValue.getUINT32()), CHARSET_SYSTEM);
+ break;
+ }
+ case TypeClass_UNSIGNED_HYPER:
+ {
+ aRetStr = L"TYPE UNSIGNED_HYPER";
+ break;
+ }
+ */
+ }
+
+ if( bIncludeType )
+ {
+ Reference< XIdlClass > xIdlClass = TypeToIdlClass( aValType, xMgr );
+ aRetStr = aRetStr + OUString( OUString::createFromAscii(" (Typ: ") ) + xIdlClass->getName() + OUString::createFromAscii(")");
+ }
+ return aRetStr;
+}
+
+/*
+// Hilfs-Funktion, um ein UString in einen Any zu konvertieren
+UsrAny StringToAny( UString aStr, TypeClass eTargetType )
+{
+ UsrAny aRetAny;
+ switch( eTargetType )
+ {
+ case TypeClass_INTERFACE: break;
+ case TypeClass_SERVICE: break;
+ case TypeClass_STRUCT: break;
+ case TypeClass_TYPEDEF: break;
+ case TypeClass_UNION: break;
+ case TypeClass_ENUM: break;
+ case TypeClass_EXCEPTION: break;
+ case TypeClass_ARRAY: break;
+ case TypeClass_SEQUENCE: break;
+ case TypeClass_VOID: break;
+ case TypeClass_ANY: break;
+ case TypeClass_UNKNOWN: break;
+ case TypeClass_BOOLEAN: aRetAny.setBOOL( short(aStr)!=0 ); break;
+ case TypeClass_CHAR: aRetAny.setChar( char(aStr) ); break;
+ case TypeClass_STRING: aRetAny.setString( aStr ); break;
+ case TypeClass_FLOAT: aRetAny.setFloat( (float)strtod( aStr.GetStr(), NULL ) ); break;
+ case TypeClass_DOUBLE: aRetAny.setDouble( strtod( aStr.GetStr(), NULL ) ); break;
+ case TypeClass_BYTE: aRetAny.setBYTE( BYTE(short(aStr)) ); break;
+ case TypeClass_SHORT: aRetAny.setINT16( short(aStr) ); break;
+ case TypeClass_LONG: aRetAny.setINT32( long(aStr) ); break;
+ case TypeClass_HYPER: break;
+ case TypeClass_UNSIGNED_SHORT: aRetAny.setUINT16( USHORT(aStr) ); break;
+ case TypeClass_UNSIGNED_LONG: aRetAny.setUINT32( ULONG(aStr) ); break;
+ case TypeClass_UNSIGNED_HYPER: break;
+ }
+ return aRetAny;
+}
+*/
+
+
+//*****************************************
+//*** XPropertySetInfo fuer Test-Klasse ***
+//*****************************************
+
+class ImplPropertySetInfo : public ImplPropertySetInfoHelper
+{
+ friend class ImplIntroTest;
+
+ Reference< XMultiServiceFactory > mxMgr;
+
+public:
+ ImplPropertySetInfo( const Reference< XMultiServiceFactory > & xMgr )
+ : mxMgr( xMgr ) {}
+ //: mxMgr( xMgr ), ImplPropertySetInfoHelper( xMgr ) {}
+
+/*
+ // Methoden von XInterface
+ virtual sal_Bool SAL_CALL queryInterface( const Uik & rUik, Any & ifc ) throw( RuntimeException );
+ virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw() { OWeakObject::release(); }
+ //ALT: sal_Bool queryInterface( Uik aUik, Reference<XInterface> & rOut );
+*/
+
+ // Methods of XPropertySetInfo
+ virtual Sequence< Property > SAL_CALL getProperties( )
+ throw(RuntimeException);
+ virtual Property SAL_CALL getPropertyByName( const OUString& aName )
+ throw(UnknownPropertyException, RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
+ throw(RuntimeException);
+ //virtual Sequence< Property > SAL_CALL getProperties(void) throw( RuntimeException );
+ //virtual Property SAL_CALL getPropertyByName(const OUString& Name) throw( RuntimeException );
+ //virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& Name) throw( RuntimeException );
+};
+
+
+/*
+// Methoden von XInterface
+sal_Bool SAL_CALL ImplPropertySetInfo::queryInterface( const Uik & rUik, Any & ifc )
+ throw( RuntimeException )
+{
+ // PropertySet-Implementation
+ if( com::sun::star::uno::queryInterface( rUik, ifc,
+ SAL_STATIC_CAST(XPropertySetInfo*, this) ) )
+ return sal_True;
+
+ return OWeakObject::queryInterface( rUik, ifc );
+}
+
+sal_Bool ImplPropertySetInfo::queryInterface( Uik aUik, Reference<XInterface> & rOut )
+{
+ if( aUik == XPropertySetInfo::getSmartUik() )
+ rOut = (XPropertySetInfo *)this;
+ else
+ UsrObject::queryInterface( aUik, rOut );
+ return rOut.is();
+}
+*/
+
+Sequence< Property > ImplPropertySetInfo::getProperties(void)
+ throw( RuntimeException )
+{
+ static Sequence<Property> * pSeq = NULL;
+
+ if( !pSeq )
+ {
+ // die Informationen fr die Properties "Width", "Height" und "Name" anlegen
+ pSeq = new Sequence<Property>( 3 );
+ Property * pAry = pSeq->getArray();
+
+ pAry[0].Name = OUString::createFromAscii("Factor");
+ pAry[0].Handle = -1;
+ pAry[0].Type = getCppuType( (double*) NULL );
+ //pAry[0].Type = TypeToIdlClass( getCppuType( (double*) NULL ), mxMgr );
+ //pAry[0].Type = Double_getReflection()->getIdlClass();
+ pAry[0].Attributes = BOUND | TRANSIENT;
+
+ pAry[1].Name = OUString::createFromAscii("MyCount");
+ pAry[1].Handle = -1;
+ pAry[1].Type = getCppuType( (sal_Int32*) NULL );
+ //pAry[1].Type = TypeToIdlClass( getCppuType( (sal_Int32*) NULL ), mxMgr );
+ //pAry[1].Type = INT32_getReflection()->getIdlClass();
+ pAry[1].Attributes = BOUND | TRANSIENT;
+
+ pAry[2].Name = OUString::createFromAscii("Info");
+ pAry[2].Handle = -1;
+ pAry[2].Type = getCppuType( (OUString*) NULL );
+ //pAry[2].Type = TypeToIdlClass( getCppuType( (OUString*) NULL ), mxMgr );
+ //pAry[2].Type = OUString_getReflection()->getIdlClass();
+ pAry[2].Attributes = TRANSIENT;
+ }
+ // Die Information ber alle drei Properties liefern.
+ return *pSeq;
+}
+
+Property ImplPropertySetInfo::getPropertyByName(const OUString& Name)
+ throw( UnknownPropertyException, RuntimeException )
+{
+ Sequence<Property> aSeq = getProperties();
+ const Property * pAry = aSeq.getConstArray();
+
+ for( sal_Int32 i = aSeq.getLength(); i--; )
+ {
+ if( pAry[i].Name == Name )
+ return pAry[i];
+ }
+ // Property unbekannt, also leere liefern
+ return Property();
+}
+
+sal_Bool ImplPropertySetInfo::hasPropertyByName(const OUString& Name)
+ throw( RuntimeException )
+{
+ Sequence<Property> aSeq = getProperties();
+ const Property * pAry = aSeq.getConstArray();
+
+ for( sal_Int32 i = aSeq.getLength(); i--; )
+ {
+ if( pAry[i].Name == Name )
+ return sal_True;
+ }
+ // Property unbekannt, also leere liefern
+ return sal_False;
+}
+
+
+
+
+//*****************************************************************
+
+
+
+class ImplIntroTest : public ImplIntroTestHelper
+{
+ Reference< XMultiServiceFactory > mxMgr;
+
+ friend class ImplPropertySetInfo;
+
+ // Properties fuer das PropertySet
+ Any aAnyArray[10];
+
+ // Optionale Schnittstelle fuer die writeln-Ausgabe
+ //IntroTestWritelnOutput* m_pOutput;
+
+ Reference< XPropertySetInfo > m_xMyInfo;
+
+ OUString m_ObjectName;
+
+ int m_nMarkusAge;
+ int m_nMarkusChildrenCount;
+
+ long m_lDroenk;
+ sal_Int16 m_nBla;
+ sal_Int16 m_nBlub;
+ sal_Int16 m_nGulp;
+ sal_Int16 m_nLaber;
+ TypeClass eTypeClass;
+ Sequence< OUString > aStringSeq;
+ Sequence< Sequence< Sequence< sal_Int16 > > > aMultSeq;
+ Reference< XIntroTest > m_xIntroTest;
+
+ // Daten fuer NameAccess
+ Reference< XIntroTest >* pNameAccessTab;
+
+ // Daten fuer IndexAccess
+ Reference< XIntroTest >* pIndexAccessTab;
+ sal_Int16 iIndexAccessCount;
+
+ // struct-Properties
+ Property m_aFirstStruct;
+ PropertyValue m_aSecondStruct;
+
+ // Listener merken (zunaechst einfach, nur einen pro Property)
+ Reference< XPropertyChangeListener > aPropChangeListener;
+ OUString aPropChangeListenerStr;
+ Reference< XVetoableChangeListener > aVetoPropChangeListener;
+ OUString aVetoPropChangeListenerStr;
+
+ void Init( void );
+
+public:
+ ImplIntroTest( const Reference< XMultiServiceFactory > & xMgr )
+ : mxMgr( xMgr )
+ //: mxMgr( xMgr ), ImplIntroTestHelper( xMgr )
+ {
+ Init();
+ }
+
+ /*
+ ImplIntroTest( IntroTestWritelnOutput* pOutput_ )
+ {
+ Init();
+ m_pOutput = pOutput_;
+ }
+ */
+
+ //SMART_UNO_DECLARATION(ImplIntroTest,UsrObject);
+
+ //BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut );
+ //Reference< XIdlClass > getIdlClass();
+
+ // Trotz virtual inline, um Schreibarbeit zu sparen (nur fuer Testzwecke)
+ // XPropertySet
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
+ virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {}
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {}
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {}
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ {}
+
+ /*
+ virtual void setIndexedPropertyValue(const OUString& aPropertyName, INT32 nIndex, const Any& aValue) {}
+ virtual Any getIndexedPropertyValue(const UString& aPropertyName, INT32 nIndex) const { return Any(); }
+ virtual void addPropertyChangeListener(const UString& aPropertyName, const XPropertyChangeListenerRef& aListener)
+ THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
+ virtual void removePropertyChangeListener(const UString& aPropertyName, const XPropertyChangeListenerRef& aListener)
+ THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
+ virtual void addVetoableChangeListener(const UString& aPropertyName, const XVetoableChangeListenerRef& aListener)
+ THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
+ virtual void removeVetoableChangeListener(const UString& aPropertyName, const XVetoableChangeListenerRef& aListener)
+ THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
+ */
+
+ // XIntroTest-Methoden
+ // Attributes
+ virtual OUString SAL_CALL getObjectName() throw(RuntimeException)
+ { return m_ObjectName; }
+ virtual void SAL_CALL setObjectName( const OUString& _objectname ) throw(RuntimeException)
+ { m_ObjectName = _objectname; }
+ virtual OUString SAL_CALL getFirstName()
+ throw(RuntimeException);
+ virtual OUString SAL_CALL getLastName() throw(RuntimeException)
+ { return OUString( OUString::createFromAscii("Meyer") ); }
+ virtual sal_Int16 SAL_CALL getAge() throw(RuntimeException)
+ { return m_nMarkusAge; }
+ virtual sal_Int16 SAL_CALL getChildrenCount() throw(RuntimeException)
+ { return m_nMarkusChildrenCount; }
+ virtual void SAL_CALL setChildrenCount( sal_Int16 _childrencount ) throw(RuntimeException)
+ { m_nMarkusChildrenCount = _childrencount; }
+ virtual Property SAL_CALL getFirstStruct() throw(RuntimeException)
+ { return m_aFirstStruct; }
+ virtual void SAL_CALL setFirstStruct( const Property& _firststruct ) throw(RuntimeException)
+ { m_aFirstStruct = _firststruct; }
+ virtual PropertyValue SAL_CALL getSecondStruct() throw(RuntimeException)
+ { return m_aSecondStruct; }
+ virtual void SAL_CALL setSecondStruct( const PropertyValue& _secondstruct ) throw(RuntimeException)
+ { m_aSecondStruct = _secondstruct; }
+
+ // Methods
+ virtual void SAL_CALL writeln( const OUString& Text )
+ throw(RuntimeException);
+ virtual sal_Int32 SAL_CALL getDroenk( ) throw(RuntimeException)
+ { return m_lDroenk; }
+ virtual Reference< ::ModuleA::XIntroTest > SAL_CALL getIntroTest( ) throw(RuntimeException);
+ virtual sal_Int32 SAL_CALL getUps( sal_Int32 l ) throw(RuntimeException)
+ { return 2*l; }
+ virtual void SAL_CALL setDroenk( sal_Int32 l ) throw(RuntimeException)
+ { m_lDroenk = l; }
+ virtual sal_Int16 SAL_CALL getBla( ) throw(RuntimeException)
+ { return m_nBla; }
+ virtual void SAL_CALL setBla( sal_Int32 n ) throw(RuntimeException)
+ { m_nBla = (sal_Int16)n; }
+ virtual sal_Int16 SAL_CALL getBlub( ) throw(RuntimeException)
+ { return m_nBlub; }
+ virtual void SAL_CALL setBlub( sal_Int16 n ) throw(RuntimeException)
+ { m_nBlub = n; }
+ virtual sal_Int16 SAL_CALL getGulp( ) throw(RuntimeException)
+ { return m_nGulp; }
+ virtual sal_Int16 SAL_CALL setGulp( sal_Int16 n ) throw(RuntimeException)
+ { m_nGulp = n; return 1; }
+ virtual TypeClass SAL_CALL getTypeClass( sal_Int16 n ) throw(RuntimeException)
+ { return eTypeClass; }
+ virtual void SAL_CALL setTypeClass( TypeClass t, double d1, double d2 ) throw(RuntimeException)
+ { eTypeClass = t; }
+ virtual Sequence< OUString > SAL_CALL getStrings( ) throw(RuntimeException)
+ { return aStringSeq; }
+ virtual void SAL_CALL setStrings( const Sequence< OUString >& Strings ) throw(RuntimeException)
+ { aStringSeq = Strings; }
+ virtual void SAL_CALL setStringsPerMethod( const Sequence< OUString >& Strings, sal_Int16 n ) throw(RuntimeException)
+ { aStringSeq = Strings; }
+ virtual Sequence< Sequence< Sequence< sal_Int16 > > > SAL_CALL getMultiSequence( ) throw(RuntimeException)
+ { return aMultSeq; }
+ virtual void SAL_CALL setMultiSequence( const Sequence< Sequence< Sequence< sal_Int16 > > >& Seq ) throw(RuntimeException)
+ { aMultSeq = Seq; }
+ virtual void SAL_CALL addPropertiesChangeListener( const Sequence< OUString >& PropertyNames, const Reference< XPropertiesChangeListener >& Listener )
+ throw(RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& Listener )
+ throw(RuntimeException);
+
+
+ // Methods of XElementAccess
+ virtual Type SAL_CALL getElementType( )
+ throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( )
+ throw(RuntimeException);
+ //virtual XIdlClassRef getElementType(void) constTHROWS( (UsrSystemException) );
+ //virtual BOOL hasElements(void) const THROWS( (UsrSystemException) );
+
+ // XNameAccess-Methoden
+ // Methods
+ virtual Any SAL_CALL getByName( const OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getElementNames( )
+ throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
+ throw(RuntimeException);
+ //virtual Any getByName(const UString& Name) const
+ //THROWS( (NoSuchElementException, WrappedTargetException, UsrSystemException) );
+ //virtual Sequence<UString> getElementNames(void) const THROWS( (UsrSystemException) );
+ //virtual BOOL hasByName(const UString& Name) const THROWS( (UsrSystemException) );
+
+ // XIndexAccess-Methoden
+ // Methods
+ virtual sal_Int32 SAL_CALL getCount( )
+ throw(RuntimeException);
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index )
+ throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
+ //virtual INT32 getCount(void) const THROWS( (UsrSystemException) );
+ //virtual Any getByIndex(INT32 Index) const
+ //THROWS( (IndexOutOfBoundsException, WrappedTargetException, UsrSystemException) );
+};
+
+//SMART_UNO_IMPLEMENTATION(ImplIntroTest,UsrObject)
+
+void ImplIntroTest::Init( void )
+{
+ // Eindeutigen Namen verpassen
+ static sal_Int32 nObjCount = 0;
+ OUString aName( OUString::createFromAscii("IntroTest-Obj Nr. ") );
+ aName += OUString::valueOf( nObjCount );
+ setObjectName( aName );
+
+ // Properties initialisieren
+ aAnyArray[0] <<= 3.14;
+ aAnyArray[1] <<= (sal_Int32)42;
+ aAnyArray[2] <<= OUString( OUString::createFromAscii("Hallo") );
+
+ // Output-Interface
+ //m_pOutput = NULL;
+
+ // Einmal fuer den internen Gebrauch die PropertySetInfo abholen
+ m_xMyInfo = getPropertySetInfo();
+ m_xMyInfo->acquire(); // sonst raucht es am Programm-Ende ab
+
+ m_nMarkusAge = 33;
+ m_nMarkusChildrenCount = 2;
+
+ m_lDroenk = 314;
+ m_nBla = 42;
+ m_nBlub = 111;
+ m_nGulp = 99;
+ m_nLaber = 1;
+ eTypeClass = TypeClass_INTERFACE;
+
+ // String-Sequence intitialisieren
+ aStringSeq.realloc( 3 );
+ OUString* pStr = aStringSeq.getArray();
+ pStr[ 0 ] = OUString( OUString::createFromAscii("String 0") );
+ pStr[ 1 ] = OUString( OUString::createFromAscii("String 1") );
+ pStr[ 2 ] = OUString( OUString::createFromAscii("String 2") );
+
+ // structs initialisieren
+ m_aFirstStruct.Name = OUString::createFromAscii("FirstStruct-Name");
+ m_aFirstStruct.Handle = 77777;
+ //XIdlClassRef Type;
+ m_aFirstStruct.Attributes = -222;
+
+ //XInterfaceRef Source;
+ Any Value;
+ Value <<= 2.718281828459;
+ m_aSecondStruct.Value = Value;
+ //XIdlClassRef ListenerType;
+ m_aSecondStruct.State = PropertyState_DIRECT_VALUE;
+
+ // IndexAccess
+ iIndexAccessCount = DEFAULT_INDEX_ACCESS_COUNT;
+ pIndexAccessTab = NULL;
+ pNameAccessTab = NULL;
+}
+
+/*
+BOOL ImplIntroTest::queryInterface( Uik aUik, XInterfaceRef & rOut )
+{
+ if( aUik == XIntroTest::getSmartUik() )
+ rOut = (XIntroTest*)this;
+ else if( aUik == XPropertySet::getSmartUik() )
+ rOut = (XPropertySet*)this;
+ else if( aUik == XNameAccess::getSmartUik() )
+ rOut = (XNameAccess*)this;
+ else if( aUik == XIndexAccess::getSmartUik() )
+ rOut = (XIndexAccess*)this;
+ else if( aUik == ((XElementAccess*)NULL)->getSmartUik() )
+ rOut = (XElementAccess*)(XIndexAccess *)this;
+ else
+ UsrObject::queryInterface( aUik, rOut );
+ return rOut.is();
+}
+
+XIdlClassRef ImplIntroTest::getIdlClass()
+{
+ static XIdlClassRef xClass = createStandardClass( L"ImplIntroTest",
+ UsrObject::getUsrObjectIdlClass(), 4,
+ XIntroTest_getReflection(),
+ XPropertySet_getReflection(),
+ XNameAccess_getReflection(),
+ XIndexAccess_getReflection() );
+ return xClass;
+}
+*/
+
+Reference< XPropertySetInfo > ImplIntroTest::getPropertySetInfo()
+ throw(RuntimeException)
+{
+ static ImplPropertySetInfo aInfo( mxMgr );
+ // Alle Objekt haben die gleichen Properties, deshalb kann
+ // die Info fr alle gleich sein
+ return &aInfo;
+
+ //if( m_xMyInfo == NULL )
+ // ((ImplIntroTest*)this)->m_xMyInfo = new ImplPropertySetInfo( this );
+ //return m_xMyInfo;
+}
+
+void ImplIntroTest::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+//void ImplIntroTest::setPropertyValue( const UString& aPropertyName, const Any& aValue )
+// THROWS( (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, UsrSystemException) )
+{
+ if( aPropChangeListener.is() && aPropertyName == aPropChangeListenerStr )
+ {
+ PropertyChangeEvent aEvt;
+ aEvt.Source = (OWeakObject*)this;
+ aEvt.PropertyName = aPropertyName;
+ aEvt.PropertyHandle = 0L;
+ //aEvt.OldValue;
+ //aEvt.NewValue;
+ //aEvt.PropagationId;
+ aPropChangeListener->propertyChange( aEvt );
+ }
+ if( aVetoPropChangeListener.is() && aPropertyName == aVetoPropChangeListenerStr )
+ {
+ PropertyChangeEvent aEvt;
+ aEvt.Source = (OWeakObject*)this;
+ aEvt.PropertyName = aVetoPropChangeListenerStr;
+ aEvt.PropertyHandle = 0L;
+ //aEvt.OldValue;
+ //aEvt.NewValue;
+ //aEvt.PropagationId;
+ aVetoPropChangeListener->vetoableChange( aEvt );
+ }
+
+ Sequence<Property> aPropSeq = m_xMyInfo->getProperties();
+ sal_Int32 nLen = aPropSeq.getLength();
+ for( sal_Int32 i = 0 ; i < nLen ; i++ )
+ {
+ Property aProp = aPropSeq.getArray()[ i ];
+ if( aProp.Name == aPropertyName )
+ aAnyArray[i] = aValue;
+ }
+}
+
+Any ImplIntroTest::getPropertyValue( const OUString& PropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+//Any ImplIntroTest::getPropertyValue(const UString& aPropertyName) const
+ //THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) )
+{
+ Sequence<Property> aPropSeq = m_xMyInfo->getProperties();
+ sal_Int32 nLen = aPropSeq.getLength();
+ for( sal_Int32 i = 0 ; i < nLen ; i++ )
+ {
+ Property aProp = aPropSeq.getArray()[ i ];
+ if( aProp.Name == PropertyName )
+ return aAnyArray[i];
+ }
+ return Any();
+}
+
+OUString ImplIntroTest::getFirstName(void)
+ throw(RuntimeException)
+{
+ return OUString( OUString::createFromAscii("Markus") );
+}
+
+void ImplIntroTest::writeln( const OUString& Text )
+ throw(RuntimeException)
+{
+ OString aStr( Text.getStr(), Text.getLength(), RTL_TEXTENCODING_ASCII_US );
+
+ // Haben wir ein Output?
+ //if( m_pOutput )
+ //{
+ //m_pOutput->doWriteln( TextStr );
+ //}
+ // Sonst einfach rausbraten
+ //else
+ {
+ printf( "%s", aStr.getStr() );
+ }
+}
+
+Reference< XIntroTest > ImplIntroTest::getIntroTest()
+ throw(RuntimeException)
+//XIntroTestRef ImplIntroTest::getIntroTest(void) THROWS( (UsrSystemException) )
+{
+ if( !m_xIntroTest.is() )
+ m_xIntroTest = new ImplIntroTest( mxMgr );
+ return m_xIntroTest;
+}
+
+// Methoden von XElementAccess
+Type ImplIntroTest::getElementType( )
+ throw(RuntimeException)
+//XIdlClassRef ImplIntroTest::getElementType(void) const THROWS( (UsrSystemException) )
+{
+ // TODO
+ Type aRetType;
+ return aRetType;
+ //return Reference< XIdlClass >();
+ //return Void_getReflection()->getIdlClass();
+}
+
+sal_Bool ImplIntroTest::hasElements( )
+ throw(RuntimeException)
+//BOOL ImplIntroTest::hasElements(void) const THROWS( (UsrSystemException) )
+{
+ return sal_True;
+}
+
+// XNameAccess-Methoden
+sal_Int32 getIndexForName( const OUString& ItemName )
+{
+ OUString aLeftStr = ItemName.copy( 0, 4 );
+ if( aLeftStr == OUString::createFromAscii("Item") )
+ {
+ // TODO
+ OUString aNumStr = ItemName.copy( 4 );
+ //sal_Int32 iIndex = (INT32)UStringToString( aNumStr, CHARSET_SYSTEM );
+ //if( iIndex < DEFAULT_NAME_ACCESS_COUNT )
+ //return iIndex;
+ }
+ return -1;
+}
+
+
+Any ImplIntroTest::getByName( const OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+//Any ImplIntroTest::getByName(const UString& Name) const
+ //THROWS( (NoSuchElementException, WrappedTargetException, UsrSystemException) )
+{
+ Any aRetAny;
+
+ if( !pNameAccessTab )
+ ((ImplIntroTest*)this)->pNameAccessTab = new Reference< XIntroTest >[ DEFAULT_NAME_ACCESS_COUNT ];
+
+ sal_Int32 iIndex = getIndexForName( aName );
+ if( iIndex != -1 )
+ {
+ if( !pNameAccessTab[iIndex].is() )
+ {
+ ImplIntroTest* p = new ImplIntroTest( mxMgr );
+ OUString aName( OUString::createFromAscii("IntroTest by Name-Access, Index = ") );
+ aName += OUString::valueOf( iIndex );
+ //aName = aName + StringToUString( String( iIndex ), CHARSET_SYSTEM );
+ p->setObjectName( aName );
+ pNameAccessTab[iIndex] = p;
+ }
+
+ Reference< XIntroTest > xRet = pNameAccessTab[iIndex];
+ aRetAny = makeAny( xRet );
+
+ //aRetAny.set( &xRet, XIntroTest_getReflection() );
+ //return (UsrObject*)(XIntroTest*)pNameAccessTab[iIndex];
+ }
+ return aRetAny;
+}
+
+Sequence< OUString > ImplIntroTest::getElementNames( )
+ throw(RuntimeException)
+//Sequence<UString> ImplIntroTest::getElementNames(void) const THROWS( (UsrSystemException) )
+{
+ Sequence<OUString> aStrSeq( DEFAULT_NAME_ACCESS_COUNT );
+ OUString* pStr = aStrSeq.getArray();
+ for( sal_Int32 i = 0 ; i < DEFAULT_NAME_ACCESS_COUNT ; i++ )
+ {
+ OUString aName( OUString::createFromAscii("Item") );
+ aName += OUString::valueOf( i );
+ //aName = aName + StringToUString( i, CHARSET_SYSTEM );
+ pStr[i] = aName;
+ }
+ return aStrSeq;
+}
+
+sal_Bool ImplIntroTest::hasByName( const OUString& aName )
+ throw(RuntimeException)
+//BOOL ImplIntroTest::hasByName(const UString& Name) const THROWS( (UsrSystemException) )
+{
+ return ( getIndexForName( aName ) != -1 );
+}
+
+// XIndexAccess-Methoden
+sal_Int32 ImplIntroTest::getCount( )
+ throw(RuntimeException)
+//sal_Int32 ImplIntroTest::getCount(void) const THROWS( (UsrSystemException) )
+{
+ return iIndexAccessCount;
+}
+
+Any ImplIntroTest::getByIndex( sal_Int32 Index )
+ throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+//Any ImplIntroTest::getByIndex( sal_Int32 Index ) const
+ //THROWS( (IndexOutOfBoundsException, WrappedTargetException, UsrSystemException) )
+{
+ Any aRetAny;
+
+ if( !pIndexAccessTab )
+ ((ImplIntroTest*)this)->pIndexAccessTab = new Reference< XIntroTest >[ iIndexAccessCount ];
+
+ if( Index < iIndexAccessCount )
+ {
+ if( !pNameAccessTab[Index].is() )
+ {
+ ImplIntroTest* p = new ImplIntroTest( mxMgr );
+ OUString aName( OUString::createFromAscii("IntroTest by Index-Access, Index = ") );
+ aName += OUString::valueOf( Index );
+ //aName = aName + StringToUString( String( iIndex ), CHARSET_SYSTEM );
+ p->setObjectName( aName );
+ pIndexAccessTab[Index] = p;
+ }
+ Reference< XIntroTest > xRet = pIndexAccessTab[Index];
+ aRetAny = makeAny( xRet );
+ }
+ return aRetAny;
+}
+
+void ImplIntroTest::addPropertiesChangeListener( const Sequence< OUString >& PropertyNames,
+ const Reference< XPropertiesChangeListener >& Listener )
+ throw(RuntimeException)
+//void ImplIntroTest::addPropertiesChangeListener
+//(const Sequence< UString >& PropertyNames, const XPropertiesChangeListenerRef& Listener)
+ //THROWS( (UsrSystemException) )
+{
+}
+
+void ImplIntroTest::removePropertiesChangeListener
+ ( const Reference< XPropertiesChangeListener >& Listener )
+ throw(RuntimeException)
+//void ImplIntroTest::removePropertiesChangeListener(const XPropertiesChangeListenerRef& Listener)
+ //THROWS( (UsrSystemException) )
+{
+}
+
+
+
+struct DefItem
+{
+ char* pName;
+ sal_Int32 nConcept;
+};
+
+// Spezial-Wert fuer Method-Concept, um "normale" Funktionen kennzeichnen zu koennen
+#define MethodConcept_NORMAL_IMPL 0x80000000
+
+
+// Test-Objekt liefern
+Any getIntrospectionTestObject( const Reference< XMultiServiceFactory > & xMgr )
+{
+ Any aObjAny;
+ Reference< XIntroTest > xTestObj = new ImplIntroTest( xMgr );
+ aObjAny.setValue( &xTestObj, ::getCppuType( (const Reference< XIntroTest > *)0 ) );
+ return aObjAny;
+}
+
+static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
+ Reference< XIdlReflection > xRefl, Reference< XIntrospection > xIntrospection )
+{
+ DefItem pPropertyDefs[] =
+ {
+ { "Factor", PropertyConcept::PROPERTYSET },
+ { "MyCount", PropertyConcept::PROPERTYSET },
+ { "Info", PropertyConcept::PROPERTYSET },
+ { "ObjectName", PropertyConcept::ATTRIBUTES },
+ { "FirstName", PropertyConcept::ATTRIBUTES },
+ { "LastName", PropertyConcept::ATTRIBUTES },
+ { "Age", PropertyConcept::ATTRIBUTES },
+ { "ChildrenCount", PropertyConcept::ATTRIBUTES },
+ { "FirstStruct", PropertyConcept::ATTRIBUTES },
+ { "SecondStruct", PropertyConcept::ATTRIBUTES },
+ { "Droenk", PropertyConcept::METHODS },
+ { "IntroTest", PropertyConcept::METHODS },
+ { "Bla", PropertyConcept::METHODS },
+ { "Blub", PropertyConcept::METHODS },
+ { "Gulp", PropertyConcept::METHODS },
+ { "Strings", PropertyConcept::METHODS },
+ { "MultiSequence", PropertyConcept::METHODS },
+ { "PropertySetInfo", PropertyConcept::METHODS },
+ { "ElementType", PropertyConcept::METHODS },
+ { "ElementNames", PropertyConcept::METHODS },
+ { "Count", PropertyConcept::METHODS },
+ { "Types", PropertyConcept::METHODS },
+ { "ImplementationId", PropertyConcept::METHODS },
+ { NULL, 0 }
+ };
+
+ // Tabelle der Property-Namen, die gefunden werden muessen
+ char* pDemandedPropNames[] =
+ {
+ "Factor",
+ "MyCount",
+ "Info",
+ "ObjectName",
+ "FirstName",
+ "LastName",
+ "Age",
+ "ChildrenCount",
+ "FirstStruct",
+ "SecondStruct",
+ "Droenk",
+ "IntroTest",
+ "Bla",
+ "Blub",
+ "Gulp",
+ "Strings",
+ "MultiSequence",
+ "PropertySetInfo",
+ "ElementType",
+ "ElementNames",
+ "Count",
+ "Types"
+ "ImplementationId"
+ };
+
+ char* pDemandedPropVals[] =
+ {
+ "3.140000",
+ "42",
+ "Hallo",
+ "IntroTest-Obj Nr. 0",
+ "Markus",
+ "Meyer",
+ "33",
+ "2",
+ "TYPE STRUCT",
+ "TYPE STRUCT",
+ "314",
+ "TYPE INTERFACE",
+ "42",
+ "111",
+ "99",
+ "TYPE SEQUENCE",
+ "TYPE SEQUENCE",
+ "TYPE INTERFACE",
+ "TYPE TYPE",
+ "TYPE SEQUENCE",
+ "10",
+ "TYPE SEQUENCE",
+ "TYPE SEQUENCE",
+ };
+
+ char* pDemandedModifiedPropVals[] =
+ {
+ "4.140000",
+ "43",
+ "Hallo (Modified!)",
+ "IntroTest-Obj Nr. 0 (Modified!)",
+ "Markus",
+ "Meyer",
+ "33",
+ "3",
+ "Wert wurde nicht modifiziert",
+ "Wert wurde nicht modifiziert",
+ "315",
+ "Wert wurde nicht modifiziert",
+ "42",
+ "112",
+ "99",
+ "Wert wurde nicht modifiziert",
+ "Wert wurde nicht modifiziert",
+ "Wert wurde nicht modifiziert",
+ "Wert wurde nicht modifiziert",
+ "Wert wurde nicht modifiziert",
+ "10",
+ "Wert wurde nicht modifiziert"
+ "Wert wurde nicht modifiziert"
+ };
+
+ char* pDemandedPropTypes[] =
+ {
+ "double",
+ "long",
+ "string",
+ "string",
+ "string",
+ "string",
+ "short",
+ "short",
+ "com.sun.star.beans.Property",
+ "com.sun.star.beans.PropertyValue",
+ "long",
+ "ModuleA.XIntroTest",
+ "short",
+ "short",
+ "short",
+ "[]string",
+ "[][][]short",
+ "com.sun.star.beans.XPropertySetInfo",
+ "type",
+ "[]string",
+ "long",
+ "[]type",
+ "[]byte",
+ };
+ //is() nDemandedPropCount = 22;
+
+
+ DefItem pMethodDefs[] =
+ {
+ { "queryInterface", MethodConcept_NORMAL_IMPL },
+ { "acquire", MethodConcept::DANGEROUS },
+ { "release", MethodConcept::DANGEROUS },
+ { "writeln", MethodConcept_NORMAL_IMPL },
+ { "getDroenk", MethodConcept::PROPERTY },
+ { "getIntroTest", MethodConcept::PROPERTY },
+ { "getUps", MethodConcept_NORMAL_IMPL },
+ { "setDroenk", MethodConcept::PROPERTY },
+ { "getBla", MethodConcept::PROPERTY },
+ { "setBla", MethodConcept_NORMAL_IMPL },
+ { "getBlub", MethodConcept::PROPERTY },
+ { "setBlub", MethodConcept::PROPERTY },
+ { "getGulp", MethodConcept::PROPERTY },
+ { "setGulp", MethodConcept_NORMAL_IMPL },
+ { "getTypeClass", MethodConcept_NORMAL_IMPL },
+ { "setTypeClass", MethodConcept_NORMAL_IMPL },
+ { "getStrings", MethodConcept::PROPERTY },
+ { "setStrings", MethodConcept::PROPERTY },
+ { "setStringsPerMethod", MethodConcept_NORMAL_IMPL },
+ { "getMultiSequence", MethodConcept::PROPERTY },
+ { "setMultiSequence", MethodConcept::PROPERTY },
+ { "addPropertiesChangeListener", MethodConcept::LISTENER },
+ { "removePropertiesChangeListener", MethodConcept::LISTENER },
+ { "getPropertySetInfo", MethodConcept::PROPERTY },
+ { "setPropertyValue", MethodConcept_NORMAL_IMPL },
+ { "getPropertyValue", MethodConcept_NORMAL_IMPL },
+ { "addPropertyChangeListener", MethodConcept::LISTENER },
+ { "removePropertyChangeListener", MethodConcept::LISTENER },
+ { "addVetoableChangeListener", MethodConcept::LISTENER },
+ { "removeVetoableChangeListener", MethodConcept::LISTENER },
+ { "getElementType", MethodConcept::PROPERTY | MethodConcept::NAMECONTAINER| MethodConcept::INDEXCONTAINER | MethodConcept::ENUMERATION },
+ { "hasElements", MethodConcept::NAMECONTAINER | MethodConcept::INDEXCONTAINER | MethodConcept::ENUMERATION },
+ { "getByName", MethodConcept::NAMECONTAINER },
+ { "getElementNames", MethodConcept::PROPERTY | MethodConcept::NAMECONTAINER },
+ { "hasByName", MethodConcept::NAMECONTAINER },
+ { "getCount", MethodConcept::PROPERTY | MethodConcept::INDEXCONTAINER },
+ { "getByIndex", MethodConcept::INDEXCONTAINER },
+ { "getTypes", MethodConcept::PROPERTY },
+ { "getImplementationId", MethodConcept::PROPERTY },
+ { "queryAdapter", MethodConcept_NORMAL_IMPL },
+ { NULL, 0 }
+ };
+
+ OString aErrorStr;
+
+ //******************************************************
+
+ // Test-Objekt anlegen
+ Any aObjAny = getIntrospectionTestObject( xMgr );
+
+ // Introspection-Service holen
+ //Reference< XMultiServiceFactory > xServiceManager(getProcessServiceManager(), USR_QUERY);
+ //Reference< XIntrospection > xIntrospection( xMgr->createInstance(L"com.sun.star.beans.Introspection"), UNO_QUERY );
+ //TEST_ENSHURE( xIntrospection.is(), "Creation of introspection instance failed" );
+ //if( !xIntrospection.is() )
+ //return sal_False;
+
+ // und unspecten
+ Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny );
+ xAccess = xIntrospection->inspect( aObjAny );
+ xAccess = xIntrospection->inspect( aObjAny );
+ TEST_ENSHURE( xAccess.is(), "introspection failed, no XIntrospectionAccess returned" );
+ if( !xAccess.is() )
+ return sal_False;
+
+ // Ergebnis der Introspection pruefen
+
+ // XPropertySet-UIK ermitteln
+ Type aType = getCppuType( (Reference< XPropertySet >*) NULL );
+ //typelib_InterfaceTypeDescription* pTypeDesc = NULL;
+ //aType.getDescription( (typelib_TypeDescription**)&pTypeDesc );
+ //Uik aPropertySetUik = *(Uik*)&pTypeDesc->aUik;
+ //typelib_typedescription_release( (typelib_TypeDescription*)pTypeDesc );
+
+ Reference< XInterface > xPropSetIface = xAccess->queryAdapter( aType );
+ //Reference< XInterface > xPropSetIface = xAccess->queryAdapter( aPropertySetUik );
+ Reference< XPropertySet > xPropSet( xPropSetIface, UNO_QUERY );
+ //XPropertySetRef xPropSet = (XPropertySet*)xPropSetIface->
+ // queryInterface( XPropertySet::getSmartUik() );
+ TEST_ENSHURE( xPropSet.is(), "Could not get XPropertySet by queryAdapter()" );
+
+ // XExactName
+ Reference< XExactName > xExactName( xAccess, UNO_QUERY );
+ TEST_ENSHURE( xExactName.is(), "Introspection unterstuetzt kein ExactName" );
+
+ // Schleife ueber alle Kombinationen von Concepts
+ for( sal_Int32 nConcepts = 0 ; nConcepts < 16 ; nConcepts++ )
+ {
+//printf( "*******************************************************\n" );
+//printf( "nConcepts = %ld\n", nConcepts );
+
+ // Wieviele Properties sollten es sein
+ sal_Int32 nDemandedPropCount = 0;
+ sal_Int32 iList = 0;
+ while( pPropertyDefs[ iList ].pName )
+ {
+ if( pPropertyDefs[ iList ].nConcept & nConcepts )
+ nDemandedPropCount++;
+ iList++;
+ }
+
+ if( xPropSet.is() )
+ {
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+ //Sequence<Property> aRetSeq = xPropSetInfo->getProperties();
+ Sequence<Property> aRetSeq = xAccess->getProperties( nConcepts );
+
+ sal_Int32 nLen = aRetSeq.getLength();
+
+ aErrorStr = "Expected to find ";
+ aErrorStr += OString::valueOf( nDemandedPropCount );
+ aErrorStr += " properties but found ";
+ aErrorStr += OString::valueOf( nLen );
+ TEST_ENSHURE( nLen == nDemandedPropCount, aErrorStr.getStr() );
+
+ // cout << "**********************************\n";
+ // cout << "*** Ergebnis der Introspection ***\n";
+ // cout << "**********************************\n";
+ // cout << "\nIntrospection hat " << nLen << " Properties gefunden:\n";
+
+ const Property* pProps = aRetSeq.getConstArray();
+ Any aPropVal;
+ sal_Int32 i;
+ iList = 0;
+ for( i = 0 ; i < nLen ; i++ )
+ {
+ const Property aProp = pProps[ i ];
+
+ // Naechste Passende Methode in der Liste suchen
+ while( pPropertyDefs[ iList ].pName )
+ {
+ if( pPropertyDefs[ iList ].nConcept & nConcepts )
+ break;
+ iList++;
+ }
+ sal_Int32 iDemanded = iList;
+ iList++;
+
+ OUString aPropName = aProp.Name;
+ OString aNameStr( aPropName.getStr(), aPropName.getLength(), RTL_TEXTENCODING_ASCII_US );
+ //UStringToString(aPropName, CHARSET_SYSTEM);
+
+//printf( "Property = %s\n", aNameStr.getStr() );
+
+ OString aDemandedName = pPropertyDefs[ iDemanded ].pName;
+ //OString aDemandedName = pDemandedPropNames[ i ];
+ aErrorStr = "Expected property \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\", found \"";
+ aErrorStr += aNameStr;
+ aErrorStr += "\"";
+ TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() );
+ // cout << "Property " << (i+1) << ": \"" << (const char*)UStringToString(aPropName, CHARSET_SYSTEM) << "\"";
+
+
+ Type aPropType = aProp.Type;
+ OString aTypeNameStr( OUStringToOString(aPropType.getTypeName(), RTL_TEXTENCODING_ASCII_US) );
+ //Reference< XIdlClass > xPropType = aProp.Type;
+ //OString aTypeNameStr( xPropType->getName(), xPropType->getName().getLength(), RTL_TEXTENCODING_ASCII_US );
+ OString aDemandedTypeNameStr = pDemandedPropTypes[ iDemanded ];
+ //OString aDemandedTypeNameStr = pDemandedPropTypes[ i ];
+ aErrorStr = "Property \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\", expected type >";
+ aErrorStr += aDemandedTypeNameStr;
+ aErrorStr += "< found type >";
+ aErrorStr += aTypeNameStr;
+ aErrorStr += "<";
+ TEST_ENSHURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() );
+ // cout << " (Prop-Typ: " << (const char*)UStringToString(xPropType->getName(), CHARSET_SYSTEM) << ")";
+
+ // Wert des Property lesen und ausgeben
+ aPropVal = xPropSet->getPropertyValue( aPropName );
+ // cout << "\n\tWert = " << (const char*)UStringToString(AnyToString( aPropVal, sal_True ), CHARSET_SYSTEM);
+
+ OString aValStr = OUStringToOString( AnyToString( aPropVal, sal_False, xMgr ), RTL_TEXTENCODING_ASCII_US );
+ OString aDemandedValStr = pDemandedPropVals[ iDemanded ];
+ //OString aDemandedValStr = pDemandedPropVals[ i ];
+ aErrorStr = "Property \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\", expected val >";
+ aErrorStr += aDemandedValStr;
+ aErrorStr += "< found val >";
+ aErrorStr += aValStr;
+ aErrorStr += "<";
+ TEST_ENSHURE( aValStr == aDemandedValStr, aErrorStr.getStr() );
+
+ // Wert pruefen und typgerecht modifizieren
+ TypeClass eType = aPropVal.getValueType().getTypeClass();
+ //Reference< XIdlClass > xIdlClass = aPropVal.getReflection()->getIdlClass();
+ //TypeClass eType = xIdlClass->getTypeClass();
+ Any aNewVal;
+ sal_Bool bModify = sal_True;
+ switch( eType )
+ {
+ case TypeClass_STRING:
+ {
+ OUString aStr;
+ aPropVal >>= aStr;
+ //OString aStr = aPropVal.getString();
+ aStr = aStr + OUString::createFromAscii(" (Modified!)");
+ aNewVal <<= aStr;
+ break;
+ }
+ case TypeClass_DOUBLE:
+ {
+ double d;
+ aPropVal >>= d;
+ aNewVal <<= d + 1.0;
+ break;
+ }
+ case TypeClass_SHORT:
+ {
+ sal_Int16 n;
+ aPropVal >>= n;
+ aNewVal <<= sal_Int16( n + 1 );
+ break;
+ }
+ case TypeClass_LONG:
+ {
+ sal_Int32 n;
+ aPropVal >>= n;
+ aNewVal <<= sal_Int32( n + 1 );
+ break;
+ }
+ default:
+ bModify = sal_False;
+ break;
+ }
+
+ // Modifizieren nur beim letzten Durchlauf
+ if( nConcepts == 15 )
+ {
+ // XExactName pruefen, dafuer alles gross machen
+ // (Introspection ist mit LowerCase implementiert, also anders machen)
+ OUString aUpperUStr = aPropName.toUpperCase();
+ OUString aExactName = xExactName->getExactName( aUpperUStr );
+ if( aExactName != aPropName )
+ {
+ aErrorStr = "Property \"";
+ aErrorStr += OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US );
+ aErrorStr += "\", not found as \"";
+ aErrorStr += OUStringToOString(aUpperUStr, RTL_TEXTENCODING_ASCII_US );
+ aErrorStr += "\" using XExactName";
+ TEST_ENSHURE( sal_False, aErrorStr.getStr() );
+ }
+ }
+ else
+ {
+ bModify = sal_False;
+ }
+
+ // Neuen Wert setzen, wieder lesen und ausgeben
+ if( bModify )
+ {
+ // cout.flush();
+
+ // 1.7.1999, UnknownPropertyException bei ReadOnly-Properties abfangen
+ try
+ {
+ xPropSet->setPropertyValue( aPropName, aNewVal );
+ }
+ catch(UnknownPropertyException e1)
+ {
+ }
+
+ aPropVal = xPropSet->getPropertyValue( aPropName );
+ // cout << "\n\tModifizierter Wert = " << (const char*) UStringToString(AnyToString( aPropVal, sal_True ), CHARSET_SYSTEM) << "\n";
+
+ OUString aStr = AnyToString( aPropVal, sal_False, xMgr );
+ OString aModifiedValStr = OUStringToOString( aStr, RTL_TEXTENCODING_ASCII_US );
+ OString aDemandedModifiedValStr = pDemandedModifiedPropVals[ i ];
+ aErrorStr = "Property \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\", expected modified val >";
+ aErrorStr += aDemandedModifiedValStr;
+ aErrorStr += "< found val >";
+ aErrorStr += aModifiedValStr;
+ aErrorStr += "<";
+ TEST_ENSHURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() );
+ }
+ else
+ {
+ // cout << "\n\tWert wurde nicht modifiziert\n";
+ }
+
+ // Checken, ob alle Properties auch einzeln gefunden werden
+ aErrorStr = "property \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\" not found with hasProperty()";
+ OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US );
+ sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, nConcepts );
+ //sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, PropertyConcept::ALL - PropertyConcept::DANGEROUS );
+ TEST_ENSHURE( bProperty, aErrorStr.getStr() );
+
+ aErrorStr = "property \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\" not equal to same Property in sequence returned by getProperties()";
+ try
+ {
+ Property aGetProp = xAccess->getProperty( aWDemandedName, nConcepts );
+ //Property aGetProp = xAccess->getProperty( aWDemandedName, PropertyConcept::ALL );
+ //TEST_ENSHURE( aGetProp == aProp , aErrorStr.getStr() );
+ }
+ catch (RuntimeException e1)
+ {
+ aErrorStr = "property \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\", exception was thrown when trying getProperty()";
+ TEST_ENSHURE( sal_False, aErrorStr.getStr() );
+ }
+
+ }
+ }
+ }
+
+ // Schleife ueber alle Kombinationen von Concepts
+ for( nConcepts = 0 ; nConcepts < 128 ; nConcepts++ )
+ {
+//printf( "*******************************************************\n" );
+//printf( "nConcepts = %ld\n", nConcepts );
+
+ // Das 2^6-Bit steht fuer "den Rest"
+ sal_Int32 nRealConcepts = nConcepts;
+ if( nConcepts & 0x40 )
+ nRealConcepts |= (0xFFFFFFFF - 0x3F);
+
+ // Wieviele Methoden sollten es sein
+ sal_Int32 nDemandedMethCount = 0;
+ sal_Int32 iList = 0;
+ while( pMethodDefs[ iList ].pName )
+ {
+ if( pMethodDefs[ iList ].nConcept & nRealConcepts )
+ nDemandedMethCount++;
+ iList++;
+ }
+
+ // Methoden-Array ausgeben
+ //aMethodSeq = xAccess->getMethods
+ Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( nRealConcepts );
+ //Sequence<XIdlMethodRef> aMethodSeq = xAccess->getMethods
+ // ( MethodConcept::ALL - MethodConcept::DANGEROUS - MethodConcept::PROPERTY );
+ sal_Int32 nLen = aMethodSeq.getLength();
+ // cout << "\n\n*** Methoden ***\n";
+ // cout << "Introspection hat " << nLen << " Methoden gefunden:\n";
+
+ aErrorStr = "Expected to find ";
+ aErrorStr += OString::valueOf( nDemandedMethCount );
+ aErrorStr += " methods but found ";
+ aErrorStr += OString::valueOf( nLen );
+ TEST_ENSHURE( nLen == nDemandedMethCount, aErrorStr.getStr() );
+
+ const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
+ sal_Int32 i;
+ iList = 0;
+
+ for( i = 0 ; i < nLen ; i++ )
+ {
+ // Methode ansprechen
+ const Reference< XIdlMethod >& rxMethod = pMethods[i];
+
+ // Methode ausgeben
+ OUString aMethName = rxMethod->getName();
+ OString aNameStr = OUStringToOString(aMethName, RTL_TEXTENCODING_ASCII_US );
+
+//printf( "Method = %s\n", aNameStr.getStr() );
+
+ // Naechste Passende Methode in der Liste suchen
+ while( pMethodDefs[ iList ].pName )
+ {
+ if( pMethodDefs[ iList ].nConcept & nRealConcepts )
+ break;
+ iList++;
+ }
+ OString aDemandedName = pMethodDefs[ iList ].pName;
+ iList++;
+
+ //OString aDemandedName = pDemandedMethNames[ i ];
+ aErrorStr = "Expected method \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\", found \"";
+ aErrorStr += aNameStr;
+ aErrorStr += "\"";
+ TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() );
+ // cout << "Methode " << (i+1) << ": " << (const char*) UStringToString(rxMethod->getReturnType()->getName(), CHARSET_SYSTEM)
+ // << " " << (const char*) UStringToString(rxMethod->getName(), CHARSET_SYSTEM) << "( ";
+
+ // Checken, ob alle Methoden auch einzeln gefunden werden
+ aErrorStr = "method \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\" not found with hasMethod()";
+ OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US );
+ sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, nRealConcepts );
+ //sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, MethodConcept::ALL );
+ TEST_ENSHURE( bMethod, aErrorStr.getStr() );
+
+ aErrorStr = "method \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\" not equal to same method in sequence returned by getMethods()";
+ try
+ {
+ Reference< XIdlMethod > xGetMethod = xAccess->getMethod( aWDemandedName, nRealConcepts );
+ //XIdlMethodRef xGetMethod = xAccess->getMethod( aWDemandedName, MethodConcept::ALL );
+ TEST_ENSHURE( xGetMethod == rxMethod , aErrorStr.getStr() );
+ }
+ catch (RuntimeException e1)
+ {
+ aErrorStr = "method \"";
+ aErrorStr += aDemandedName;
+ aErrorStr += "\", exception was thrown when trying getMethod()";
+ TEST_ENSHURE( sal_False, aErrorStr.getStr() );
+ }
+ }
+ }
+
+ // Listener-Klassen ausgeben
+ Sequence< Type > aClassSeq = xAccess->getSupportedListeners();
+ sal_Int32 nLen = aClassSeq.getLength();
+ // cout << "\n\n*** Anmeldbare Listener ***\n";
+ // cout << "Introspection hat " << nLen << " Listener gefunden:\n";
+
+ const Type* pListeners = aClassSeq.getConstArray();
+ for( sal_Int32 i = 0 ; i < nLen ; i++ )
+ {
+ // Methode ansprechen
+ const Type& aListenerType = pListeners[i];
+
+ // Namen besorgen
+ OUString aListenerClassName = aListenerType.getTypeName();
+ // cout << "Listener " << (i+1) << ": " << (const char*)UStringToString(aListenerClassName, CHARSET_SYSTEM) << "\n";
+ }
+
+
+ // Performance bei hasMethod testen.
+ //CheckMethodPerformance( xAccess, "queryInterface", 100000 );
+ //CheckMethodPerformance( xAccess, "getIdlClasses", 100000 );
+
+ // cout.flush();
+
+
+
+
+ return sal_True;
+}
+
+
+
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int __cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( OUString::createFromAscii("stoctest.rdb") ) );
+
+ sal_Bool bSucc = sal_False;
+ try
+ {
+ Reference< XImplementationRegistration > xImplReg(
+ xMgr->createInstance( OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration") ), UNO_QUERY );
+ VOS_ENSHURE( xImplReg.is(), "### no impl reg!" );
+
+ // Register services
+ OUString libName;
+
+ // CoreReflection
+ ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("corefl"), libName);
+ xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
+ libName, Reference< XSimpleRegistry >() );
+ Reference< XIdlReflection > xRefl( xMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY );
+ VOS_ENSHURE( xRefl.is(), "### no corereflection!" );
+
+ // Introspection
+ ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("insp"), libName);
+ xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
+ libName, Reference< XSimpleRegistry >() );
+ Reference< XIntrospection > xIntrosp( xMgr->createInstance( OUString::createFromAscii("com.sun.star.beans.Introspection") ), UNO_QUERY );
+ VOS_ENSHURE( xRefl.is(), "### no corereflection!" );
+
+ bSucc = test_introsp( xMgr, xRefl, xIntrosp );
+ //bSucc = test_corefl( xRefl );
+ }
+ catch (Exception & rExc)
+ {
+ VOS_ENSHURE( sal_False, "### exception occured!" );
+ OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ VOS_TRACE( "### exception occured: " );
+ VOS_TRACE( aMsg.getStr() );
+ VOS_TRACE( "\n" );
+ }
+
+ Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+
+ printf( "testintrosp %s !\n", (bSucc ? "succeeded" : "failed") );
+ return (bSucc ? 0 : -1);
+}
+
+
+
+
+
+
+
+//*****************************
+//*** TEST-Implementationen ***
+//*****************************
+// Bleibt auf Dauer nicht drin, dient als exportierbare Test-Klasse
+// z.B. fuer Basic-Anbindung
+
+
+
+
+
+
diff --git a/stoc/test/testintrosp.idl b/stoc/test/testintrosp.idl
new file mode 100644
index 000000000000..74d3ee7610e3
--- /dev/null
+++ b/stoc/test/testintrosp.idl
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * $RCSfile: testintrosp.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_beans_XIntroTest_idl__
+#define __com_sun_star_beans_XIntroTest_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_beans_Property_idl__
+#include <com/sun/star/beans/Property.idl>
+#endif
+
+#ifndef __com_sun_star_beans_PropertyValue_idl__
+#include <com/sun/star/beans/PropertyValue.idl>
+#endif
+
+#ifndef __com_sun_star_uno_TypeClass_idl__
+#include <com/sun/star/uno/TypeClass.idl>
+#endif
+
+#ifndef __com_sun_star_beans_XPropertiesChangeListener_idl__
+#include <com/sun/star/beans/XPropertiesChangeListener.idl>
+#endif
+
+
+//=============================================================================
+
+module ModuleA
+{
+//module com { module sun { module star { module beans {
+
+//interface XPropertyChangeListener;
+//interface XPropertiesChangeListener;
+
+//=============================================================================
+/** This is a test interface for introspection.
+
+ <p>IMPORTANT: FOR TEST ONLY!
+
+ <p>The following interface is just for testing purposes. It will not
+ stay in the product. It is only used as an exportable test class,
+ i.e. for BASIC integration.
+
+ @deprecated
+*/
+[ uik(E227A4AB-33D6-11D1-AABE00A0-249D5590), ident( "XIntroTest", 1.0 ) ]
+interface XIntroTest: com::sun::star::uno::XInterface
+{
+ //-------------------------------------------------------------------------
+ /** contains the ID-String of the implementation.
+ */
+ [attribute] string ObjectName;
+
+ //-------------------------------------------------------------------------
+ /** contains the first name of a person.
+ */
+ [readonly, attribute] string FirstName;
+
+ //-------------------------------------------------------------------------
+ /** contains the last name of a person.
+ */
+ [readonly, attribute] string LastName;
+
+ //-------------------------------------------------------------------------
+ /** contains the age of a person.
+ */
+ [readonly, attribute] short Age;
+
+ //-------------------------------------------------------------------------
+ /** contains the number of children person has.
+ */
+ [attribute] short ChildrenCount;
+
+ //-------------------------------------------------------------------------
+ /** contains a struct of type Property.
+ */
+ [attribute] com::sun::star::beans::Property FirstStruct;
+
+ //-------------------------------------------------------------------------
+ /** contains a struct of type PropertyValue.
+ */
+ [attribute] com::sun::star::beans::PropertyValue SecondStruct;
+
+ //-------------------------------------------------------------------------
+ /** Ausgabe-Methode
+ */
+ void writeln( [in] string Text );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ long getDroenk();
+
+ //-------------------------------------------------------------------------
+ /** Weitere Introspection-Test-Objekt holen
+ */
+ XIntroTest getIntroTest();
+ //com::sun::star::beans::XIntroTest getIntroTest();
+
+ //-------------------------------------------------------------------------
+ /** !!! No property, because parameter exists
+ */
+ long getUps( [in] long l );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ void setDroenk( [in] long l );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ short getBla();
+
+ //-------------------------------------------------------------------------
+ /** !!! Not the set method for property Bla, because param type != return type.
+ */
+ void setBla( [in] long n );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ short getBlub();
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ void setBlub( [in] short n );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ short getGulp();
+
+ //-------------------------------------------------------------------------
+ /** !!! Not the set method for property Gulp, because return type != void.
+ */
+ short setGulp( [in] short n );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ com::sun::star::uno::TypeClass getTypeClass( [in] short n );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ void setTypeClass( [in] com::sun::star::uno::TypeClass t,
+ [in] double d1,
+ [in] double d2 );
+
+ //-------------------------------------------------------------------------
+ /**
+ */
+ sequence<string> getStrings();
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ void setStrings( [in] sequence<string> Strings );
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ void setStringsPerMethod( [in] sequence<string> Strings,
+ [in] short n );
+
+ //-------------------------------------------------------------------------
+ /**
+ */
+ sequence< sequence< sequence< short > > > getMultiSequence();
+
+ //-------------------------------------------------------------------------
+ /** ...
+ */
+ void setMultiSequence( [in] sequence< sequence< sequence< short > > > Seq );
+
+ //-------------------------------------------------------------------------
+ /**Add a PropertiesChangeListener
+ */
+ [oneway] void addPropertiesChangeListener( [in] sequence< string > PropertyNames,
+ [in] com::sun::star::beans::XPropertiesChangeListener Listener );
+
+ //-------------------------------------------------------------------------
+ /**Remove a PropertiesChangeListener
+ */
+ [oneway] void removePropertiesChangeListener( [in] com::sun::star::beans::XPropertiesChangeListener Listener );
+
+};
+
+//=============================================================================
+
+};
+//}; }; }; };
+
+#endif
diff --git a/stoc/test/testloader.cxx b/stoc/test/testloader.cxx
new file mode 100644
index 000000000000..c2a664f46eed
--- /dev/null
+++ b/stoc/test/testloader.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: testloader.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#ifndef _VOS_MODULE_HXX_
+#include <vos/module.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+
+
+#include <com/sun/star/loader/XImplementationLoader.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+#if defined ( UNX ) || defined ( MAC )
+#include <limits.h>
+#define _MAX_PATH PATH_MAX
+#endif
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::loader;
+using namespace com::sun::star::lang;
+using namespace vos;
+using namespace rtl;
+
+#ifdef _DEBUG
+#define TEST_ENSHURE(c, m) VOS_ENSHURE(c, m)
+#else
+#define TEST_ENSHURE(c, m) VOS_VERIFY(c)
+#endif
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference<XInterface> xIFace;
+
+ OModule* pModule = new OModule(OUString());
+
+ OUString dllName;
+ NAMESPACE_VOS(ORealDynamicLoader)::computeLibraryName(OUString::createFromAscii("cpld"), dllName);
+
+ if (pModule->load(dllName))
+ {
+ // try to get provider from module
+ component_getFactoryFunc pCompFactoryFunc = (component_getFactoryFunc)
+ pModule->getSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) );
+
+ if (pCompFactoryFunc)
+ {
+ XSingleServiceFactory * pRet = (XSingleServiceFactory *)(*pCompFactoryFunc)(
+ "com.sun.star.comp.stoc.DLLComponentLoader", 0, 0 );
+ if (pRet)
+ {
+ xIFace = pRet;
+ pRet->release();
+ }
+ }
+ }
+
+ TEST_ENSHURE( xIFace.is(), "testloader error1");
+
+ Reference<XSingleServiceFactory> xFactory( Reference<XSingleServiceFactory>::query(xIFace) );
+
+ TEST_ENSHURE( xFactory.is(), "testloader error2");
+
+ Reference<XInterface> xLoader = xFactory->createInstance();
+
+ TEST_ENSHURE( xLoader.is(), "testloader error3");
+
+ Reference<XServiceInfo> xServInfo( Reference<XServiceInfo>::query(xLoader) );
+
+ TEST_ENSHURE( xServInfo.is(), "testloader error4");
+
+ TEST_ENSHURE( xServInfo->getImplementationName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.comp.stoc.DLLComponentLoader") ), "testloader error5");
+ TEST_ENSHURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")) ), "testloader error6");
+ TEST_ENSHURE( xServInfo->getSupportedServiceNames().getLength() == 1, "testloader error7");
+
+ xIFace.clear();
+ xFactory.clear();
+ xLoader.clear();
+ xServInfo.clear();
+
+ delete pModule;
+
+ printf("Test Dll ComponentLoader, OK!\n");
+
+ return(0);
+}
+
+
diff --git a/stoc/test/testproxyfac.cxx b/stoc/test/testproxyfac.cxx
new file mode 100644
index 000000000000..61772e08be74
--- /dev/null
+++ b/stoc/test/testproxyfac.cxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * $RCSfile: testproxyfac.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/queryinterface.hxx>
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/util/XProxyFactory.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <stdio.h>
+
+
+using namespace rtl;
+using namespace cppu;
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+
+
+static sal_Int32 s_n = 0;
+
+//==================================================================================================
+class Test1 : public WeakImplHelper2< XServiceInfo, XProxyFactory >
+{
+public:
+ virtual ~Test1()
+ { ++s_n; }
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw (RuntimeException)
+ { return OUString::createFromAscii( "a" ); }
+ virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException)
+ { return sal_False; }
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException)
+ { return Sequence< OUString >(); }
+ // XProxyFactory
+ virtual Reference< XAggregation > SAL_CALL createProxy( const Reference< XInterface > & xTarget ) throw (RuntimeException)
+ { return Reference< XAggregation >(); }
+};
+//==================================================================================================
+class Test2 : public WeakImplHelper1< XServiceInfo >
+{
+ Reference< XAggregation > _xAgg;
+public:
+ static Reference< XInterface > createTest2( const Reference< XAggregation > & xAgg )
+ {
+ Test2 * p = new Test2();
+ Reference< XInterface > xRet( (XInterface *)(XServiceInfo *)p );
+ p->_xAgg = xAgg;
+ xAgg->release(); // ref to 1
+ p->acquire(); // for xAgg dtor
+ p->_xAgg->setDelegator( xRet );
+ return xRet;
+ }
+ virtual ~Test2()
+ { ++s_n; }
+
+ virtual Any SAL_CALL queryInterface( const Type & rType ) throw (RuntimeException)
+ {
+ Any aRet( OWeakObject::queryInterface( rType ) );
+ if (! aRet.hasValue())
+ {
+ aRet = cppu::queryInterface( rType, (XServiceInfo *)this );
+ if (! aRet.hasValue())
+ return _xAgg->queryAggregation( rType );
+ }
+ return aRet;
+ }
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw (RuntimeException)
+ { return OUString::createFromAscii( "b" ); }
+ virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException)
+ { return sal_False; }
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException)
+ { return Sequence< OUString >(); }
+};
+
+static sal_Bool test_proxyfac( const Reference< XProxyFactory > & xProxyFac )
+{
+ {
+ Reference< XServiceInfo > x1( new Test1() );
+ Reference< XServiceInfo > x1p( xProxyFac->createProxy( x1 ), UNO_QUERY );
+// if (x1->getImplementationName() != x1p->getImplementationName() ||
+// !x1->getImplementationName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ))
+// {
+// return sal_False;
+// }
+// if (x1 == x1p)
+// return sal_False;
+ //
+
+ Reference< XAggregation > xAgg( xProxyFac->createProxy( x1 ) );
+ Reference< XInterface > xMaster( Test2::createTest2( xAgg ) );
+
+ Reference< XServiceInfo > x2( xMaster, UNO_QUERY );
+ Test2 * pt2 = static_cast< Test2 * >( x2.get() );
+
+ if ((Test2 *)(XServiceInfo *)xMaster.get() != pt2 ||
+ !pt2->getImplementationName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("b") ) ||
+ !x2->getImplementationName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("b") ))
+ {
+ return sal_False;
+ }
+
+ if (x2 == x1 || x2 == x1p)
+ return sal_False;
+ if (x2 != xAgg)
+ return sal_False;
+
+ if (x1->getImplementationName() == x2->getImplementationName() ||
+ x1p->getImplementationName() == x2->getImplementationName())
+ {
+ return sal_False;
+ }
+
+ if (s_n)
+ return sal_False;
+ }
+ return s_n == 2;
+}
+
+#ifdef UNX
+#define REG_PREFIX "lib"
+#define DLL_POSTFIX ".so"
+#else
+#define REG_PREFIX ""
+#define DLL_POSTFIX ".dll"
+#endif
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int __cdecl main( int argc, char * argv[] )
+#endif
+{
+ Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb") ) ) );
+
+ sal_Bool bSucc = sal_False;
+ try
+ {
+ Reference< XImplementationRegistration > xImplReg(
+ xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration") ) ), UNO_QUERY );
+ OSL_ENSHURE( xImplReg.is(), "### no impl reg!" );
+
+ OUString aLibName( OUString::createFromAscii(REG_PREFIX) );
+ aLibName += OUString::createFromAscii("proxyfac");
+#ifndef OS2
+ aLibName += OUString::createFromAscii(DLL_POSTFIX);
+#endif
+ xImplReg->registerImplementation(
+ OUString::createFromAscii("com.sun.star.loader.SharedLibrary"), aLibName, Reference< XSimpleRegistry >() );
+
+ Reference< XProxyFactory > xProxyFac( xMgr->createInstance( OUString::createFromAscii("com.sun.star.util.ProxyFactory") ), UNO_QUERY );
+ OSL_ENSHURE( xProxyFac.is(), "### no proxy factory!" );
+
+ bSucc = test_proxyfac( xProxyFac );
+ }
+ catch (Exception & rExc)
+ {
+ OSL_ENSHURE( sal_False, "### exception occured!" );
+ OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ OSL_TRACE( "### exception occured: " );
+ OSL_TRACE( aMsg.getStr() );
+ OSL_TRACE( "\n" );
+ }
+
+ Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
+
+ printf( "testproxyfac %s !\n", (bSucc ? "succeeded" : "failed") );
+ return (bSucc ? 0 : -1);
+}
diff --git a/stoc/test/testregistry.cxx b/stoc/test/testregistry.cxx
new file mode 100644
index 000000000000..8ff0cf91bd36
--- /dev/null
+++ b/stoc/test/testregistry.cxx
@@ -0,0 +1,671 @@
+/*************************************************************************
+ *
+ * $RCSfile: testregistry.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef _VOS_MODULE_HXX_
+#include <vos/module.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _VOS_PROCESS_HXX_
+#include <vos/process.hxx>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+#ifndef _REGISTRY_REGISTRY_HXX_
+#include <registry/registry.hxx>
+#endif
+
+
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
+#include <cppuhelper/servicefactory.hxx>
+#endif
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#if defined ( UNX ) || defined ( MAC )
+#include <limits.h>
+#define _MAX_PATH PATH_MAX
+#endif
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace vos;
+using namespace rtl;
+
+#ifdef _DEBUG
+#define TEST_ENSHURE(c, m) VOS_ENSHURE(c, m)
+#else
+#define TEST_ENSHURE(c, m) VOS_VERIFY(c)
+#endif
+
+OString userRegEnv("STAR_USER_REGISTRY=");
+
+OUString getExePath()
+{
+ OStartupInfo startupInfo;
+ OUString exe;
+
+ VOS_VERIFY(startupInfo.getExecutableFile(exe) == OStartupInfo::E_None);
+
+#if defined(WIN32) || defined(__OS2__) || defined(WNT)
+ exe = exe.copy(0, exe.getLength() - 16);
+#else
+ exe = exe.copy(0, exe.getLength() - 12);
+#endif
+ return exe;
+}
+
+void setStarUserRegistry()
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey, rKey, rKey2;
+
+ OUString userReg = getExePath();
+ userReg += OUString::createFromAscii("user.rdb");
+ if(myRegistry->open(userReg, REG_READWRITE))
+ {
+ TEST_ENSHURE(!myRegistry->create(userReg), "setStarUserRegistry error 1");
+ }
+
+ TEST_ENSHURE(!myRegistry->close(), "setStarUserRegistry error 9");
+ delete myRegistry;
+
+ userRegEnv += OUStringToOString(userReg, RTL_TEXTENCODING_ASCII_US);
+ putenv((char *)userRegEnv.getStr());
+}
+
+void setLinkInDefaultRegistry(const OUString& linkName, const OUString& linkTarget)
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey;
+
+ OUString appReg = getExePath();
+ appReg += OUString::createFromAscii("stoctest.rdb");
+
+ TEST_ENSHURE(!myRegistry->open(appReg, REG_READWRITE), "setLinkInDefaultRegistry error 1");
+ TEST_ENSHURE(!myRegistry->openRootKey(rootKey), "setLinkInDefaultRegistry error 2");
+
+ TEST_ENSHURE(!rootKey.createLink(linkName, linkTarget), "setLinkInDefaultRegistry error 3");
+
+ TEST_ENSHURE(!rootKey.closeKey(), "setLinkInDefaultRegistry error 4");
+ TEST_ENSHURE(!myRegistry->close(), "setLinkInDefaultRegistry error 5");
+
+ delete myRegistry;
+}
+
+
+void test_SimpleRegistry()
+{
+ Reference<XInterface> xIFace;
+ OModule* pModule = new OModule(OUString());
+
+ OUString dllName;
+ NAMESPACE_VOS(ORealDynamicLoader)::computeLibraryName(OUString::createFromAscii("simreg"), dllName);
+
+ if (pModule->load(dllName))
+ {
+ // try to get provider from module
+ component_getFactoryFunc pCompFactoryFunc = (component_getFactoryFunc)
+ pModule->getSymbol( OUString::createFromAscii(COMPONENT_GETFACTORY) );
+
+ if (pCompFactoryFunc)
+ {
+ XSingleServiceFactory * pRet = (XSingleServiceFactory *)(*pCompFactoryFunc)(
+ "com.sun.star.comp.stoc.SimpleRegistry", 0, 0 );
+ if (pRet)
+ {
+ xIFace = pRet;
+ pRet->release();
+ }
+ }
+ }
+
+ TEST_ENSHURE( xIFace.is(), "test_SimpleRegistry error1");
+
+ Reference<XSingleServiceFactory> xFactory( Reference<XSingleServiceFactory>::query(xIFace) );
+ xIFace.clear();
+
+ TEST_ENSHURE( xFactory.is(), "testloader error11");
+
+ Reference<XInterface> xIFace2 = xFactory->createInstance();
+ xFactory.clear();
+
+ TEST_ENSHURE( xIFace2.is(), "testloader error12");
+
+ Reference<XServiceInfo> xServInfo( Reference<XServiceInfo>::query(xIFace2) );
+
+ TEST_ENSHURE( xServInfo.is(), "test_SimpleRegistry error2");
+
+ TEST_ENSHURE( xServInfo->getImplementationName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.comp.stoc.SimpleRegistry") ), "test_SimpleRegistry error3");
+ TEST_ENSHURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry"))), "test_SimpleRegistry error4");
+ TEST_ENSHURE( xServInfo->getSupportedServiceNames().getLength() == 1, "test_SimpleRegistry error5");
+ xServInfo.clear();
+
+ Reference<XSimpleRegistry> xReg( Reference<XSimpleRegistry>::query(xIFace2) );
+ xIFace2.clear();
+
+ TEST_ENSHURE( xReg.is(), "test_SimpleRegistry error6");
+
+ try
+ {
+ xReg->open(OUString( RTL_CONSTASCII_USTRINGPARAM("testreg.rdb") ), sal_False, sal_True);
+
+ TEST_ENSHURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 7" );
+ TEST_ENSHURE( xReg->isReadOnly() == sal_False, "test_SimpleRegistry error 8" );
+
+ Reference<XRegistryKey> xRootKey(xReg->getRootKey());
+ TEST_ENSHURE( xRootKey->isValid(), "test_SimpleRegistry error 9" );
+
+ Reference<XRegistryKey> xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FirstKey") ));
+
+ Reference<XRegistryKey> xSubKey = xKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FirstSubKey") ));
+ xSubKey->setLongValue(123456789);
+
+ xSubKey = xKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("SecondSubKey") ));
+ xSubKey->setAsciiValue(OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein acsii value") ));
+
+ xSubKey = xKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("ThirdSubKey") ));
+ xSubKey->setStringValue(OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein unicode value") ));
+
+ xSubKey = xKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FourthSubKey") ));
+ Sequence<sal_Int8> aSeq((sal_Int8*)"ich bin ein binary value", 25);
+ xSubKey->setBinaryValue(aSeq);
+
+ Sequence<OUString> seqNames = xKey->getKeyNames();
+ Sequence< Reference<XRegistryKey> > seqKeys = xKey->openKeys();
+
+ OUString name;
+ for (sal_Int32 i=0; i < seqNames.getLength(); i++)
+ {
+ name = seqNames.getArray()[i];
+ xSubKey = seqKeys.getArray()[i];
+
+ if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/FirstSubKey") ))
+ {
+ TEST_ENSHURE( xSubKey->getLongValue() == 123456789,
+ "test_SimpleRegistry error 10" );
+ } else
+ if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/SecondSubKey") ))
+ {
+ TEST_ENSHURE( xSubKey->getAsciiValue() == OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein acsii value") ),
+ "test_SimpleRegistry error 11" );
+ } else
+ if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/ThirdSubKey") ))
+ {
+ TEST_ENSHURE( xSubKey->getStringValue() == OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein unicode value") ),
+ "test_SimpleRegistry error 12" );
+ } else
+ if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/FourthSubKey") ))
+ {
+ Sequence<sal_Int8> seqByte = xSubKey->getBinaryValue();
+ TEST_ENSHURE(!strcmp(((const char*)seqByte.getArray()), "ich bin ein binary value"),
+ "test_SimpleRegistry error 13" );
+ }
+
+ seqKeys.getArray()[i]->closeKey();
+ }
+
+ xKey->closeKey();
+
+ xRootKey->deleteKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FirstKey") ));
+ xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("SecondFirstKey" )));
+
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("SecondKey") ));
+ sal_Int32 pLongs[3] = {123, 456, 789};
+ Sequence<sal_Int32> seqLongs(pLongs, 3);
+ xKey->setLongListValue(seqLongs);
+
+ Sequence<sal_Int32> seqLongs2;
+ seqLongs2 = xKey->getLongListValue();
+ TEST_ENSHURE( seqLongs.getLength() == 3, "test_SimpleRegistry error 14" );
+ TEST_ENSHURE( seqLongs.getArray()[0] == 123, "test_SimpleRegistry error 15" );
+ TEST_ENSHURE( seqLongs.getArray()[1] == 456, "test_SimpleRegistry error 16" );
+ TEST_ENSHURE( seqLongs.getArray()[2] == 789, "test_SimpleRegistry error 17" );
+
+
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("ThirdKey") ));
+ OUString pAscii[3];
+ pAscii[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") );
+ pAscii[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") );
+ pAscii[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("ich") );
+
+ Sequence<OUString> seqAscii(pAscii, 3);
+ xKey->setAsciiListValue(seqAscii);
+
+ Sequence<OUString> seqAscii2;
+ seqAscii2 = xKey->getAsciiListValue();
+ TEST_ENSHURE( seqAscii2.getLength() == 3, "test_SimpleRegistry error 18" );
+ TEST_ENSHURE( seqAscii2.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), "test_SimpleRegistry error 19");
+ TEST_ENSHURE( seqAscii2.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), "test_SimpleRegistry error 20");
+ TEST_ENSHURE( seqAscii2.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich") ), "test_SimpleRegistry error 21");
+
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FourthKey") ));
+ OUString pUnicode[3];
+ pUnicode[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") );
+ pUnicode[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") );
+ pUnicode[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("ich als unicode") );
+
+ Sequence<OUString> seqUnicode(pUnicode, 3);
+ xKey->setStringListValue(seqUnicode);
+
+ Sequence<OUString> seqUnicode2;
+ seqUnicode2 = xKey->getStringListValue();
+ TEST_ENSHURE( seqUnicode2.getLength() == 3, "test_SimpleRegistry error 22" );
+ TEST_ENSHURE( seqUnicode2.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), "test_SimpleRegistry error 23");
+ TEST_ENSHURE( seqUnicode2.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), "test_SimpleRegistry error 24");
+ TEST_ENSHURE( seqUnicode2.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich als unicode") ), "test_SimpleRegistry error 25");
+
+
+ xReg->open(OUString( RTL_CONSTASCII_USTRINGPARAM("testreg2.rdb") ), False, True);
+ TEST_ENSHURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 25" );
+ xRootKey = xReg->getRootKey();
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("ThirdKey/FirstSubKey/WithSubSubKey") ));
+ xKey->closeKey();
+ xRootKey->closeKey();
+ xReg->close();
+
+ xReg->open(OUString( RTL_CONSTASCII_USTRINGPARAM("testreg.rdb") ), False, False);
+ TEST_ENSHURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 26" );
+
+ xReg->mergeKey(OUString(), OUString( RTL_CONSTASCII_USTRINGPARAM("testreg2.rdb") ));
+
+ xRootKey = xReg->getRootKey();
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FirstKey/SecondSubKey") ));
+ TEST_ENSHURE( !xKey.is(), "test_SimpleRegistry error 27" );
+
+ // Test Links
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FifthKey") ));
+ xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("MyFirstLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey") ));
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink") ));
+ TEST_ENSHURE( xKey->isValid(), "test_SimpleRegistry error 27" );
+ TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey") ), "test_SimpleRegistry error 28" );
+
+ xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ));
+
+ TEST_ENSHURE( xKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") ))
+ == OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ), "test_SimpleRegistry error 29" );
+
+ try
+ {
+ TEST_ENSHURE( xKey->getResolvedName(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink/BlaBlaBla") ))
+ == OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink/BlaBlaBla") ), "test_SimpleRegistry error 30" );
+ }
+ catch(InvalidRegistryException&)
+ {
+ }
+
+ xRootKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/MyThirdLink") ));
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("SixthKey") ));
+ xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("MyThirdLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ));
+
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/SixthSubKey") ));
+
+ try
+ {
+ xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") ));
+ }
+ catch(InvalidRegistryException&)
+ {
+ }
+
+ TEST_ENSHURE( xRootKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") ))
+ == OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ), "test_SimpleRegistry error 31" );
+
+ xRootKey->deleteLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") ));
+
+ xRootKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey/WithSubSubKey") ));
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("SixthKey") ));
+ seqNames = xKey->getKeyNames();
+ seqKeys = xKey->openKeys();
+
+ TEST_ENSHURE( seqNames.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/SixthSubKey") ),
+ "test_SimpleRegistry error 32" );
+ TEST_ENSHURE( seqNames.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/MyThirdLink") ),
+ "test_SimpleRegistry error 33" );
+
+ TEST_ENSHURE( seqKeys.getArray()[0]->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/SixthSubKey") ),
+ "test_SimpleRegistry error 34" );
+ TEST_ENSHURE( seqKeys.getArray()[1]->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey/WithSubSubKey") ),
+ "test_SimpleRegistry error 35" );
+
+ xRootKey->deleteLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ));
+
+// xRootKey->closeKey();
+
+// xReg->open(L"testreg2.rdb", False, True);
+// xReg->destroy();
+ }
+ catch(InvalidRegistryException&)
+ {
+ TEST_ENSHURE(0, "exception InvalidRegistryExcption raised while doing test_SimpleRegistry");
+ }
+ catch(InvalidValueException&)
+ {
+ TEST_ENSHURE(0, "exception InvalidValueExcption raised while doing test_SimpleRegistry()");
+ }
+
+ xReg.clear();
+
+ delete pModule;
+
+ printf("Test SimpleRegistry, OK!\n");
+}
+
+
+void test_DefaultRegistry()
+{
+// Reference < XMultiServiceFactory > rSMgr = ::cppu::createDefaultRegistryServiceFactory( );
+
+ // Test NestedRegistry
+ OUString exePath( getExePath() );
+ OUString userRdb(exePath);
+ OUString applicatRdb(exePath);
+
+ userRdb += OUString::createFromAscii("user.rdb");
+ applicatRdb += OUString::createFromAscii("stoctest.rdb");
+
+ Reference < XMultiServiceFactory > rSMgr = ::cppu::createRegistryServiceFactory( userRdb, applicatRdb, sal_False,
+ OUString::createFromAscii("//./e:/src596/stoc/wntmsci3/bin") );
+
+ Reference< XPropertySet > xPropSet( rSMgr, UNO_QUERY);
+ TEST_ENSHURE( xPropSet.is(), "test_DefaultRegistry error0");
+
+ Any aPropertyAny( xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Registry")) ) );
+ TEST_ENSHURE( aPropertyAny.hasValue(), "test_DefaultRegistry error1");
+
+ Reference<XSimpleRegistry> xReg;
+ aPropertyAny >>= xReg;
+ TEST_ENSHURE( xReg.is(), "test_DefaultRegistry error1a");
+
+ Reference<XServiceInfo> xServInfo( Reference<XServiceInfo>::query(xReg) );
+
+ TEST_ENSHURE( xServInfo.is(), "test_DefaultRegistry error2");
+
+ TEST_ENSHURE( xServInfo->getImplementationName() == OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.NestedRegistry") ), "test_DefualtRegistry error3");
+ TEST_ENSHURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.NestedRegistry") )), "test_DefaultRegistry error4");
+ TEST_ENSHURE( xServInfo->getSupportedServiceNames().getLength() == 1, "test_DefaultRegistry error5");
+ xServInfo.clear();
+
+ TEST_ENSHURE( xReg.is(), "test_DefaultRegistry error6");
+
+ try
+ {
+ Reference<XRegistryKey> xRootKey(xReg->getRootKey());
+
+ Reference<XRegistryKey> xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/UCR/com/sun/star/registry/XSimpleRegistry") ));
+
+ TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/UCR/com/sun/star/registry/XSimpleRegistry") ),
+ "test_DefaultRegistry error 7" );
+
+ xReg->mergeKey(OUString( RTL_CONSTASCII_USTRINGPARAM("Test") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("testreg.rdb") ));
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("Test/ThirdKey/FirstSubKey/WithSubSubKey") ));
+ if (xKey.is())
+ xKey->setLongValue(123456789);
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("Test/ThirdKey/FirstSubKey") ));
+ if (xKey.is())
+ {
+ xKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("SecondSubSubKey") ));
+
+ Sequence<OUString> seqNames = xKey->getKeyNames();
+
+ TEST_ENSHURE( seqNames.getLength() == 2, "test_DefaultRegistry error 8" );
+ }
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey") ));
+ if (xKey.is())
+ {
+ RegistryValueType valueType = xKey->getValueType();
+ TEST_ENSHURE( valueType == RegistryValueType_ASCIILIST, "test_DefaultRegistry error 9" );
+
+ Sequence<OUString> seqValue = xKey->getAsciiListValue();
+
+ TEST_ENSHURE( seqValue.getLength() == 3, "test_DefaultRegistry error 10" );
+ TEST_ENSHURE( seqValue.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ),
+ "test_DefaultRegistry error 11" );
+ TEST_ENSHURE( seqValue.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ),
+ "test_DefaultRegistry error 12" );
+ TEST_ENSHURE( seqValue.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich") ),
+ "test_DefaultRegistry error 13" );
+
+ Sequence<sal_Int32> seqLong(3);
+ seqLong.getArray()[0] = 1234;
+ seqLong.getArray()[1] = 4567;
+ seqLong.getArray()[2] = 7890;
+
+ xKey->setLongListValue(seqLong);
+
+ Sequence<sal_Int32> seqLongValue = xKey->getLongListValue();
+
+ TEST_ENSHURE( seqLongValue.getLength() == 3, "test_DefaultRegistry error 14" );
+ TEST_ENSHURE( seqLongValue.getArray()[0] == 1234, "test_DefaultRegistry error 15" );
+ TEST_ENSHURE( seqLongValue.getArray()[1] == 4567, "test_DefaultRegistry error 16" );
+ TEST_ENSHURE( seqLongValue.getArray()[2] == 7890, "test_DefaultRegistry error 17" );
+ }
+
+ // Test Links
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey") ));
+ xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("MyFirstLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey") ));
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink") ));
+ TEST_ENSHURE( xKey->isValid(), "test_DefaultRegistry error 18" );
+ TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey") ),
+ "test_DefaultRegistry error 19" );
+
+ xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") ));
+
+ TEST_ENSHURE( xKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") ))
+ == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") ),
+ "test_DefaultRegistry error 20" );
+
+ try
+ {
+ TEST_ENSHURE( xKey->getResolvedName(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink/BlaBlaBla") ))
+ == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink/BlaBlaBla") ),
+ "test_DefaultRegistry error 21" );
+ }
+ catch(InvalidRegistryException&)
+ {
+ }
+
+ xRootKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/SixthKey/MyThirdLink") ));
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/SixthKey") ));
+ xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("MyThirdLink") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") ));
+
+ try
+ {
+ xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") ));
+ }
+ catch(InvalidRegistryException&)
+ {
+ printf("test InvalidRegistryExcption OK!\n");
+ }
+
+ TEST_ENSHURE( xRootKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") ))
+ == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") ),
+ "test_DefaultRegistry error 22" );
+
+ xRootKey->deleteLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") ));
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/DefaultLink/SecondSubSubKey") ));
+ if (xKey.is())
+ {
+ TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey/SecondSubSubKey") ), "test_DefaultRegistry error 23" );
+ }
+ xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/DefaultLink/ThirdSubSubKey") ));
+ if (xKey.is())
+ {
+ TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey/ThirdSubSubKey") ),
+ "test_DefaultRegistry error 24" );
+ }
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("Test") ));
+ TEST_ENSHURE( xKey->isValid(), "test_DefaultRegistry error 25" );
+
+ xRootKey->deleteKey(OUString( RTL_CONSTASCII_USTRINGPARAM("Test") ));
+
+ xReg->mergeKey(OUString( RTL_CONSTASCII_USTRINGPARAM("AllFromTestreg2") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("testreg2.rdb") ));
+
+ xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/AllFromTestreg2/ThirdKey/FirstSubKey") ));
+ if (xKey.is())
+ {
+ xRootKey->deleteKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/AllFromTestreg2") ));
+ }
+/*
+ Reference<XSimpleRegistry> xSimplReg( xMgr->createInstance(L"com.sun.star.registry.SimpleRegistry"), USR_QUERY );
+
+ xSimplReg->open(L"testreg2.rdb", False, True);
+ xSimplReg->destroy();
+
+ xSimplReg->open(L"testreg.rdb", False, True);
+ xSimplReg->destroy();
+*/
+ }
+ catch(InvalidRegistryException&)
+ {
+ TEST_ENSHURE(0, "exception InvalidRegistryExcption raised while doing test_DefaultRegistry");
+ }
+ catch(InvalidValueException&)
+ {
+ TEST_ENSHURE(0, "exception InvalidValueExcption raised while doing test_DefaultRegistry()");
+ }
+ xReg.clear();
+
+ // shutdown
+ Reference< ::com::sun::star::lang::XComponent > xComp( rSMgr, UNO_QUERY );
+ VOS_ENSHURE( xComp.is(), "### serivce manager has to implement XComponent!" );
+ xComp->dispose();
+
+ printf("Test DefaultRegistry, OK!\n");
+}
+
+
+
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+ setStarUserRegistry();
+ setLinkInDefaultRegistry(OUString::createFromAscii("/Test/DefaultLink"),
+ OUString::createFromAscii("/Test/FifthKey/MyFirstLink"));
+
+ test_SimpleRegistry();
+ test_DefaultRegistry();
+
+ return(0);
+}
+
+
diff --git a/stoc/test/testsmgr.cxx b/stoc/test/testsmgr.cxx
new file mode 100644
index 000000000000..a711898bad74
--- /dev/null
+++ b/stoc/test/testsmgr.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: testsmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:29:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#ifndef _VOS_MODULE_HXX_
+#include <vos/module.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _VOS_PROCESS_HXX_
+#include <vos/process.hxx>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+#ifndef _REGISTRY_REGISTRY_HXX_
+#include <registry/registry.hxx>
+#endif
+
+#ifndef _UNO_MAPPING_HXX_
+#include <uno/mapping.hxx>
+#endif
+
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include "testsmgr_cpnt/testsmgr_cpnt.hxx"
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifdef _DEBUG
+#define TEST_ENSHURE(c, m) VOS_ENSHURE(c, m)
+#else
+#define TEST_ENSHURE(c, m) VOS_VERIFY(c)
+#endif
+
+
+using namespace ::rtl;
+using namespace ::vos;
+OString userRegEnv("STAR_USER_REGISTRY=");
+
+OUString getExePath()
+{
+ OStartupInfo startupInfo;
+ OUString exe;
+
+ VOS_VERIFY(startupInfo.getExecutableFile(exe) == OStartupInfo::E_None);
+
+#if defined(WIN32) || defined(__OS2__) || defined(WNT)
+ exe = exe.copy(0, exe.getLength() - 16);
+#else
+ exe = exe.copy(0, exe.getLength() - 12);
+#endif
+ return exe;
+}
+
+void setStarUserRegistry()
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey, rKey, rKey2;
+
+ OUString userReg = getExePath();
+ userReg += OUString::createFromAscii("user.rdb");
+ if(myRegistry->open(userReg, REG_READWRITE))
+ {
+ TEST_ENSHURE(!myRegistry->create(userReg), "setStarUserRegistry error 1");
+ }
+
+ TEST_ENSHURE(!myRegistry->close(), "setStarUserRegistry error 9");
+ delete myRegistry;
+
+ userRegEnv += OUStringToOString(userReg, RTL_TEXTENCODING_ASCII_US);
+ putenv((char *)userRegEnv.getStr());
+}
+
+
+
+void SAL_CALL main()
+{
+ printf( "ServiceManagerTest : \r");
+ setStarUserRegistry();
+ fflush( stdout );
+ test_ServiceManager();
+
+ printf( "ServiceManagerTest : OK\n" );
+}