1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
32 #include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
34 #include <usr/factoryhlp.hxx>
35 #include "testfactreg.hxx"
38 #ifndef _VOS_NO_NAMESPACE
48 BOOL EXTERN_SERVICE_CALLTYPE
exService_writeRegEntry(
49 const UNO_INTERFACE(XRegistryKey
)* xUnoKey
)
53 uno2smart(xKey
, *xUnoKey
);
55 UString str
= UString( L
"/" ) + OPipeTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
56 XRegistryKeyRef xNewKey
= xKey
->createKey( str
);
57 xNewKey
->createKey( OPipeTest_getServiceName() );
59 str
= UString( L
"/" ) + ODataStreamTest_getImplementationName(1) + UString( L
"/UNO/SERVICES" );
60 xNewKey
= xKey
->createKey( str
);
61 xNewKey
->createKey( ODataStreamTest_getServiceName(1) );
63 str
= UString( L
"/" ) + ODataStreamTest_getImplementationName(2) + UString( L
"/UNO/SERVICES" );
64 xNewKey
= xKey
->createKey( str
);
65 xNewKey
->createKey( ODataStreamTest_getServiceName(2) );
67 str
= UString( L
"/" ) + OObjectStreamTest_getImplementationName(1) + UString( L
"/UNO/SERVICES" );
68 xNewKey
= xKey
->createKey( str
);
69 xNewKey
->createKey( OObjectStreamTest_getServiceName(1) );
71 str
= UString( L
"/" ) + OObjectStreamTest_getImplementationName(2) + UString( L
"/UNO/SERVICES" );
72 xNewKey
= xKey
->createKey( str
);
73 xNewKey
->createKey( OObjectStreamTest_getServiceName(2) );
75 str
= UString( L
"/" ) + OMarkableOutputStreamTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
76 xNewKey
= xKey
->createKey( str
);
77 xNewKey
->createKey( OMarkableOutputStreamTest_getServiceName() );
79 str
= UString( L
"/" ) + OMarkableInputStreamTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
80 xNewKey
= xKey
->createKey( str
);
81 xNewKey
->createKey( OMarkableInputStreamTest_getServiceName() );
83 str
= UString( L
"/" ) + OMyPersistObject_getImplementationName() + UString( L
"/UNO/SERVICES" );
84 xNewKey
= xKey
->createKey( str
);
85 xNewKey
->createKey( OMyPersistObject_getServiceName() );
91 UNO_INTERFACE(XInterface
) EXTERN_SERVICE_CALLTYPE exService_getFactory
93 const wchar_t* implementationName
,
94 const UNO_INTERFACE(XMultiServiceFactory
)* xUnoFact
,
95 const UNO_INTERFACE(XRegistryKey
)*
98 UNO_INTERFACE(XInterface
) xUnoRet
= {0, 0};
101 XMultiServiceFactoryRef xSMgr
;
102 UString
aImplementationName(implementationName
);
104 uno2smart(xSMgr
, *xUnoFact
);
106 if (aImplementationName
== OPipeTest_getImplementationName() )
108 xRet
= createSingleFactory( xSMgr
, implementationName
,
109 OPipeTest_CreateInstance
,
110 OPipeTest_getSupportedServiceNames() );
112 else if( aImplementationName
== ODataStreamTest_getImplementationName(1) ) {
113 xRet
= createSingleFactory( xSMgr
, implementationName
,
114 ODataStreamTest_CreateInstance
,
115 ODataStreamTest_getSupportedServiceNames(1) );
117 else if( aImplementationName
== ODataStreamTest_getImplementationName(2) ) {
118 xRet
= createSingleFactory( xSMgr
, implementationName
,
119 ODataStreamTest_CreateInstance
,
120 ODataStreamTest_getSupportedServiceNames(2) );
122 else if( aImplementationName
== OObjectStreamTest_getImplementationName(1) ) {
123 xRet
= createSingleFactory( xSMgr
, implementationName
,
124 OObjectStreamTest_CreateInstance
,
125 OObjectStreamTest_getSupportedServiceNames(1) );
127 else if( aImplementationName
== OObjectStreamTest_getImplementationName(2) ) {
128 xRet
= createSingleFactory( xSMgr
, implementationName
,
129 OObjectStreamTest_CreateInstance
,
130 OObjectStreamTest_getSupportedServiceNames(2) );
132 else if( aImplementationName
== OMarkableOutputStreamTest_getImplementationName() ) {
133 xRet
= createSingleFactory( xSMgr
, implementationName
,
134 OMarkableOutputStreamTest_CreateInstance
,
135 OMarkableOutputStreamTest_getSupportedServiceNames() );
137 else if( aImplementationName
== OMarkableInputStreamTest_getImplementationName() ) {
138 xRet
= createSingleFactory( xSMgr
, implementationName
,
139 OMarkableInputStreamTest_CreateInstance
,
140 OMarkableInputStreamTest_getSupportedServiceNames() );
142 else if( aImplementationName
== OMyPersistObject_getImplementationName() ) {
143 xRet
= createSingleFactory( xSMgr
, implementationName
,
144 OMyPersistObject_CreateInstance
,
145 OMyPersistObject_getSupportedServiceNames() );
149 smart2uno(xRet
, xUnoRet
);
159 Sequence
<BYTE
> createSeq( char * p
)
161 Sequence
<BYTE
> seq( strlen( p
)+1 );
162 strcpy( (char * ) seq
.getArray() , p
);
166 Sequence
<BYTE
> createIntSeq( INT32 i
)
169 sprintf( pcCount
, "%d" , i
);
170 return createSeq( pcCount
);