1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: service.cxx,v $
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 ************************************************************************/
30 #include "cppuhelper/implementationentry.hxx"
31 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
32 #include "com/sun/star/registry/XRegistryKey.hpp"
33 #include "comphelper/servicedecl.hxx"
35 // =============================================================================
37 // =============================================================================
38 using namespace ::com::sun::star
;
39 using namespace ::com::sun::star::uno
;
41 namespace sdecl
= comphelper::service_decl
;
43 // reference service helper(s)
46 extern sdecl::ServiceDecl
const serviceDecl
;
50 extern sdecl::ServiceDecl
const serviceDecl
;
54 extern sdecl::ServiceDecl
const serviceDecl
;
58 extern sdecl::ServiceDecl
const serviceDecl
;
62 extern sdecl::ServiceDecl
const serviceDecl
;
66 extern sdecl::ServiceDecl
const serviceDecl
;
70 extern sdecl::ServiceDecl
const serviceDecl
;
72 namespace vbaeventshelper
74 extern sdecl::ServiceDecl
const serviceDecl
;
78 extern sdecl::ServiceDecl
const serviceDecl
;
83 SAL_DLLPUBLIC_EXPORT
void SAL_CALL
component_getImplementationEnvironment(
84 const sal_Char
** ppEnvTypeName
, uno_Environment
** /*ppEnv*/ )
86 OSL_TRACE("In component_getImplementationEnv");
87 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
90 SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL
component_writeInfo(
91 lang::XMultiServiceFactory
* pServiceManager
, registry::XRegistryKey
* pRegistryKey
)
93 OSL_TRACE("In component_writeInfo");
95 // Component registration
96 if ( component_writeInfoHelper( pServiceManager
, pRegistryKey
,
97 range::serviceDecl
, workbook::serviceDecl
, worksheet::serviceDecl
, globals::serviceDecl
, window::serviceDecl
, hyperlink::serviceDecl
, application::serviceDecl
) && component_writeInfoHelper( pServiceManager
, pRegistryKey
, vbaeventshelper::serviceDecl
) )
99 // Singleton registration
102 registry::XRegistryKey
* pKey
=
103 reinterpret_cast< registry::XRegistryKey
* >(pRegistryKey
);
105 Reference
< registry::XRegistryKey
>xKey
= pKey
->createKey(
106 rtl::OUString::createFromAscii( ("ooo.vba.Globals/UNO/SINGLETONS/ooo.vba.theGlobals") ) );
107 xKey
->setStringValue( ::rtl::OUString::createFromAscii(
108 ("ooo.vba.Globals") ) );
111 catch( uno::Exception
& /*e*/ )
113 //recomp & friends will detect false returned and fail
118 // Component registration
119 return component_writeInfoHelper( pServiceManager
, pRegistryKey
,
120 range::serviceDecl
, workbook::serviceDecl
, worksheet::serviceDecl
, globals::serviceDecl
, window::serviceDecl
, hyperlink::serviceDecl
, application::serviceDecl
) && component_writeInfoHelper( pServiceManager
, pRegistryKey
, vbaeventshelper::serviceDecl
, textframe::serviceDecl
);
125 SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
component_getFactory(
126 const sal_Char
* pImplName
, lang::XMultiServiceFactory
* pServiceManager
,
127 registry::XRegistryKey
* pRegistryKey
)
129 OSL_TRACE("In component_getFactory for %s", pImplName
);
130 void* pRet
= component_getFactoryHelper(
131 pImplName
, pServiceManager
, pRegistryKey
, range::serviceDecl
, workbook::serviceDecl
, worksheet::serviceDecl
, globals::serviceDecl
, window::serviceDecl
, hyperlink::serviceDecl
, application::serviceDecl
);
133 pRet
= component_getFactoryHelper( pImplName
, pServiceManager
, pRegistryKey
, vbaeventshelper::serviceDecl
, textframe::serviceDecl
);
134 OSL_TRACE("Ret is 0x%x", pRet
);