Update ooo320-m1
[ooovba.git] / extensions / source / abpilot / abpservices.cxx
blobe39095a46c9c6355eb824df53ee87ae0a556bfba
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: abpservices.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"
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_OABSPilotUno();
46 //---------------------------------------------------------------------------------------
48 extern "C" void SAL_CALL abp_initializeModule()
50 static sal_Bool s_bInit = sal_False;
51 if (!s_bInit)
53 createRegistryInfo_OABSPilotUno();
54 ::abp::OModule::setResourceFilePrefix("abp");
55 s_bInit = sal_True;
59 //---------------------------------------------------------------------------------------
61 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
62 component_getImplementationEnvironment(
63 const sal_Char **ppEnvTypeName,
64 uno_Environment ** /*ppEnv*/
67 abp_initializeModule();
68 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
71 //---------------------------------------------------------------------------------------
72 extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
73 void* pServiceManager,
74 void* pRegistryKey
77 if (pRegistryKey)
78 try
80 return ::abp::OModule::writeComponentInfos(
81 static_cast<XMultiServiceFactory*>(pServiceManager),
82 static_cast<XRegistryKey*>(pRegistryKey));
84 catch (InvalidRegistryException& )
86 OSL_ASSERT("abp::component_writeInfo: could not create a registry key (InvalidRegistryException) !");
89 return sal_False;
92 //---------------------------------------------------------------------------------------
93 extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
94 const sal_Char* pImplementationName,
95 void* pServiceManager,
96 void* /*pRegistryKey*/)
98 Reference< XInterface > xRet;
99 if (pServiceManager && pImplementationName)
101 xRet = ::abp::OModule::getComponentFactory(
102 ::rtl::OUString::createFromAscii(pImplementationName),
103 static_cast< XMultiServiceFactory* >(pServiceManager));
106 if (xRet.is())
107 xRet->acquire();
108 return xRet.get();