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 760 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucb_component_getFactory(
34 : const sal_Char * pImplName, void * pServiceManager, void * )
35 : {
36 760 : void * pRet = 0;
37 :
38 : Reference< XMultiServiceFactory > xSMgr(
39 760 : static_cast< XMultiServiceFactory * >( pServiceManager ) );
40 1520 : Reference< XSingleServiceFactory > xFactory;
41 :
42 :
43 : // Universal Content Broker.
44 :
45 :
46 1520 : if ( UniversalContentBroker::getImplementationName_Static().
47 1520 : equalsAscii( pImplName ) )
48 : {
49 222 : xFactory = UniversalContentBroker::createServiceFactory( xSMgr );
50 : }
51 :
52 :
53 : // UCB Store.
54 :
55 :
56 1076 : else if ( UcbStore::getImplementationName_Static().
57 1076 : equalsAscii( pImplName ) )
58 : {
59 214 : xFactory = UcbStore::createServiceFactory( xSMgr );
60 : }
61 :
62 :
63 : // UCB PropertiesManager.
64 :
65 :
66 648 : else if ( UcbPropertiesManager::getImplementationName_Static().
67 648 : equalsAscii( pImplName ) )
68 : {
69 11 : xFactory = UcbPropertiesManager::createServiceFactory( xSMgr );
70 : }
71 :
72 :
73 : // UCP Proxy Factory.
74 :
75 :
76 626 : else if ( UcbContentProviderProxyFactory::getImplementationName_Static().
77 626 : equalsAscii( pImplName ) )
78 : {
79 133 : xFactory = UcbContentProviderProxyFactory::createServiceFactory( xSMgr );
80 : }
81 :
82 :
83 : // Command Environment.
84 :
85 :
86 360 : else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static().
87 360 : equalsAscii( pImplName ) )
88 : {
89 1 : xFactory = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr );
90 : }
91 :
92 : // FilePicker
93 179 : else if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
94 : {
95 358 : xFactory = cppu::createSingleFactory(xSMgr,
96 : OUString::createFromAscii( pImplName ),
97 : FileAccess_CreateInstance,
98 179 : FileAccess_getSupportedServiceNames() );
99 : }
100 :
101 760 : if ( xFactory.is() )
102 : {
103 760 : xFactory->acquire();
104 760 : pRet = xFactory.get();
105 : }
106 :
107 1520 : return pRet;
108 : }
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|