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: webdavservices.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_ucb.hxx"
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
35 #include <com/sun/star/registry/XRegistryKey.hpp>
36 #include "webdavprovider.hxx"
38 using namespace com::sun::star
;
40 //=========================================================================
41 static sal_Bool
writeInfo( void * pRegistryKey
,
42 const rtl::OUString
& rImplementationName
,
43 uno::Sequence
< rtl::OUString
> const & rServiceNames
)
45 rtl::OUString
aKeyName( rtl::OUString::createFromAscii( "/" ) );
46 aKeyName
+= rImplementationName
;
47 aKeyName
+= rtl::OUString::createFromAscii( "/UNO/SERVICES" );
49 uno::Reference
< registry::XRegistryKey
> xKey
;
52 xKey
= static_cast< registry::XRegistryKey
* >(
53 pRegistryKey
)->createKey( aKeyName
);
55 catch ( registry::InvalidRegistryException
const & )
62 sal_Bool bSuccess
= sal_True
;
64 for ( sal_Int32 n
= 0; n
< rServiceNames
.getLength(); ++n
)
68 xKey
->createKey( rServiceNames
[ n
] );
70 catch ( registry::InvalidRegistryException
const & )
79 //=========================================================================
80 extern "C" void SAL_CALL
component_getImplementationEnvironment(
81 const sal_Char
** ppEnvTypeName
, uno_Environment
** /*ppEnv*/ )
83 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
86 //=========================================================================
87 extern "C" sal_Bool SAL_CALL
component_writeInfo(
88 void * /*pServiceManager*/, void * pRegistryKey
)
90 return pRegistryKey
&&
92 //////////////////////////////////////////////////////////////////////
93 // WebDAV Content Provider.
94 //////////////////////////////////////////////////////////////////////
96 writeInfo( pRegistryKey
,
97 ::webdav_ucp::ContentProvider::getImplementationName_Static(),
98 ::webdav_ucp::ContentProvider::getSupportedServiceNames_Static() );
101 //=========================================================================
102 extern "C" void * SAL_CALL
component_getFactory(
103 const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
107 uno::Reference
< lang::XMultiServiceFactory
> xSMgr(
108 reinterpret_cast< lang::XMultiServiceFactory
* >(
110 uno::Reference
< lang::XSingleServiceFactory
> xFactory
;
112 //////////////////////////////////////////////////////////////////////
113 // WebDAV Content Provider.
114 //////////////////////////////////////////////////////////////////////
116 if ( ::webdav_ucp::ContentProvider::getImplementationName_Static().
117 compareToAscii( pImplName
) == 0 )
119 xFactory
= ::webdav_ucp::ContentProvider::createServiceFactory( xSMgr
);
122 //////////////////////////////////////////////////////////////////////
127 pRet
= xFactory
.get();