merge the formfield patch from ooo-build
[ooovba.git] / extensions / source / dbpilots / dbpservices.cxx
blob2ff042aebd72f9a710fb9116a161904ae78af834
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: dbpservices.cxx,v $
10 * $Revision: 1.8 $
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"
33 #include "componentmodule.hxx"
35 //---------------------------------------------------------------------------------------
37 using namespace ::rtl;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::lang;
40 using namespace ::com::sun::star::registry;
42 //---------------------------------------------------------------------------------------
44 extern "C" void SAL_CALL createRegistryInfo_OGroupBoxWizard();
45 extern "C" void SAL_CALL createRegistryInfo_OListComboWizard();
46 extern "C" void SAL_CALL createRegistryInfo_OGridWizard();
48 //---------------------------------------------------------------------------------------
50 extern "C" void SAL_CALL dbp_initializeModule()
52 static sal_Bool s_bInit = sal_False;
53 if (!s_bInit)
55 createRegistryInfo_OGroupBoxWizard();
56 createRegistryInfo_OListComboWizard();
57 createRegistryInfo_OGridWizard();
58 ::dbp::OModule::setResourceFilePrefix("dbp");
59 s_bInit = sal_True;
63 //---------------------------------------------------------------------------------------
65 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
66 component_getImplementationEnvironment(
67 const sal_Char **ppEnvTypeName,
68 uno_Environment ** /*ppEnv*/
71 dbp_initializeModule();
72 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
75 //---------------------------------------------------------------------------------------
76 extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
77 void* pServiceManager,
78 void* pRegistryKey
81 if (pRegistryKey)
82 try
84 return ::dbp::OModule::writeComponentInfos(
85 static_cast<XMultiServiceFactory*>(pServiceManager),
86 static_cast<XRegistryKey*>(pRegistryKey));
88 catch (InvalidRegistryException& )
90 OSL_ASSERT("dbp::component_writeInfo: could not create a registry key (InvalidRegistryException) !");
93 return sal_False;
96 //---------------------------------------------------------------------------------------
97 extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
98 const sal_Char* pImplementationName,
99 void* pServiceManager,
100 void* /*pRegistryKey*/)
102 Reference< XInterface > xRet;
103 if (pServiceManager && pImplementationName)
105 xRet = ::dbp::OModule::getComponentFactory(
106 ::rtl::OUString::createFromAscii(pImplementationName),
107 static_cast< XMultiServiceFactory* >(pServiceManager));
110 if (xRet.is())
111 xRet->acquire();
112 return xRet.get();