merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / filter / xml / xmlservices.cxx
blob4471442f907e8b965c9a44e1d865274cf42eaa18
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: xmlservices.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_dbaccess.hxx"
34 #ifndef _CPPUHELPER_FACTORY_HXX_
35 #include <cppuhelper/factory.hxx>
36 #endif
37 #ifndef _OSL_DIAGNOSE_H_
38 #include <osl/diagnose.h>
39 #endif
40 #ifndef _FLT_REGHELPER_HXX_
41 #include "flt_reghelper.hxx"
42 #endif
44 /********************************************************************************************/
46 using namespace ::dbaxml;
47 using namespace ::com::sun::star::uno;
48 using namespace ::com::sun::star::lang;
49 using namespace ::com::sun::star::registry;
51 //***************************************************************************************
53 // registry functions
54 extern "C" void SAL_CALL createRegistryInfo_ODBFilter();
55 extern "C" void SAL_CALL createRegistryInfo_ODBFilterExport();
56 extern "C" void SAL_CALL createRegistryInfo_OSettingsExport();
57 extern "C" void SAL_CALL createRegistryInfo_OFullExport();
58 extern "C" void SAL_CALL createRegistryInfo_DBContentLoader2();
59 extern "C" void SAL_CALL createRegistryInfo_DBTypeDetection();
60 extern "C" void SAL_CALL writeDBLoaderInfo2(void* pRegistryKey);
62 //***************************************************************************************
63 extern "C" void SAL_CALL createRegistryInfo_dbaxml()
65 static sal_Bool bInit = sal_False;
66 if (!bInit)
68 createRegistryInfo_DBTypeDetection();
69 createRegistryInfo_ODBFilter();
70 createRegistryInfo_ODBFilterExport();
71 createRegistryInfo_OSettingsExport();
72 createRegistryInfo_OFullExport();
73 createRegistryInfo_DBContentLoader2();
74 bInit = sal_True;
78 //---------------------------------------------------------------------------------------
80 extern "C" void SAL_CALL component_getImplementationEnvironment(
81 const sal_Char **ppEnvTypeName,
82 uno_Environment **
85 createRegistryInfo_dbaxml();
86 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
89 //---------------------------------------------------------------------------------------
90 extern "C" sal_Bool SAL_CALL component_writeInfo(
91 void* pServiceManager,
92 void* pRegistryKey
95 if (pRegistryKey)
96 try
98 writeDBLoaderInfo2(pRegistryKey);
99 return ::dbaxml::OModuleRegistration::writeComponentInfos(
100 static_cast<XMultiServiceFactory*>(pServiceManager),
101 static_cast<XRegistryKey*>(pRegistryKey));
103 catch (InvalidRegistryException& )
105 OSL_ENSURE(sal_False, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !");
108 return sal_False;
111 //---------------------------------------------------------------------------------------
112 extern "C" void* SAL_CALL component_getFactory(
113 const sal_Char* pImplementationName,
114 void* pServiceManager,
115 void* /*pRegistryKey*/)
117 Reference< XInterface > xRet;
118 if (pServiceManager && pImplementationName)
120 xRet = ::dbaxml::OModuleRegistration::getComponentFactory(
121 ::rtl::OUString::createFromAscii(pImplementationName),
122 static_cast< XMultiServiceFactory* >(pServiceManager));
125 if (xRet.is())
126 xRet->acquire();
127 return xRet.get();