Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
21 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
22 : #include "ucb.hxx"
23 : #include "ucbstore.hxx"
24 : #include "ucbprops.hxx"
25 : #include "provprox.hxx"
26 : #include "cmdenv.hxx"
27 :
28 : using namespace com::sun::star::uno;
29 : using namespace com::sun::star::lang;
30 : using ::rtl::OUString;
31 :
32 :
33 : //=========================================================================
34 46 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory(
35 : const sal_Char * pImplName, void * pServiceManager, void * )
36 : {
37 46 : void * pRet = 0;
38 :
39 : Reference< XMultiServiceFactory > xSMgr(
40 46 : reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
41 46 : Reference< XSingleServiceFactory > xFactory;
42 :
43 : //////////////////////////////////////////////////////////////////////
44 : // Universal Content Broker.
45 : //////////////////////////////////////////////////////////////////////
46 :
47 92 : if ( UniversalContentBroker::getImplementationName_Static().
48 92 : compareToAscii( pImplName ) == 0 )
49 : {
50 24 : xFactory = UniversalContentBroker::createServiceFactory( xSMgr );
51 : }
52 :
53 : //////////////////////////////////////////////////////////////////////
54 : // UCB Store.
55 : //////////////////////////////////////////////////////////////////////
56 :
57 44 : else if ( UcbStore::getImplementationName_Static().
58 44 : compareToAscii( pImplName ) == 0 )
59 : {
60 20 : xFactory = UcbStore::createServiceFactory( xSMgr );
61 : }
62 :
63 : //////////////////////////////////////////////////////////////////////
64 : // UCB PropertiesManager.
65 : //////////////////////////////////////////////////////////////////////
66 :
67 4 : else if ( UcbPropertiesManager::getImplementationName_Static().
68 4 : compareToAscii( pImplName ) == 0 )
69 : {
70 0 : xFactory = UcbPropertiesManager::createServiceFactory( xSMgr );
71 : }
72 :
73 : //////////////////////////////////////////////////////////////////////
74 : // UCP Proxy Factory.
75 : //////////////////////////////////////////////////////////////////////
76 :
77 4 : else if ( UcbContentProviderProxyFactory::getImplementationName_Static().
78 4 : compareToAscii( pImplName ) == 0 )
79 : {
80 : xFactory
81 2 : = UcbContentProviderProxyFactory::createServiceFactory( xSMgr );
82 : }
83 :
84 : //////////////////////////////////////////////////////////////////////
85 : // Command Environment.
86 : //////////////////////////////////////////////////////////////////////
87 :
88 0 : else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static().
89 0 : compareToAscii( pImplName ) == 0 )
90 : {
91 : xFactory
92 0 : = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr );
93 : }
94 :
95 : //////////////////////////////////////////////////////////////////////
96 :
97 46 : if ( xFactory.is() )
98 : {
99 46 : xFactory->acquire();
100 46 : pRet = xFactory.get();
101 : }
102 :
103 46 : return pRet;
104 : }
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|