1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
24 #include <usr/factoryhlp.hxx>
25 #include "testfactreg.hxx"
35 BOOL EXTERN_SERVICE_CALLTYPE
exService_writeRegEntry(
36 const UNO_INTERFACE(XRegistryKey
)* xUnoKey
)
40 uno2smart(xKey
, *xUnoKey
);
42 UString str
= UString( L
"/" ) + OPipeTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
43 XRegistryKeyRef xNewKey
= xKey
->createKey( str
);
44 xNewKey
->createKey( OPipeTest_getServiceName() );
46 str
= UString( L
"/" ) + ODataStreamTest_getImplementationName(1) + UString( L
"/UNO/SERVICES" );
47 xNewKey
= xKey
->createKey( str
);
48 xNewKey
->createKey( ODataStreamTest_getServiceName(1) );
50 str
= UString( L
"/" ) + ODataStreamTest_getImplementationName(2) + UString( L
"/UNO/SERVICES" );
51 xNewKey
= xKey
->createKey( str
);
52 xNewKey
->createKey( ODataStreamTest_getServiceName(2) );
54 str
= UString( L
"/" ) + OObjectStreamTest_getImplementationName(1) + UString( L
"/UNO/SERVICES" );
55 xNewKey
= xKey
->createKey( str
);
56 xNewKey
->createKey( OObjectStreamTest_getServiceName(1) );
58 str
= UString( L
"/" ) + OObjectStreamTest_getImplementationName(2) + UString( L
"/UNO/SERVICES" );
59 xNewKey
= xKey
->createKey( str
);
60 xNewKey
->createKey( OObjectStreamTest_getServiceName(2) );
62 str
= UString( L
"/" ) + OMarkableOutputStreamTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
63 xNewKey
= xKey
->createKey( str
);
64 xNewKey
->createKey( OMarkableOutputStreamTest_getServiceName() );
66 str
= UString( L
"/" ) + OMarkableInputStreamTest_getImplementationName() + UString( L
"/UNO/SERVICES" );
67 xNewKey
= xKey
->createKey( str
);
68 xNewKey
->createKey( OMarkableInputStreamTest_getServiceName() );
70 str
= UString( L
"/" ) + OMyPersistObject_getImplementationName() + UString( L
"/UNO/SERVICES" );
71 xNewKey
= xKey
->createKey( str
);
72 xNewKey
->createKey( OMyPersistObject_getServiceName() );
78 UNO_INTERFACE(XInterface
) EXTERN_SERVICE_CALLTYPE exService_getFactory
80 const wchar_t* implementationName
,
81 const UNO_INTERFACE(XMultiServiceFactory
)* xUnoFact
,
82 const UNO_INTERFACE(XRegistryKey
)*
85 UNO_INTERFACE(XInterface
) xUnoRet
= {0, 0};
88 XMultiServiceFactoryRef xSMgr
;
89 UString
aImplementationName(implementationName
);
91 uno2smart(xSMgr
, *xUnoFact
);
93 if (aImplementationName
== OPipeTest_getImplementationName() )
95 xRet
= createSingleFactory( xSMgr
, implementationName
,
96 OPipeTest_CreateInstance
,
97 OPipeTest_getSupportedServiceNames() );
99 else if( aImplementationName
== ODataStreamTest_getImplementationName(1) ) {
100 xRet
= createSingleFactory( xSMgr
, implementationName
,
101 ODataStreamTest_CreateInstance
,
102 ODataStreamTest_getSupportedServiceNames(1) );
104 else if( aImplementationName
== ODataStreamTest_getImplementationName(2) ) {
105 xRet
= createSingleFactory( xSMgr
, implementationName
,
106 ODataStreamTest_CreateInstance
,
107 ODataStreamTest_getSupportedServiceNames(2) );
109 else if( aImplementationName
== OObjectStreamTest_getImplementationName(1) ) {
110 xRet
= createSingleFactory( xSMgr
, implementationName
,
111 OObjectStreamTest_CreateInstance
,
112 OObjectStreamTest_getSupportedServiceNames(1) );
114 else if( aImplementationName
== OObjectStreamTest_getImplementationName(2) ) {
115 xRet
= createSingleFactory( xSMgr
, implementationName
,
116 OObjectStreamTest_CreateInstance
,
117 OObjectStreamTest_getSupportedServiceNames(2) );
119 else if( aImplementationName
== OMarkableOutputStreamTest_getImplementationName() ) {
120 xRet
= createSingleFactory( xSMgr
, implementationName
,
121 OMarkableOutputStreamTest_CreateInstance
,
122 OMarkableOutputStreamTest_getSupportedServiceNames() );
124 else if( aImplementationName
== OMarkableInputStreamTest_getImplementationName() ) {
125 xRet
= createSingleFactory( xSMgr
, implementationName
,
126 OMarkableInputStreamTest_CreateInstance
,
127 OMarkableInputStreamTest_getSupportedServiceNames() );
129 else if( aImplementationName
== OMyPersistObject_getImplementationName() ) {
130 xRet
= createSingleFactory( xSMgr
, implementationName
,
131 OMyPersistObject_CreateInstance
,
132 OMyPersistObject_getSupportedServiceNames() );
136 smart2uno(xRet
, xUnoRet
);
146 Sequence
<BYTE
> createSeq( char * p
)
148 Sequence
<BYTE
> seq( strlen( p
)+1 );
149 strcpy( (char * ) seq
.getArray() , p
);
153 Sequence
<BYTE
> createIntSeq( INT32 i
)
156 sprintf( pcCount
, "%d" , i
);
157 return createSeq( pcCount
);
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */