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: wininetbecdef.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_shell.hxx"
34 #include <wininetbackend.hxx>
35 #include <com/sun/star/registry/XRegistryKey.hpp>
37 #ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
38 #include <cppuhelper/implementationentry.hxx>
40 #include <com/sun/star/uno/XComponentContext.hpp>
42 namespace css
= com::sun::star
;
43 namespace uno
= css::uno
;
44 namespace lang
= css::lang
;
45 namespace backend
= css::configuration::backend
;
47 //------------------------------------------------------------------------------
49 static uno::Reference
<uno::XInterface
> SAL_CALL
createWinInetBackend(
50 const uno::Reference
<uno::XComponentContext
>& xContext
){
52 return * WinInetBackend::createInstance(xContext
);
55 //------------------------------------------------------------------------------
57 static const cppu::ImplementationEntry kImplementations_entries
[] =
61 WinInetBackend::getBackendName
,
62 WinInetBackend::getBackendServiceNames
,
63 cppu::createSingleComponentFactory
,
70 //------------------------------------------------------------------------------
72 extern "C" void SAL_CALL
component_getImplementationEnvironment(
73 const sal_Char
**aEnvTypeName
, uno_Environment
** /*aEnvironment*/) {
75 *aEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
78 //------------------------------------------------------------------------------
80 extern "C" sal_Bool SAL_CALL
component_writeInfo(void * /*pServiceManager*/, void *pRegistryKey
) {
82 using namespace ::com::sun::star::registry
;
87 uno::Reference
< XRegistryKey
> xImplKey
= static_cast< XRegistryKey
* >( pRegistryKey
)->createKey(
88 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + WinInetBackend::getBackendName()
91 // Register associated service names
92 uno::Reference
< XRegistryKey
> xServicesKey
= xImplKey
->createKey(
93 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") )
96 uno::Sequence
<rtl::OUString
> sServiceNames
= WinInetBackend::getBackendServiceNames();
97 for (sal_Int32 i
= 0 ; i
< sServiceNames
.getLength() ; ++ i
)
98 xServicesKey
->createKey(sServiceNames
[i
]);
100 // Register supported components
101 uno::Reference
<XRegistryKey
> xComponentKey
= xImplKey
->createKey(
102 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/DATA/SupportedComponents") )
105 xComponentKey
->setAsciiListValue( WinInetBackend::getSupportedComponents() );
109 catch( InvalidRegistryException
& )
111 OSL_ENSURE(sal_False
, "InvalidRegistryException caught");
117 //------------------------------------------------------------------------------
119 extern "C" void *component_getFactory( const sal_Char
*aImplementationName
,
120 void *aServiceManager
,
121 void *aRegistryKey
) {
123 return cppu::component_getFactoryHelper(
127 kImplementations_entries
) ;
130 //------------------------------------------------------------------------------