merge the formfield patch from ooo-build
[ooovba.git] / extensions / source / config / ldap / componentdef.cxx
blobcd707562f516db483f7cba69893ede005b6071d3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: componentdef.cxx,v $
10 * $Revision: 1.6 $
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_extensions.hxx"
34 #ifndef EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
35 #include "ldapuserprofilebe.hxx"
36 #endif //CONFIGMGR_BACKEND_LDAPUSERPROFILE_HXX_
37 #include <com/sun/star/registry/XRegistryKey.hpp>
38 #ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
39 #include <cppuhelper/implementationentry.hxx>
40 #endif // _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
41 #include <rtl/ustrbuf.hxx>
43 using namespace extensions::config::ldap ;
45 //==============================================================================
47 static uno::Reference<uno::XInterface> SAL_CALL createLdapUserProfileBe(
48 const uno::Reference<uno::XComponentContext>& aContext) {
49 return * new LdapUserProfileBe(aContext) ;
51 //------------------------------------------------------------------------------
53 static const cppu::ImplementationEntry kImplementations_entries[] =
56 createLdapUserProfileBe,
57 LdapUserProfileBe::getLdapUserProfileBeName,
58 LdapUserProfileBe::getLdapUserProfileBeServiceNames,
59 cppu::createSingleComponentFactory,
60 NULL,
63 { NULL, NULL, NULL, NULL, NULL, 0 }
64 } ;
65 //------------------------------------------------------------------------------
67 extern "C" void SAL_CALL component_getImplementationEnvironment(
68 const sal_Char **aEnvTypeName,
69 uno_Environment** /*aEnvironment*/) {
70 *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
72 //------------------------------------------------------------------------------
74 extern "C" sal_Bool SAL_CALL component_writeInfo(void *aServiceManager,
75 void *aRegistryKey) {
76 using namespace ::com::sun::star::registry;
77 if (aRegistryKey)
80 /** Service factory */
81 uno::Reference<lang::XMultiServiceFactory> xFactory
82 (reinterpret_cast<lang::XMultiServiceFactory*> (aServiceManager),
83 uno::UNO_QUERY);
85 rtl::OUStringBuffer aImplKeyName;
86 aImplKeyName.appendAscii("/");
87 aImplKeyName.append(LdapUserProfileBe::getLdapUserProfileBeName());
89 rtl::OUString aMainKeyName(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
91 uno::Reference<XRegistryKey> xNewImplKey(
92 reinterpret_cast<XRegistryKey*>
93 (aRegistryKey)->createKey(aImplKeyName.makeStringAndClear()));
95 uno::Reference<XRegistryKey> xNewKey(
96 xNewImplKey->createKey(aMainKeyName));
98 //Now register associated service names
99 uno::Sequence<rtl::OUString> sServiceNames =
100 LdapUserProfileBe::getLdapUserProfileBeServiceNames();
101 for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i)
103 xNewKey->createKey(sServiceNames[i]);
105 //Now register associated org.openoffice.UserProfile component
106 //that this backend supports under xNewImplKey
107 uno::Reference<XRegistryKey> xComponentKey(
108 xNewImplKey->createKey(rtl::OUString::createFromAscii
109 ("/DATA/SupportedComponents")));
111 uno::Sequence<rtl::OUString> aComponentList(1);
112 aComponentList[0]= rtl::OUString::createFromAscii
113 ("org.openoffice.UserProfile");
115 xComponentKey->setAsciiListValue(aComponentList);
116 return sal_True;
118 return sal_False;
120 //------------------------------------------------------------------------------
122 extern "C" void *component_getFactory(const sal_Char *aImplementationName,
123 void *aServiceManager,
124 void *aRegistryKey) {
125 return cppu::component_getFactoryHelper(aImplementationName,
126 aServiceManager,
127 aRegistryKey,
128 kImplementations_entries) ;
130 //------------------------------------------------------------------------------