1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 * OpenOffice.org - a multi-platform office productivity suite
8 * This file is part of OpenOffice.org.
10 * OpenOffice.org is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License version 3
12 * only, as published by the Free Software Foundation.
14 * OpenOffice.org is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License version 3 for more details
18 * (a copy is included in the LICENSE file that accompanied this code).
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with OpenOffice.org. If not, see
22 * <http://www.openoffice.org/license.html>
23 * for a copy of the LGPLv3 License.
25 ************************************************************************/
27 // MARKER(update_precomp.py): autogen include statement, do not remove
28 #include "precompiled_extensions.hxx"
30 #include "corecontroller.hxx"
31 #include "invite_job.hxx"
32 #include "onlogrotate_job.hxx"
33 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34 #include <cppuhelper/factory.hxx>
35 #include <osl/mutex.hxx>
36 #include <osl/thread.h>
37 #include <rtl/ustrbuf.hxx>
38 #include <rtl/ustring.hxx>
41 using namespace ::com::sun::star::lang
;
42 using namespace ::com::sun::star::registry
;
43 using namespace ::com::sun::star::uno
;
44 using namespace ::oooimprovement
;
45 using ::rtl::OUString
;
46 using ::rtl::OUStringBuffer
;
51 void writeInfo(const Reference
<XRegistryKey
>& reg_key
,
52 const OUString
& implementation_name
,
53 const OUString
& service_name
)
55 OUStringBuffer
buf(256);
56 buf
.append(implementation_name
);
57 buf
.appendAscii("/UNO/SERVICES/");
58 buf
.append(service_name
);
59 reg_key
->createKey(buf
.makeStringAndClear());
65 void SAL_CALL
component_getImplementationEnvironment(const sal_Char
** env_type_name
, uno_Environment
**)
66 { *env_type_name
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
; }
68 void* SAL_CALL
component_getFactory(const sal_Char
* pImplName
, void* pServiceManager
, void*)
70 if ( !pServiceManager
|| !pImplName
) return 0;
72 Reference
<XSingleServiceFactory
> factory
;
73 Reference
<XMultiServiceFactory
> sm(reinterpret_cast<XMultiServiceFactory
*>(pServiceManager
), UNO_QUERY
);
74 OUString impl_name
= OUString::createFromAscii(pImplName
);
75 Sequence
<OUString
> names(1);
78 if (impl_name
.equals(CoreController::getImplementationName_static()))
79 factory
= ::cppu::createSingleFactory(sm
, impl_name
, CoreController::Create
, names
);
80 if (impl_name
.equals(OnLogRotateJob::getImplementationName_static()))
81 factory
= ::cppu::createSingleFactory(sm
, impl_name
, OnLogRotateJob::Create
, names
);
82 if (impl_name
.equals(InviteJob::getImplementationName_static()))
83 factory
= ::cppu::createSingleFactory(sm
, impl_name
, InviteJob::Create
, names
);
84 if (!factory
.is()) return 0;