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 : #include "FileAccess.hxx"
28 :
29 : using namespace com::sun::star::uno;
30 : using namespace com::sun::star::lang;
31 :
32 :
33 1109 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory(
34 : const sal_Char * pImplName, void * pServiceManager, void * )
35 : {
36 1109 : void * pRet = 0;
37 :
38 : Reference< XMultiServiceFactory > xSMgr(
39 1109 : reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
40 2218 : Reference< XSingleServiceFactory > xFactory;
41 :
42 :
43 : // Universal Content Broker.
44 :
45 :
46 2218 : if ( UniversalContentBroker::getImplementationName_Static().
47 2218 : equalsAscii( pImplName ) )
48 : {
49 335 : xFactory = UniversalContentBroker::createServiceFactory( xSMgr );
50 : }
51 :
52 :
53 : // UCB Store.
54 :
55 :
56 1548 : else if ( UcbStore::getImplementationName_Static().
57 1548 : equalsAscii( pImplName ) )
58 : {
59 317 : xFactory = UcbStore::createServiceFactory( xSMgr );
60 : }
61 :
62 :
63 : // UCB PropertiesManager.
64 :
65 :
66 914 : else if ( UcbPropertiesManager::getImplementationName_Static().
67 914 : equalsAscii( pImplName ) )
68 : {
69 14 : xFactory = UcbPropertiesManager::createServiceFactory( xSMgr );
70 : }
71 :
72 :
73 : // UCP Proxy Factory.
74 :
75 :
76 886 : else if ( UcbContentProviderProxyFactory::getImplementationName_Static().
77 886 : equalsAscii( pImplName ) )
78 : {
79 183 : xFactory = UcbContentProviderProxyFactory::createServiceFactory( xSMgr );
80 : }
81 :
82 :
83 : // Command Environment.
84 :
85 :
86 520 : else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static().
87 520 : equalsAscii( pImplName ) )
88 : {
89 2 : xFactory = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr );
90 : }
91 :
92 : // FilePicker
93 258 : else if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
94 : {
95 516 : xFactory = cppu::createSingleFactory(xSMgr,
96 : OUString::createFromAscii( pImplName ),
97 : FileAccess_CreateInstance,
98 258 : FileAccess_getSupportedServiceNames() );
99 : }
100 :
101 1109 : if ( xFactory.is() )
102 : {
103 1109 : xFactory->acquire();
104 1109 : pRet = xFactory.get();
105 : }
106 :
107 2218 : return pRet;
108 : }
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|