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