merge the formfield patch from ooo-build
[ooovba.git] / shell / source / backends / localebe / localebecdef.cxx
blob668187b1ee216896a8ff567bff704548e7d72e2c
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: localebecdef.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_shell.hxx"
34 #include <localebackend.hxx>
35 #include <com/sun/star/registry/XRegistryKey.hpp>
37 #ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
38 #include <cppuhelper/implementationentry.hxx>
39 #endif
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 createLocaleBackend(
50 const uno::Reference<uno::XComponentContext>& xContext){
52 return * LocaleBackend::createInstance(xContext);
55 //------------------------------------------------------------------------------
57 static const cppu::ImplementationEntry kImplementations_entries[] =
60 createLocaleBackend,
61 LocaleBackend::getBackendName,
62 LocaleBackend::getBackendServiceNames,
63 cppu::createSingleComponentFactory,
64 NULL,
67 { NULL, NULL, NULL, NULL, NULL, 0 }
68 } ;
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;
83 if (pRegistryKey)
85 try
87 uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey(
88 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + LocaleBackend::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 = LocaleBackend::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( LocaleBackend::getSupportedComponents() );
107 return sal_True;
109 catch( InvalidRegistryException& )
111 OSL_ENSURE(sal_False, "InvalidRegistryException caught");
114 return sal_False;
117 //------------------------------------------------------------------------------
119 extern "C" void *component_getFactory( const sal_Char *aImplementationName,
120 void *aServiceManager,
121 void *aRegistryKey) {
123 return cppu::component_getFactoryHelper(
124 aImplementationName,
125 aServiceManager,
126 aRegistryKey,
127 kImplementations_entries) ;
130 //------------------------------------------------------------------------------