1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: testfactreg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_extensions.hxx"
35 #include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
37 #include <usr/factoryhlp.hxx>
38 #include "testfactreg.hxx"
41 #ifndef _VOS_NO_NAMESPACE
51 BOOL EXTERN_SERVICE_CALLTYPE
exService_writeRegEntry(
52 const UNO_INTERFACE(XRegistryKey
)* xUnoKey
)
56 uno2smart(xKey
, *xUnoKey
);
58 UString str
= UString( L
"/" ) + OPipeTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
59 XRegistryKeyRef xNewKey
= xKey
->createKey( str
);
60 xNewKey
->createKey( OPipeTest_getServiceName() );
62 str
= UString( L
"/" ) + ODataStreamTest_getImplementationName(1) + UString( L
"/UNO/SERVICES" );
63 xNewKey
= xKey
->createKey( str
);
64 xNewKey
->createKey( ODataStreamTest_getServiceName(1) );
66 str
= UString( L
"/" ) + ODataStreamTest_getImplementationName(2) + UString( L
"/UNO/SERVICES" );
67 xNewKey
= xKey
->createKey( str
);
68 xNewKey
->createKey( ODataStreamTest_getServiceName(2) );
70 str
= UString( L
"/" ) + OObjectStreamTest_getImplementationName(1) + UString( L
"/UNO/SERVICES" );
71 xNewKey
= xKey
->createKey( str
);
72 xNewKey
->createKey( OObjectStreamTest_getServiceName(1) );
74 str
= UString( L
"/" ) + OObjectStreamTest_getImplementationName(2) + UString( L
"/UNO/SERVICES" );
75 xNewKey
= xKey
->createKey( str
);
76 xNewKey
->createKey( OObjectStreamTest_getServiceName(2) );
78 str
= UString( L
"/" ) + OMarkableOutputStreamTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
79 xNewKey
= xKey
->createKey( str
);
80 xNewKey
->createKey( OMarkableOutputStreamTest_getServiceName() );
82 str
= UString( L
"/" ) + OMarkableInputStreamTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
83 xNewKey
= xKey
->createKey( str
);
84 xNewKey
->createKey( OMarkableInputStreamTest_getServiceName() );
86 str
= UString( L
"/" ) + OMyPersistObject_getImplementationName() + UString( L
"/UNO/SERVICES" );
87 xNewKey
= xKey
->createKey( str
);
88 xNewKey
->createKey( OMyPersistObject_getServiceName() );
94 UNO_INTERFACE(XInterface
) EXTERN_SERVICE_CALLTYPE exService_getFactory
96 const wchar_t* implementationName
,
97 const UNO_INTERFACE(XMultiServiceFactory
)* xUnoFact
,
98 const UNO_INTERFACE(XRegistryKey
)*
101 UNO_INTERFACE(XInterface
) xUnoRet
= {0, 0};
104 XMultiServiceFactoryRef xSMgr
;
105 UString
aImplementationName(implementationName
);
107 uno2smart(xSMgr
, *xUnoFact
);
109 if (aImplementationName
== OPipeTest_getImplementationName() )
111 xRet
= createSingleFactory( xSMgr
, implementationName
,
112 OPipeTest_CreateInstance
,
113 OPipeTest_getSupportedServiceNames() );
115 else if( aImplementationName
== ODataStreamTest_getImplementationName(1) ) {
116 xRet
= createSingleFactory( xSMgr
, implementationName
,
117 ODataStreamTest_CreateInstance
,
118 ODataStreamTest_getSupportedServiceNames(1) );
120 else if( aImplementationName
== ODataStreamTest_getImplementationName(2) ) {
121 xRet
= createSingleFactory( xSMgr
, implementationName
,
122 ODataStreamTest_CreateInstance
,
123 ODataStreamTest_getSupportedServiceNames(2) );
125 else if( aImplementationName
== OObjectStreamTest_getImplementationName(1) ) {
126 xRet
= createSingleFactory( xSMgr
, implementationName
,
127 OObjectStreamTest_CreateInstance
,
128 OObjectStreamTest_getSupportedServiceNames(1) );
130 else if( aImplementationName
== OObjectStreamTest_getImplementationName(2) ) {
131 xRet
= createSingleFactory( xSMgr
, implementationName
,
132 OObjectStreamTest_CreateInstance
,
133 OObjectStreamTest_getSupportedServiceNames(2) );
135 else if( aImplementationName
== OMarkableOutputStreamTest_getImplementationName() ) {
136 xRet
= createSingleFactory( xSMgr
, implementationName
,
137 OMarkableOutputStreamTest_CreateInstance
,
138 OMarkableOutputStreamTest_getSupportedServiceNames() );
140 else if( aImplementationName
== OMarkableInputStreamTest_getImplementationName() ) {
141 xRet
= createSingleFactory( xSMgr
, implementationName
,
142 OMarkableInputStreamTest_CreateInstance
,
143 OMarkableInputStreamTest_getSupportedServiceNames() );
145 else if( aImplementationName
== OMyPersistObject_getImplementationName() ) {
146 xRet
= createSingleFactory( xSMgr
, implementationName
,
147 OMyPersistObject_CreateInstance
,
148 OMyPersistObject_getSupportedServiceNames() );
152 smart2uno(xRet
, xUnoRet
);
162 Sequence
<BYTE
> createSeq( char * p
)
164 Sequence
<BYTE
> seq( strlen( p
)+1 );
165 strcpy( (char * ) seq
.getArray() , p
);
169 Sequence
<BYTE
> createIntSeq( INT32 i
)
172 sprintf( pcCount
, "%d" , i
);
173 return createSeq( pcCount
);