Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 : : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
31 : : #include "ucb.hxx"
32 : : #include "ucbstore.hxx"
33 : : #include "ucbprops.hxx"
34 : : #include "provprox.hxx"
35 : : #include "cmdenv.hxx"
36 : :
37 : : using namespace com::sun::star::uno;
38 : : using namespace com::sun::star::lang;
39 : : using ::rtl::OUString;
40 : :
41 : :
42 : : //=========================================================================
43 : 747 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory(
44 : : const sal_Char * pImplName, void * pServiceManager, void * )
45 : : {
46 : 747 : void * pRet = 0;
47 : :
48 : : Reference< XMultiServiceFactory > xSMgr(
49 [ + - ]: 747 : reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
50 : 747 : Reference< XSingleServiceFactory > xFactory;
51 : :
52 : : //////////////////////////////////////////////////////////////////////
53 : : // Universal Content Broker.
54 : : //////////////////////////////////////////////////////////////////////
55 : :
56 [ + + ]: 747 : if ( UniversalContentBroker::getImplementationName_Static().
57 [ + - ]: 747 : compareToAscii( pImplName ) == 0 )
58 : : {
59 [ + - ][ + - ]: 250 : xFactory = UniversalContentBroker::createServiceFactory( xSMgr );
60 : : }
61 : :
62 : : //////////////////////////////////////////////////////////////////////
63 : : // UCB Store.
64 : : //////////////////////////////////////////////////////////////////////
65 : :
66 [ + + ]: 497 : else if ( UcbStore::getImplementationName_Static().
67 [ + - ]: 497 : compareToAscii( pImplName ) == 0 )
68 : : {
69 [ + - ][ + - ]: 236 : xFactory = UcbStore::createServiceFactory( xSMgr );
70 : : }
71 : :
72 : : //////////////////////////////////////////////////////////////////////
73 : : // UCB PropertiesManager.
74 : : //////////////////////////////////////////////////////////////////////
75 : :
76 [ + + ]: 261 : else if ( UcbPropertiesManager::getImplementationName_Static().
77 [ + - ]: 261 : compareToAscii( pImplName ) == 0 )
78 : : {
79 [ + - ][ + - ]: 11 : xFactory = UcbPropertiesManager::createServiceFactory( xSMgr );
80 : : }
81 : :
82 : : //////////////////////////////////////////////////////////////////////
83 : : // UCP Proxy Factory.
84 : : //////////////////////////////////////////////////////////////////////
85 : :
86 [ + + ]: 250 : else if ( UcbContentProviderProxyFactory::getImplementationName_Static().
87 [ + - ]: 250 : compareToAscii( pImplName ) == 0 )
88 : : {
89 : : xFactory
90 [ + - ][ + - ]: 248 : = UcbContentProviderProxyFactory::createServiceFactory( xSMgr );
91 : : }
92 : :
93 : : //////////////////////////////////////////////////////////////////////
94 : : // Command Environment.
95 : : //////////////////////////////////////////////////////////////////////
96 : :
97 [ + - ]: 2 : else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static().
98 [ + - ]: 2 : compareToAscii( pImplName ) == 0 )
99 : : {
100 : : xFactory
101 [ + - ][ + - ]: 2 : = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr );
102 : : }
103 : :
104 : : //////////////////////////////////////////////////////////////////////
105 : :
106 [ + - ]: 747 : if ( xFactory.is() )
107 : : {
108 [ + - ]: 747 : xFactory->acquire();
109 [ + - ]: 747 : pRet = xFactory.get();
110 : : }
111 : :
112 : 747 : return pRet;
113 : : }
114 : :
115 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|