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 :
31 :
32 : //=========================================================================
33 379 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory(
34 : const sal_Char * pImplName, void * pServiceManager, void * )
35 : {
36 379 : void * pRet = 0;
37 :
38 : Reference< XMultiServiceFactory > xSMgr(
39 379 : reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
40 758 : Reference< XSingleServiceFactory > xFactory;
41 :
42 : //////////////////////////////////////////////////////////////////////
43 : // Universal Content Broker.
44 : //////////////////////////////////////////////////////////////////////
45 :
46 758 : if ( UniversalContentBroker::getImplementationName_Static().
47 758 : compareToAscii( pImplName ) == 0 )
48 : {
49 141 : xFactory = UniversalContentBroker::createServiceFactory( xSMgr );
50 : }
51 :
52 : //////////////////////////////////////////////////////////////////////
53 : // UCB Store.
54 : //////////////////////////////////////////////////////////////////////
55 :
56 476 : else if ( UcbStore::getImplementationName_Static().
57 476 : compareToAscii( pImplName ) == 0 )
58 : {
59 134 : xFactory = UcbStore::createServiceFactory( xSMgr );
60 : }
61 :
62 : //////////////////////////////////////////////////////////////////////
63 : // UCB PropertiesManager.
64 : //////////////////////////////////////////////////////////////////////
65 :
66 208 : else if ( UcbPropertiesManager::getImplementationName_Static().
67 208 : compareToAscii( pImplName ) == 0 )
68 : {
69 6 : xFactory = UcbPropertiesManager::createServiceFactory( xSMgr );
70 : }
71 :
72 : //////////////////////////////////////////////////////////////////////
73 : // UCP Proxy Factory.
74 : //////////////////////////////////////////////////////////////////////
75 :
76 196 : else if ( UcbContentProviderProxyFactory::getImplementationName_Static().
77 196 : compareToAscii( pImplName ) == 0 )
78 : {
79 : xFactory
80 97 : = UcbContentProviderProxyFactory::createServiceFactory( xSMgr );
81 : }
82 :
83 : //////////////////////////////////////////////////////////////////////
84 : // Command Environment.
85 : //////////////////////////////////////////////////////////////////////
86 :
87 2 : else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static().
88 2 : compareToAscii( pImplName ) == 0 )
89 : {
90 : xFactory
91 1 : = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr );
92 : }
93 :
94 : //////////////////////////////////////////////////////////////////////
95 :
96 379 : if ( xFactory.is() )
97 : {
98 379 : xFactory->acquire();
99 379 : pRet = xFactory.get();
100 : }
101 :
102 758 : return pRet;
103 : }
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|