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"
30 #include <rtl/unload.h>
32 #include "ole2uno.hxx"
33 #include "servprov.hxx"
34 #include <rtl/ustring.hxx>
35 #include <cppuhelper/factory.hxx>
37 using namespace ole_adapter
;
42 rtl_StandardModuleCount globalModuleCount
= MODULE_COUNT_INIT
;
46 Reference
<XInterface
> SAL_CALL
ConverterProvider_CreateInstance2( const Reference
<XMultiServiceFactory
> & xSMgr
)
49 Reference
<XInterface
> xService
= *new OleConverter_Impl2( xSMgr
);
53 Reference
<XInterface
> SAL_CALL
ConverterProvider_CreateInstanceVar1( const Reference
<XMultiServiceFactory
> & xSMgr
)
56 Reference
<XInterface
> xService
= *new OleConverter_Impl2( xSMgr
, UNO_OBJECT_WRAPPER_REMOTE_OPT
, IUNKNOWN_WRAPPER_IMPL
);
60 Reference
<XInterface
> SAL_CALL
OleClient_CreateInstance( const Reference
<XMultiServiceFactory
> & xSMgr
)
63 Reference
<XInterface
> xService
= *new OleClient_Impl( xSMgr
);
67 Reference
<XInterface
> SAL_CALL
OleServer_CreateInstance( const Reference
<XMultiServiceFactory
> & xSMgr
)
70 Reference
<XInterface
> xService
= *new OleServer_Impl(xSMgr
);
75 extern "C" void * SAL_CALL
component_getFactory(
76 const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
80 OUString
aImplName( OUString::createFromAscii( pImplName
) );
81 Reference
< XSingleServiceFactory
> xFactory
;
82 Sequence
<OUString
> seqServiceNames
;
83 if (pServiceManager
&& aImplName
.equals( reinterpret_cast<const sal_Unicode
*>(L
"com.sun.star.comp.ole.OleConverter2") ))
85 xFactory
= createSingleFactory( reinterpret_cast< XMultiServiceFactory
*>(pServiceManager
),
86 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverter2")),
87 ConverterProvider_CreateInstance2
, seqServiceNames
,
88 &globalModuleCount
.modCnt
);
90 else if (pServiceManager
&& aImplName
.equals( reinterpret_cast<const sal_Unicode
*>(L
"com.sun.star.comp.ole.OleConverterVar1") ))
92 xFactory
= createSingleFactory( reinterpret_cast<XMultiServiceFactory
*>(pServiceManager
),
93 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverterVar1")),
94 ConverterProvider_CreateInstanceVar1
, seqServiceNames
,
95 &globalModuleCount
.modCnt
);
97 else if(pServiceManager
&& aImplName
.equals(reinterpret_cast<const sal_Unicode
*>(L
"com.sun.star.comp.ole.OleClient")))
99 xFactory
= createSingleFactory( reinterpret_cast< XMultiServiceFactory
*>(pServiceManager
),
100 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleClient")),
101 OleClient_CreateInstance
, seqServiceNames
,
102 &globalModuleCount
.modCnt
);
104 else if(pServiceManager
&& aImplName
.equals(reinterpret_cast<const sal_Unicode
*>(L
"com.sun.star.comp.ole.OleServer")))
106 xFactory
= createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory
*>(pServiceManager
),
107 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleServer")),
108 OleServer_CreateInstance
, seqServiceNames
,
109 &globalModuleCount
.modCnt
);
115 pRet
= xFactory
.get();
122 extern "C" void SAL_CALL
component_getImplementationEnvironment(
123 const sal_Char
** ppEnvTypeName
, uno_Environment
** /*ppEnv*/ )
125 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
129 extern "C" sal_Bool
component_canUnload( TimeValue
* libUnused
)
131 return globalModuleCount
.canUnload( &globalModuleCount
, libUnused
);